Summary: In D16805827, I moved `RCTImageLoader`, `RCTImageStoreManager`, and `RCTImageEditingManager` to `CoreModules`. This was necessary to turn `RCTImageLoader` into a TurboModule. However, after D17671288 landed, it's no longer necessary to have OSS NativeModules in `CoreModules`. Therefore, I'm moving these NativeModules back to `RCTImage`.
Reviewed By: PeteTheHeat
Differential Revision: D17720575
fbshipit-source-id: 44b07cfa07cbb2b87254132810f86974edc7edab
Summary: Ports an internal ESLint rule used at Facebook, `error-subclass-name`, to cover the React Native codebase. This rule enforces that error classes ( = those with PascalCase names ending with `Error`) only extend other error classes, and that regular functions don't have names that could be mistaken for those of error classes.
Reviewed By: rubennorte
Differential Revision: D17829298
fbshipit-source-id: 834e457343034a0897ab394b6a2d941789953d2e
Summary: This PR caused a regression with shadows, see https://github.com/facebook/react-native/issues/26544.
Reviewed By: JoshuaGross, mdvacca
Differential Revision: D17809320
fbshipit-source-id: 0c83cd211425622ada0fd8c492f43df0536a4b8a
Summary: Reverts D14176217 so we can do the partial React sync in the next diff which removes this API
Reviewed By: TheSavior
Differential Revision: D17828977
fbshipit-source-id: 7dd98c19890aeee0a153746ce65fd3b148b4ca7b
Summary: Use TestParametrization to test both fbjni and vanilla jni versions
Reviewed By: amir-shalem
Differential Revision: D17788718
fbshipit-source-id: 0f3317b7403cadca7b7ccd9140f1933d746bf433
Summary: Removes the use of `framesToPop` from method wrappers in the RN bridge.
Reviewed By: rubennorte
Differential Revision: D17764986
fbshipit-source-id: f2fac0c33a9a7c821bb920fa65b92a4672150a38
Summary:
This PR bumps bumps Soloader to 0.8.0. This fixes white screen/ crash issues when downloading from Google Play.
Related to:
https://github.com/facebook/react-native/issues/25927#26400
## Changelog
[Android] [Changed] - Bump Soloader to 0.8.0
Pull Request resolved: https://github.com/facebook/react-native/pull/26759
Test Plan:
A few CI tests fail, but I don't see the link with what I changed, especially the ios tests.
It's working locally though, and for people on github who tried this solution as well.
Differential Revision: D17828891
Pulled By: mdvacca
fbshipit-source-id: 1c7809aa681b41b8ed9a4da96d041d52f3cfbb76
Summary:
`MountingCoordinator::waitForTransaction()` allows waiting for a new coming transaction synchronously, as efficient as waiting for a mutex.
This feature can be used to implement more high-level synchronous rendering APIs.
Reviewed By: mdvacca
Differential Revision: D17629425
fbshipit-source-id: acd91b941e4d6d43bc4518f332a1604e14506be9
Summary: Add ScopedLocalRef, ScopedGlobalRef and some common methods to be used later.
Reviewed By: amir-shalem
Differential Revision: D17711284
fbshipit-source-id: be43d5e246bc2406765057783be11854877c41f1
Summary: This diff moves methods related to actions on YGNode like free node, reset node etc. to vanilla JNI
Reviewed By: amir-shalem
Differential Revision: D17668008
fbshipit-source-id: 03bfc51ec1fcf06569713400f984d551827e22fe
Summary: Moving common code to YGJNI.h header class so that same can be used in fbjni and vanilla jni implementations
Reviewed By: amir-shalem
Differential Revision: D17666457
fbshipit-source-id: 1e6cd2506fb773b8a17ebef277a2c7ef9728e66b
Summary: We need commands to work with `LegacyViewManagerInterop`. We will need to rethink this once Fabric has command-execution pipeline in place.
Reviewed By: shergin
Differential Revision: D17787294
fbshipit-source-id: a6b3dbfae41f04e7e7f5bafb1f7b4ad0de0eedc3
Summary:
LegacyViewManagerInterop layer can now handle events as well.
We expose `eventInterceptor` from `NSComponentData`, that way we can hook into event dispatching that happens within `NSComponentData`.
Coordinator has a map of `UIView -> reactTag` which it uses to figure out to which component view to forward the event.
New `LegacyViewManagerInteropViewEventEmitter` exposes APIs to send `folly::dynamic` to javascript.
Reviewed By: shergin
Differential Revision: D17765834
fbshipit-source-id: 25e75e445b32c69ec9ab0189c4ab7fba5f8c7b5d
Summary: I made a mistake earlier and somehow prevented RCTRedBox showing up. Not sure why this didn't prevent them from showing up in dev mode.
Reviewed By: RSNara
Differential Revision: D17798516
fbshipit-source-id: 48bf0523124ad3fd96d626281390bbafc62f3390
Summary:
This fixes a bug where the frames array can contain a duplicate entry at the end.
For example, suppose the duration is 1000.0 then it would create an array with the following:
```
[ 0,
0.0010119824303159884,
0.00391003997863186,
0.00851330482578147,
0.01466951184383165,
0.022249135687575607,
0.03114100006836614,
0.041248932923769244,
0.05248918022066495,
0.06478838042267626,
0.07808196049642172,
0.09231285402599128,
0.1074304693764467,
0.12338985513375342,
0.14015102395653428,
0.15767840628626964,
0.17594041329987542,
0.1949090949486824,
0.21455988464815853,
0.23487142789035506,
0.25582549864491233,
0.27740701626433145,
0.2996041891505173,
0.3224088345090182,
0.34581696665965683,
0.36982983491413496,
0.394455794287552,
0.4197139228812336,
0.44564199741037275,
0.4723190090623474,
0.5000000572130084,
0.5276809909376533,
0.5543580025896278,
0.5802860771187669,
0.6055442057124484,
0.6301701650858652,
0.6541830333403433,
0.6775911654909819,
0.7003958108494828,
0.7225929837356684,
0.7441745013550876,
0.7651285721096447,
0.785440115351841,
0.8050909050513173,
0.8240595867001241,
0.84232159371373,
0.8598489760434653,
0.876610144866246,
0.8925695306235529,
0.9076871459740083,
0.9219180395035779,
0.9352116195773232,
0.9475108197793346,
0.9587510670762303,
0.9688589999316335,
0.9777508643124241,
0.9853304881561681,
0.9914866951742183,
0.996089960021368,
0.9989880175696839,
1,
1 ]
```
With this change, it now generates the following array:
```
[ 0,
0.0010119824303159884,
0.00391003997863186,
0.00851330482578147,
0.01466951184383165,
0.022249135687575607,
0.03114100006836614,
0.041248932923769244,
0.05248918022066495,
0.06478838042267626,
0.07808196049642172,
0.09231285402599128,
0.1074304693764467,
0.12338985513375342,
0.14015102395653428,
0.15767840628626964,
0.17594041329987542,
0.1949090949486824,
0.21455988464815853,
0.23487142789035506,
0.25582549864491233,
0.27740701626433145,
0.2996041891505173,
0.3224088345090182,
0.34581696665965683,
0.36982983491413496,
0.394455794287552,
0.4197139228812336,
0.44564199741037275,
0.4723190090623474,
0.5000000572130084,
0.5276809909376533,
0.5543580025896278,
0.5802860771187669,
0.6055442057124484,
0.6301701650858652,
0.6541830333403433,
0.6775911654909819,
0.7003958108494828,
0.7225929837356684,
0.7441745013550876,
0.7651285721096447,
0.785440115351841,
0.8050909050513173,
0.8240595867001241,
0.84232159371373,
0.8598489760434653,
0.876610144866246,
0.8925695306235529,
0.9076871459740083,
0.9219180395035779,
0.9352116195773232,
0.9475108197793346,
0.9587510670762303,
0.9688589999316335,
0.9777508643124241,
0.9853304881561681,
0.9914866951742183,
0.996089960021368,
0.9989880175696839,
1 ]
```
Note that the duplicate 1 at the end is now gone. This is because previously when it accumulated dt for 60 frames. dt wasn't quite exactly 1000, it was instead 999.9999999999999 and so didn't break out of the loop when it should have. This adds a tolerance so that it does break out of the loop.
Reviewed By: sahrens
Differential Revision: D17738602
fbshipit-source-id: deba5d5a08ae842e2a9e2b75f2e25e14f3700518
Summary:
This PR addresses issue https://github.com/facebook/react-native/issues/23870 (`View.getGlobalVisibleRect()` is broken in some use cases)
The issue affects the following Android APIs:
- ViewGroup.getChildVisibleRect()
- View.getGlobalVisibleRect() (Which calls into ViewGroup.getChildVisibleRect)
- View.getLocalVisibleRect() (Which calls into View.getGlobalVisibleRect())
According to Android documentation, View.getGlobalVisibleRect() should provide a rect for a given view that has been clipped by the bounds of all of its parent views up the view hierarchy. It does so through the use of the recursive function ViewGroup.getChildVisibleRect().
Since React Native has a separate clipping mechanism that does not rely on Android UI's clipping implementation, ViewGroup.getChildVisibleRect() is unable to determine that a rect should be clipped if the clipping view is a ReactClippingViewGroup. This resultantly breaks some important use cases for things like testing with Detox, which relies on this functionality to tell when a component is on-screen, as explained in the above referenced issue.
The rationale of the fix is essentially to implement logic analogous to [ViewGroup.getChildVisibleRect()](https://android.googlesource.com/platform/frameworks/base/+/master/core/java/android/view/ViewGroup.java#6176), discarding irrelevant Android clipping modes, and instead testing against the 'overflow' property, restoring the originally intended functionality. This is implemented as an override to ViewGroup.getChildVisibleRect() in the following classes:
- ReactViewGroup
- ReactScrollView
- ReactHorizontalScrollView
Unfortunately, since the public ViewGroup.getChildVisibleRect() API recurses into a `hide` annotated API which cannot be overridden, it was necessary to provide this override in each of the above React Native classes to ensure the superclass implementation would not be called, which would break the recursion.
## Changelog
[Android] [Fixed] - View.getGlobalVisibleRect() clips result rect properly when overflow is 'hidden'
Pull Request resolved: https://github.com/facebook/react-native/pull/26334
Test Plan:
The functionality in question is neither used internally nor exposed by React Native, and thus only affects Android native modules that use the above referenced APIs.
As such, I have primarily performed testing with a forked example project that had been submitted with issue https://github.com/facebook/react-native/issues/23870, originally by d4vidi.
The example project can be found here:
- [Configured to build against RN Master](https://github.com/davidbiedenbach/RNClipVisibilityBugDemo/tree/rn-master)
- [Configured to build against PR branch](https://github.com/davidbiedenbach/RNClipVisibilityBugDemo/tree/fix-23870)
(Original project here: https://github.com/d4vidi/RNClipVisibilityBugDemo)
### Bug in effect:
When built against RN master, it can be observed that fully clipped views are reported as visible, as in the below screenshots.
#### Views inside a ReactViewGroup do not report as clipped
![BugScreen1](https://user-images.githubusercontent.com/1563532/64999573-314b6300-d89d-11e9-985e-294bd51a0ba9.jpg)
#### Views inside a ReactScrollView do not report as clipped
![BugScreen2](https://user-images.githubusercontent.com/1563532/64999580-38727100-d89d-11e9-8186-96b25c937edc.jpg)
#### Views inside a ReactHorizontalScrollView do not report clipping properly
![BugScreen4](https://user-images.githubusercontent.com/1563532/64999588-3f00e880-d89d-11e9-9477-7b79e44c5e46.jpg)
### Bug fixed
When built against the PR branch, fully-clipped views no longer report visible.
#### Views inside a ReactViewGroup report clipping properly
![FixScreen1](https://user-images.githubusercontent.com/1563532/64999634-6b1c6980-d89d-11e9-8534-b26b638bf4d8.jpg)
#### Views inside a ReactScrollView report clipping properly
![FixScreen2](https://user-images.githubusercontent.com/1563532/64999641-7079b400-d89d-11e9-8f95-4d6e28bcf833.jpg)
#### Views inside a ReactHorizontalScrollView report clipping properly
![FixScreen4](https://user-images.githubusercontent.com/1563532/64999645-74a5d180-d89d-11e9-9754-170bb3b620a2.jpg)
Reviewed By: mdvacca
Differential Revision: D17782658
Pulled By: yungsters
fbshipit-source-id: 0cd0d385898579a7a8a3e453f6ba681679ebe496
Summary: Oleksandr made the point that making `sDidInit` volatile isn't quite enough because the flag is set at the beginning of the function; it's possible that it will return true while it's still in the process of initializing the bridge. Moving where we set the flag to the end of the function should address the issue.
Reviewed By: JoshuaGross
Differential Revision: D17770128
fbshipit-source-id: 695d3edc582d9dce1884d8698d400dd147ca5cae
Summary:
If you passed
```
contentInset: { bottom: 10 }
```
then it wouldn't go into the if case and it could try to call `setOffset` with `undefined`. `setOffset` requires a number.
Changelog:
[Fix][ScrollView] ScrollView contentInset top now defaults to 0 in expected situations
Reviewed By: JoshuaGross
Differential Revision: D17796155
fbshipit-source-id: 951dbbb0de1052f64a6835963e8bbc564990c120
Summary:
This function doesn't exist on the scroll responder so this prop is being set to undefined.
As this is an event, not setting the prop just means that nothing will listen to the event.
Changelog:
[Internal]
Reviewed By: JoshuaGross
Differential Revision: D17795678
fbshipit-source-id: 73f2c125e0868e19258b43e3a053447be3f5e768
Summary: We generate a stub for plugin system, so that TurboModules can work in OSS. Unless the `RN_DISABLE_OSS_PLUGIN_HEADER` define is seet, TurboModules will use the plugin stub. Therefore, for internal builds, we should set this define.
Reviewed By: fkgozali, mdvacca
Differential Revision: D17789993
fbshipit-source-id: a93735738513457236adb3064b80601053c95dd3
Summary:
@public
This will provide a more useful error message and hopefully allow us to debug the issue further.
Reviewed By: JoshuaGross
Differential Revision: D17793693
fbshipit-source-id: 848ae658200ea5e3892d8a88888599c1c248c994
Summary:
This diff adds server side logging for all log levels in development (some levels sampled)
There are two new mobile analytic event pipelines (that pipe to scuba table)
- rn_dev_logs ([pigeon](https://our.intern.facebook.com/intern/marauder/event/?name=rn_dev_logs) [scuba](https://fburl.com/scuba/pqxl6mf5))
- rn_dev_logs_sampled ([pigeon](https://our.intern.facebook.com/intern/marauder/event/?name=rn_dev_logs_sampled) [scuba](https://fburl.com/scuba/oqz6b5x3))
Notes:
- All React Native logs from JS and Native on iOS go through this path to be printed to the console, so everything will be caputured even though native errors/warnings do not necessarily show a red/yellow box
- All errors and warnings are logged
- Log level info is sampled
Reviewed By: sammy-SC
Differential Revision: D17789494
fbshipit-source-id: dea6359237dbd91f267949f5185a0c79bb4083b8
Summary: Props are being ignored on native side, let's get rid of them.
Reviewed By: TheSavior
Differential Revision: D17765185
fbshipit-source-id: d3625dd25d2e41a49e701d54fe9a7b74cd47786c
Summary: We are moving away from setNativeProps, this adds necessary method on native to leverage commands API
Reviewed By: shergin
Differential Revision: D17787877
fbshipit-source-id: 8f06cdd85c96bce4ea9bb7a8cd5f6c1a1d68b20a
Summary:
This is required so we can switch to using commands instead of `setNativeProps`.
`setNativeProps` are not supported in Fabric, we are moving away from it.
Reviewed By: JoshuaGross
Differential Revision: D17764967
fbshipit-source-id: 16e54ebe1f0c58b80a6491db970a60c01fec8a15
Summary: Fabric doesn't support setNativeProps, so we have to use commands instead to set the value of the native component.
Reviewed By: JoshuaGross
Differential Revision: D17736274
fbshipit-source-id: 18c47365926c3c2cfc3551f4b5b6cc72e4162367
Summary:
The implementation for this class was commented out in D14200097.
ServerSnapshotTests rely on this class to decide when test app setup is finished [here](diffusion/FBS/browse/master/fbandroid/instrumentation_tests/com/facebook/react/screenshots/shared/ReactNativeScreenshotTestCase.java;676aecf86a816bba8eb8571bc327e77c8f2e149b$164).
The only change I made is to use InstrumentationRegistry from Androidx instead of support.
Reviewed By: rickhanlonii, mdvacca
Differential Revision: D15068069
fbshipit-source-id: c69c7d46a1068836f9a9303de11e9a7a36b4e6d9
Summary: Adding a second exception with a different error message so we can tell how the ViewManagerRegistry was created when it fails to find a view manager.
Reviewed By: rickhanlonii, JoshuaGross
Differential Revision: D17759060
fbshipit-source-id: 4415fa7440395f7e5730d2b77088f16a1a6a819d
Summary: In D17747958 I added a function to check the value of a static variable, but forgot to make sure it was accessed in a thread-safe manner. Adding `volatile` to the flag
Reviewed By: makovkastar
Differential Revision: D17763888
fbshipit-source-id: f227b69de1a0df6493424da3b276529555999f70
Summary: Adding a hook to check if ReactBridge is initialized so we can avoid loading the .so on the main thread.
Reviewed By: fkgozali
Differential Revision: D17747958
fbshipit-source-id: 5969afa57dc1b446c03bc68eaa9e1385fe17c461