Commit Graph

296 Commits

Author SHA1 Message Date
Joshua Gross 95cab24a6e LayoutAnimations: assert that tag >0 instead of != 0
Summary:
LayoutAnimations: assert that tag >0 instead of != 0. It's possible that a corrupt tag value would be below zero which is not valid.

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D26271515

fbshipit-source-id: a62445ad29d60e5180e62ec4c6d5b08784655808
2021-02-05 00:57:42 -08:00
Joshua Gross 1c2a95d6c6 LayoutAnimations: when setting up animation start/final ShadowViews, ensure props are not null
Summary:
LayoutAnimations: when setting up animation start/final ShadowViews, ensure props are not null

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D26271510

fbshipit-source-id: 8d99ba8272fb63103a8d85bb0e14d02256a6d74d
2021-02-05 00:57:41 -08:00
Joshua Gross cc9a3e27c2 LayoutAnimations: ensure that interpolated props are never null
Summary:
ensure that interpolated props are never null

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D26271516

fbshipit-source-id: d012e530e92dabce1e0a7df8edf670e90367a892
2021-02-05 00:57:41 -08:00
Joshua Gross f0a599a112 LayoutAnimations: in createInterpolatedShadowView, ensure that props are never null
Summary:
props should never be null

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D26271513

fbshipit-source-id: 126f4e11f0f0f4e4c911e445fa8f6632a1c77cf2
2021-02-05 00:57:41 -08:00
Joshua Gross 87fe643a2f LayoutAnimations: ensure that we always have a valid ComponentDescriptor
Summary:
We should always be able to reference a ComponentDescriptor. If there are any valid cases where the ComponentDescriptor doesn't exist (?) we need to document those and investigate more.

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D26271511

fbshipit-source-id: 659d160f82f1e78025d3dbe16efa0fa2d072d15f
2021-02-05 00:57:41 -08:00
Joshua Gross 512fd0e0b8 Add asserts to LayoutAnimations to check that ShadowViews are always valid
Summary:
Make sure there's no corruption happening to these ShadowViews.

Changelog: [internal]

Reviewed By: mdvacca

Differential Revision: D26271509

fbshipit-source-id: 01bfa1bfce56e72b48304fe15b6f6426d3b5247e
2021-02-05 00:57:40 -08:00
Sara Valderrama bb796be9e1 fix rounding for translation to android/ios colors
Summary:
Currently, there is a bug with the way that fabric translates float values for color components to hex/int value (which android uses). There are two main problems with the current setup. The first is that we are using 256 as our ratio instead of 255 which is the maximum value for any color component in hex. The second is that we cast the components to ints instead of rounding which truncates the values. We uncovered this with UIQR because our off-by-one color values were incorrectly off a little bit extra for fabric surfaces.

Changelog: [Internal] updates the float-to-int value conversion for color components to be fully accurate

Reviewed By: shergin

Differential Revision: D26161396

fbshipit-source-id: 884e27ffa01b116f9307c00298bb8d888f9f6dd7
2021-02-04 14:18:41 -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
David Vacca 1e6d2e983a Remove strong reference from TM infra
Summary:
This diff refactor strong references on TM infra to use weak references and avoid leaking objects

changelog: [internal] internal

Reviewed By: RSNara

Differential Revision: D26229814

fbshipit-source-id: d4a327dba227378d23764433d5917eb4378a4453
2021-02-03 12:56:17 -08:00
Samuel Susla 177e147335 Add tests for AttributedStringBox
Summary: Changelog: [internal]

Reviewed By: JoshuaGross

Differential Revision: D26168698

fbshipit-source-id: 4416c01a3d4b3721964e2c73e145fb346f45a66a
2021-02-02 14:18:25 -08:00
Samuel Susla 64d9364095 Copy data in updateState instead of moving them
Summary:
Changelog: [internal]

`UpdateState` lambda can be called multiple times because of state auto-repeater. But previously we moved state data into the lambda and then moved it into constructor shared data constructor. If auto-repeater called update state lambda again, the data would be in invalid state.
To fix this, state data has to be copied into shared data constructor.

Background executor was more likely to kick trigger state auto-repeater, that's why the crash was happening in BE experiment.
State-autorepeater was enabled at the end of December. That explains why the crash started appearing in v301 (prior to 301, this crash was not happening).

Reviewed By: JoshuaGross, shergin

Differential Revision: D26173800

fbshipit-source-id: 46d1bae226e607d04d5ba28e6c2a8ec86258593a
2021-02-01 10:17:56 -08:00
Valentin Shergin d6341c4fad Fabric: Using ShadowNodeTraits::Trait::MeasurableYogaNode in ParagraphShadowNode
Summary:
Similarly to D25937710 (https://github.com/facebook/react-native/commit/3d166a0a4c08fdaae9174625d7baba247f84fdea) we are moving away from using imperative methods that dirty Yoga node.

Changelog: [Internal] Fabric-specific internal change.

Reviewed By: sammy-SC

Differential Revision: D26069354

fbshipit-source-id: 3d4e1bd4715a204d90174c7ea29b56438778bfa3
2021-01-31 22:21:51 -08:00
Samuel Susla 67699ba9f2 Fix test setup in attributedString module
Summary:
changelog: [internal]

Tests were not running because of `#ifdef ANDROID` directive.
Tests had leaks and were using asserts instead of `EXPECT_EQ`.

Reviewed By: JoshuaGross

Differential Revision: D26168536

fbshipit-source-id: 453fe06a965c48f54d4bad6fe6653b6f45c39ccd
2021-01-31 15:10:58 -08:00
Samuel Susla dce1863bf9 Put moved from AttributedStringBox into consistent state
Summary:
Changelog: [internal]

Fixes an inconsistency that `AttributedStringBox` can get into.

Example of inconsitency:
After `AttributedStringBox` is moved (move constructor or move assignment operator), moved from `AttributedStringBox` needs to be set into blank state. Its mode needs to be `Value`, `opaquePointer_` should be nullptr and `value_` empty AttributedString. This was not the case before as the default move constructor and operator would leave `mode_` as `OpaquePointer` but ivar representing opaquePointer would be nullptr.

Reviewed By: JoshuaGross

Differential Revision: D26168142

fbshipit-source-id: eed2a7c3a165ae5e1f269822c12042c6ccbd3388
2021-01-31 15:10:58 -08:00
Valentin Shergin 9d4096b296 Fabric: Using SurfaceManager for testing SurfaceHandler infrastructure
Summary:
The diff implements a way to use `SurfaceHandler` without using `SurfaceHandler` directly for testing and transitioning purposes. If a boolean flag is enabled all calls related to surface management will be redirected to an appropriate `SurfaceHandler` via `SurfaceManager`.

Changelog: [Internal] Fabric-specific internal change.

Reviewed By: sammy-SC

Differential Revision: D26125955

fbshipit-source-id: 8760c237d486897ea0c32867c921d445a7f24edc
2021-01-29 17:47:51 -08:00
Valentin Shergin 7a290d1596 Fabric: Introducing SurfaceHandler
Summary:
This implements `SurfaceHandler`, a new primitive for controlling the Surface life-cycle that ensures ownership, preserves state, maintains internal invariants, and simplifies surface manipulation from the application side.

For now, all this is an unused code. The coming diff will introduce an experiment that will route all surfaceId-based APIs to SurfaceHandler-based ones.

Changelog: [Internal] Fabric-specific internal change.

Reviewed By: sammy-SC

Differential Revision: D24290777

fbshipit-source-id: f2ff2b58e6d46e971a548f9f02113a1c783c4940
2021-01-29 07:54:19 -08:00
Samuel Susla 6b1a899ef7 BackgroundExecutor: rename shouldCancel to shouldYield
Summary:
Changelog: [internal]

Name `shouldCancel` is misleading. It implies the commit is cancelled and doesn't happen.
`shouldYield` expresses the intent better, because the commit's changes do eventually reach mounting layer but the current commit is rather yielding to the next one.

Reviewed By: mdvacca

Differential Revision: D26126121

fbshipit-source-id: 18988f217cbc651f0010f6e2381682bdbaed8bd4
2021-01-28 12:40:12 -08:00
Samuel Susla f92cc5ba77 Background Executor: only cancel commit if it is for the same surface
Summary:
Changelog: [internal]

In theory, a commit from different surface could cancel a commit for unrelated surface. Adding surfaceId to cancellation logic assures this doesn't happen.

Reviewed By: shergin

Differential Revision: D26126003

fbshipit-source-id: 15b9b73f1000a2b4ae882e0a5129fe26fbb53fd2
2021-01-28 12:40:11 -08:00
Samuel Susla d5a1bbe64a Background Executor: Move complete root event counting to static variable
Summary:
Changelog: [internal]

This simplifies logic, there is no need to keep the counter as an ivar of UIManager.

Reviewed By: JoshuaGross, shergin

Differential Revision: D26125928

fbshipit-source-id: bd266586463a9f9b85d6dc189cdab19f79e3d107
2021-01-28 12:40:11 -08:00
Samuel Susla fc1f0df465 Introducing: Props forwarding whe cloning shadow node
Summary:
Changelog: [internal]

If ShadowNode has not been mounted, forward rawProps from `sourceShadowNode` to newly cloned shadow node.
This is Android specific change, on iOS the logic should remain unchanged.

Reviewed By: JoshuaGross

Differential Revision: D26049264

fbshipit-source-id: 7c201bc2d4e99eec024065714d2172c5c817153c
2021-01-28 11:21:21 -08:00
Samuel Susla 78df536c78 Call updateMountedFlag in ShadowTree::tryCommit only if commit will go to native
Summary:
Changelog: [internal]

`updateMountedFlag` needs to be called only when new revision will be mounted. In case a commit is throttled, this wasn't the case. Therefore, moving cancellation of commit so it happens before `updateMountedFlag`. We already cancel commits on that place so it should be safe.

Reviewed By: shergin

Differential Revision: D26049262

fbshipit-source-id: e0ecdd2d8f0cdb09d0c0a07ad3931ce77bcf03cf
2021-01-28 04:43:25 -08:00
Valentin Shergin a0ab688216 Fabric: Using UIManagerBinding::getBinding() to access the binding on demand
Summary:
This changes how we access UIManagerBinding in Fabric code. Instead of storing a pointer to it and accessing it, now we just request it from JavaScript runtime on demand. After a week of testing, I hope we will be able to simplify retaining and referencing logic between UIManager and UIManagerBinding. The change is gated just in case to have the ability to turn this new implementation off.

Changelog: [Internal] Fabric-specific internal change.

Reviewed By: sammy-SC

Differential Revision: D26082788

fbshipit-source-id: 211c551fe1aaba9b0bff18478e40e1e1f32e999c
2021-01-26 14:58:23 -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
Valentin Shergin 9e16ac93ed Fabric: Simplifications in UIManagerBinding::completeRoot
Summary:
This is a small simplification of the logic we have in UIManagerBinding choosing the way to call `completeRoot`. It removes an additional check for for `sharedUIManager->backgroundExecutor_` not being empty. We don't need it because it never changes and we already have the same check several lines above.

Changelog: [Internal] Fabric-specific internal change.

Reviewed By: sammy-SC

Differential Revision: D25953674

fbshipit-source-id: 683b3e51a792160d480551a65c40492ce28938e4
2021-01-25 21:57:58 -08:00
Valentin Shergin 9117840f1c Fabric: Removing Scheduler::rootComponentDescriptor_
Summary:
This diff simplifies `ShadowTree` constructor by removing `rootComponentDescriptor` argument. It was previously stored and supplied by `Scheduler`; now `ShadowTree` class allocates one instance of it for all instances of `ShadowTree`. The `RootComponentDescriptor` instance of it is only needed to clone a `RootShadowNode` instance; it cannot issue events, state updates, or anything like that because it does not have React counterpart.

Changelog: [Internal] Fabric-specific internal change.

Reviewed By: JoshuaGross, sammy-SC

Differential Revision: D26048466

fbshipit-source-id: ec02b1b4bcc917efe17cef58112fa870b341c85f
2021-01-25 14:12:14 -08:00
Joshua Gross 82e9cb1b4e Add SurfaceId to ShadowView
Summary:
See title. Not used in this diff; see next diff in stack.

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D26001014

fbshipit-source-id: 475eb265f1c27bd9aff978a49652764a50287e47
2021-01-21 23:47:34 -08:00
Valentin Shergin 6079256fcc Fabric: SchedulerToolbox::commitHooks, a way to pass commit hooks to UIManager via Scheduler API
Summary:
Even though CommitHooks, in general, should be implemented as part of the Core and explicitly registered inside the code, sometimes it's handy to pass specify some additional commit hooks during Scheduler initialization (e.g. hooks that are parts of DevEx tools). Now it's possible.

We will use it soon in Timeline feature.

Changelog: [Internal] Fabric-specific internal change.

Differential Revision: D25920577

fbshipit-source-id: 00f33b7b576c9812afd70c364b5cceb3521da16b
2021-01-19 20:57:55 -08:00
Joshua Gross 9b1f3b16b0 Back out hacks to fix T83141606
Summary:
Original commit changeset: 3ed8e78e31b0

Backing-out D25938851 (https://github.com/facebook/react-native/commit/69b3016171bb2f994dd4a62c34c2c4645b5a7d56) and D25935785 (https://github.com/facebook/react-native/commit/bdea479a1faa0f1f7d7c9d9162212cce94bc9720). Based on analysis documented in T83141606, I believe this issue should be fixed in JS.

Additionally, this crash actually has nothing to do with (un)flattening or the differ; it is a side-effect of stale ShadowNodes being cloned, which I believe is either UB or a contract violation. Either way, it should probably be fixed either in JS, or in node cloning. So this isn't the right solution for this issue and should be reverted.

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D25949569

fbshipit-source-id: 8cf1094a767da98fff4430da60d223412e029545
2021-01-19 00:29:41 -08:00
Joshua Gross 69b3016171 Followup to D25935785: mark more mutation instructions as "recreated"
Summary:
As a follow up to D25935785 (https://github.com/facebook/react-native/commit/bdea479a1faa0f1f7d7c9d9162212cce94bc9720), there are more cases where nodes are "recreated" due to unflattening.

This has no impact anywhere (yet) as far as I'm aware, but could fix the same issues as D25935785 (https://github.com/facebook/react-native/commit/bdea479a1faa0f1f7d7c9d9162212cce94bc9720) (on Android only).

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D25938851

fbshipit-source-id: 3ed8e78e31b0b911e274ecc395a43bc6cb6d5f9d
2021-01-16 23:34:37 -08:00
Valentin Shergin 3d166a0a4c Fabric: Using ShadowNodeTraits::Trait::MeasurableYogaNode in TextInput
Summary:
It is the correct way to deal with the measure function.

I believe it can fix the crash we see with TextInput state update. The crash is probably caused by invalid value of `shadowNodeRawPtr` in `YogaLayoutableShadowNode::yogaNodeCloneCallbackConnector`.
It's hard to reconstruct the full chain of events but I think it's related: Yoga's dirty flag influences cloning, so the improper setting of this flag can misalign "natural" ShadowNode cloning (influenced by changes in the tree) and YGNode-initiated cloning (triggered by layout process).

Changelog: [Internal] Fabric-specific internal change.

Reviewed By: sammy-SC

Differential Revision: D25937710

fbshipit-source-id: a4e7c9dd8f5e6598fc662f4c6ee8061fd795e20d
2021-01-16 15:53:55 -08:00
Valentin Shergin 8684ef499f Fabric: Implementation for ShadowNodeTraits::Trait::MeasurableYogaNode
Summary:
This implements the `MeasurableYogaNode` trait in `YogaLayoutableShadowNode`. We had this trait from the very beginning but never used it. Now, if the trait is specified, `YogaLayoutableShadowNode` will set the measure function for the node and dirty it during cloning.

Previously, we used (and still use) a dedicated method for setting up the measure function - `YogaLayoutableShadowNode::enableMeasurement()`. The problem with it is that to make it work we have to dirty the Yoga node every time we clone it. And the only proper way to do this in the `YogaLayoutableShadowNode` constructor because if we do it later ancestor nodes could not observe this and react to this. Therefore we have to have a trait for it.

The plan is to use it for TextInput first to fix a crash (see the next diff). After we confirm it works fine, we will replace all the usages of `enableMeasurement` with the new trait.

This diff also renames the other two yoga-related traits (to make them less verbose and look unified), adds more comments, and asserts.

Changelog: [Internal] Fabric-specific internal change.

Reviewed By: sammy-SC

Differential Revision: D25937711

fbshipit-source-id: fafbd5d62537ac09e02ffbfd56adab6d629d791d
2021-01-16 15:53:55 -08:00
Joshua Gross bdea479a1f Fix Android crash: mark re-created nodes in Differ
Summary:
Android has some optimizations around view allocation and pre-allocation that, in the case of View Unflattening, can cause "Create" mutations to be skipped.

To make sure that doesn't happen, we add a flag to ShadowViewMutation (in the core) that any platform can consume, that indicates if the mutation is a "recreation" mutation.

It is still a bit unclear why this is needed, in the sense that I would expect props revision to increment if a view is unflattened. However, there is at least one documented reproduction where that is *not* the case. So for now, we'll have a hack pending further investigation.

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D25935785

fbshipit-source-id: 6fb4f0a6dedba0fe46ba3cd558ac1daa70f671f5
2021-01-16 11:05:54 -08:00
Valentin Shergin 16a1fc7b7a Fabric: Introducing ShadowTree::CommitMode
Summary:
CommitMode allows customizing the side-effects of commit operations. In `Suspended` mode, the results of commit operations will not be passed down to a MountingCoordinator which will result in skipping the mounting phase completely.
This is one of the core elements of the Pre-rendering infrastructure.

Changelog: [Internal] Fabric-specific internal change.

Differential Revision: D24290773

fbshipit-source-id: c10ec20d13f3131fc632352ef22f4465c9dfb3c2
2021-01-15 16:23:14 -08:00
Ramanpreet Nara 8fe25fcd5b Remove TurboModuleSchema and clean up JavaTurboModule
Summary:
This concludes the TurboModule JS codegen cleanup.

Changelog: [Internal]

Reviewed By: fkgozali

Differential Revision: D25915167

fbshipit-source-id: 901468fd559a7b3d75b929e9ff1167544e71a2d5
2021-01-14 19:14:23 -08:00
Ramanpreet Nara a156ee9b73 Delete JS TurboModule Codegen Gating
Summary: Changelog: [Internal]

Reviewed By: fkgozali

Differential Revision: D25915171

fbshipit-source-id: b59e21f834a7172055e180eddb9bf15737a6cf0f
2021-01-14 19:14:23 -08:00
Ramanpreet Nara 8ed6659907 Stop forwarding TurboModule schema to TurboModule HostObjects
Summary: Changelog: [Internal]

Reviewed By: fkgozali

Differential Revision: D25915170

fbshipit-source-id: 2b390428c1f582e55cf3ffe8e691f069bf2fd295
2021-01-14 19:14:23 -08:00
Peter Argany a1d626739d Delete iOS10/tvOS10 support from React Native Libraries
Summary:
allow-large-files

Changelog: [iOS] Remove iOS10/tvOS10 suppport

Similar to D19265731 (https://github.com/facebook/react-native/commit/674b591809cd1275b5f1c4d203c2f0ec52303396) for iOS9.

I just ran this command:
`find . -type f -exec sed -i '' 's/{ :ios => "10.0" }/{ :ios => "11.0" }/' {} +`
and then updated pods

Reviewed By: fkgozali

Differential Revision: D25693227

fbshipit-source-id: 0073d57ecbb268c52d21962cef202316857bcbd2
2021-01-11 16:46:16 -08:00
David Vacca 4076293aa1 Fix changes of View visibilities
Summary:
The purpose of this diff is to ensure that visibility changes are handled correctly when the value of "display" for a View changes from 'flex' to 'none'.

RNTester is nesting several Views with different kind of visibilities. When the user tap on an item there's a state update that changes the visibility styles for some of these views. Fabric does not reflect the right changes of visibility on the screen.

changelog: internal

Reviewed By: shergin

Differential Revision: D25841763

fbshipit-source-id: 769b97afb72939d346a4c6f2669ff938b35596bc
2021-01-10 19:46:40 -08:00
Samuel Susla 50f2dd9cce Make layout event asynchronous unbatched
Summary:
Changelog: [internal]

Making "layout" event asynchronous unbatched will bring the behaviour closer to Paper.
Paper puts "layout" event in the event queue from ShadowQueue and schedules a flush of event queue on JavaScript queue.

Before this, Fabric puts "layout" event in the event queue from JavaScript queue, waits until main run loop is about to go to sleep and then schedules a flush of event queue on JavaScript thread.

Now Fabric no longer waits for main run loop to go to sleep but induces a flush of event queue on JavaScript thread right away.

Reviewed By: JoshuaGross, shergin

Differential Revision: D25849468

fbshipit-source-id: 366e99364507f7bc1d09325c04a604bcb2043e3d
2021-01-10 16:21:05 -08:00
Andres Suarez 0f4f917663 Apply clang-format update fixes
Reviewed By: igorsugak

Differential Revision: D25861683

fbshipit-source-id: 616afca13ae64c76421053ce49286035e0687e36
2021-01-09 22:11:00 -08:00
Joshua Gross c15f907f67 Core native implementation of sendAccessibilityEvent in Fabric
Summary:
This is the core (Cxx) Fabric implementation of sendAccessibilityEvent. No platform support is added in this diff (Android and iOS do not build yet).

See following diffs.

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D25852412

fbshipit-source-id: 88b7d8e2e251183dfe7fb377a4cffbac8f458656
2021-01-08 18:10:59 -08:00
Andrew Coates 47bb3be6ce Minor code tweaks to work around a compiler bug in MSVC. (#30696)
Summary:
While pulling in additional react-native code into react-native-windows to support fabric, I hit some bugs with the MSVC compiler.  These minor changes work around those bugs and shouldn't have any functional effect on the code

## Changelog

[Internal] [Fixed] - Minor code tweaks to work around a compiler bug in MSVC.

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

Test Plan: Code compiles in MSVC and clang.

Reviewed By: shergin

Differential Revision: D25830710

Pulled By: appden

fbshipit-source-id: 796bd8191ea62fe62e09dd16cc56b8edc092297f
2021-01-08 13:33:37 -08:00
Samuel Susla deda35134a Make EventQueue a virtual class
Summary:
Changelog: [internal]

EventQueue is used as a virtual class, this diff makes it one.

Reviewed By: JoshuaGross, shergin

Differential Revision: D25826983

fbshipit-source-id: 60e6937514cd3b837b0ca9f61bfaa081823ffc61
2021-01-07 13:42:24 -08:00
Valentin Shergin 934275f931 Fabric: Changeing debouncing logic of onLayout event
Summary:
This changes the way we throttle `onLayout` events in Fabric.

The approach we used before has several issues:
* Every event-dispatching action initiated a lambda scheduled on JavaScript thread (which is a bit inefficient).
* If an event had {0,0,0,0} frame, it might be skipped because this is the default frame value.
* An event was always delivered by the exact block scheduled at the moment of the event initiation (even though some other blocks might be called before). In case of events being initiated rapidly, it can delay actual event delivery and maybe even overwhelm the JavaScript thread.

The new implementation uses a different approach: we maintain the shared storage with recent frame value and use the very first opportunity to deliver it. Alse see comments in the code.

Changelog: [Internal] Fabric-specific internal change.

Reviewed By: sammy-SC

Differential Revision: D25676336

fbshipit-source-id: 275b08990f7c5cf1f05a8f954ebc795a14e10ec2
2021-01-04 15:02:32 -08:00
Vladimir Morozov 8aea93022b Remove dependency on Folly in TurboModuleUtils.h (#30672)
Summary:
The TurboModuleUtils.h includes "folly/Optional.h" which is not used and creates an unnecessary dependency on Folly.
In this PR we remove this unnecessary include.

It is required for the https://github.com/microsoft/react-native-windows/pull/6804 where we add an experimental support for the C++ TurboModules. While the C++ TurboModules use the same JSI and TurboModule code defined in react-native, we provide a layer that let them to work over the ABI-safe Microsoft.ReactNative.dll boundary. The RNW Nuget distribution with DLL files includes a few source files to create native/turbo modules that work through the ABI-safe API. The TurboModuleUtils.h is one of such files. By removing the dependency on Folly we reduce requirements for the native module code. After this PR is merged we will remove the fork of the TurboModuleUtils.h  added in https://github.com/microsoft/react-native-windows/pull/6804.

## Changelog

[Internal] [Fixed] - Remove dependency on Folly in TurboModuleUtils.h

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

Test Plan:
The change does not bring any functional changes. It may only affect code compilation where some code may depend on TurboModuleUtils.h when it needs the "folly/Optional.h". The fix is add the `#include <folly/Optional.h>` there explicitly.

I had run the iOS tests and they passed:
```
yarn
pod install in packages\rn-tester
./scripts/objc-test.sh test
```

Reviewed By: mdvacca

Differential Revision: D25758927

Pulled By: fkgozali

fbshipit-source-id: 347d8f6bc333a3df67095ea0dc7221c818432fab
2021-01-04 12:04:58 -08:00
Samuel Susla 1bafd0086f Remove v1 event coalescing
Summary:
Changelog: [internal]

Old event coalescing isn't used anymore and there haven't been any problems with the new one.

Reviewed By: shergin

Differential Revision: D25701311

fbshipit-source-id: 359f0361edffa22130cfa8322038acdbe26fd599
2021-01-04 04:12:30 -08:00
Rubén Norte e088a4fe9c Add support for UnsafeObject to allow using Flow strict in native modules
Summary:
This new type will be valid in Flow strict mode and can be used by native modules and components to replace `Object`, with the same semantics.

This unblocks the migration of the most modules in the React Native package to Flow strict.

Changelog: [Internal] Add UnsafeObject type compatible with Flow strict mode to use in native modules and components

Reviewed By: RSNara

Differential Revision: D25540631

fbshipit-source-id: 60b80bbc84a53aecc747e3a1799cdf551e1859cd
2021-01-04 03:56:57 -08:00
David Vacca 89beefaefb Setup test infra into mapBuffer project
Summary:
Setup test infra into mapBuffer project

changelog: [internal]

Reviewed By: JoshuaGross

Differential Revision: D25733949

fbshipit-source-id: bcfc89d87e28dc5a6ed28bc6b56893aa6f191e71
2021-01-01 15:45:06 -08:00
Joshua Gross 266108d7d8 LayoutAnimations: use the final view as the baseline for animations, instead of the initial view
Summary:
To ensure that we're not sending old eventEmitters or State objects to the mounting layer, or potentially out-of-date Props objects, base
animated interpolations on the final ShadowNode instead of the initial.

Changelog: [Internal]

Reviewed By: shergin

Differential Revision: D25727481

fbshipit-source-id: 560ae8d25c7cec4c2137e70b4571b762f461edff
2020-12-29 15:54:45 -08:00
Joshua Gross 907b574cf6 LayoutAnimations: change default prop interpolation on Android: set new non-interpolated prop values at beginning of animation, not end
Summary:
In Android, only changed prop values are sent to the mounting layer via folly::dynamic maps. In the LayoutAnimation system, before this, we only sent that
map at the /end/ of the animation for any non-interpolated values (for example, image source is not interpolated so it was not updated until the end of the animation).

However, what we probably expect is that all non-interpolated values change immediately, and interpolated values smoothly transition. This diff makes that change on Android
by using the final RawProps as the /initial/ value that interpolations are stacked on.

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D25727483

fbshipit-source-id: e692d37b9965fedcdf429a81d60b7cb7f0c6abe1
2020-12-29 15:54:45 -08:00