Commit Graph

4671 Commits

Author SHA1 Message Date
Albert Sun b474be6cc8 Back out "Make NativeModules immediately initializable"
Summary:
This caused a few apps to crash on launch.

Changelog: [Android][Fixed] - Crashes due to "Make NativeModules immediately initializable"

Reviewed By: olegbl

Differential Revision: D26278594

fbshipit-source-id: 969a3dc49a843366c4ae6ed19a9233d1e6f39b13
2021-02-05 10:16:25 -08:00
Andrei Shikov 6061b79283 Clear enable_android_surface_clear_after_crash_report and disable_view_operations_after_catalyst_destroy
Summary: Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D26238985

fbshipit-source-id: 5aa1172e73dd6623e2af1acd909e1548e37e8f30
2021-02-05 07:01:10 -08:00
Sidharth Guglani 96bc33a1d7 instance of checks for YogaNodeJniBase
Summary:
Changelog:
[Internal][Yoga] - Added instance of checks in `YogaNodeJNIBase` class to prevent `ClassCastException`s. This was happening for some NT android tests - Mocked Yoga Node object was being passed in the `addChildAt` api

Stack Trace of exception
    java.lang.ClassCastException: com.facebook.yoga.YogaNode$MockitoMock$1408896622 cannot be cast to com.facebook.yoga.YogaNodeJNIBase
	at com.facebook.yoga.YogaNodeJNIBase.addChildAt(YogaNodeJNIBase.java:86)
	at com.facebook.litho.DefaultInternalNode.addChildAt(DefaultInternalNode.java:220)
	at com.facebook.litho.DefaultInternalNode.child(DefaultInternalNode.java:377)
	at com.facebook.litho.DefaultInternalNode.child(DefaultInternalNode.java:360)
	at com.facebook.litho.Column.resolve(Column.java:118)
	at com.facebook.litho.Layout.create(Layout.java:172)

Reviewed By: Andrey-Mishanin

Differential Revision: D26114992

fbshipit-source-id: 774a689609e67f9244b81c6788b62cd61cd96d14
2021-02-05 03:42:50 -08:00
Joshua Gross 5ae8e84dc7 Fix IntBufferMountItem optimization + LayoutAnimation bug
Summary:
The new IntBufferMountItem queueing actually enforces a global ordering of mutation types: CREATEs, then INSERT, then REMOVE, then UPDATE, then DELETE.

See comments for more details. In general this ordering is fine, but if a DELETE animation is in progress and (due to view unflattening) the same view is recreated, the CREATE will be executed and then the in-process DELETE (since conflicting animations get flushed).

To mitigate this, in Binding we detect this and simply remove DELETE operations queued when we detect that we want to CREATE the node. `DELETE...CREATE` is valid but `CREATE...DELETE` in a single frame is not, so this is safe.

This does complicate and add more assumptions to Binding than I would like, but it should unblock us for now.

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D26271299

fbshipit-source-id: 9453fe17b8b541e484a047dc9637674dbdcc8e9a
2021-02-05 00:57:40 -08:00
Valentin Shergin fc24bb4af0 Fabric: Support for setIsJSResponder, all the native changes
Summary:
This is a Fabric-compliant implementation of `JSResponder` feature. To make it work e2e we also need to update FabricRenderer in React repository. But before we can do this, we need to ship the native changes.

Changelog: [Internal] Fabric-specific internal change.

Reviewed By: mdvacca

Differential Revision: D24630027

fbshipit-source-id: 70c30e1250b554d83862956b536714704093072f
2021-02-04 13:16:29 -08:00
Ramanpreet Nara 2bf866e401 Make NativeModules immediately initializable
Summary:
## Problem:
NativeModules can only be initialized after we mark them initializable on the NativeModules thread. This work is scheduled in ReactInstanceManager.setupReactContext(), after we schedule the execution of the JS bundle on the JavaScript thread in ReactInstanceManager.createReactContext():

https://www.internalfb.com/intern/diffusion/FBS/browse/master/xplat/js/react-native-github/ReactAndroid/src/main/java/com/facebook/react/ReactInstanceManager.java?commit=9b58f58b8eb12281567b8d24d6d000e868e61a1f&lines=1256-1257%2C1331%2C1334-1335%2C1333-1334

So, if the timings don't work out, the JavaScript thread could start executing the JS bundle before the NativeModule thread makes all NativeModules initializable. In this case, those NativeModule will just appear to be null in C++/JavaScript.

## Fix
This diff makes all NativeModules initializable immediately after  their ModuleHolder is created. ModuleHolder.markInitializable() simply initializes initializes modules that were eagerly created.

Changelog: [Android][Fixed] - Make NativeModules immediately initializable

Reviewed By: JoshuaGross

Differential Revision: D26233372

fbshipit-source-id: a9223ff093da5b80781169be88e6ec9516c7a29b
2021-02-03 18:42:43 -08:00
Lulu Wu 5d8e75937d Rename "ReactInstanceManagerDevHelper" to "ReactInstanceDevHelper" so it doesn't look like Bridge-specific
Summary: Changelog: [Internal]

Reviewed By: PeteTheHeat

Differential Revision: D26199747

fbshipit-source-id: c6fe7d07e15940d08cc726c6631dd387910b40a0
2021-02-03 14:39:40 -08:00
Ramanpreet Nara 77ba2ad2f2 Delete NewJavaNativeModule
Summary:
`xbgs NewJavaNativeModule` shows this isn't used anywhere.

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D26230382

fbshipit-source-id: daf9501115b1c094d22128144b5ebc29ae39c429
2021-02-03 13:50:05 -08:00
Ramanpreet Nara 13f100f788 Move TurboModuleManager creation into ReactInstanceManager
Summary:
See title.

Changelog: [Android][Changed] - Move TurboModuleManager creation into ReactInstanceManager

Reviewed By: mdvacca

Differential Revision: D26193053

fbshipit-source-id: fe92636f0cb3dca65fa919ac5df8931b693f76c5
2021-02-02 20:50:31 -08:00
Ramanpreet Nara eb7e89e286 Register TurboModuleManagerDelegate builders without JSIModules
Summary:
How does an application register a TurboModuleManagerDelegate with ReactInstanceManager?
1. Call ReactInstanceManagerBuilder.setReactPackageTurboModuleManagerDelegateBuilder(ReactPackageTurboModuleManagerDelegate.Builder)
2. Override ReactNativeHost.getReactPackageTurboModuleManagerDelegateBuilder()

Changelog: [Android][Added] - Introduce API to allow applications to register TurboModuleManagerDelegates with ReactInstanceManager

Reviewed By: mdvacca

Differential Revision: D26193055

fbshipit-source-id: bf82e63e6ab1c0c8f12bada92ac6852c992ec9cb
2021-02-02 20:50:30 -08:00
Ramanpreet Nara 2a1b5193f7 Allow ReactInstanceManager to create TurboModuleManager
Summary:
Previously, owner(TurboModuleManager) used to depend on owner(ReactInstanceManager). Now, owner(ReactInstanceManager) depends on owner(TurboModuleManager).

**Rationale:** This allows ReactInstanceManager to create TurboModuleManager.

## Changes
We moved ReactPackageTurboModuleManagerDelegate to com.facebook.react.

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D26163661

fbshipit-source-id: 3ebff16ef2aa77e20bb55500ed44c9214acb91dd
2021-02-02 20:50:30 -08:00
Joshua Gross b0ec350568 Detect startSurface race-conditions and warn silently
Summary:
Crash in debug, log a warning and continue in production.

Changelog: [Internal]

Differential Revision: D26133167

fbshipit-source-id: 60279363a3e90d592e7ddbde188c13cda89c28c6
2021-01-28 16:22:06 -08:00
Joshua Gross aad423d59e Support RCTModernEventEmitter+RCTEventEmitter in ReactSwitchEvent Event class
Summary:
Support RCTModernEventEmitter+RCTEventEmitter in an Event class(es). This improves perf in Fabric. Migrate any constructor callsites to the new constructor and deprecate the previous one.

Changelog: [Internal]

Reviewed By: PeteTheHeat, mdvacca

Differential Revision: D26056823

fbshipit-source-id: 1d25afb2d4cfd7e539214d4592e361260f98fc56
2021-01-28 14:07:31 -08:00
Joshua Gross 1dcb4cfe7f Support RCTModernEventEmitter+RCTEventEmitter in RefreshEvent Event class
Summary:
Support RCTModernEventEmitter+RCTEventEmitter in an Event class(es). This improves perf in Fabric. Migrate any constructor callsites to the new constructor and deprecate the previous one.

Changelog: [Internal]

Reviewed By: PeteTheHeat, mdvacca

Differential Revision: D26056815

fbshipit-source-id: d0e03a69f84de47385e064c74f0a79c52c61022d
2021-01-28 14:07:31 -08:00
Joshua Gross a8d7c2cd62 Support RCTModernEventEmitter+RCTEventEmitter in PickerItemSelectEvent Event class
Summary:
Support RCTModernEventEmitter+RCTEventEmitter in an Event class(es). This improves perf in Fabric. Migrate any constructor callsites to the new constructor and deprecate the previous one.

Changelog: [Internal]

Reviewed By: PeteTheHeat, mdvacca

Differential Revision: D26056813

fbshipit-source-id: e3b0132fac6335e83ff5b1992424edcb98703803
2021-01-28 14:07:31 -08:00
Joshua Gross f6af7b2a58 Support RCTModernEventEmitter+RCTEventEmitter in ReactSlidingCompleteEvent Event class
Summary:
Support RCTModernEventEmitter+RCTEventEmitter in an Event class(es). This improves perf in Fabric. Migrate any constructor callsites to the new constructor and deprecate the previous one.

Changelog: [Internal]

Reviewed By: PeteTheHeat, mdvacca

Differential Revision: D26056808

fbshipit-source-id: aa7ff9520a6a2470c642f06797757e1c0362abe9
2021-01-28 14:07:31 -08:00
Joshua Gross 6e62100297 Support RCTModernEventEmitter+RCTEventEmitter in ReactContentSizeChangedEvent Event class
Summary:
Support RCTModernEventEmitter+RCTEventEmitter in an Event class(es). This improves perf in Fabric. Migrate any constructor callsites to the new constructor and deprecate the previous one.

Changelog: [Internal]

Reviewed By: PeteTheHeat, mdvacca

Differential Revision: D26056802

fbshipit-source-id: 72eb498673aecce48145c785a4c2a48e0432059d
2021-01-28 14:07:30 -08:00
Joshua Gross e253a6940d Support RCTModernEventEmitter+RCTEventEmitter in TouchEvent Event class
Summary:
Support RCTModernEventEmitter+RCTEventEmitter in an Event class(es). This improves perf in Fabric. Migrate any constructor callsites to the new constructor and deprecate the previous one.

Changelog: [Internal]

Reviewed By: PeteTheHeat, mdvacca

Differential Revision: D26056725

fbshipit-source-id: 771e5dd4cd1aeca3d2afd1a67ee58b9ac21eda79
2021-01-28 14:07:30 -08:00
Joshua Gross db5bc2f766 Support RCTModernEventEmitter+RCTEventEmitter in ShowEvent Event class
Summary:
Support RCTModernEventEmitter+RCTEventEmitter in an Event class(es). This improves perf in Fabric. Migrate any constructor callsites to the new constructor and deprecate the previous one.

Changelog: [Internal]

Reviewed By: PeteTheHeat, mdvacca

Differential Revision: D26056723

fbshipit-source-id: c20183a4a1189f13b15a138968937080888a200b
2021-01-28 14:07:30 -08:00
Joshua Gross 1575e7ffe3 Support RCTModernEventEmitter+RCTEventEmitter in ScrollEvent Event class
Summary:
Support RCTModernEventEmitter+RCTEventEmitter in an Event class(es). This improves perf in Fabric. Migrate any constructor callsites to the new constructor and deprecate the previous one.

Changelog: [Internal]

Reviewed By: PeteTheHeat, mdvacca

Differential Revision: D26056720

fbshipit-source-id: f36a6caf4e748c915b66f66fd9b4cad6826ecacf
2021-01-28 14:07:30 -08:00
Joshua Gross 583d6229c6 Support RCTModernEventEmitter+RCTEventEmitter in RequestCloseEvent Event class
Summary:
Support RCTModernEventEmitter+RCTEventEmitter in an Event class(es). This improves perf in Fabric. Migrate any constructor callsites to the new constructor and deprecate the previous one.

Changelog: [Internal]

Reviewed By: PeteTheHeat, mdvacca

Differential Revision: D26056714

fbshipit-source-id: 215d8e44d7909f30f4a45f57e5d22a32a635d0ba
2021-01-28 14:07:29 -08:00
Joshua Gross 42274b0ba8 Support RCTModernEventEmitter+RCTEventEmitter in ReactTextInputSubmitEditingEvent Event class
Summary:
Support RCTModernEventEmitter+RCTEventEmitter in an Event class(es). This improves perf in Fabric. Migrate any constructor callsites to the new constructor and deprecate the previous one.

Changelog: [Internal]

Reviewed By: PeteTheHeat, mdvacca

Differential Revision: D26056700

fbshipit-source-id: b3452125678ec8770dec9587106b8bf0f2490027
2021-01-28 14:07:29 -08:00
Joshua Gross ae979a14d6 Support RCTModernEventEmitter+RCTEventEmitter in ReactTextInputSelectionEvent Event class
Summary:
Support RCTModernEventEmitter+RCTEventEmitter in an Event class(es). This improves perf in Fabric. Migrate any constructor callsites to the new constructor and deprecate the previous one.

Changelog: [Internal]

Reviewed By: PeteTheHeat, mdvacca

Differential Revision: D26056696

fbshipit-source-id: 50c0f01164e078b0ad32f66dda80c965f731f1fb
2021-01-28 14:07:29 -08:00
Joshua Gross 2b0d69976f Support RCTModernEventEmitter+RCTEventEmitter in ReactTextInputKeyPressEvent Event class
Summary:
Support RCTModernEventEmitter+RCTEventEmitter in an Event class(es). This improves perf in Fabric. Migrate any constructor callsites to the new constructor and deprecate the previous one.

Changelog: [Internal]

Reviewed By: PeteTheHeat, mdvacca

Differential Revision: D26056690

fbshipit-source-id: 208982ca5b53985bd8079c4b206a7eb4bb883494
2021-01-28 14:07:28 -08:00
Joshua Gross 8e2b45fe79 Support RCTModernEventEmitter+RCTEventEmitter in ReactTextInputFocusEvent Event class
Summary:
Support RCTModernEventEmitter+RCTEventEmitter in an Event class(es). This improves perf in Fabric. Migrate any constructor callsites to the new constructor and deprecate the previous one.

Changelog: [Internal]

Reviewed By: PeteTheHeat, mdvacca

Differential Revision: D26056685

fbshipit-source-id: a9abb451e62c9e378b0a5667fa4c5f82952bd02b
2021-01-28 14:07:28 -08:00
Joshua Gross a5a94ce786 Support RCTModernEventEmitter+RCTEventEmitter in ReactTextInputEvent Event class
Summary:
Support RCTModernEventEmitter+RCTEventEmitter in an Event class(es). This improves perf in Fabric. Migrate any constructor callsites to the new constructor and deprecate the previous one.

Changelog: [Internal]

Reviewed By: PeteTheHeat, mdvacca

Differential Revision: D26056680

fbshipit-source-id: 2a57f15c01a585af9ddbe08cf6dd60922d4f64b3
2021-01-28 14:07:28 -08:00
Joshua Gross 346b1f1df4 Support RCTModernEventEmitter+RCTEventEmitter in ReactTextInputEndEditingEvent Event class
Summary:
Support RCTModernEventEmitter+RCTEventEmitter in an Event class(es). This improves perf in Fabric. Migrate any constructor callsites to the new constructor and deprecate the previous one.

Changelog: [Internal]

Reviewed By: PeteTheHeat, mdvacca

Differential Revision: D26056676

fbshipit-source-id: 6baa5d9ba0ef15218ce02cbb51862f18d98b465c
2021-01-28 14:07:28 -08:00
Joshua Gross a01cea10f6 Support RCTModernEventEmitter+RCTEventEmitter in ReactTextInputBlurEvent Event class
Summary:
Support RCTModernEventEmitter+RCTEventEmitter in an Event class(es). This improves perf in Fabric. Migrate any constructor callsites to the new constructor and deprecate the previous one.

Changelog: [Internal]

Reviewed By: PeteTheHeat, mdvacca

Differential Revision: D26056672

fbshipit-source-id: 2f3e4b9bbed339f15b22fe87e27d81af083fd481
2021-01-28 14:07:27 -08:00
Joshua Gross 8569e9933f Support RCTModernEventEmitter+RCTEventEmitter in ReactTextChangedEvent Event class
Summary:
Support RCTModernEventEmitter+RCTEventEmitter in an Event class(es). This improves perf in Fabric. Migrate any constructor callsites to the new constructor and deprecate the previous one.

Changelog: [Internal]

Reviewed By: PeteTheHeat, mdvacca

Differential Revision: D26055276

fbshipit-source-id: f38f9e94ab313fb842d1e3037ab667cd460f1043
2021-01-28 14:07:27 -08:00
Joshua Gross aa9c8abd1a Support RCTModernEventEmitter+RCTEventEmitter in ViewGroupClickEvent Event class
Summary:
Support RCTModernEventEmitter+RCTEventEmitter in an Event class(es). This improves perf in Fabric. Migrate any constructor callsites to the new constructor and deprecate the previous one.

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D26054855

fbshipit-source-id: 9592d854962d53f64d836b8361256cac5c4325df
2021-01-28 14:07:27 -08:00
Joshua Gross 70073664ab Support RCTModernEventEmitter+RCTEventEmitter in OnLayoutEvent Event class
Summary:
Support RCTModernEventEmitter +RCTEventEmitter in an Event class(es). This improves perf in Fabric. Migrate any constructor callsites to the new constructor and deprecate the previous one.

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D26054856

fbshipit-source-id: 228cc08a624e793aff4caf36e1df8285f3b3519d
2021-01-28 14:07:26 -08:00
Joshua Gross 5d2f77553c Support RCTModernEventEmitter+RCTEventEmitter in DrawerClosedEvent, DrawerOpenedEvent, DrawerSlideEvent, DrawerStateChangedEvent Event classes
Summary:
Support RCTModernEventEmitter +RCTEventEmitter in an Event class(es). This improves perf in Fabric. Migrate any constructor callsites to the new constructor and deprecate the previous one.

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D26043861

fbshipit-source-id: 37757508c835cbd1181f0e0e774abc62fdbfee2b
2021-01-28 14:07:26 -08:00
Joshua Gross 46df827c7e Support RCTModernEventEmitter+RCTEventEmitter in ReactAccessibilityDelegate.Anonymous Event class
Summary:
Support RCTModernEventEmitter +RCTEventEmitter in an Event class. This improves perf in Fabric. Migrate any constructor callsites to the new constructor and deprecate the previous one.

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D26043393

fbshipit-source-id: b126658d818a18b7ffb2794de8e59a49c0e3d258
2021-01-28 14:07:26 -08:00
Joshua Gross 72d0ddc16f Refactor Event to encourage and ease migration to RCTModernEventEmitter support
Summary:
The `Event` interface has been improved such that:

1. `getEventData` is now a default method on Event that returns null
2. `dispatch` has a default implementation that relies on getEventName() and getEventData()
3. `dispatchModern` can detect if surfaceId and event data are present; if not, it falls back to dispatch

This will dramatically ease future migrations: at some point in the (distant) future, we can simply delete RCTEventEmitter and
all use-cases will be supported by the current `Event` class without needing to introduce a 3rd transitional interface; and 99%
of all Event classes can be simplified, delet their `dispatch` implementation and need no further work.

At their core, all Events are simply: (1) a name, (2) data, (3) a target (surfaceId and tag). The interface now reflects that but still
allows for flexibility of the data and names being generated on-demand if necessary; but for the vast majority of Event classes, code
will be dramatically simplified.

I also migrate a single Event class, ContentSizeChangeEvent, to use this new method of dispatch.

Changelog: [Android][Changed] Added convenience methods to simplify native Event classes and ease migrations

Reviewed By: mdvacca

Differential Revision: D26043325

fbshipit-source-id: bc308105f7f6e654d45fd156dbf4a2bcbc45819c
2021-01-28 14:07:26 -08:00
Joshua Gross de8aa2c6b9 Try to call setSurfaceId and setId earlier on ReactRootViews
Summary:
We assume that startSurface is always called off the UI thread; see if we can synchronously call setId and setSurfaceId, and in general, call setSurfaceId sooner.

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D26053050

fbshipit-source-id: a657584502bb0018e9591fe610eac0fc9fab2ca9
2021-01-28 14:07:25 -08:00
Valentin Shergin a8fbe7269f Fabric: Setting mountingOverrideDelegate for MountingCoordinator directly
Summary:
Before this change, `mountingOverrideDelegate` was proxied via `Scheduler::startSurface` and `ShadowTree::ShadowTree` constructor down to `MountingCordinator`. Now we set it on the `MountingCoordinator` directly.

Changelog: [Internal] Fabric-specific internal change.

Reviewed By: sammy-SC

Differential Revision: D26049076

fbshipit-source-id: 7f1ecf2c8b6f264a7e59d19881464fe529c53d30
2021-01-26 14:58:22 -08:00
Joshua Gross 4f3b174120 Guard against setId being called on the ReactRootView outside of RN core
Summary:
The RootView being managed by Fabric should have an id of View.NO_ID when it is "handed over" to RN. This is true for Fabric and non-Fabric
and setting a custom id on the ReactRootView has never been supported. I'm temporarily (?) adding an additional check earlier and into ReactRootView to hopefully
catch any of these issues early.

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D26077509

fbshipit-source-id: 59e1ec080504e50698acc654c29120f039238a96
2021-01-26 10:51:28 -08:00
Joshua Gross 335d9d88e1 Fix sendAccessibilityEvent in Fabric
Summary:
This logic got reversed.

Changelog: [internal]

Differential Revision: D26070642

fbshipit-source-id: 4c68e4af25d4907746a09e7a3afe175d88a25f95
2021-01-26 00:50:56 -08:00
Joshua Gross 5792c32e36 Fix race between stopSurface and PreAllocateMountItem
Summary:
There is a race between PreAllocateMountItems executing and killing off stale SurfaceMountingManagers.

For now I'm simplifying the "eviction" mechanism. We just keep up to 15 SurfaceMountingManagers around and start evicting them from the least-recently-referenced one.

Hopefully this logic can be simplified in the future.

I'm also sneaking in a small perf optimization for PreAllocateMountItem: don't queue them if the associated surface is already stopped, because chewing through a bunch of dead PreAllocateMountItems on the UI thread can be expensive.

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D26059378

fbshipit-source-id: 3b2503d7d8e5f045ae741d0d4a5880d1b37758d2
2021-01-25 20:30:38 -08:00
Joshua Gross 47cd7edf14 Fix race between initial updateRootLayoutSpecs and startSurface
Summary:
In some cases, onMeasure/onLayout are called on the RootView before `startSurface` in Fabric has been able to set surfaceId on the RootView.

With the new SurfaceMountingManager, this causes a crash because we need a valid surfaceId to perform an operation. Before the SurfaceMountingManager refactor, a surfaceId of 0 would be passed to `mBinding.setConstraints` in the FabricUIManager, and setConstraints in C++ noops if there's an invalid surfaceId.

For now, FabricUIManager will also fail silently if the surfaceId is invalid when updateRootLayoutSpecs is called, just to be conservative and to be consistent with previous behavior. This will be upgraded to a hard-crash in the future.

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D26051266

fbshipit-source-id: ca2d80f899cdba9b3962af68546bd83b77be0680
2021-01-25 12:53:08 -08:00
generatedunixname89002005325674 d368d11a0f Daily arc lint --take GOOGLEJAVAFORMAT
Reviewed By: zertosh

Differential Revision: D26043994

fbshipit-source-id: 7e49a747e07fb7dcb01c92bba7cb88d9e3266f69
2021-01-25 04:19:55 -08:00
David Vacca 164e133a98 Remove usage of FabricUIManager Module related to NativeDriverAnimations
Summary:
This diff removes references to FabricUIManager from UIManagerModule, these callsited were originally used for NativeAnimatedDriver, but they are not used anymore

changelog: [internal] internal

Reviewed By: JoshuaGross, shergin

Differential Revision: D26035388

fbshipit-source-id: d4825af17f6948d922c42670f2c7b02498c12039
2021-01-25 03:05:33 -08:00
Joshua Gross 5d62b4a19a Rename Event.dispatchV2 -> dispatchModern
Summary:
See title. dispatchV2 was just introduced yesterday, so nothing relies on it yet / it's safe to rename (there are no released versions of RN with `dispatchV2`).

And... dispatchModern is a better name.

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D26039008

fbshipit-source-id: 009ae721b8caef23a389c33b51f6f8952a6a73da
2021-01-24 22:13:11 -08:00
Joshua Gross 595b569ead Fix EventEmitter crash for events that are sent to a stopped surface
Summary:
In SurfaceMountingManager/MountingManager/FabricUIManager infra, we try to blackhole events that are sent to a stopped surface. In this case I just forgot to add a null check. Add here to protect against events sent to stopped surfaces - for example, if a TextInput is focused when the surface is stopped, a "blur" event will be sent and will crash here otherwise. Now it blackholes silently, as expected.

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D26031260

fbshipit-source-id: 9936466ca2d00267efaf7fa594c9bcd59f7aad2a
2021-01-22 19:32:15 -08:00
Joshua Gross ee10932e26 Support RCTModernEventEmitter in for ReactTextInput* Event classes
Summary:
Support RCTEventEmitterV2 in ReactTextInput*Event classes for optimal Fabric perf. Backwards-compatible with non-Fabric renderer.

Changelog: [Changed][Android] Old native ReactTextInput*Event creation APIs have changed, and will be removed in the (distant) future. The old methods will work for now with minor perf implications for Fabric.

Reviewed By: mdvacca

Differential Revision: D26031261

fbshipit-source-id: 7c972ecfd1e395104c4639995bb5ecc5f7c6baae
2021-01-22 19:32:15 -08:00
Joshua Gross ddabf3fd56 Support RCTModernEventEmitter in ImageLoadEvent
Summary:
Support RCTEventEmitterV2 in ImageLoadEvent for optimal Fabric perf. Backwards-compatible with non-Fabric renderer.

Changelog: [Changed][Android] Old native ImageLoadEvent creation APIs have changed, and will be removed in the (distant) future. The old methods will work for now with minor perf implications for Fabric.

Reviewed By: mdvacca

Differential Revision: D26029773

fbshipit-source-id: c8e00e06a2f9d6682367f9099bdf7f5fc12890e0
2021-01-22 19:32:15 -08:00
Joshua Gross 62f0dee235 Migrate ScrollEvent to RCTModernEventEmitter
Summary:
Motivation: perf, simplicity, adhering to new SurfaceMountingManager APIs available to us. Backwards-compatible with events sent through old system or Fabric, to Fabric or non-Fabric Views.

Changelog: [Changed][Android] Old Native method to create ScrollEvent has been deprecated and will be removed at some point in the (distant) future

Reviewed By: mdvacca

Differential Revision: D26027105

fbshipit-source-id: b9dba5b56c2bfed3b8fc4488c54b271b85ab5fa0
2021-01-22 19:32:14 -08:00
Joshua Gross 708038d80e Refactor EventEmitters to take optional surfaceId, migrate TouchEvent
Summary:
Refactor EventEmitters to take an optional SurfaceId that Fabric will use, and non-Fabric will not.

Migrating touches is a good proof-of-concept for how this could be used generally, and as it turns out, TouchEvent's API is more flexible than most other event APIs (because it uses a dictionary to pass data around, so we can just stuff SurfaceId into it - not efficient, but flexible).

All new APIs are backwards-compatible and designed to work with old-style events, with Fabric and non-Fabric. Native Views that migrate to the new API will be backwards-compatible and get an efficiency boost in Fabric.

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D26025135

fbshipit-source-id: 5b418951e9d0a3882f2d67398f2aaadac8a3a556
2021-01-22 19:32:14 -08:00
Joshua Gross 2fbbdbb2ce Create V2 EventEmitter (ModernEventEmitter) interface that surfaceId can be passed into
Summary:
Create V2 EventEmitter that surfaceId can be passed into, with a backwards-compat layer, and some debug-only logging to help assist with migration.

Changelog: [Changed][Android] RCTEventEmitter has been deprecated in favor of RCTModernEventEmitter for optimal Fabric support; RCTEventEmitter will continue to work in Fabric, but there are minor perf implications.

Reviewed By: mdvacca

Differential Revision: D26027104

fbshipit-source-id: 784ca092bbc88d19c82f6c42537c34460d96de86
2021-01-22 19:32:14 -08:00
Joshua Gross 8357b39908 Rename String surfaceID to surfaceName/moduleName, add int surfaceId to ThemedReactContext
Summary:
There's a field called `surfaceID` in a couple of classes that isn't the same as the integer `surfaceId` in Fabric.

For consistency, I've deprecated a couple of them, or renamed when appropriate.

In addition, now we're passing the actual integer surfaceId into the ThemedReactContext. This means that every single View created in Fabric gets annotated with the surfaceId it's in. Currently this isn't used, but the idea is that now each View has a mapping back to its surface, which could be used to simplify / optimize operations with SurfaceMountingManager. In particular, we might be able to use this in the future to optimize animations and/or event emitters.

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D26021571

fbshipit-source-id: b7db7de123db07fa928a6f815be86bdbb030e62c
2021-01-22 19:32:14 -08:00