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

22504 Коммитов

Автор SHA1 Сообщение Дата
David Vacca 25f942757f Migrate Shimmer.ios to use codegenNativeComponent
Summary:
Migrate Shimmer.ios to use codegenNativeComponent

changelog: [internal] internal

Reviewed By: JoshuaGross

Differential Revision: D28117192

fbshipit-source-id: 8edd06184abf29e0c8fe414bc9760d2e0f97c6c8
2021-04-30 17:41:25 -07:00
Ramanpreet Nara e5080e6171 Pull RCTViewRegistry attachment out of TurboModuleManager
Summary:
## Rationale
The TurboModuleManager should only be concerned with modules. The bridge and RCTInstance integrate the TurboModuleManager with the rest of React Native. Therefore, abstractions used by TurboModules that reach into the rest of React Native should be attached by the bridge or by RCTInstance.

## Changes
In this diff, we pull RCTViewRegistry attachment out of the TurboModuleManager. In bridge mode, it'll be attached to TurboModule by the bridge. In bridgeless mode, it'll be attached to TurboModules by the RCTInstance.

Changelog: [Internal]

Reviewed By: PeteTheHeat

Differential Revision: D28086320

fbshipit-source-id: 9d99835bdbb66bb6a41fbd0d8a3970cefae16b81
2021-04-30 16:40:16 -07:00
Peter Argany 8eceee744e Fix Hermes build on folly 2021.04.26.00
Summary:
This fixes multiple compile errors when building RNTester with Hermes enabled:
- `Typedef redefinition with different types ('uint8_t' (aka 'unsigned char') vs 'enum clockid_t')`
- `'event2/event-config.h' file not found`
- tons of missing files (all added to RCT-Folly/Futures)

Changelog: [iOS] Fix Hermes build on folly version 2021.04.26.00
allow-large-files

Reviewed By: RSNara

Differential Revision: D28128087

fbshipit-source-id: ee7cb6fda72d00d22f6182d958aa8ba55939f158
2021-04-30 15:05:22 -07:00
Riley Dulin 7579ed3f6f Implement HeapProfiler.getObjectByHeapObjectId
Summary:
Implement the API for querying the properties of an object found in a
heap snapshot.

Now when you are debugging and take a heap snapshot, you can hover
over an object and inspect it!

Only works for subclasses of JSObject. Doesn't work for stuff like HiddenClass,
PropertyAccessor, native objects like WeakValueMap, etc. Those internal objects
display "Preview is not available" which matches what Chrome prints for its own
internal stuff.

Changelog: [Internal]

Reviewed By: avp

Differential Revision: D27834672

fbshipit-source-id: 607a8984b5a48b76c5ae57f9bd5bf53168f3ec3f
2021-04-30 13:44:02 -07:00
Samuel Susla 2b27323308 Remove unnecessary access to UIKit on main thread in [RCTRedBox dealloc]
Summary:
Changelog: Fix main thread access to UIKit in RCTRedBox

{F611784226}

Xcode's main thread checker complains about this during reload. it is not needed to set `dataSource` and `delegate` to nil because the table view is about to be destroyed.

Reviewed By: mdvacca

Differential Revision: D28089039

fbshipit-source-id: 13b62cafb4790fc15b5a5dde131d4ae64bd97c82
2021-04-30 10:46:35 -07:00
Andrei Shikov 382e90c0dd Batch Animation setValue call in a separate batch
Summary:
NativeAnimationModule on Android is using batches to combine related updates together. In Fabric, this process is controlled by JS, which schedules starts batching when Animated component props are about to be updated.

In rare cases when there's no prop update (like calls to `setValue` on `AnimatedValue`), changes weren't applied until the next batch was scheduled. This change ensures that such changes get applied directly.

This problem doesn't happen on iOS or non-Fabric surfaces, because they use per-frame scheduling instead.

Changelog: [Internal]

Reviewed By: JoshuaGross

Differential Revision: D28100641

fbshipit-source-id: 87b3acb3a8de131cdcb2104dc121d40eccfbc29d
2021-04-30 10:21:36 -07:00
Rubén Norte 80ce3c7fe2 Cache root components with display name to avoid invalidating whole subtree on updates
Summary:
In development, we can specify a debug name to force the whole React tree to have a meaningful name. This is useful for debugging: React DevTools, component stack traces, etc. More context in D26637787 (eeb36f4709).

This worked fine until now because `renderApplication` is never called more than once per React Native root. With pre-rendering, this won't be true as we'll be able to re-render the whole React tree with new props (after navigating to the screen).

The problem with the current implementation is that we generate a new component every time `renderApplication` is called, which makes the React reconciliation consider them different components and discards the whole sub-tree.

This fixes it by caching those components so we always return a component with the same identity (exactly the same function) when we call `renderApplication` repeatedly.

This won't have any effect in production where these components aren't created at all.

Changelog: [Internal]

Reviewed By: ShikaSD

Differential Revision: D28061384

fbshipit-source-id: 95833a5b74bb622896cb47426f74324d8740e5d7
2021-04-30 09:46:14 -07:00
Rubén Norte fdfadd43f2 Simplify logic to coerce DisplayMode
Summary:
Changelog: [Internal]

TSIA

Reviewed By: ShikaSD

Differential Revision: D28061403

fbshipit-source-id: bb98fa2ccdd3f8e936bec95fbbbeace42664a608
2021-04-30 09:46:14 -07:00
Nat Mote 6386f691f7 Deploy Flow v0.150.0
Summary: Changelog: [Internal]

Reviewed By: dsainati1

Differential Revision: D28096358

fbshipit-source-id: 8b947673c32f4af6755954ede78e7708a5801197
2021-04-30 09:13:16 -07:00
Samuel Susla ad2f1caf9a Clean up optimized_hit_testing_ios
Summary:
Changelog: [internal]

Clean up the experiment

Reviewed By: JoshuaGross

Differential Revision: D27996499

fbshipit-source-id: 3c9598846b3800eef86d039580e6a12e7273e798
2021-04-30 06:11:55 -07:00
Rick Hanlon 2482684080 Run sync from CI artifacts
Summary:
Runs an A:A react sync against the current revision to pick up the updates from the sync script.

Changelog: [Internal]

Reviewed By: yungsters, kacieb

Differential Revision: D28103715

fbshipit-source-id: 3593909e999bdceeb95423dc37dc0ee4282963d9
2021-04-29 20:39:28 -07:00
Kevin Gozali f346dd616f iOS new architecture: disallow disabling enforcement when RCT_NEW_ARCHITECTURE is defined
Summary: Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D28080430

fbshipit-source-id: 3e89be8419776c4a6da9dd9e8c6c5501c8f6c304
2021-04-29 19:46:10 -07:00
Xuan Huang c54aeccf1a Reflect Hermes release version from HermesBadge
Summary:
Changelog:
[General] - Reflect Hermes release version from HermesBadge

It was a common footgun that an unexpected version of Hermes
engine is used in a RN app. To help with indicating this from
the runtime, Hermes exposes its OSS release version from
`HermesInternal.getRuntimeProperties()` Starting from 0.8.0.

This diff updates the `HermesBadge` used by `NewAppScreen`
header to reflect the version.

Reviewed By: nadiia

Differential Revision: D24436609

fbshipit-source-id: 8ba45be598a7d5af0e38f5044f9370fc7e1eb9a1
2021-04-29 17:13:29 -07:00
Brian Vaughn 9e020ef476 Update React DevTools to ^4.13.0
Summary:
React DevTools has gotten pretty outdated in React Native. Let's fix that!

Last time I tried this it caused a lot of churn for tools like Flipper, so I approached this in two steps ([detailed in this post](https://fb.workplace.com/groups/rnsyncsquad/permalink/808063140086959/)).

First was a short term plan (as implemented in [PR 21344](https://github.com/facebook/react/pull/21344)) to:
1. Branch and make a patch release of DevTools 4.10 that adds a protocol check to the frontend (to detect any newer backends).
2. Upgrade Flipper (and recommend upgrade for the OSS React Native Debugger as well) to this new frontend.
3. Wait for the updated frontend to roll out.

The short term plan is now done, at least for the internal build of Flipper, and both GitHub PRs to update Flipper and React Native Debugger have been merged.

So this diff moves forward with the longer term plan (implemented in [PR 21331](https://github.com/facebook/react/pull/21331)):
1. Add an explicit version to the protocol used by the DevTools "backend" and "frontend" components to talk to each other.
2. Check this protocol during initialization to ensure it matches.
3. Show upgrade/downgrade instructions if there's a mismatch (or if the check times out without a response– indicating an older backend).
4. Release this as 4.13.

 ---

Changelog:
[General][Changed] - Upgrade `react-devtools-core` from ~4.6.0 to ^4.13.0

Reviewed By: yungsters

Differential Revision: D28103394

fbshipit-source-id: 21114294144bde9aede63cb3ba98a240082299bd
2021-04-29 16:58:36 -07:00
Joshua Gross b44f4dda4f LayoutAnimations: fix mutation ordering hitting assert
Summary:
When REMOVE animations finish, they are hitting asserts in StubViewTree because of UPDATEs and REMOVEs being out-of-order. By simply not forcing REMOVEs to happen before UPDATEs, this problem seems to go away.

Long-term (in a couple weeks, likely) I want to add unit tests to catch all cases like this, but I'm comfortable with this change since it does fix a known assert failure.

Changelog: [Internal]

Differential Revision: D28086223

fbshipit-source-id: eb77ea94d76e996d7b2cb37038ce6f2a9799f8b4
2021-04-29 15:32:09 -07:00
Xuan Huang 2b67631210 Bump Hermes npm to 0.8.0
Summary:
Changelog:
[Breaking][Changed] - Bump Hermes to 0.8.0

allow-large-files

Reviewed By: nadiia

Differential Revision: D28087209

fbshipit-source-id: 2f26901d07ad29093d44e4a71eaa7b7c4ad9afb2
2021-04-29 15:23:57 -07:00
Neal Poole 33ef82ce6d Update validateBaseUrl to use latest regex
Summary:
Updating the regex to avoid a potential regular expression denial-of-service vulnerability.

Changelog: Update validateBaseUrl to use a more robust regular expression. Fixes CVE-2020-1920, GHSL-2020-293

Reviewed By: lunaleaps

Differential Revision: D25507604

fbshipit-source-id: c36a03c456881bc655c861e1a2c5cd41a7127c9d
2021-04-29 14:53:15 -07:00
Peter Argany 36b58a824e Bump Flipper-Folly to 2.5.3 and RCT-Folly to 2021.04.26.00
Summary:
This fixes an error where folly fails to build on Xcode 12.5, by bumping the various folly deps in RN to builds with a fix.

Next step is to commit this to 0.64 release branch

allow-large-files

Changelog: [iOS] Fix builds on Xcode 12.5

Reviewed By: fkgozali

Differential Revision: D28071808

fbshipit-source-id: 236b66bf8294db0c76ff25b11632c1bf89525921
2021-04-29 10:39:25 -07:00
Joshua Gross a249065503 Pass "blockNativeResponder" param to RCTMountingManager
Summary:
From looking at other implementations of setJSResponder, we need the MountingManager to have access to "blocksNativeResponder" param, but do not need to pass that through to individual views (see also Android implementation).

Changelog: [Internal]

Reviewed By: sammy-SC, mdvacca

Differential Revision: D28066257

fbshipit-source-id: e1420431478fd27d2e1463e291a0bbc600d3f0a6
2021-04-29 09:29:45 -07:00
David Vacca 8eeb01686f Ship virtualizedlist remeasure fix
Summary:
This diff ships the virtualizedlist remeasure fix implemented in D27003249 (1bc06f18c6)

For more details about experiment see: https://fb.workplace.com/groups/rn.engineering/permalink/2831770330485832/

changelog: [internal] internal

Reviewed By: JoshuaGross

Differential Revision: D28072308

fbshipit-source-id: c23c958ca9f2991236cb5a5c02084722aa6de919
2021-04-28 20:16:23 -07:00
Ramanpreet Nara 7e05480cc3 Delete @synthesize turboModuleRegistry API in RCTTurboModule
Summary:
All NativeModules/TurboModules can use the following Venice-compatible API instead:
```
synthesize moduleRegistry = _moduleRegistry
```

In bridge mode, it'll look up the module via the TurboModule system/bridge.
In bridgeless mode, it'll look up the module via the TurboModule system.

Therefore, there's no need to support this API.

Changelog: [iOS][Removed] - Delete synthesize turboModuleRegistry API in RCTTurboModule

Reviewed By: fkgozali

Differential Revision: D28070740

fbshipit-source-id: d2c8285fd4c05b67fb03ce82217bf6ddfd1dd685
2021-04-28 16:49:05 -07:00
ananta 2b49664cb8 Add flow types to AccessibilityExample.js (#31384)
Summary:
[AccessibilityExample.js](https://github.com/facebook/react-native/blob/master/packages/rn-tester/js/examples/Accessibility/AccessibilityExample.js) does not have proper Flow types. Without Flow typing enforced, it is easy for bugs to be introduced when making changes to this file. This pull request enforces Flow typing in this file.

## Changelog
[General] [Fixed] - Fixed return type of `AccessibilityRoleAndStateExample`
[General] [Added] - Added Flow Types to AccessibilityExample.js

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

Test Plan:
Before:
![Screen Shot 2021-04-19 at 7 39 58 PM](https://user-images.githubusercontent.com/12180395/115248265-42c6b200-a147-11eb-8dad-058f646a1550.png)

After:
![Screen Shot 2021-04-19 at 7 40 10 PM](https://user-images.githubusercontent.com/12180395/115248284-465a3900-a147-11eb-8bff-4050ce6bd806.png)

Reviewed By: yungsters, nadiia

Differential Revision: D28004170

Pulled By: kacieb

fbshipit-source-id: 77bc44bbaf7a19c034a92a2daef302d5dc6078fa
2021-04-28 15:29:54 -07:00
Samuel Susla c3d765883a Fix frames for in text links
Summary:
Changelog: [internal]

`accessibilityFrame` needs to take scrolling position into account. To fix that, we calculate the position dynamically.

Reviewed By: mdvacca

Differential Revision: D28056789

fbshipit-source-id: 3247b3e6fd64934e99563de83d163f657828e933
2021-04-28 14:50:14 -07:00
Kacie Bawiec c68c151cda React Native sync for revisions a632f7d...2a7bb41
Summary:
This sync includes the following changes:
- **[9a2591681](https://github.com/facebook/react/commit/9a2591681 )**: Fix export //<Sebastian Markbage>//
- **[4a8deb083](https://github.com/facebook/react/commit/4a8deb083 )**: Switch the isPrimaryRender flag based on the stream config ([#21357](https://github.com/facebook/react/pull/21357)) //<Sebastian Markbåge>//
- **[bd4f056a3](https://github.com/facebook/react/commit/bd4f056a3 )**: [Fizz] Implement lazy components and nodes ([#21355](https://github.com/facebook/react/pull/21355)) //<Sebastian Markbåge>//
- **[fc33f12bd](https://github.com/facebook/react/commit/fc33f12bd )**: Remove unstable scheduler/tracing API ([#20037](https://github.com/facebook/react/pull/20037)) //<Brian Vaughn>//
- **[721238394](https://github.com/facebook/react/commit/721238394 )**: Enable strict effects mode for React Native Facebook builds ([#21354](https://github.com/facebook/react/pull/21354)) //<Brian Vaughn>//
- **[48740429b](https://github.com/facebook/react/commit/48740429b )**: Expiration: Do nothing except disable time slicing ([#21345](https://github.com/facebook/react/pull/21345)) //<Andrew Clark>//
- **[0f5ebf366](https://github.com/facebook/react/commit/0f5ebf366 )**: Delete unreferenced type ([#21343](https://github.com/facebook/react/pull/21343)) //<Andrew Clark>//
- **[9cd52b27f](https://github.com/facebook/react/commit/9cd52b27f )**: Restore context after an error happens ([#21341](https://github.com/facebook/react/pull/21341)) //<Sebastian Markbåge>//
- **[ad091759a](https://github.com/facebook/react/commit/ad091759a )**: Revert "Emit reactroot attribute on the first element we discover ([#21154](https://github.com/facebook/react/pull/21154))" ([#21340](https://github.com/facebook/react/pull/21340)) //<Sebastian Markbåge>//
- **[709f94841](https://github.com/facebook/react/commit/709f94841 )**: [Fizz] Add FB specific streaming API and build ([#21337](https://github.com/facebook/react/pull/21337)) //<Sebastian Markbåge>//
- **[e8cdce40d](https://github.com/facebook/react/commit/e8cdce40d )**: Don't flush sync at end of discreteUpdates ([#21327](https://github.com/facebook/react/pull/21327)) //<Andrew Clark>//
- **[a15586001](https://github.com/facebook/react/commit/a15586001 )**: Fix: Don't flush discrete at end of batchedUpdates ([#21229](https://github.com/facebook/react/pull/21229)) //<Andrew Clark>//
- **[89847bf6e](https://github.com/facebook/react/commit/89847bf6e )**: Continuous updates should interrupt transitions ([#21323](https://github.com/facebook/react/pull/21323)) //<Andrew Clark>//
- **[ef37d55b6](https://github.com/facebook/react/commit/ef37d55b6 )**: Use performConcurrentWorkOnRoot for "sync default" ([#21322](https://github.com/facebook/react/pull/21322)) //<Andrew Clark>//

Changelog:
[General][Changed] - React Native sync for revisions a632f7d...2a7bb41

jest_e2e[run_all_tests]

Reviewed By: JoshuaGross

Differential Revision: D28063006

fbshipit-source-id: 7e3535f80961706863b6c2188ee44b5796b2f000
2021-04-28 14:17:08 -07:00
Samuel Susla 84d55868e8 Fix DatePicker sizing issue
Summary:
Changelog: Fix possible sizing issue with DatePicker

Changing `preferredDatePickerStyle` changes size of the component without triggering re-layout of the react native screen. The fix is to make sure the size stays the same after changing the style.

Reviewed By: mdvacca

Differential Revision: D28035226

fbshipit-source-id: 2dcb50fd5ebaa0c0d01d3289c4ffa77a053cfc4a
2021-04-28 13:48:28 -07:00
Scott Kyle 2f62c2892d Fix crash in RCTCoreModulesClassProvider during quit
Summary:
This intentionally leaks the static map, since it still might be accessed after static destructors are run. This is a common approach to this problem, see https://github.com/facebook/react-native/pull/22607 and https://github.com/facebook/componentkit/pull/906 as examples. It also sets up an autorelease pool from  `RCTNativeModule::invoke` as a precaution since there's no strict guarantee one exists when it is called.

Changelog:
[iOS][Fixed] - Fix crash in RCTCoreModulesClassProvider during quit

Reviewed By: RSNara

Differential Revision: D27932062

fbshipit-source-id: fa75da4b78290027a762440ac6943c81b8594a57
2021-04-28 13:29:06 -07:00
Adam Cmiel 08ea434ba8 Migrate xplat autoglob targets (#31400)
Summary:
## Changelog: [Internal]
Pull Request resolved: https://github.com/facebook/react-native/pull/31400
Pull Request resolved: https://github.com/facebook/react-native/pull/31411

Annotate autolgob mode for apple library targets

Reviewed By: adamjernst

Differential Revision: D27890473

fbshipit-source-id: 75239c6c1871310e1ccd6576569161eb4163a3c1
2021-04-28 11:07:17 -07:00
Samuel Susla 050f84fd2b EventQueue::enqueueStateUpdate now accepts rvalue reference
Summary:
Changelog: [internal]

state infra uses rvalue references until this point. I assume the original author intended to rvalue reference even here.
This way, we avoid unnecessary copy.

Reviewed By: JoshuaGross

Differential Revision: D28057570

fbshipit-source-id: 19af480234d44acffcdbb22606607279e25c8aed
2021-04-28 11:00:03 -07:00
Samuel Susla 74d3559924 Clean up extract_uimanagerbinding_on_demand experiment
Summary:
Changelog: [internal]

Cleanup the experiment.

Reviewed By: mdvacca

Differential Revision: D27995976

fbshipit-source-id: dd6b25f5ad225243765d64b7d92b97f4423005a2
2021-04-28 04:19:24 -07:00
David Vacca a56c15894a Enable Fabric in logbox
Summary:
This diff enables  Fabric in logbox in the facebook app

changelog: [internal] internal

Reviewed By: JoshuaGross

Differential Revision: D28031255

fbshipit-source-id: 8abc301651ad09e4e48c88961bc7f3b91e6c4ae3
2021-04-27 19:45:08 -07:00
David Vacca 3d0cf8dcf8 Fix IllegalArgumentException when creating layout with negative width
Summary:
This diff fixes an IllegalArgumentException that's thrown when creating layout with negative width.

This is not a new bug, but it started firing recently (probably caused by a change in text being measured)

stacktrace:
```
stack_trace:	java.lang.IllegalArgumentException: Layout: -2 < 0
	at android.text.Layout.<init>(Layout.java:265)
	at android.text.Layout.<init>(Layout.java:241)
	at android.text.BoringLayout.<init>(BoringLayout.java:179)
	at android.text.BoringLayout.make(BoringLayout.java:61)
	at com.facebook.react.views.text.TextLayoutManager.createLayout(TextLayoutManager.java:290)
	at com.facebook.react.views.text.TextLayoutManager.measureText(TextLayoutManager.java:384) [inlined]
	at com.facebook.react.views.text.ReactTextViewManager.measure(ReactTextViewManager.java:172) [inlined]
	at com.facebook.react.fabric.mounting.MountingManager.measure(MountingManager.java:349) [inlined]
	at com.facebook.react.fabric.FabricUIManager.measure(FabricUIManager.java:461)
	at com.facebook.react.bridge.queue.NativeRunnable.run(Native Method)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
	at java.lang.Thread.run(Thread.java:923)

```

changelog: [internal] internal

Reviewed By: JoshuaGross

Differential Revision: D28015820

fbshipit-source-id: 129cd2a4c492d95d57fcdf3883b967a0b5df639a
2021-04-27 19:45:08 -07:00
David Vacca 3178e80c88 Cleanup unused variables
Summary:
EZ cleanup of unused variables in TextLayoutManager
changelog: [internal] internal

Reviewed By: JoshuaGross

Differential Revision: D28015819

fbshipit-source-id: 8e380926ebff9256e89e6cd654fa96eeb938d797
2021-04-27 19:45:08 -07:00
Ramanpreet Nara 4c5182c1cc RCTNetworking: Use RCTModuleRegistry to load handlers
Summary:
## Context
A React Native application can configure its RCTNetworking by initializing it with id<RCTURLRequestHandler> objects.

Therefore, RCTNetworking supports this initializer:
```
- (instancetype)initWithHandlersProvider:(NSArray<id<RCTURLRequestHandler>> * (^)(void))getHandlers
```

Right now, all id<RCTURLRequestHandler> are NativeModules. So, they need to be loaded using the Bridge/TurboModuleManager.

## Problem
The method [that constructs RCTNetworking](https://www.internalfb.com/code/fbsource/[6530647879a5e6d5edcfad029b39879c87e97bb3]/fbobjc/Apps/Wilde/FBReactModule2/FBReactModuleAPI/FBReactModuleAPI/FBReactModule.mm?lines=1471) is shared between bridge mode and bridgeless mode. So, the shared constructor needs to know what infra to use to load the request handlers: the TurboModuleManager, when called from a bridgeless context; the bridge, when called from a bridge context. There's no easy way to let this shared constructor know what context it's being called from. We could fork the constructor, but that's not very clean.

## Changes
In this refactor, RCTNetworking gives its _handlersProvider its RCTModuleRegistry. If the module was instantiated in bridgeless mode, RCTModuleRegistry will use the TurboModuleManager. If the module was instantiated in bridge mode, RCTModuleRegistry will use the bridge. Using RCTModuleRegistry allows the _handlersProvider to load id<RCTURLRequestHandler> from correct infra, in both contexts.

Changelog: [iOS][Changed] - Give RCTNetworking handler provider block RCTModuleRegistry

Reviewed By: PeteTheHeat

Differential Revision: D28013000

fbshipit-source-id: 956d660771ab18f5e7f24fcc28792f9a217146e7
2021-04-27 15:03:05 -07:00
Ramanpreet Nara af6bcfa3ab RCTImageLoader: Use RCTModuleRegistry to load loaders/decoders
Summary:
## Context
A React Native application can configure its RCTImageLoader by initializing it with two different sets of objects:
- id<RCTImageURLLoader>
- id<RCTImageDataDecoder>

Therefore, RCTImageLoader supports this initializer:
```
- (instancetype)initWithRedirectDelegate:(id<RCTImageRedirectProtocol>)redirectDelegate
                         loadersProvider:(NSArray<id<RCTImageURLLoader>> * (^)(void))getLoaders
                        decodersProvider:(NSArray<id<RCTImageDataDecoder>> * (^)(void))getHandlers
```

Right now, both the id<RCTImageURLLoader>s and id<RCTImageDataDecoder>s are NativeModules. So, they need to be loaded using the Bridge/TurboModuleManager.

## Problem
The method [that constructs RCTImageLoader](https://www.internalfb.com/code/fbsource/[6530647879a5e6d5edcfad029b39879c87e97bb3]/fbobjc/Apps/Wilde/FBReactModule2/FBReactModuleAPI/FBReactModuleAPI/FBReactModule.mm?lines=1462-1469) is shared between bridge mode and bridgeless mode. So, the shared constructor needs to know what infra to use to load the loaders/decoders: the TurboModuleManager, when called from a bridgeless context; the bridge, when called from a bridge context. There's no easy way to let this shared constructor know what context it's being called from. We could fork the constructor, but that's not very clean.

## Changes
In this refactor, RCTImageLoader gives its loadersProvider and decodersProvider its RCTModuleRegistry. If the module was instantiated in bridgeless mode, RCTModuleRegistry will use the TurboModuleManager. If the module was instantiated in bridge mode, RCTModuleRegistry will use the bridge. Using RCTModuleRegistry allows these two blocks to load the RCTImageURLLoaders and RCTImageDataDecoder from correct infra, in both contexts.

Changelog: [iOS][Changed] - Give RCTImageURLLoader's loader/decoder provider blocks RCTModuleRegistry

Reviewed By: PeteTheHeat

Differential Revision: D28012999

fbshipit-source-id: 09c787923b57bbf72aff95b504f88ee1f2f44283
2021-04-27 15:03:05 -07:00
Micha Reiser d6cd2e6559 Upgrade to Jest 26.6.3
Summary: Changelog: [Internal]

Reviewed By: motiz88

Differential Revision: D27996469

fbshipit-source-id: 41f11be8477f5c1314e87f365d09a0c03f272284
2021-04-27 09:42:13 -07:00
Joshua Gross 119e8f4cd8 Differ: in flattening/unflattening nested case, reduce code duplication
Summary:
Refactor a code block that is duplicated 2x. Logic stays the same besides renaming, and a ternary operator to decide between getting the children from "old" or "new" tree.

Tests can help us refactor knowing that the logic is still correct.

Changelog: [Internal]

Reviewed By: sammy-SC

Differential Revision: D28018994

fbshipit-source-id: d34a033444e67091e44ff6a747fd39846c165238
2021-04-27 09:38:43 -07:00
Joshua Gross 1e68a5f573 Differ: simplify nested flattening/unflattening code
Summary:
There's a case here where we do a loop, with a map loopup, and nested map lookup inside of that. It's not particularly efficient and was done because we have multiple distinct pointers to distinct ShadowViews that are backed by the same ShadowNode. Now due to previous, recent refactoring, we can simplify this case a lot.

The code WAS correct before, just confusing and not particularly efficient. Tests can prove that this is still correct.

Changelog: [Internal]

Reviewed By: sammy-SC

Differential Revision: D28018996

fbshipit-source-id: a7c8148802650c88888960c9c099954e0f8bc357
2021-04-27 09:38:43 -07:00
Joshua Gross 121a84496c Differ: remove incorrect comment
Summary:
This is no longer true because of the "scope" mechanism.

Changelog: [Internal]

Reviewed By: sammy-SC

Differential Revision: D28018995

fbshipit-source-id: 91470234bb15f7feeb92b41613b0bbdbe42ccb27
2021-04-27 09:38:43 -07:00
Joshua Gross 7131791ab1 Differ: dedupe more code in main differ loop
Summary:
I am deduping a duplicated block, and adding comments to explain when we create INSERT/REMOVE mutations immediately and when we defer creation.

Theoretically the ordering of mutations will be more consistent now, which ~shouldn't matter, but is probably a decent property to have. In particular, before, in some cases
both of these orderings were possible in various scenarios:

```
INSERT X -> Y
INSERT Y -> Z
```

and

```
INSERT Y -> Z
INSERT X -> Y
```

Both of those are fine/correct/won't cause issues on any known platforms. But now, at least for the two cases touched here, only this ordering will be produced:

```
INSERT Y -> Z
INSERT X -> Y
```

meaning we build the tree from the bottom-up (the "bottom" being the root) and do out-of-order inserts less frequently.

Again, the biggest part of this diff should be readability/refactoring/de-duplicating logic, but more consistent orderings is a nice-to-have.

Changelog: [Internal]

Reviewed By: sammy-SC

Differential Revision: D28017926

fbshipit-source-id: 5941588d0c8bba8b0df7d0084d5d198f4b7c2427
2021-04-27 09:38:43 -07:00
Andrei Shikov 0aa7e5b5d4 Back out "Assign batch number to only batched animated instructions"
Summary:
This change broke some animations on non-Fabric surfaces due to inconsistent batching of animation operations.

Changelog: [Internal]

Reviewed By: JoshuaGross

Differential Revision: D28013968

fbshipit-source-id: 2f65c799dbe00168f1e756ef0af60206df5a8fcc
2021-04-27 04:00:16 -07:00
Andrei Shikov ef0db95300 Back out "Adjust animation batch numbers to be consistent when controlled by native"
Summary:
This change caused crashes in animations on some surfaces.

Changelog: [Internal]

Reviewed By: JoshuaGross

Differential Revision: D28013969

fbshipit-source-id: 95845c69d6e67d59582ea14ad08cbf42fd3e2f8f
2021-04-27 04:00:16 -07:00
Samuel Susla 841756b150 Implement RuntimeScheduler::getCurrentPriorityLevel
Summary:
Changelog: [internal]

Implement `RuntimeScheduler::getCurrentPriorityLevel`.

JavaScript implementation: https://github.com/facebook/react/blob/master/packages/scheduler/src/forks/SchedulerNoDOM.js#L63

Reviewed By: ShikaSD

Differential Revision: D27998510

fbshipit-source-id: 634c09185f9eae8f7afcdb6acd9b74effd587da7
2021-04-27 00:29:04 -07:00
Nadiia D 46ffe84453 Make RootTag an opaque type
Summary:
Changelog:
[General][Changed] Make the RootTag an opaque type

Reviewed By: yungsters

Differential Revision: D27992320

fbshipit-source-id: 2901f0e59f573106295b986fe04db227134235da
2021-04-26 22:57:55 -07:00
Nadiia D 9b98edcd01 Stabilize RootTagContext
Summary:
Changelog:
[General][Removed] - Stabilize RootTagContext

Reviewed By: TheSavior

Differential Revision: D27954168

fbshipit-source-id: ff04375f00229b1a601cbd1182001885d8b687ec
2021-04-26 22:57:55 -07:00
Nadiia D 9d489354ae Stabilize RootTagContext
Summary:
Changelog:
[General][Added] - Stabilize RootTagContext. And temporarily export both `unstable_RootTagContext` and `RootTagContext`

Reviewed By: TheSavior

Differential Revision: D27951427

fbshipit-source-id: dff8d4ca07c89edeeb517a42a3922e4e23899d8e
2021-04-26 22:57:55 -07:00
Tim Yung 8719a2e9a9 msggen: Upgrade `jest` Dependency
Summary:
Upgrades `jest` to mitigate a dependency with security vulnerabilities.

Changelog:
[Internal]

Reviewed By: mhorowitz

Differential Revision: D28009549

fbshipit-source-id: ea3313a452e9e4b79d68781ffc37c26b00f26da5
2021-04-26 15:15:46 -07:00
Tim Yung 6ea72fa231 msggen: Fix Missing `RefProperty.recursive`
Summary:
This was missing, causing the test to fail.

Changelog:
[Internal]

Reviewed By: mhorowitz

Differential Revision: D28009429

fbshipit-source-id: 51d4366b4feb6a2300c5bd05007dd9455bdcd77b
2021-04-26 15:15:45 -07:00
Kacie Bawiec 0afd71a18d Convert require to import in Libraries/Components
Summary:
Changelog:
[General][Changed] Convert require statements to use import from in Libraries/Components

Reviewed By: lunaleaps

Differential Revision: D27921557

fbshipit-source-id: 3f1618455a47a56c4a090f3ececfef88476c0b8a
2021-04-26 12:50:59 -07:00
Joshua Gross ca3aae7980 Differ: fix unit test case 1167342011
Summary:
Unit test case seed 1167342011 encodes a case where the differ produces a DELETE and CREATE of the same node in the same frame, which we consider an error.

It turns out this was caused by nested "unflatten" operations and this bit of deleted code specifically. We were deleting an unmatched node from a parent call's dictionary of nodes,
which prevented it from being matched in the "old" tree later on.

This is only possible now that we attach pointers to the "other" ViewNodePair when they're matched, so we can check existence of that pointer instead of inclusion in dictionaries to decide if we need to DELETE/CREATE a node and its subtree.

Changelog: [Internal]

Reviewed By: sammy-SC

Differential Revision: D28003330

fbshipit-source-id: 305440ef20b921883c1d6e38a4a4072e5a7f95ac
2021-04-26 11:59:11 -07:00
Joshua Gross 4bc81422ed Differ: fix debug log compilation
Summary:
Only compiles when debug flags are added locally. This fixes compiler errors.

Changelog: [Internal]

Reviewed By: sammy-SC

Differential Revision: D28003331

fbshipit-source-id: 0383f41bbb405a1b089f155d2a7f3398795ac965
2021-04-26 11:59:11 -07:00