Граф коммитов

788 Коммитов

Автор SHA1 Сообщение Дата
Kevin Gozali 83edd0c5fe codegen: set up Gradle plugin for more maintable codegen build steps
Summary:
Instead of sourcing-in a .gradle file to setup codegen tasks in Gradle, let's define a proper `com.facebook.react.codegen` Gradle plugin, so that any Gradle project (lib/app) can include it via:

```
plugins {
    id 'com.facebook.react.codegen'
}
```

The idea (not yet implemented in this commit) is to then allow those projects to add this section in the projects:

```
codegen {
    enableCodegen = ...
    jsRootDir = ...
}
```

This is more scalable and less hacky.

Important notes:
* The Gradle plugin should be prepared during the build, we're not going to publish it to Maven or other repo at this point.
* This setup is inspired by composite build setup explained here: https://ncorti.com/blog/gradle-plugins-and-composite-builds
* All android specific setup is added under `packages/react-native-codegen/android/` dir, but long term, we may want to move it up to `packages/react-native-codegen/` along side setup for other platforms.
* As part of this setup, the plugin will have an option (to be validated) to produce Java specs using https://github.com/square/javapoet
  * This is the same library already used for React Native Android annotation processors
  * This generator will not deal with parsing Flow types into schema, it will just takes in the schema and produce Java code
  * We're evaluating whether JavaPoet is a better choice for Java code generation long term, vs building it in JS via string concatenation: https://github.com/facebook/react-native/blob/master/packages/react-native-codegen/src/generators/modules/GenerateModuleJavaSpec.js
  * This commit produces a sample Java code, not the actual codegen output

Changelog: [Internal]

To try this out, run this Gradle task:

```
USE_CODEGEN=1 ./gradlew :ReactAndroid:generateJava
```

Reviewed By: JoshuaGross, mdvacca

Differential Revision: D22917315

fbshipit-source-id: 0b79dba939b73ff1305b4b4fd86ab897c7a48d53
2020-08-04 00:55:23 -07:00
Janic Duplessis e0e33fce53 Fix RNTester TurboModules loading (#29538)
Summary:
It is now required to call RCTBridge.setRCTTurboModuleRegistry for turbo modules to work properly on iOS.

## Changelog

[Internal] [Fix] - Fix RNTester TurboModules loading

Pull Request resolved: https://github.com/facebook/react-native/pull/29538

Test Plan: Tested that images in RNTester now loads properly and Redbox module missing warning are gone.

Reviewed By: JoshuaGross

Differential Revision: D22884163

Pulled By: fkgozali

fbshipit-source-id: daf2fccdb518ec4a382b80b7f7b02004405a7564
2020-07-31 21:26:35 -07:00
Kevin Gozali c085068d7b OSS Android: architecture.gradle base setup
Summary:
Introduced `architecture.gradle` that sets up pluggable build-time codegen steps for Gradle so that:
* Libraries, including core ReactAndroid, can produce the new architecture codegen (NativeModule **Java** specs in this diff) during build time
* Hosting app (e.g. RNTester) can produce its own set of codegen specs separately

**Please note that this is still work in progress, hence app templates have not been updated to use it yet.**

In order to activate this setup, the env variable `USE_CODEGEN=1` must be set. Eventually, this var will be removed from the logic.

With this change, RNTester:
* Will see all the generated specs populated in the Gradle build dir, which should be equivalent to the currently [**checked in version**](https://github.com/facebook/react-native/tree/master/ReactAndroid/src/main/java/com/facebook/fbreact/specs).
* The specs will compile, but **have not been validated** vs the existing NativeModule .java classes through out the core -- that will be the next step
* The specs are under `com.facebook.fbreact.specs.beta` namespace, which will be configurable in the future. `.beta` is added to avoid conflict with the existing files in the repo.

### Is this all we need to enable TurboModule in Android?
No. There are a few more pieces needed:
* C++ codegen output for JNI layer for each NativeModule spec
* The C++ module lookup for TurboModule Manager
* The JNI build setup in Gradle for these C++ output
* Toggle to enable TurboModule system in the entire app

Changelog: [Internal]

Reviewed By: JoshuaGross

Differential Revision: D22838581

fbshipit-source-id: d972e2fbb37bdbd3354e72b014fc8bb27a33b9ac
2020-07-31 19:04:54 -07:00
David Vacca 973198667d Upgrade react-native-github Android to support API level 19+
Summary:
This diff upgrades react-native-github Android to support API level 19+

changelog: [Android][Deprecated] Deprecate support of Android API levels 16 to 18. The new minSDK version will be 19+ moving forward

Reviewed By: JoshuaGross

Differential Revision: D22734208

fbshipit-source-id: b052721c8cfb44f8d74cf4bbb5b7a769e544d1d9
2020-07-30 17:10:10 -07:00
Jayesh Kawli b78d7051e5 Moved ART iOS files to FB internal
Summary:
As a part of the "Lean Core" effort we are moving many React Native open source modules into React Native. Through this task, we reduced the app size of all React Native applications!

For this task, I moved the ART iOS files to Facebook internal.

Changelog:
[iOS][Changed] - Moved ART iOS files from React Native to Facebook internal

Reviewed By: PeteTheHeat

Differential Revision: D22560856

fbshipit-source-id: 4ed982b0361fef3e875374b6c3df0204037c2bfa
2020-07-19 13:59:06 -07:00
Ankit Tiwari f898bb65fa Fix alert screen crash in android in RNTester app (#29150)
Summary:
fixes - https://github.com/MLH-Fellowship/react-native/issues/21

[Reviewed by jevakallio](https://github.com/MLH-Fellowship/react-native/pull/22)

## Changelog

Before:

![image](https://user-images.githubusercontent.com/22813027/84471321-ba63bf00-aca2-11ea-92c0-3b43a8bdd28a.png)

After:

<img width="305" alt="Screenshot 2020-06-12 at 11 49 31 AM" src="https://user-images.githubusercontent.com/22813027/84471351-c8b1db00-aca2-11ea-9844-2b06da36e590.png">
Pull Request resolved: https://github.com/facebook/react-native/pull/29150

Test Plan:
1. Run the RNTester app locally on both android and iOS.
2. Open the Alert API screen.
3. Alert examples should be visible and functional in both android and iOS.

Screenshot for both android and iOS screens-

<img width="688" alt="Screenshot 2020-06-12 at 11 52 21 AM" src="https://user-images.githubusercontent.com/22813027/84471544-2d6d3580-aca3-11ea-9142-5f31a3daaf4e.png">

Reviewed By: cpojer

Differential Revision: D22067670

Pulled By: rickhanlonii

fbshipit-source-id: e7c43b77a30ae2e258303ce84f7fc4dee63776e6
2020-07-12 19:57:12 -07:00
Tim Yung caf010914c RN: Remove `fbjs/performanceNow` Dependency
Summary:
Replaces `fbjs/performanceNow` call sites in React Native with `performance.now`.

We did not originally polyfill this in `InitializeCore`, but now we do (and back it with a proper `nativePerformanceNow` implementation). Also, added the missing polyfill to our Jest setup.

Changelog:
[Internal]

Reviewed By: cpojer

Differential Revision: D22445948

fbshipit-source-id: dcfd9867c050617f6e2a3d0a1eb6f48a44771dda
2020-07-09 11:40:57 -07:00
Hein Rutjes cfa4260598 Add support for shadowColor on Android (API >= 28) (#28650)
Summary:
This PR adds support for the `shadowColor` style on Android.

This is possible as of Android P using the `setOutlineAmbientShadowColor` and `setOutlineSpotShadowColor` View methods. The actual rendered color is a multiplication of the color-alpha, shadow-effect and elevation-value.

## Changelog

`[Android] [Added] - Add support for shadowColor on API level >= 28`
Pull Request resolved: https://github.com/facebook/react-native/pull/28650

Test Plan:
- Only execute code on Android P
- Added Android `BoxShadow` tests to RNTester app

![image](https://user-images.githubusercontent.com/6184593/79457137-fe627c80-7fef-11ea-8e88-3d9423a4f264.png)

Reviewed By: mdvacca

Differential Revision: D21125479

Pulled By: shergin

fbshipit-source-id: 14dcc023977d7a9d304fabcd3c90bcf34482f137
2020-07-07 23:32:38 -07:00
Jimmy Zhang 3d882495d5 Check whether packager is running in RCTBundleURLProvider for saved JSLocation
Summary:
Changelog:
Adding packager running check when RCTBundleURLProvider is returning JSLocation, this prevents an invalid address from being returned which might cause various issues.

Reviewed By: cpojer

Differential Revision: D22390156

fbshipit-source-id: a20dbf63103158a34cbf6dc0ae8349b2f9e5b0a8
2020-07-06 09:08:44 -07:00
Christoph Nakazawa e881b244ca Remove JSDeltaBundleClient
Summary:
This was an experiment that never shipped. In the meantime we built Fast Refresh which obviates the need to complicate how we load and store bundles on device.

Changelog: [Internal]

Reviewed By: motiz88

Differential Revision: D22330994

fbshipit-source-id: 5a623b2611dd2622f17dd83ed35ef05c3100e40d
2020-07-02 04:06:19 -07:00
Héctor Ramos e255748d12 Codegen: Enable generation of ObjC FBReactNativeSpec with CocoaPods
Summary:
Build `FBReactNativeSpec.h` and `FBReactNativeSpec-generated.mm` using the new codegen script whenever the workspace is created using CocoaPods if the `USE_CODEGEN` envvar is set to 1.

Effectively makes use of the new codegen integration in CocoaPods opt-in.

The `USE_CODEGEN` envvar check should be removed when the generated files are removed from source control, at which point use of the new codegen in CocoaPods will be necessary.

```
cd RNTester
USE_CODEGEN=1 pod install
```

Changelog: [Internal]

Reviewed By: RSNara

Differential Revision: D22250128

fbshipit-source-id: 8f06bf1424ca2e003ecfd032ec03d7896569f9bd
2020-07-01 22:45:12 -07:00
Valentin Shergin 4776ebd7c3 Fabric: A demo in RNTester for `display: none`
Summary:
An interactive demo that stress-tests the `display: none` feature.

Changelog: [Internal] Fabric-specific internal change.

Reviewed By: mdvacca

Differential Revision: D22336304

fbshipit-source-id: 43855e979d45b4bdfdcf82f6b805a4f4af868368
2020-07-01 20:54:58 -07:00
TMaszko d92284216f Fix: Preserve native animated value after animated component unmount (#28841)
Summary:
After animation has been finished using Native driver there is no final value passed from the native to JS side. This causes a bug from https://github.com/facebook/react-native/issues/28114.

This PR solves this problem in the same way as `react-native-reanimated` library. When detaching it is calling native side to get the last value from Animated node and stores it on the JS side.

Preserving animated value even if animation was using `useNativeDriver: true`
Fixes https://github.com/facebook/react-native/issues/28114

## Changelog

<!-- Help reviewers and the release process by writing your own changelog entry. For an example, see:
https://github.com/facebook/react-native/wiki/Changelog
-->

[Internal] [Fixed] - Save native Animated node value on JS side in detach phase
Pull Request resolved: https://github.com/facebook/react-native/pull/28841

Test Plan: Unit tests for added getValue method passed. Green CI

Reviewed By: mdvacca

Differential Revision: D22211499

Pulled By: JoshuaGross

fbshipit-source-id: 9a3a98a9f9a8536fe2c8764f667cdabe1f6ba82a
2020-06-29 17:09:37 -07:00
fabriziobertoglio1987 0fda91ffff Adding Hyphenation Frequency prop for Text component (#29157)
Summary:
This issue fixes https://github.com/facebook/react-native/issues/28279
android_hyphenationFrequency prop for Android Text component which sets the frequency of automatic hyphenation to use when determining word breaks.

## Changelog

<!-- Help reviewers and the release process by writing your own changelog entry. For an example, see:
https://github.com/facebook/react-native/wiki/Changelog
-->

[Android] [Fixed] - Adding Hyphenation Frequency prop for Text component
Pull Request resolved: https://github.com/facebook/react-native/pull/29157

Test Plan:
More info are available in the [android docs](https://developer.android.com/reference/android/widget/TextView#setHyphenationFrequency(int)). I will add the documentation to the docs later once the pull request is taken in consideration for merging.

| **AFTER** |
|:-------------------------:|
|  <img src="https://user-images.githubusercontent.com/24992535/84919245-f8f1e300-b0c1-11ea-8a33-f30d0c9a75b7.png"  width="300" height="" />|

I remain available to do improvements. Thanks a lot. Fabrizio.

Reviewed By: TheSavior

Differential Revision: D22219548

Pulled By: JoshuaGross

fbshipit-source-id: 7e2523c25adfcd75454f60184eb73dc49891bef7
2020-06-29 16:57:12 -07:00
Andrew Coates (REDMOND) f8c68bf358 Make platformColors test page render with out of tree platforms (#29120)
Summary:
PlatformColorExample RNTester page crashes when running on platforms other than iOS/Android.
Changed some very minor logic to take into account that platforms other than iOS/Android exist.

## Changelog

[Internal] [Fixed] - PlatformColorExample RNTester page crashes when running on platforms other than iOS/Android.
Pull Request resolved: https://github.com/facebook/react-native/pull/29120

Reviewed By: sahrens

Differential Revision: D22109188

Pulled By: TheSavior

fbshipit-source-id: 853bea0ac4ea5c67f35d89d1a2bf55f5c89823b4
2020-06-29 12:01:03 -07:00
Tim Yung 70a73ca461 EventEmitter: Import `{Emitter => Event}Subscription`
Summary:
Changes dependents of `EmitterSubscription` to instead import the `EventSubscription` type from `EventEmitter.js`.

Changelog:
[Internal]

(Note: this ignores all push blocking failures!)

Reviewed By: cpojer

Differential Revision: D22182309

fbshipit-source-id: 575f4c59248ef50182ddb33911f1e6f3ba88ec07
2020-06-23 13:50:26 -07:00
simek ff690283e0 RNTester: remove 'supportsTVOS' flag (#29018)
Summary:
Refs: [0.62 release](https://reactnative.dev/blog/#moving-apple-tv-to-react-native-tvos), https://github.com/facebook/react-native/issues/28706, https://github.com/facebook/react-native/issues/28743

Support for the tvOS with the 0.62 release has been moved out to the `react-native-tvos` package. This PR removes the legacy flag related to the tvOS in the RNTester app examples.

Since Android TV support is still included in the Core I assume that the TV platform check cannot be removed completely.

## Changelog

[Internal] [Removed] - remove 'supportsTVOS' flag from the RNTester examples

## Test Plan

I have used the local working copy of `react-native` repo and test the changes in the RNTester app build from this code. Flow and List checks passed (but there is one, unrelated Prettier issue in the `AlertExample.js` file).
Pull Request resolved: https://github.com/facebook/react-native/pull/29018

Reviewed By: kacieb

Differential Revision: D22109549

Pulled By: TheSavior

fbshipit-source-id: d0f71f3d5f5f89d554972ec194ebf2801386fcff
2020-06-19 00:13:26 -07:00
Richard Groves 3e5a7b2939 Add quotes around paths in shell script call (#29160)
Summary:
Without this the RNTester app on iOS can’t be built in a folder that has a space in the path.

## Changelog

<!-- Help reviewers and the release process by writing your own changelog entry. For an example, see:
https://github.com/facebook/react-native/wiki/Changelog
-->

[iOS] [FIXED] - RNTester app builds in a path that contains a space
Pull Request resolved: https://github.com/facebook/react-native/pull/29160

Test Plan:
1. Clone react-native into a folder where the path has a space
2. Follow the instructions at https://github.com/facebook/react-native/blob/master/RNTester/README.md to get the RNTesterPods.xcworkspace
3. Open the workspace and build the project. Path to workspace was /Users/richard/UX Cam/Code/Test Projects/ReactNative/react-native/RNTester/RNTesterPods.xcworkspace

4. See error message - '/Users/richard/UX' is the first part of my path before the space

/Users/richard/Library/Developer/Xcode/DerivedData/RNTesterPods-ctjcmrlwzntpssgmcjydmovoztwl/Build/Intermediates.noindex/RNTesterPods.build/Debug-iphonesimulator/RNTester.build/Script-68CD48B71D2BCB2C007E06A9.sh: line 3: /Users/richard/UX: No such file or directory

Reviewed By: RSNara

Differential Revision: D22118259

Pulled By: TheSavior

fbshipit-source-id: 1213d88f66fd47dd052eaeb5f26da9056887f5ea
2020-06-18 10:44:06 -07:00
Tim Yung fa0e6f8051 RN: Image Progress Event on Android
Summary:
Adds support for the `onProgress` event on `Image`, for Android.

Since Fresco does not provide a progress listener on `ControllerListener`, this uses a forwarding progress indicator `Drawable` to pass along values from `onLevelChange`.

Caveat: The ratio between `loaded` and `total` can be used, but `total` is currently always 10000. It seems that Fresco does not currently expose the content length from the network response headers.

Changelog:
[Android][Added] - Adds support for the `onProgress` event on `Image`

Reviewed By: mdvacca

Differential Revision: D22029915

fbshipit-source-id: 66174b55ed01e1a059c080e2b14415e7d268bc5c
2020-06-16 15:01:05 -07:00
Tim Yung 74ab8f6e5a RN: Consistent API for Image Events
Summary:
Changes the `onLoad` and `onError` events on `Image` to be consistent with each other and with the `ImageSource` type.

Changelog:
[Android][Breaking] - On `Image`, `onLoad` and `onError` event objects will no longer have an extra `uri` property.
[Android][Breaking] - On `Image`, `onLoad` event objects' `source.url` is now renamed to `source.uri`.
[iOS][Breaking] - On `Image`, `onLoad` event objects' `source.url` is now renamed to `source.uri`.

Reviewed By: mdvacca

Differential Revision: D22023565

fbshipit-source-id: 5ea7904c697f87e01118bdb81ed50ab0a5aecdce
2020-06-16 15:01:05 -07:00
Christoph Nakazawa b4c13929e2 Fix typo
Summary: Changelog: [Internal]

Reviewed By: makovkastar

Differential Revision: D21996455

fbshipit-source-id: 8fc339f987957cf58b6ff56c1b4d28f8725d70c9
2020-06-11 07:35:31 -07:00
Christoph Nakazawa 1e61fa0931 Fix MultipartResponse to allow for binary data to be sent
Summary: Changelog: [Internal]

Reviewed By: motiz88

Differential Revision: D21995098

fbshipit-source-id: b387bd45b44fe93743d34d2a3435c165d15f054f
2020-06-11 07:23:59 -07:00
Emily Janzer a50fa552a7 Fix CircleCI by adding dependency on JSI to cxxreact (#29087)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/29087

D21908523 added an implicit dependency on `jsi.h` to use functions like `asObject`, etc. For some reason this doesn't break the build with BUCK (??) but it does with cocoapods. Adding the dep to the cxxreact podspec and regenerating offline mirrors to unbreak CircleCI. Also adding the BUCK dep and include statement for good measure.

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D21924592

fbshipit-source-id: 295c0670c6499e1195ba3c3a3320c6aee13bc025
2020-06-07 17:55:16 -07:00
Christoph Nakazawa 8821d271b4 RCTDevSplitBundleLoader: Add ability to enable `modulesOnly` and `runModule`
Summary: Changelog: [Internal]

Reviewed By: jimmy623

Differential Revision: D21882786

fbshipit-source-id: 1f90c62c3a385f1b12caef4bcc01e5bf53f0f882
2020-06-05 04:30:03 -07:00
Emily Janzer 5c474ac24c Convert JSEngineInstance into a runtime factory, move runtime ownership to ReactInstance (#29009)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/29009

OSS changes: Update RCTTurboModuleManager to accept a RuntimeExecutor instead of a `jsi::Runtime`.

Reviewed By: RSNara

Differential Revision: D21270243

fbshipit-source-id: e954e62ffd54cd57f6644de853e92f71c5e52e78
2020-06-03 22:06:39 -07:00
simek ad2f98df8f mark 'force' as optional property of PressEvent object (#29006)
Summary:
Refs:
* https://github.com/facebook/react-native/blob/master/React/Fabric/RCTSurfaceTouchHandler.mm#L93
* https://github.com/facebook/react-native/blob/master/RNTester/js/examples/Pressable/PressableExample.js#L25

According to the current implementation `force` will be returned only on `iOS` platform, only on the devices which have a hardware 3D touch capabilities.

## Changelog

<!-- Help reviewers and the release process by writing your own changelog entry. For an example, see:
https://github.com/facebook/react-native/wiki/Changelog
-->

[General] [Fixed] - mark `force` as an optional property of the PressEvent object
Pull Request resolved: https://github.com/facebook/react-native/pull/29006

Test Plan: Go CI!

Reviewed By: cpojer

Differential Revision: D21797241

Pulled By: TheSavior

fbshipit-source-id: e66be6958a2251bc8585e87e6bad54484a067949
2020-05-29 17:36:59 -07:00
Valentin Shergin c8d678abcf Revert D21396409: Add possibility to disable buttons in action sheet ios
Differential Revision:
D21396409

Original commit changeset: b3c3e4429651

fbshipit-source-id: 073bea94d96f0ebbb474c474c73e4e3f01f27b2e
2020-05-19 16:36:32 -07:00
lukewalczak f0bf4b0986 Add possibility to disable buttons in action sheet ios (#28792)
Summary:
I've noticed that currently there is no option to disable button within the `ActionSheetIOS`. It can be really useful and decided to extend the API to support that functionality.

I added a new option called `disabledButtonsIndices` to `ActionSheetIOS` which is an array of button indices which should be disabled.

`ActionSheetIOS` documentation - PR https://github.com/facebook/react-native-website/pull/1898

## Changelog

[iOS] [Added] - Add disableButtonsIndices option to ActionSheetIOS component
Pull Request resolved: https://github.com/facebook/react-native/pull/28792

Test Plan:
1. Run the `RNTester`
2. Choose `ActionSheetIOS`
3. Check the fourth example `Show Action Sheet with disabled buttons`
4. `Option 1` and `Option 2` should be disabled

screenshot | gif
 --- | ---
<img width="493" alt="Screenshot 2020-04-30 at 15 16 22" src="https://user-images.githubusercontent.com/22746080/80739025-1ec52780-8b16-11ea-8b1c-30bb40ad8c99.png"> | ![action_sheet_disabled](https://user-images.githubusercontent.com/22746080/80739043-24227200-8b16-11ea-8bcb-af25eb57baac.gif)

Differential Revision: D21396409

Pulled By: shergin

fbshipit-source-id: b3c3e442965160e0c5e52854352f0540575c4d4c
2020-05-19 00:19:56 -07:00
Ramanpreet Nara eb2a561ecb Rename <ReactCommon/NativeModulePerfLogger.h> to <reactperflogger/NativeModulePerfLogger.h>
Summary:
## Motivation
This rename will fix the following CircleCI build failures:
- [test_ios_unit_frameworks](https://circleci.com/gh/facebook/react-native/150473?utm_campaign=vcs-integration-link&utm_medium=referral&utm_source=github-build-link)
- [test_ios_detox_frameworks](https://circleci.com/gh/facebook/react-native/150474?utm_campaign=vcs-integration-link&utm_medium=referral&utm_source=github-build-link)

## Investigation
We have 4 podspec targets that map to the same header namespace (i.e: `header_dir`) `ReactCommon`:
- **New:** `React-perflogger`: Directory is `ReactCommon/preflogger`, and contains `NativeModulePerfLogger.{h,cpp}`.
- `React-runtimeexecutor`: Directory is `ReactCommon/runtimeexecutor`, and contains only `RuntimeExecutor.h`
- `React-callinvoker`: Directory is `ReactCommon/callinvoker`, and contains only `CallInvoker.h`
- `ReactCommon/turbomodule/core`: Directory is `ReactCommon/turbomodule`, and contains C++ files, as well has header files.

**The problem:**
We couldn't import headers from `React-perflogger` in `ReactCommon/turbomodule/core` files.

**The cause:**
I'm not entirely sure why, but I was able to discern the following two rules by playing around with the podspecs:
1. If your podspec target has a cpp file, it'll generate a framework when `USE_FRAMEWORKS=1`.
2. Two different frameworks cannot map to the same `module_name` or `header_dir`. (Why? No clue. But something breaks silently when this is the case).

So, this is what happened when I landed `React-perflogger` (D21443610):
1. The TurboModules code generates the `ReactCommon` framework that uses the `ReactCommon` header namespace.
2. `React-runtimeexecutor` and `React-callinvoker` also used the `ReactCommon` header namespace. However, neither generate a framework because of Rule 1.
3. When I comitted `React-perflogger`, I introduced a second framework that competed with the `ReactCommon` framework (i.e: TurboModules code) for the `ReactCommon` header namespace. Rule 2 violation.

## Thoughts on renaming
- `<perflogger/NativeModulePerfLogger.h>` is too generic, and the `perflogger` namepsace is used internally within FB.
- `<react/perflogger/NativeModulePerfLogger.h>` matches our fabric header format, but I'm pretty sure that slashes aren't allowed in `header_dir`: I tested this and it didn't work. IIRC, only alphanumeric and underscore are valid characters for `header_dir` or `module_name`. So, I opted to just use `reactperflogger`.

Changelog: [Internal]

Reviewed By: fkgozali

Differential Revision: D21598852

fbshipit-source-id: 60da5d0f7758eaf13907a080b7d8756688f40723
2020-05-15 15:25:23 -07:00
Keegan Mendonca 2b0208b399 Revert D21585006: Rename <ReactCommon/NativeModulePerfLogger.h> to <reactperflogger/NativeModulePerfLogger.h>
Differential Revision:
D21585006

Original commit changeset: e3339273af5d

fbshipit-source-id: cb4ff227edcc16842c7539bf71c912cd4ec478e0
2020-05-14 21:48:44 -07:00
David Vacca 84bca09f87 Fix position of TextInlineViews when nesting multiple Text components
Summary:
This diff fixes the position of TextInlineViews when nesting multiple Text.
The root is that we were not taking into consideration LayoutOffset of nested TextViews during the calculation of the nested views.

changelog: [Internal] Internal fix in Fabric

Reviewed By: JoshuaGross

Differential Revision: D21586893

fbshipit-source-id: 55e6ad0cf95222588ffe9185f5e22baea1059448
2020-05-14 21:42:37 -07:00
Ramanpreet Nara 9f3c7af400 Rename <ReactCommon/NativeModulePerfLogger.h> to <reactperflogger/NativeModulePerfLogger.h>
Summary:
## Motivation
This rename will fix the following CircleCI build failures:
- [test_ios_unit_frameworks](https://circleci.com/gh/facebook/react-native/150473?utm_campaign=vcs-integration-link&utm_medium=referral&utm_source=github-build-link)
- [test_ios_detox_frameworks](https://circleci.com/gh/facebook/react-native/150474?utm_campaign=vcs-integration-link&utm_medium=referral&utm_source=github-build-link)

## Investigation
We have 4 podspec targets that map to the same header namespace (i.e: `header_dir`) `ReactCommon`:
- **New:** `React-perflogger`: Directory is `ReactCommon/preflogger`, and contains `NativeModulePerfLogger.{h,cpp}`.
- `React-runtimeexecutor`: Directory is `ReactCommon/runtimeexecutor`, and contains only `RuntimeExecutor.h`
- `React-callinvoker`: Directory is `ReactCommon/callinvoker`, and contains only `CallInvoker.h`
- `ReactCommon/turbomodule/core`: Directory is `ReactCommon/turbomodule`, and contains C++ files, as well has header files.

**The problem:**
We couldn't import headers from `React-perflogger` in `ReactCommon/turbomodule/core` files.

**The cause:**
I'm not entirely sure why, but I was able to discern the following two rules by playing around with the podspecs:
1. If your podspec target has a cpp file, it'll generate a framework when `USE_FRAMEWORKS=1`.
2. Two different frameworks cannot map to the same `module_name` or `header_dir`. (Why? No clue. But something breaks silently when this is the case).

So, this is what happened when I landed `React-perflogger` (D21443610):
1. The TurboModules code generates the `ReactCommon` framework that uses the `ReactCommon` header namespace.
2. `React-runtimeexecutor` and `React-callinvoker` also used the `ReactCommon` header namespace. However, neither generate a framework because of Rule 1.
3. When I comitted `React-perflogger`, I introduced a second framework that competed with the `ReactCommon` framework (i.e: TurboModules code) for the `ReactCommon` header namespace. Rule 2 violation.

## Thoughts on renaming
- `<perflogger/NativeModulePerfLogger.h>` is too generic, and the `perflogger` namepsace is used internally within FB.
- `<react/perflogger/NativeModulePerfLogger.h>` matches our fabric header format, but I'm pretty sure that slashes aren't allowed in `header_dir`: I tested this and it didn't work. IIRC, only alphanumeric and underscore are valid characters for `header_dir` or `module_name`. So, I opted to just use `reactperflogger`.

Changelog: [Internal]

Reviewed By: fkgozali

Differential Revision: D21585006

fbshipit-source-id: e3339273af5dfd65a1454d87213d1221de6a4651
2020-05-14 20:54:57 -07:00
Samuel Susla 060250dcb0 Add support for ScrollView.contentOffset
Summary:
Changelog: [Internal]

Fabric's scrollview didn't have `contentOffset` implemented.

Reviewed By: JoshuaGross

Differential Revision: D21573179

fbshipit-source-id: 258c1cfa3398336f74d7ab033d90edcec7095292
2020-05-14 11:52:05 -07:00
Ramanpreet Nara 9f310a2b15 Instrument JS requires
Summary:
This diff instruments two markers:
- JSRequireBeginning: From the start of the JS require to when we start creating the platform NativeModule
- JSRequireEnding: From the end of platform NativeModule create to the end of the JS require

In order to accomplish this, I had modify `ModuleRegistry::ModuleRegistry()` to accept a `std::shared_ptr<NativeModulePerfLogger>`. I also had to implement the public method `ModuleRegistry::getNativeModulePerfLogger()` so that `JSINativeModules` could start logging the JS require beginning and ending.

Changelog: [Internal]

Reviewed By: PeteTheHeat

Differential Revision: D21418803

fbshipit-source-id: 53828817ae41f23f3f04a95b1d3ac0012735da48
2020-05-13 20:28:17 -07:00
Ramanpreet Nara 0486640571 Introduce NativeModulePerfLogger
Summary:
## Description
This diff introduces `NativeModulePerfLogger`, its BUCK, Cocoapod, android-ndk targets. This diff also wires up those targets into the React Native bridge and TurboModules targets, so that we get signal on if the code compiles.

This diff also introduces `TurboModulePerfLogger`, which is a namespace that holds the `NativeModulePerfLogger` that'll do perf-logging for TurboModules.

## How will perflogging work on iOS?
1. Each application will, during React Native initialization, create a NativeModule perf logger.
2. If TurboModules are enabled, we'll call `TurboModulePerfLogger::setInstance(perfLogger)`. If TurboModules are disabled, we'll call `NativeModulePerfLogger::setInstance(perfLogger)`.
3. TurboModules, when they're created and used, will log events via `TurboModulePerfLogger::getInstance()`. NativeModules (i.e: bridge modules), when they're created and used, will log events via the `NativeModulePerfLogger::getInstance()`.

> **Note:** The NativeModule system will log events for non-TurboModules as well. Maybe we should log events for only NativeModules that conform to the `TurboModule` interface, when TurboModules are disabled. This'll ensure a fair comparison between the two systems.

## How will perflogging work on Android?
Please see the subsequent diff.

allow-large-files

Changelog:
[Both][Added] - Introduce `NativeModulePerfLogger`

Reviewed By: PeteTheHeat

Differential Revision: D21318053

fbshipit-source-id: 6ddf5b5a80bdc4076d2dd6588067e2b0ec8c2c6b
2020-05-13 20:28:15 -07:00
Rick Hanlon c3a3d42e00 Fix dev tool hotkets in RNTester
Summary:
This diff fixed hotkeys for dev tools like cmd+d, cmd+r, and cmd+i when Turbo Modules are enabled until we have a proper way to eagerly initialize turbo modules.

Changelog: [Internal]

Reviewed By: RSNara

Differential Revision: D21517482

fbshipit-source-id: 8c68bc126361aa961a4f05c93dc19ada32fe44c7
2020-05-13 19:32:19 -07:00
Samuel Susla d9593ae1b3 Add support for ScrollView.centerContent in Fabric
Summary:
Changelog: [Internal]

ScrollView didn't support centerContent prop. The implementation is copied over from Paper.

I added an example of this prop in RNTester.

Reviewed By: JoshuaGross

Differential Revision: D21548270

fbshipit-source-id: 28f6c8d769c5a6bc1d111b33970a06b95c259132
2020-05-13 12:28:54 -07:00
Paige Sun e5a6655e71 iOS: Fix Animated image crash when CADisplayLink target in RCTWeakProxy is nil
Summary:
## Problem
When self is nil, this may crash in RCTUIImageViewAnimated.m.

```
_displayLink = [CADisplayLink displayLinkWithTarget:[RCTWeakProxy weakProxyWithTarget:self] selector:selector(displayDidRefresh:)];
```

## Fix

Replace `RCTWeakProxy` with a concrete class `RCTDisplayWeakRefreshable` that has the displayDidRefresh method, that calls the displayDidRefresh method in its weak target.

### Original Github Issue
https://github.com/facebook/react-native/pull/28070#issuecomment-619295254

Changelog: [iOS] [Fixed] -  Fix Animated image crash when CADisplayLink target in RCTWeakProxy is nil

Reviewed By: shergin

Differential Revision: D21419385

fbshipit-source-id: da7c3c38f81ea54f633da7f59359e07680ea2faf
2020-05-12 17:08:43 -07:00
Moti Zilberman 9b5359133b Add package name / bundle ID to bundle URL in development
Summary:
Adds the package name (Android) / bundle ID (iOS) as a new URL parameter named `app` in the bundle URL. This currently has no effect on Metro, which will ignore it for bundling / caching purposes.

Changelog: [General] - Add package name / bundle ID to bundle URL in development

Reviewed By: cpojer

Differential Revision: D21429764

fbshipit-source-id: 394fe50dba72219f7594ebeac9486a8264a836a6
2020-05-12 07:35:50 -07:00
Janic Duplessis d30c920749 Mention using bundler to install cocoapods in RNTester README (#28873)
Summary:
This makes sure the proper version of cocoapods gets used, this will avoid noise in diffs if someone ends up updating pods with a different version.

## Changelog

[Internal] [Changed] - Mention using bundler to install cocoapods in RNTester README
Pull Request resolved: https://github.com/facebook/react-native/pull/28873

Test Plan: N/A

Differential Revision: D21519862

Pulled By: shergin

fbshipit-source-id: 3dc555bc3aee6bee10127ba5b5862302a63346c4
2020-05-11 23:28:59 -07:00
Samuel Susla dd7b67168f Move SegmentedControl components to separate file and make them function based
Summary: Changelog: [Internal] Separate SegmentControl examples into separate file and make them functional based

Reviewed By: mdvacca

Differential Revision: D21475596

fbshipit-source-id: 19165232f2a8edefa66f122944621f93265ff704
2020-05-11 09:01:35 -07:00
Manvir Singh d54113d8c4 implemented showSoftInputOnFocus for iOS (#28834)
Summary:
`showSoftInputOnFocus` was added in https://github.com/facebook/react-native/issues/25028, but it was only added for Android. There was a lot of discussion on the original issue being addressed (https://github.com/facebook/react-native/issues/14045), that there is a need for this on iOS as well. The issue with iOS was brought up again on https://github.com/facebook/react-native/issues/27243.

On a related note, when searching this repo's issues for `showSoftInputOnFocus`, it appears that there are several closed issues that claim that the Android implementation doesn't work (https://github.com/facebook/react-native/issues/25685, https://github.com/facebook/react-native/issues/25687, https://github.com/facebook/react-native/issues/26643). So perhaps the Android implementation needs to be looked at as well (I myself have not gotten around to confirming whether it works or not)

## Changelog

[iOS] [Added] - Add showSoftInputOnFocus to TextInput
Pull Request resolved: https://github.com/facebook/react-native/pull/28834

Test Plan:
You'd use this just like you would in the Android implementation:
```jsx
<TextInput showSoftInputOnFocus={false} />
```

## GIFs
### Before change
![May-04-2020 20-52-49](https://user-images.githubusercontent.com/4932784/81034028-9d89cf80-8e4a-11ea-906c-64f62504f80c.gif)

### After change
![May-04-2020 20-54-27](https://user-images.githubusercontent.com/4932784/81034035-a11d5680-8e4a-11ea-918e-119a1c9e2a19.gif)

Differential Revision: D21418763

Pulled By: shergin

fbshipit-source-id: 561e72fc2cf16b30446132f6b96b8aa2b4a92daf
2020-05-11 09:01:33 -07:00
Emily Janzer a4a47b9a1e Expose RuntimeExecutor on CatalystInstance (#28851)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/28851

This diff creates a RuntimeExecutor that uses the bridge and exposes it on CatalystInstanceImpl.

Changelog: [Internal]

Reviewed By: mdvacca, RSNara

Differential Revision: D21051949

fbshipit-source-id: b3977fc14fa19089f33e297d29cedba0d067526d
2020-05-08 16:13:42 -07:00
Yuanzhe Bian 851644cfc2 Fix Animated type
Summary:
- Fixed typing of Animated and fixed the callsites

Changelog: [Internal]

Reviewed By: kacieb

Differential Revision: D21311870

fbshipit-source-id: 386fb496ab00ef7917273dc3eb65e1ed76a8dd33
2020-05-07 00:06:27 -07:00
Emily Janzer ca105f8b06 Update cocoapods (#28833)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/28833

The checked-in RNTester podfile was generated using Cocoapods version 1.9.1. This doesn't match the version currently used in CircleCI, which is 1.8.4. In order to update the offline mirrors and land them without breaking CircleCI, it seems we need to switch back to 1.8.4. This diff updates the podfile back to 1.8.4 and updates the offline mirrors.

Reviewed By: fkgozali

Differential Revision: D21392989

fbshipit-source-id: b14aa6e2798175534e9416410ba9d6877fb718c0
2020-05-06 17:00:33 -07:00
Christoph Nakazawa 87d000f890 Fix invalid type annotations
Summary:
Our parsers accept these but they are invalid. This fixes them.

Changelog: [Internal]

Reviewed By: yungsters

Differential Revision: D21373812

fbshipit-source-id: 6084757b9f842644fe629ae5e6d85baec611588d
2020-05-03 12:09:48 -07:00
Emily Janzer bf0539fb51 Revert D21336180: Update cocoapods, fix RNTester
Differential Revision:
D21336180

Original commit changeset: 4d51f53466ec

fbshipit-source-id: 5519bc0457f14060e793d2da454489b77fce923f
2020-05-01 15:11:39 -07:00
Emily Janzer c25911bea8 Update cocoapods, fix RNTester
Summary:
Updating pods and fixing an issue in the RN podfile.

Changelog: [iOS][Fixed] Update podfile for RNTester

Reviewed By: PeteTheHeat

Differential Revision: D21336180

fbshipit-source-id: 4d51f53466ec2d432cf7a5775cb4d69d47423077
2020-05-01 13:51:47 -07:00
Jason Safaiyeh 6de9f37d66 Resolve RNTester Xcode warnings (#28676)
Summary:
Resolve RNTester Xcode warnings.

## Changelog

<!-- Help reviewers and the release process by writing your own changelog entry. For an example, see:
https://github.com/facebook/react-native/wiki/Changelog
-->

[Internal] [iOS] - Resolve RNTester Xcode warnings
Pull Request resolved: https://github.com/facebook/react-native/pull/28676

Test Plan: Building RNTester no longer shows project setting warnings

Differential Revision: D21109702

Pulled By: hramos

fbshipit-source-id: f7552d3a9857ee7415cd96622a0a79797a168698
2020-04-28 14:41:48 -07:00
Samuel Susla e68f9bf768 Calling Paper TextInput setTextAndSelection view command now dirties layout
Summary:
Changelog: [Internal]

Previously `setTextAndSelection` was not dirtying layout. This would cause an issue where `setTextAndSelection` causes layout change. For example calling setTextAndSelection with empty string on a multiline auto expanding text input.

I changed one example in TextInputSharedExamples.js, "Live Re-Write (no spaces allowed) and clear" example is now multiline. This allows to test whether `setTextAndSelection` dirties layout. Enter multiline string to to the example text input and press clear. Observe that the text input shrinks to single line height.

Reviewed By: shergin

Differential Revision: D21182990

fbshipit-source-id: de8501ea0b97012cf4cdf8d5f658649139f92da6
2020-04-27 03:23:34 -07:00