Commit Graph

4361 Commits

Author SHA1 Message Date
Ian Childs f7e7e89335 provided_dep does not need to be a dep too
Differential Revision: D34108108

fbshipit-source-id: b31d2e87c8dcbe5a9b2ad9d74c54958cf1571026
2022-02-09 16:21:55 -08:00
Xin Chen fc7eb91f56 Add RedBoxSurfaceDelegate to DevSupportManagerBase to abstract surface logic to show RedBox
Summary:
This diff adds `RedBoxSurfaceDelegate` to replace existing logic in `DevSupportManagerBase` to abstract how we show/hide the RedBox surface. The delegate will wrap a RedBoxDialog instance, which is used to show/hide the dialog for default behavior (when there is no surface delegate for redbox got provided).

I also updated the interface for delegate to accomodate new use cases:
- Add `isShowing` for the `SurfaceDelegate`
- Add a list of getters for `DevSupportManager` for data access in the delegate
- (Update 2/7) Separate Dialog from `RedBoxDialog`, and re-named it to `RedBoxContentView`. This is to make it clear that the delegate is responsible to provide actual surface implementation (Dialog). The content view is meant to be shared.

Changelog:
[Android][Internal]

Reviewed By: javache

Differential Revision: D33987835

fbshipit-source-id: 57c20648e7f2ec8238963feca27ccd5518e7931d
2022-02-09 15:16:22 -08:00
Hamid 5341ad8962 use root locale when converting string case (#33028)
Summary:
Not setting locale for language/country neutral operation may cause bug depending on the default locale.
See https://docs.oracle.com/javase/7/docs/api/java/util/Locale.html#ROOT

Note: I am just searching for toLowerCase() and toUppercase() in my project's dependencies and send the same PR, in order to just be considered. Although I've seen the lack of explicit locale has caused issues for us, I am not sure if react-native is actually affected. I haven't checked for `String.format()` yet.

Example related issue: joltup/rn-fetch-blob#573

## Changelog

[Android] [Fixed] - Use root locale when converting string case.

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

Reviewed By: ShikaSD

Differential Revision: D33943446

Pulled By: cortinico

fbshipit-source-id: d5be9392ea7c21a33436acac5b5e8c50b7c7e31e
2022-02-09 14:06:34 -08:00
David Vacca eafa5bcb38 Log timestamp in ReactMarker.logFabricMarker method
Summary:
Ensure we always log a timestamp in ReactMarker.logFabricMarker

changelog: [internal] internal

Reviewed By: ShikaSD

Differential Revision: D34006699

fbshipit-source-id: 79ff1005ba1f0ed44bf319e50a80dbdebd1ec24f
2022-02-09 10:03:34 -08:00
Genki Kondo bb435a2b11 Support AnimatedColor.setValue for platform colors
Summary:
In order to support AnimatedColor.setValue for platform colors, we need to pass the platform color object to the native animated node which will then resolve and apply the color.

Thus, the approach is:
- Add a new API updateAnimatedNodeConfig to NativeAnimatedModule
- [JS] On AnimatedColor.setValue, if the value is a platform color, then we call updateAnimatedNodeConfig
- [Android] We introduce AnimatedNodeWithUpdateableConfig interface with a method updateConfig. On ColorAnimatedNode.java, we use updateConfig to resolve and apply the color

Changelog:
[Internal][Fixed] - Use context from view when resolving platform color

Reviewed By: javache, mdvacca

Differential Revision: D34025193

fbshipit-source-id: 8b368f6b7cb2cf7cebe8b66461cd4185cbadd44c
2022-02-08 16:31:14 -08:00
Genki Kondo 1a044123fc Use context from view when resolving platform color if activity doesn't exist
Summary:
There are cases where the activity may not exist (such as for VRShell panel apps). In this case we will search for a view associated with a PropsAnimatedNode to get the context.

Changelog:
[Internal][Fixed] - Use context from view when resolving platform color if activity doesn't exist

Reviewed By: javache

Differential Revision: D34022882

fbshipit-source-id: c316935af1034ea770f3ef9334f77d6dc783fb27
2022-02-08 11:42:27 -08:00
Andrei Shikov ebc856b2de Check if view exists before skipping CREATE command
Summary:
Updates early return in the CREATE command codepath that checks if the view already exists before allocating it. Normally the view state is expected to be created only if the view is preallocated, but empty view state is also created for the flattened nodes when they create an event emitter.

By checking the view existence, we can ensure that view was indeed preallocated before, and skip for optimization purposes.

Changelog: [Internal]

Reviewed By: sammy-SC

Differential Revision: D34050884

fbshipit-source-id: 489fc1052fec9f71712ea729121ac8ef3e3f3d4e
2022-02-08 08:41:35 -08:00
Xin Chen 97ce240a27 Update RedBoxDialog to separate content view and dialog
Summary:
This diff separates the content view creation logic from existing `RedBoxDialog` logic. After the change, `RedBoxDialog` is no longer a subclass of `Dialog`, but behaves like a dialog with forwarding pattern to delegate dialog API to internal member. This will keep the APIs consistent with dependent components.

The motivation of the change is to make the content view reusable. This is important in VR surface where we don't have activities and necessary implementations for Dialog to show.

Changelog:
[Android][Internal]

Reviewed By: javache

Differential Revision: D34016503

fbshipit-source-id: 261594bda9f6fb2d83764a1e5ec2e9e60d8d39a3
2022-02-07 15:31:15 -08:00
Xin Chen 99890bfacf Move RedBoxHandler interface to the proper interfaces directory
Summary:
We put the `:interfaces` target on the dependencies list for `:devsupport` target in the [BUCK file](https://fburl.com/code/lrr1c0pn). In the following diffs I will need to put the interface [`/devsupport/RedBoxHandler`](https://fburl.com/code/v53euvps) on to [`/devsupport/interfaces/DevSupportManager`](https://fburl.com/code/k8gwxa0f). This violates the dependency rule.

Since `RedBoxHandler` is an interface, I moved it to the interfaces list in this diff to unblock.

Changelog:
[Android][Internal]

Reviewed By: yungsters

Differential Revision: D33987834

fbshipit-source-id: 77a1ee14bd10c6bbaac2ee465ae7050e99ed0399
2022-02-07 13:43:49 -08:00
Samuel Susla 731429ebcf Enable RuntimeScheduler::callExpiredTasks on Android
Summary:
changelog: [internal]

In order to call `RuntimeScheduler::callExpiredTasks`, we need to pass it to `Scheduler` through context container.

Reviewed By: javache

Differential Revision: D34042293

fbshipit-source-id: 62d18507fb107c5be2ac9d003f63735aab6a09ac
2022-02-07 10:06:08 -08:00
Genki Kondo be260b9f47 Fix ScrollView contentOffset
Summary:
When setting ScrollView's contentOffset, if the ScrollView hasn't been laid out yet when ReactScrollViewManager.setContentOffset is called, then scroll position is never set properly. This is because the actual scroll offset (0, 0) was being passed into setPendingContentOffsets, instead of the desired scroll offset. Thus,
when ReactScrollView.onLayout gets called, ReactScrollView.scrollTo gets called with (0, 0).

Also updates out of date comments,

Changelog:
[Android][Fixed] - Fix ScrollView contentOffset

Reviewed By: ryancat

Differential Revision: D34015853

fbshipit-source-id: 84141a663fdb0ace2be7cef61f14944cb08125d1
2022-02-04 16:28:54 -08:00
David Vacca 7cc7e66564 Update javadoc of ReactRoot.getState()
Summary:
Update javadoc of ReactRoot.getState() since the task was fixed and the API remained the same

changelog: [internal] internal

Reviewed By: javache

Differential Revision: D33981298

fbshipit-source-id: 0136a640b884a787b0a20162781735630c1fa1c7
2022-02-04 10:34:52 -08:00
Samuel Susla 4cbcb7a13a Abandon mc react_fabric.enable_event_emitter_wrapper_raw_pointer
Summary:
changelog: [internal]

Remove gating.

Reviewed By: philIip

Differential Revision: D33944220

fbshipit-source-id: bba076a2166f8d676119d5c069a3894e3d547285
2022-02-03 04:50:04 -08:00
Genki Kondo 08faa130dd Delete ReactFeatureFlags.enableRoundedCornerPostprocessing
Summary:
Rounded corner postprocessing has been disabled for 2 months now, and [metrics neutral](https://www.internalfb.com/intern/qe2/react_fabric_marketplace_home_android_universe/react_fabric_disable_rounded_corner_postprocess_android/setup/config). Removing the flag and associated codepaths.

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D33953645

fbshipit-source-id: b0e5a6068114d74292f17450a22816f19cae6f15
2022-02-02 15:55:54 -08:00
John Porto 1bf84a63d8 Make automatic SampleProfiling registration optional.
Summary:
This change makes automatic sample profiling registration opt in. This is in preparation for an upcoming change where hermes
will enforce that the sampling profiler must be destroyed on
the same thread it was created.

Changelog: [internal]

Reviewed By: sammy-SC

Differential Revision: D33826992

fbshipit-source-id: 89843b5fc5b936f674a8d0a470e92af0cd8f6125
2022-02-02 10:52:56 -08:00
Andrei Shikov 65df2f30a5 Support view allocation counters with Venice
Summary:
Venice uses `SurfaceHandler` abstraction which start/stops surfaces independently from `Binding.cpp`, so previous `onSurfaceStart/Stop` callback would not be triggered.

On Android, each surface is used exactly once at the time of writing, so we can use `register/unregister` callbacks to create/clear remembered views for the surface.

Changelog: [Internal]

Reviewed By: sammy-SC

Differential Revision: D33845685

fbshipit-source-id: 8de4204c7498176fdbe8d44fbc5f2e4079212a1c
2022-02-02 09:17:56 -08:00
Genki Kondo cb42049e0a Support platform color with AnimatedColor on Android
Summary:
Adds support for platform colors in AnimatedColor.
Passes the processed native color object to the native ColorAnimatedNode via the native config; ColorAnimatedNode then uses ColorPropConverter.getColor to resolve the resource path.

Note: setting a platform color via setValue on an existing AnimatedColor is not supported yet

Changelog:
[Android][Added] - Support platform color with AnimatedColor

Reviewed By: yungsters

Differential Revision: D33922266

fbshipit-source-id: 04d39a5ce0872b31d06ffbd4639d2f2213cf3314
2022-02-01 16:12:30 -08:00
Felipe Perez 3552ff0562 Back out "Delete RuntimeScheduler yielding mobile config"
Summary:
D33740360 (https://github.com/facebook/react-native/commit/16ed62a850dd81bd9cc7f77ab3e77f42ed64b177) broke Explore VR on React Native. The app would go into a loop on boot and not finish mounting. This is probably a product code issue, but it's not a trivial issue to solve. Unlanding to unblock the RN migration.

Changelog:

[internal] internal

Reviewed By: mdvacca

Differential Revision: D33918026

fbshipit-source-id: cc77c70ece9994d82c91f7ae8783e959629e9cfb
2022-02-01 15:17:14 -08:00
Pieter De Baets 79975d146e Fix display metric used for scrollview snapping
Summary:
Similarly to D29864944 (https://github.com/facebook/react-native/commit/6d4fff2e5ccaffb6b0255a139f2ae8e009278948) we want to use `getWindowDisplayMetrics` instead of `getScreenDisplayMetrics`.

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D33916223

fbshipit-source-id: cae07b1f0c1498745f28d0b9f860edcc55bde5ed
2022-02-01 10:58:25 -08:00
Keshav Kolur 554b35daf4 Revert D33852709: Replace fb_xplat_platform_specific_rule calls where rule = fb_java_library with direct call to fb_java_library_android
Differential Revision:
D33852709 (https://github.com/facebook/react-native/commit/dc507be4d9a9d3edce4b2a0b2b7a0cbbcd0cffd0)

Original commit changeset: 1ff3a1225e68

Original Phabricator Diff: D33852709 (https://github.com/facebook/react-native/commit/dc507be4d9a9d3edce4b2a0b2b7a0cbbcd0cffd0)

fbshipit-source-id: 10db2d1bda1ea69b9a0226041493af06b78c16c4
2022-01-31 14:15:36 -08:00
Keshav Kolur dc507be4d9 Replace fb_xplat_platform_specific_rule calls where rule = fb_java_library with direct call to fb_java_library_android
Summary: Replace fb_xplat_platform_specific_rule calls where rule = fb_java_library with direct call to fb_java_library_android

Reviewed By: alexmalyshev

Differential Revision: D33852709

fbshipit-source-id: 1ff3a1225e681d0924ec04e955b0039724182b1c
2022-01-31 13:41:23 -08:00
Kuba Holuj 50c8e973f0 Update StatusBar for Android 11+ (#32975)
Summary:
Android 11 (API 30) introduced a new interface for changing the appearance of the status bars with [`WindowInsetsController#setSystemBarsAppearance`](https://developer.android.com/reference/kotlin/android/view/WindowInsetsController#setsystembarsappearance) and deprecated using the `WindowManager#systemUiVisibility` properties.

Apparently, once you call `setSystemBarsAppearance` Android will no longer respect `systemUiVisibility` and if anyone, such as the Android 12 Splash Screen library, happens to call it, it will break status bars.

This PR augments the RN StatusBarModule to use the new interface on Android 11+.

Also updated the rn-tester app, see video.

https://user-images.githubusercontent.com/1124321/151321561-8202e237-cf7d-45ce-b957-18b5bafd17c4.mov

## 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] [Changed] - Use new StatusBar API on Android 11 (API 30)+

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

Reviewed By: cortinico

Differential Revision: D33814853

Pulled By: ShikaSD

fbshipit-source-id: c0f2651015dddb4871a3e3b26642f76a46da2a76
2022-01-31 11:32:51 -08:00
Elias Nahum 6239e2f5ce Android: Fix crash when WindowInsets is null on ReactRootView (#32989)
Summary:
Fixes a potential crash was introduced by https://github.com/facebook/react-native/issues/30919 that aimed to get the keyboard height on devices with a Notch. The problem is that it considers that any ReactRootView will have an insets available.

When using [react-native-navigation](https://github.com/wix/react-native-navigation) and assigning a Navigation button to the TopBar as a component, the component gets registered as a RootView but won't have any insets attach to the view.

[getRootWindowInsets()](https://developer.android.com/reference/android/view/View#getRootWindowInsets()) in fact return a `WindowInset` only available if the view is attached, so when executing `checkForKeyboardEvents` method from ReactRootView, is trying to access the `DisplayCutout` of a null object, leading to a crash.

## Changelog

[Android] [Fixed] - Fix potential crash if ReactRootView does not have insets attached.

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

Test Plan:
Without the code change: Notice how the second screen being push contains a React Component on the top right of the navigation bar, and when component is unmounted (going back) the app crashes.

https://user-images.githubusercontent.com/6757047/151558235-39b9a8b5-be73-4c31-8053-02ce188637b8.mp4

crash log
```
2022-01-28 10:27:52.902 15600-15600/com.mattermost.rnbeta E/AndroidRuntime: FATAL EXCEPTION: main
    Process: com.mattermost.rnbeta, PID: 15600
    java.lang.NullPointerException: Attempt to invoke virtual method 'android.view.DisplayCutout android.view.WindowInsets.getDisplayCutout()' on a null object reference
        at com.facebook.react.ReactRootView$CustomGlobalLayoutListener.checkForKeyboardEvents(ReactRootView.java:778)
        at com.facebook.react.ReactRootView$CustomGlobalLayoutListener.onGlobalLayout(ReactRootView.java:769)
        at android.view.ViewTreeObserver.dispatchOnGlobalLayout(ViewTreeObserver.java:1061)
        at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:3214)
        at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:2143)
        at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:8665)
        at android.view.Choreographer$CallbackRecord.run(Choreographer.java:1037)
        at android.view.Choreographer.doCallbacks(Choreographer.java:845)
        at android.view.Choreographer.doFrame(Choreographer.java:780)
        at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:1022)
        at android.os.Handler.handleCallback(Handler.java:938)
        at android.os.Handler.dispatchMessage(Handler.java:99)
        at android.os.Looper.loopOnce(Looper.java:201)
        at android.os.Looper.loop(Looper.java:288)
        at android.app.ActivityThread.main(ActivityThread.java:7839)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1003)
```

After applying the patch which is only a null check validation and does not change any previous behavior

https://user-images.githubusercontent.com/6757047/151558429-9ff1a608-abb6-4168-8db9-df0c3c71d79e.mp4

Reviewed By: cortinico

Differential Revision: D33844955

Pulled By: ShikaSD

fbshipit-source-id: ed5579ad3afeed009c61cc1851eee45c70087cf5
2022-01-31 07:58:28 -08:00
Genki Kondo 3f49e6763e Support color animation with native driver for Android
Summary:
Adds support for Animated.Color with native driver for Android. Reads the native config for the rbga channel AnimatedNodes, and on update(), converts the values into an integer (0xaarrggbb)

Followup changes will include support for iOS and platform colors.

Changelog:
[Android][Added] - Support running animations with AnimatedColor with native driver

Reviewed By: javache

Differential Revision: D33833600

fbshipit-source-id: 2bf05c9715b603cf014ace09e9308b2bfd67f30a
2022-01-29 13:51:41 -08:00
Paige Sun 79ae50f3e9 Remove Static View Configs from bridge mode
Summary:
Changelog: [Internal]

Remove all the MCs that enable SVCs in Fabric, because we'll only test SVCs in Bridgeless mode to simplify rollout. There were complications with enabling SVCs in Fabric at a previous rollout.

Reviewed By: RSNara

Differential Revision: D33861243

fbshipit-source-id: fdbfedce77f8bd1bab2a807237017787ae8bf7c1
2022-01-28 23:39:38 -08:00
Paige Sun b4b5c59645 Add ComponentNameResolverManager to make UIManager.hasViewManagerConfig() work on Venice
Summary: Changelog: [Internal]

Reviewed By: RSNara

Differential Revision: D33860658

fbshipit-source-id: 41079b13acef531877c82dc0b2063dbe2b42edcf
2022-01-28 18:46:04 -08:00
David Vacca 34dcbfb8d9 Ship ReactFeatureFlags.enableScrollViewSnapToAlignmentProp
Summary:
This diff ships ReactFeatureFlags.enableScrollViewSnapToAlignmentProp, QE showed neutral metrics in fb4a

changelog: [internal] internal

Reviewed By: philIip

Differential Revision: D33781627

fbshipit-source-id: d4e52d8bdf1acb4904e92f13b7d721582d140ba3
2022-01-27 17:03:26 -08:00
David Vacca 11b7443afb Delete ReactFeatureFlags.enableReactContextCleanupFix
Summary:
This diff deletes the flag ReactFeatureFlags.enableReactContextCleanupFix, the flag was disabled for many months, I just disable it.

changelog: [internal] internal

Reviewed By: genkikondo, makovkastar

Differential Revision: D33781628

fbshipit-source-id: 4b5e22adf9d30da5b85bbbde8bdc98d98f5e8891
2022-01-27 17:03:26 -08:00
David Vacca 9abcea7e11 Delete enableFabricInLogBox flag
Summary:
This diff deletes the ReactFeatureFlag enableFabricInLogBox, from now on Logbox will be rendered in Fabric when Fabric is enabled

changelog: [internal] internal

Reviewed By: genkikondo

Differential Revision: D33781626

fbshipit-source-id: 3187a22fec80125afd27860995637564640dab8d
2022-01-27 17:03:25 -08:00
Xin Chen 67355f6c74 Update PointerEvents static method to reduce duplication
Summary:
This diff updated `PointerEvents` enum to reduce duplication for null checks on pointer events string.

Changelog: [Internal]

Reviewed By: javache

Differential Revision: D33717223

fbshipit-source-id: ff542a05240393416d85651ca08cd55136eb79a4
2022-01-27 11:17:55 -08:00
Xin Chen 45244ebce2 Fix TouchTargetHelper to correctly use the overflowInset information
Summary:
The overflowInset uses negative values to indicate extending from parent view. This diff fixes the math so that it's correctly check if the point is within overflowInset.

Changelog
[Android][Fixed] - Fix math for detecting if children views are in parent's overflowInset area.

Reviewed By: genkikondo

Differential Revision: D33750129

fbshipit-source-id: 1a5a33a227280c687b158b4a81a56017b6f4f3e0
2022-01-26 19:23:13 -08:00
Samuel Susla 16ed62a850 Delete RuntimeScheduler yielding mobile config
Summary:
changelog: [internal]

Yielding in RuntimeScheduler is shipped. This diff removes the gating around it.

Reviewed By: sshic

Differential Revision: D33740360

fbshipit-source-id: 267372e81e66dda96e451435954a7c3546cc6fbe
2022-01-26 09:23:08 -08:00
David Vacca 93677cecde Ship eager initialization of mapbuffer
Summary:
Ship eager initialization of mapbuffer

changelog: [internal] internal

Reviewed By: ShikaSD

Differential Revision: D33754255

fbshipit-source-id: 1b8359b8c9fbc4fc7a155cb73e9147fd5b1f5963
2022-01-25 17:23:30 -08:00
David Vacca 9df02fff6b Eager initialize Fabric in RN VR apps
Summary:
Enable eager intialization of FabricUIManager during intiialization of React Native.
This feature highly improved TTRC in Markeptlace Home

changelog: [internal] internal

Reviewed By: genkikondo

Differential Revision: D33585099

fbshipit-source-id: 0ffbc720bcb1edd1b04180189a52c82e9e2fa800
2022-01-25 17:23:29 -08:00
Xin Chen 48f6967ae8 Add pointerEvents prop to RN Android scroll views
Summary:
Per discussion in the previous diff D33672110, it's ok to add the `pointerEvents` prop to scrollview. This will help prevent scrolling on the ScrollView if pointerEvents is set to `box-none`, or `none`.

Corresponding doc changes are in https://github.com/facebook/react-native-website/pull/2936

Changelog:
[Android][Added] - Add new API in ScrollView and HorizontalScrollView to process pointerEvents prop.

Reviewed By: javache

Differential Revision: D33699223

fbshipit-source-id: 1cae5113e9e7d988fc4c4765c41d817a321804c4
2022-01-21 13:40:09 -08:00
Ramanpreet Nara 0343e697fd Fix NVC for RCTTextInlineImage
Summary:
This diff fixes the Static/Native ViewConfigs for RCTTextInlineImage.

Changelog: [Internal]

Reviewed By: p-sun, sshic

Differential Revision: D33674127

fbshipit-source-id: 8cf5ffeaca635b4afd30c437dc0f87ea1fdc15a8
2022-01-20 13:52:03 -08:00
Ramanpreet Nara 26d05d8dd7 Fix SVC for RCTModalHostView
Summary:
Making the native ViewConfig for RCTModalHostView match its static ViewConfig.

Changelog: [Internal]

Reviewed By: JoshuaGross

Differential Revision: D33303419

fbshipit-source-id: 6fac237d670ee221ad867f79e54d5a3576c156da
2022-01-20 13:52:03 -08:00
Andrei Shikov adb2167640 Serialize and assert type information in mapbuffer
Summary:
Serializes type information along with key/value in MapBuffer, asserting the data type on Java side during read. At the moment, accessing value with incorrect will result in a crash.

Other changes:
Adds a `getType` method to verify types before accessing them.
Removes `null` as a type, as just not inserting value and checking for its existence with `hasKey` is more optimal.

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D33656841

fbshipit-source-id: 23a78daa0d84704aab141088b5dfe881e9609472
2022-01-20 12:57:22 -08:00
Janic Duplessis 3a07dcf81e Allow passing ReadableNativeMap/Array to push/put methods (#32910)
Summary:
This allow adding ReadableNativeArray/Map to a WritableNativeArray/Map. There is no reason why this can't be allowed, the types were actually updated in https://github.com/facebook/react-native/commit/1a2937151b8d36e8741ef9d4fbe7d2ebf65cb775#diff-d1dc45892b3ba242aed9a1bf7219d2838fae8c7a654c402ba70bc4b100149624, but the assertion remains.

## 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] [Added] - Allow passing ReadableNativeMap/Array to push/put methods

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

Test Plan: Tested that RN tester builds and run correctly on android.

Reviewed By: christophpurrer

Differential Revision: D33646510

Pulled By: yungsters

fbshipit-source-id: 878f1994b73ed1cf830966ab296b9c0325630da1
2022-01-19 11:17:00 -08:00
Sam Kline c8d823b9bd Reset ReactInstanceManager state on failure to allow retries (#32901)
Summary:
This fixes https://github.com/facebook/react-native/issues/32898 by reseting ReactInstanceManager state when `createReactContext` throws. By resetting the state, we allow future attempts at creating the React context.

## Changelog

[Android] [Fixed] - Fixed empty screen after retrying a BundleDownloader failure in dev mode

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

Test Plan: Go through the steps to reproduce listed in https://github.com/facebook/react-native/issues/32898 and see that the React Native application starts.

Reviewed By: cortinico

Differential Revision: D33634178

Pulled By: ShikaSD

fbshipit-source-id: e54d12d5f33c9c7c0ca213113871b88c2f1dc261
2022-01-19 05:06:18 -08:00
Andrei Shikov b173bf3c0e Minor MapBuffer renames for consistency
Summary:
Rename `_header` to `header_` to align with the C++ naming scheme we use.
Rename `readKey` to `readUnsignedShort` as purpose of the method have changed.

Changelog: [Internal]

Reviewed By: javache

Differential Revision: D33637127

fbshipit-source-id: a82f4d6c1b753b21e0567fbe919af98e4c78105d
2022-01-18 18:00:07 -08:00
Joshua Gross 2151d11527 Fix T110060790
Summary:
In the case of T110060790, there is a JavaScript crash that causes RN teardown to race with a ScrollView event being emitted, which ends up being reported as the "real" cause of the crash.

This is not correct, and it's better to just ignore this case. If there's no EventDispatcher, it means something has gone wrong (usually teardown) before, RN is in an inconsistent state, and we should
not crash here or report here.

Changelog: [Android][Fixed] Fix crash from ScrollView that occurs while reporting an error from JS

Reviewed By: mdvacca

Differential Revision: D33644692

fbshipit-source-id: 41c3defde795b804239cc8401c8aff71d017d59d
2022-01-18 16:15:37 -08:00
Pieter De Baets 08e76772fe Avoid repeated value read in SubtractionAnimatedNode
Summary:
Minor optimization, but spotted this while reviewing the implementation for D33622997

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D33622996

fbshipit-source-id: 8712753803fc46e6a046d50f77454a813e4a641a
2022-01-18 13:53:43 -08:00
Pieter De Baets b2105711a0 Support Animated.event extracting values from array
Summary:
`onPointerMove` events get dispatched with an `offset: [x, y]` attribute (API is not yet available in OSS, so subject to change), but `EventAnimationDriver` in RN Android is not able to extract values with such keys (even though the equivalent JS implementation does allow it).

(TODO: verify iOS behaviour)

Changelog:
[General][Added] - Animated.event can be used to extract values with numeric keys from native events

Reviewed By: mdvacca

Differential Revision: D32531117

fbshipit-source-id: 918a5443c5d8f5f8200d86bb67f84e8bc175c1d3
2022-01-18 13:53:43 -08:00
Andrei Shikov a054379a54 Remove short conversions in MapBuffer
Summary:
MapBuffer uses unsigned short in C++, but Java doesn't really have a type that represents that. That means that MapBuffer would be limited to max 32768 values instead of 65536, which doesn't make much sense as a limitation.
Considering weird (and usually not performant) handling of short values in Java in general, this change replaces them with ints, converting keys from short when needed with `key & 0xFFFF`.

Changelog: [Internal]

Reviewed By: javache

Differential Revision: D33595308

fbshipit-source-id: a7adde8a207bb4aa1d81d367ab5d7b41ace2e291
2022-01-17 11:13:15 -08:00
Andrei Shikov ead669524e Check if the allocated views set for exists for surface on mount
Summary:
Adds a check to verify that we are not trying to insert a new view id into a non-existent set.

Changelog: [Internal]

Reviewed By: sammy-SC

Differential Revision: D33621031

fbshipit-source-id: 8468af69bea250a70d656789ea819c39b55a9de6
2022-01-17 06:32:37 -08:00
Ramanpreet Nara 28f5abc717 Fix NVC for RCTSlider
Summary:
## Android Failures
```
LOG  SVC RCTSlider Invalid
 LOG  {
  "missing": {
    "directEventTypes": {
      "topSlidingComplete": {
        "registrationName": "onSlidingComplete"
      }
    }
  },
  "unexpected": {
    "bubblingEventTypes": {
      "paperValueChange": {
        "phasedRegistrationNames": {
          "captured": "onValueChangeCapture",
          "bubbled": "onValueChange"
        }
      },
      "topValueChange": {
        "phasedRegistrationNames": {
          "captured": "onValueChangeCapture",
          "bubbled": "onValueChange"
        }
      }
    },
    "directEventTypes": {
      "paperSlidingComplete": {
        "registrationName": "onSlidingComplete"
      }
    },
    "validAttributes": {
      "disabled": true,
      "maximumTrackImage": {
        "process": "[Function resolveAssetSource]"
      },
      "minimumTrackImage": {
        "process": "[Function resolveAssetSource]"
      },
      "thumbImage": {
        "process": "[Function resolveAssetSource]"
      },
      "trackImage": {
        "process": "[Function resolveAssetSource]"
      }
    }
  },
  "unequal": {}
}
```

## iOS Failures
```
 LOG  SVC RCTSlider Invalid
 LOG  {
  "missing": {},
  "unexpected": {
    "bubblingEventTypes": {
      "paperValueChange": {
        "phasedRegistrationNames": {
          "captured": "onValueChangeCapture",
          "bubbled": "onValueChange"
        }
      }
    },
    "directEventTypes": {
      "paperSlidingComplete": {
        "registrationName": "onSlidingComplete"
      }
    },
    "validAttributes": {
      "enabled": true
    }
  },
  "unequal": []
}
```

Reviewed By: yungsters

Differential Revision: D33409401

fbshipit-source-id: 519b6e35246e6671dbea1f374435d92937d96c1d
2022-01-14 16:31:50 -08:00
Andrei Shikov f33892081a Cleanup ReadableMapBuffer
Summary:
Cleans up `ReadableMapBuffer` APIs and migrates to use `std::vector` instead of raw pointer array.

Also uses `fbjni` utility to allocate the bytes instead of making manual JNI calls.

Changelog: [Internal]

Reviewed By: sammy-SC

Differential Revision: D33513027

fbshipit-source-id: afe7d320d12830503de4c9994117d849f0b25245
2022-01-12 08:13:32 -08:00
grgr-dkrk 36037fa81b feat: add accessibilityLabelledBy props (#32470)
Summary:
related: https://github.com/facebook/react-native/issues/30846, https://github.com/facebook/react-native/issues/26739

Added `accessibilityLabelledBy` props to find the nativeID of the associated label, it mainly for` <TextInput> `.

The reason for implementing it as `labelledBy` instead of `labelFor` is as follows.
- It was difficult to find a component with `labelFor` because the `<Text>` component does not add the `labelFor` received from her Props to the View's tag.
- The use case looks like the HTML `aria-labelledby`, which is intuitive for web developers. It also seems easy to convert to a web platform.

## 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] [Added] - add `accessibilityLabelledBy` props

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

Test Plan:
I checked it with RNTester using an Android11.

https://user-images.githubusercontent.com/40130327/138666856-891d9f4d-52cf-4181-a81f-13b033037db4.mp4

Reviewed By: lunaleaps, kacieb

Differential Revision: D31897112

Pulled By: ShikaSD

fbshipit-source-id: 66361735679560c01834b3a4483adf264098b3e3
2022-01-11 06:51:39 -08:00
Ramanpreet Nara ae6a84e70d Fix NVC for AndroidProgressBar
Summary: Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D33341772

fbshipit-source-id: eddd344135e6deed60c21eb838a244753e2204b5
2022-01-11 00:24:41 -08:00