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

6509 Коммитов

Автор SHA1 Сообщение Дата
Rubén Norte c6d77a8570 Make some modules flow strict
Summary:
TSIA

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D28412774

fbshipit-source-id: 899a78e573bb49633690275052d5e7cb069327fb
2021-05-14 04:23:21 -07:00
Tien Pham 129180c77b Fix natively driven animations not getting reset properly (#29585)
Summary:
Fixes https://github.com/facebook/react-native/issues/28517

Animated.loop needs to reset the animation after each iteration but currently, natively driven animations are not getting reset properly.
## 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
-->

[General] [Fixed] - Fix natively driven animations not getting reset properly

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

Test Plan: Tested within RNTester

Reviewed By: kacieb

Differential Revision: D28383538

Pulled By: yungsters

fbshipit-source-id: 40790ad8f825c402afc3515ef6afc00570704109
2021-05-13 00:43:47 -07:00
Andrei Shikov 10b9308eb9 React Native sync for revisions 2a7bb41...b8fda6c
Summary:
This sync includes the following changes:
- **[b8fda6cab](https://github.com/facebook/react/commit/b8fda6cab )**: [React Native] Set allowConcurrentByDefault = true ([#21491](https://github.com/facebook/react/pull/21491)) //<Ricky>//
- **[1bb8987cc](https://github.com/facebook/react/commit/1bb8987cc )**: Renamed function in error log issue #21446 ([#21449](https://github.com/facebook/react/pull/21449)) //<faebzz>//
- **[bd070eb2c](https://github.com/facebook/react/commit/bd070eb2c )**: Enable setJSResponder/setIsJSResponder for React Native Fabric ([#21439](https://github.com/facebook/react/pull/21439)) //<Joshua Gross>//
- **[e9a4a44aa](https://github.com/facebook/react/commit/e9a4a44aa )**: Add back root override for strict mode ([#21428](https://github.com/facebook/react/pull/21428)) //<Ricky>//
- **[d1542de3a](https://github.com/facebook/react/commit/d1542de3a )**: Unify React.memo and React.forwardRef display name logic ([#21392](https://github.com/facebook/react/pull/21392)) //<Brian Vaughn>//
- **[9a130e1de](https://github.com/facebook/react/commit/9a130e1de )**: StrictMode includes strict effects by default ([#21418](https://github.com/facebook/react/pull/21418)) //<Brian Vaughn>//
- **[15fb8c304](https://github.com/facebook/react/commit/15fb8c304 )**: createRoot API is no longer strict by default ([#21417](https://github.com/facebook/react/pull/21417)) //<Brian Vaughn>//
- **[aea7c2aab](https://github.com/facebook/react/commit/aea7c2aab )**: Re-land "Support nesting of startTransition and flushSync (alt) ([#21149](https://github.com/facebook/react/pull/21149))" //<Andrew Clark>//
- **[bacc87068](https://github.com/facebook/react/commit/bacc87068 )**: Re-land "Flush discrete passive effects before paint ([#21150](https://github.com/facebook/react/pull/21150))" //<Andrew Clark>//
- **[098600c42](https://github.com/facebook/react/commit/098600c42 )**: Re-land "Fix: flushSync changes priority inside effect ([#21122](https://github.com/facebook/react/pull/21122))" //<Andrew Clark>//
- **[df420bc0a](https://github.com/facebook/react/commit/df420bc0a )**: Re-land "Delete LanePriority type ([#21090](https://github.com/facebook/react/pull/21090))" //<Andrew Clark>//
- **[ab5b37927](https://github.com/facebook/react/commit/ab5b37927 )**: Re-land "Clean up host pointers in level 2 of clean-up flag ([#21112](https://github.com/facebook/react/pull/21112))" //<Andrew Clark>//
- **[fd907c1f1](https://github.com/facebook/react/commit/fd907c1f1 )**: Re-land "Use highest priority lane to detect interruptions ([#21088](https://github.com/facebook/react/pull/21088))"" //<Andrew Clark>//
- **[269dd6ec5](https://github.com/facebook/react/commit/269dd6ec5 )**: subtreeFlag warning: Fix legacy suspense false positive ([#21388](https://github.com/facebook/react/pull/21388)) //<Andrew Clark>//
- **[9e9dac650](https://github.com/facebook/react/commit/9e9dac650 )**: Add unstable_concurrentUpdatesByDefault ([#21227](https://github.com/facebook/react/pull/21227)) //<Ricky>//
- **[86f3385d9](https://github.com/facebook/react/commit/86f3385d9 )**: Revert "Use highest priority lane to detect interruptions ([#21088](https://github.com/facebook/react/pull/21088))" //<Andrew Clark>//
- **[c6702656f](https://github.com/facebook/react/commit/c6702656f )**: Revert "Clean up host pointers in level 2 of clean-up flag ([#21112](https://github.com/facebook/react/pull/21112))" //<Andrew Clark>//
- **[1bd41c664](https://github.com/facebook/react/commit/1bd41c664 )**: Revert "Delete LanePriority type ([#21090](https://github.com/facebook/react/pull/21090))" //<Andrew Clark>//
- **[e7e0a90bd](https://github.com/facebook/react/commit/e7e0a90bd )**: Revert "Fix: flushSync changes priority inside effect ([#21122](https://github.com/facebook/react/pull/21122))" //<Andrew Clark>//
- **[7bac7607a](https://github.com/facebook/react/commit/7bac7607a )**: Revert "Flush discrete passive effects before paint ([#21150](https://github.com/facebook/react/pull/21150))" //<Andrew Clark>//
- **[207d4c3a5](https://github.com/facebook/react/commit/207d4c3a5 )**: Revert "Support nesting of startTransition and flushSync (alt) ([#21149](https://github.com/facebook/react/pull/21149))" //<Andrew Clark>//

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

jest_e2e[run_all_tests]

Reviewed By: yungsters

Differential Revision: D28351439

fbshipit-source-id: 29620f96c9fb9f02b0d856111d3882d3c69fd1c5
2021-05-11 11:20:10 -07:00
Tim Yung 0bbb51e8c2 Animated: Remove Erroneous `AnimatedProps` Check
Summary:
This check will never pass because `this._propsAnimated` contains an instance of `AnimatedProps`, but `nextProps` contains an object literal containing the new props.

Changelog:
[Internal]

Reviewed By: JoshuaGross, TheSavior, kacieb

Differential Revision: D28271627

fbshipit-source-id: c563eec1eeaee5eb84bb01525313b46db502225a
2021-05-10 17:02:59 -07:00
Tim Yung faf4550047 Animated: Decouple `__attach` from `new AnimatedProps`
Summary:
Decouples `__attach` from the constructor in `AnimatedProps`.

This change will enable the instantiation of `AnimatedProps` (and subsequent invocation of `__getValue()`) without having to trigger side effects until after mount or update. This is important in order for `Animated` to ever become safe for Concurrent Mode.

Changelog:
[Internal]

Reviewed By: lunaleaps

Differential Revision: D28271628

fbshipit-source-id: 6ccfed6de79382cecdfa6939c7dad3134e1ecaaa
2021-05-10 17:02:59 -07:00
Rubén Norte d87542ee4c Create usePerformanceLogger hook
Summary:
Having to import `useContext` every time is annoying, so this just creates a convenience function to get it.

Changelog: [Internal]

Reviewed By: GijsWeterings

Differential Revision: D28258305

fbshipit-source-id: 7293478f9baa11711a541f987225108871688e0e
2021-05-10 07:21:25 -07:00
Tim Yung ae4946f983 Animated: Remove `Animated.__PropsOnlyForTests`
Summary:
Deletes `Animated.__PropsOnlyForTests` because it is unnecessary for actually testing `AnimatedProps`.

Changelog:
[General][Removed] - Removed `Animated.__PropsOnlyForTests`.

Reviewed By: kacieb

Differential Revision: D28271629

fbshipit-source-id: 7d4c83d72f7298ed43e3659126cb45d271c5dac7
2021-05-07 21:05:58 -07:00
Adrien HARNAY 1d924549ca Add onPressIn & onPressOut props to Text (#31288)
Summary:
I added onPressIn & onPressOut props to Text to help implement custom highlighting logic (e.g. when clicking on a Text segment). Since TouchableOpacity can't be nested in Text having custom lineHeights without bugs in some occasions, this modification helps to replicate its behavior.

## Changelog

[General] [Added] - Add onPressIn & onPressOut props to Text

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

Test Plan:
```
const [pressing, setPressing] = useState(false);

<Text
  onPressIn={() => setPressing(true)}
  onPressOut={() => setPressing(false)}
  style={{ opacity: pressing ? 0.5 : 1 }}
/>
```

Thanks in advance!

Reviewed By: yungsters

Differential Revision: D27945133

Pulled By: appden

fbshipit-source-id: 8342ca5f75986b4644a193d2f71eab3bc0ef1a5f
2021-05-06 12:42:00 -07:00
Kacie Bawiec 438a4cf59b Cleanup to ship ScrollViewStickyHeader experiment
Summary:
Changelog:
[General][Changed] Refactor ScrollViewStickyHeader to a functional component to remove unsafe lifecycles and mutations during render

Reviewed By: lunaleaps

Differential Revision: D28203776

fbshipit-source-id: 615c8e1cd9e9e26d25c7d02aee7e4a0bfc8ec6c3
2021-05-05 15:23:23 -07:00
David Vacca 873bd5b04c Delete registerGeneratedViewConfig API
Summary:
This diff deletes the registerGeneratedViewConfig API that is not used anymore.
This API was likely ONLY used internally at facebook, that's why I'm not deprecating it.

changelog: [Delete] Delete registerGeneratedViewConfig API

Reviewed By: fkgozali

Differential Revision: D28207558

fbshipit-source-id: 8598591e7ba1a7b001c87cb8728f2c599b1bbf63
2021-05-05 09:12:41 -07:00
Rubén Norte 8abe737068 Centralize public access to LogBox in LogBox module
Summary:
Some components are using `LogBoxData` directly, forcing logs to be shown on the screen even when LogBox is uninstalled. This changes all accesses to `LogBoxData` to go through `LogBox` so `uninstall` is used correctly.

It also changes when LogBox is installed, moving it from `AppContainer` to `InitializeCore` (which happens earlier) so we can capture more logs in LogBox.

Changelog: [General][Changed] Initialized LogBox earlier and centralized access in LogBox module

Reviewed By: rickhanlonii

Differential Revision: D27999361

fbshipit-source-id: 1115ef6b71e08cc33743d205da0064fbe9a74a0e
2021-05-04 10:58:24 -07:00
Kacie Bawiec da899c0cc4 Add support for Toggle Button accessibilityRole
Summary:
Changelog:
[General][Added] Add support for "togglebutton" accessibilityRole

# Context
The role for ToggleButton, which is needed on Android to implement toggle buttons correctly, is not currently supported.

# What does this diff do?
Adds support for accessibilityRole `"togglebutton"`.

On Android, this maps to class `"Android.widget.ToggleButton"`.

iOS does not have an equivalent trait for togglebutton, so I set it to be the same as setting `accessibilityRole="button"` for iOS.

# Caveats - checked vs selected
It seems to me like this role currently requires that you set `accessibilityState={{checked: true/false}}`. The behavior is strange when setting `selected` state, I think because on Android ToggleButtons are meant to use `checked` to indicate toggled on/off.

This is tricky because typically on iOS if you have a toggle button, you would use `selected` instead of `checked`, so RN users are likely to mess this up.

Possible solutions:
1. document that you should use `checked` state on Android for toggle buttons (and maybe throw a warning if someone passes in `selected`).
2. have RN ignore it if someone passes in accessibilityState `selected`, if this role is used.
3. Have RN convert passed in `selected` state to `checked` on the Android side.

Reviewed By: nadiia

Differential Revision: D27976046

fbshipit-source-id: 4ce202449cf2371f4bf83c4db2d53120369ee7b0
2021-05-03 11:50:02 -07:00
Luna Wei ab66741c8c Cleanup for shipping use_switch_modern
Summary:
Changelog:
[General][Changed] - Refactor Switch component to functional and remove experimentation around it

Reviewed By: kacieb

Differential Revision: D28127518

fbshipit-source-id: c71d305a2caa8b3342ba603133c6e28c34410528
2021-05-03 11:44:53 -07:00
Luna Wei 2e0e3f7ddb Cleanup for shipping use_vsl_modern_v2
Summary:
Changelog:
[General][Changed] - Refactored auxiliary component ItemWithSeparator in VirtualizedSectionList to be functional

Reviewed By: kacieb

Differential Revision: D28127519

fbshipit-source-id: 402bee01e7f26722c376e8ed94ff4b5524d32379
2021-05-03 11:44:53 -07:00
Paige Sun 0932a0d775 iOS: 2/5 Remove use of bridge from Modal by dismissing with visible prop
Summary: Changelog: [Fabric][iOS][Fix] Remove use of bridge from Modal by dismissing Modal with visible prop

Reviewed By: sammy-SC

Differential Revision: D28074326

fbshipit-source-id: 0278bfb031db802b59429c553ac62d83838f4cc9
2021-05-02 15:42:49 -07:00
Paige Sun 3c17922c35 iOS: 1/7 Add missing onDismiss prop in Modal component
Summary:
Changelog: [Internal]

Static ViewConfigs are not yet available in Fabric. ViewConfigs are generated from Paper view managers.

For a prop to pass through from JS to iOS, props in [RCTModalHostViewNativeComponent.js](dc80b2dcb5/Libraries/Modal/RCTModalHostViewNativeComponent.js) need to match RCT_EXPORT_VIEW_PROPERTY in RCTModalHostViewManager.m.

Reviewed By: sammy-SC

Differential Revision: D27977574

fbshipit-source-id: 9790d93500890a04ffc0fb4d2bcd2de5187f1fc0
2021-05-02 00:19:53 -07:00
David Vacca cf0a6e9e27 Refactor RCTMultilineTextInputNativeComponent to use NativeComponentRegistry instead of requireNativeComponent
Summary:
This diff migrates RCTMultilineTextInputNativeComponent to use NativeComponentRegistry instead of requireNativeComponent. The intention is to unify the way the component is registered and enable StaticViewConfigs for this component
changelog: [internal] internal

Reviewed By: JoshuaGross

Differential Revision: D28116333

fbshipit-source-id: b245026ebcd564380d0c74bbd6d9a36c661a8e71
2021-04-30 17:41:25 -07:00
David Vacca f76943af1a Refactor RCTSingelineTextInputNativeComponent to use NativeComponentRegistry instead of requireNativeComponent
Summary:
This diff migrates RCTSingelineTextInputNativeComponent to use NativeComponentRegistry instead of requireNativeComponent. The intention is to unify the way the component is registered and enable StaticViewConfigs for this component
changelog: [internal] internal

Reviewed By: JoshuaGross

Differential Revision: D28116332

fbshipit-source-id: d0a1a512a1cd967608512423db3dffa7c68fd2c5
2021-04-30 17:41:25 -07:00
David Vacca fc52e93db5 Add warnings to deprecate UIManager methods when using Fabric + StaticViewConfigs enabled
Summary:
This diff reports warning when a method of the LazyUIManager is called when using fabric and StaticViewConfigs enabled

changelog: [Android][changed] Deprecate UIManager methods when using the new architecture enabled

Reviewed By: fkgozali

Differential Revision: D28108804

fbshipit-source-id: 4b430bdefa67914883a595dff97ea6c9ffd93361
2021-04-30 17:41:25 -07:00
David Vacca 37750100ac Add warnings to deprecate UIManager.getViewManagerConfig method
Summary:
UIManager.getViewManagerConfig method is deprecated, use UIManager.hasViewManagerConfig instead

changelog: [Deprecated] UIManager.getViewManagerConfig method has been deprecated, use UIManager.hasViewManagerConfig instead.

Reviewed By: fkgozali

Differential Revision: D27983717

fbshipit-source-id: 982ecce20eb441c076f7c26d9a54ea13d93c2a31
2021-04-30 17:41:25 -07:00
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
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
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
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
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
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
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
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
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
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
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
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
Tim Yung f598dd0ee3 RN: Create Experiment for `collapsable` (iOS)
Summary:
Sets up an experiment that enables `collapsable` in Fabric for iOS. This will enable us to validate with production data that enabling the use of this prop does not cause unexpected regressions.

Changelog:
[internal]

Reviewed By: mdvacca

Differential Revision: D27987619

fbshipit-source-id: 9b1c0ff45bed09b1e72ad7d9c782f07bb4211cc6
2021-04-25 01:17:55 -07:00
Tim Yung b914153286 Animated: Delete `getNode()` on Refs
Summary:
In 0.62, `createAnimatedComponent` was changed to use `forwardRef` instead of requiring callers to use `ref.getNode()`. In order to preserve backward-compatibility, `ref.getNode()` was monkey-patched onto the returned ref, if possible, to return the `ref` and output a console warning.

Three major (well, technically, minor) releases later, we are dropping support for `getNode()`. Calling it on the `ref` of an animated component will begin to fail after this (unless the underlying component itself actually implements a `getNode()` method on its imperative handle).

Changelog:
[General][Removed] - Removed `getNode()` from animated component refs.

Reviewed By: nadiia

Differential Revision: D27979882

fbshipit-source-id: 885c3dbf4f2749c994fc2662dd6f16ff3dd887c7
2021-04-24 17:09:12 -07:00
Andrei Shikov bda032af6e Adjust animation batch numbers to be consistent when controlled by native
Summary:
D27682424 (ea1ff374de) updated how animated node batches are executed in Fabric. On Paper, these batches were controlled by native module in some places (batch was executed ~every 2 frames), but some animations were switching animation batching control to JS globally there as well.

This change updates two things:
- If batching is controlled by native, it makes sure batches are calculated correctly.
- At the same time, this change switches control for animation node batching to JS, aligning it with Fabric.

Changelog: [Internal]

Reviewed By: JoshuaGross, mdvacca

Differential Revision: D27939659

fbshipit-source-id: d6251bce2a303a4a007dc10297edc0175cc4b348
2021-04-23 15:07:35 -07:00
Lulu Wu de477a0df6 Register RCTEventEmitter as callable module for Venice
Summary:
## Context
Trying to fix this js error
```
com.facebook.errorreporting.lacrima.common.exception.LacrimaJavascriptException: Error: Module RCTEventEmitter has not been registered as callable. Did you forget to call `RN$registerCallableModule`?, js build: UNKNOWN
```
https://fburl.com/logview/fvc33d48

Changelog:
[General][Changed] - Register RCTEventEmitter as callable module for Venice

Reviewed By: PeteTheHeat

Differential Revision: D27969226

fbshipit-source-id: 8e807ee5b2ef447b0bb49fa2107352d89584c181
2021-04-23 13:32:05 -07:00
Andy Chou 266b21baf3 Update height for different UIDatePickerStyles
Summary:
Adding support for DatePickerStyles on iOS13.4+
Changelog:
[iOS][Added] - Expose UIDatePickerStyles as a prop for DatePickerIOS

Reviewed By: PeteTheHeat

Differential Revision: D27953279

fbshipit-source-id: a35adf245147467ecbacac3770b9c50836cea468
2021-04-22 22:27:22 -07:00
Andy Chou 2b62e19a78 iOS 14 Support new DatePicker styles
Summary:
Adding support for DatePickerStyles on iOS13.4+

Changelog:
[iOS][Added] - Expose UIDatePickerStyles as a prop for DatePickerIOS

Reviewed By: PeteTheHeat

Differential Revision: D27948608

fbshipit-source-id: fcc16c630148818d9db0c9eef8363f8592b13791
2021-04-22 22:27:22 -07:00
Rick Hanlon 96930fad13 Flip useTransition tuple
Summary:
This diff flips the order of the tuple returned by useTransition.

See here for more info: https://github.com/facebook/react/pull/20976

Changelog: internal

Reviewed By: gaearon

Differential Revision: D27928490

fbshipit-source-id: a1896f92ef24382012fa3be1ef043752e62b21e7
2021-04-21 20:29:34 -07:00
Rick Hanlon 42dceaf21c React Native sync for revisions f7cdc89...bd7f4a0
Summary:
This sync includes the following changes:
- **[bd7f4a013](https://github.com/facebook/react/commit/bd7f4a013 )**: Fix sloppy factoring in `performSyncWorkOnRoot` ([#21246](https://github.com/facebook/react/pull/21246)) //<Andrew Clark>//
- **[78120032d](https://github.com/facebook/react/commit/78120032d )**: Remove `flushDiscreteUpdates` from end of event ([#21223](https://github.com/facebook/react/pull/21223)) //<Andrew Clark>//
- **[a3a7adb83](https://github.com/facebook/react/commit/a3a7adb83 )**: Turn off enableSyncDefaultUpdates in test renderer ([#21319](https://github.com/facebook/react/pull/21319)) //<Ricky>//
- **[cdb6b4c55](https://github.com/facebook/react/commit/cdb6b4c55 )**: Only hide outermost host nodes when Offscreen is hidden ([#21250](https://github.com/facebook/react/pull/21250)) //<Brian Vaughn>//
- **[b9c6a2b30](https://github.com/facebook/react/commit/b9c6a2b30 )**: Remove LayoutStatic check from commit phase ([#21249](https://github.com/facebook/react/pull/21249)) //<Brian Vaughn>//
- **[af1a4cbf7](https://github.com/facebook/react/commit/af1a4cbf7 )**: Revert expiration for retry lanes ([#21300](https://github.com/facebook/react/pull/21300)) //<Andrew Clark>//
- **[cc4b431da](https://github.com/facebook/react/commit/cc4b431da )**: Mark boundary as client rendered even if aborting fallback ([#21294](https://github.com/facebook/react/pull/21294)) //<Sebastian Markbåge>//

Changelog:
[General][Changed] - React Native sync for revisions f7cdc89...bd7f4a0

jest_e2e[run_all_tests]

Reviewed By: JoshuaGross

Differential Revision: D27909257

fbshipit-source-id: 36ec4cf1de9df109f1fe1542031df10a693baae0
2021-04-21 09:58:51 -07:00
Rubén Norte 158e17f6a0 Fix incorrect warning on NativeEventEmitter when nativeModule is null
Summary: Changelog: [Internal]

Reviewed By: ShikaSD

Differential Revision: D27881851

fbshipit-source-id: 3b1cba618a86aff1e1c7ffbc0ea5d7047713d30a
2021-04-20 08:45:42 -07:00
Andrei Shikov de318cd318 React Native sync for revisions c9aab1c...f7cdc89
Summary:
This sync includes the following changes:
- **[f7cdc8936](https://github.com/facebook/react/commit/f7cdc8936 )**: Also turn off enableSyncDefaultUpdates in RN test renderer ([#21293](https://github.com/facebook/react/pull/21293)) //<Ricky>//
- **[4c9eb2af1](https://github.com/facebook/react/commit/4c9eb2af1 )**: Add dynamic flags to React Native ([#21291](https://github.com/facebook/react/pull/21291)) //<Ricky>//
- **[9eddfbf5a](https://github.com/facebook/react/commit/9eddfbf5a )**: [Fizz] Two More Fixes ([#21288](https://github.com/facebook/react/pull/21288)) //<Sebastian Markbåge>//
- **[11b07597e](https://github.com/facebook/react/commit/11b07597e )**: Fix classes ([#21283](https://github.com/facebook/react/pull/21283)) //<Sebastian Markbåge>//
- **[96d00b9bb](https://github.com/facebook/react/commit/96d00b9bb )**: [Fizz] Random Fixes ([#21277](https://github.com/facebook/react/pull/21277)) //<Sebastian Markbåge>//
- **[81ef53953](https://github.com/facebook/react/commit/81ef53953 )**: Always insert a dummy node with an ID into fallbacks ([#21272](https://github.com/facebook/react/pull/21272)) //<Sebastian Markbåge>//
- **[a4a940d7a](https://github.com/facebook/react/commit/a4a940d7a )**: [Fizz] Add unsupported Portal/Scope components ([#21261](https://github.com/facebook/react/pull/21261)) //<Sebastian Markbåge>//
- **[f4d7a0f1e](https://github.com/facebook/react/commit/f4d7a0f1e )**: Implement useOpaqueIdentifier ([#21260](https://github.com/facebook/react/pull/21260)) //<Sebastian Markbåge>//
- **[dde875dfb](https://github.com/facebook/react/commit/dde875dfb )**: [Fizz] Implement Hooks ([#21257](https://github.com/facebook/react/pull/21257)) //<Sebastian Markbåge>//
- **[a597c2f5d](https://github.com/facebook/react/commit/a597c2f5d )**: [Fizz] Fix reentrancy bug ([#21270](https://github.com/facebook/react/pull/21270)) //<Sebastian Markbåge>//
- **[15e779d92](https://github.com/facebook/react/commit/15e779d92 )**: Reconciler should inject its own version into DevTools hook ([#21268](https://github.com/facebook/react/pull/21268)) //<Brian Vaughn>//
- **[4f76a28c9](https://github.com/facebook/react/commit/4f76a28c9 )**: [Fizz] Implement New Context ([#21255](https://github.com/facebook/react/pull/21255)) //<Sebastian Markbåge>//
- **[82ef450e0](https://github.com/facebook/react/commit/82ef450e0 )**: remove obsolete SharedArrayBuffer ESLint config ([#21259](https://github.com/facebook/react/pull/21259)) //<Henry Q. Dineen>//
- **[dbadfa2c3](https://github.com/facebook/react/commit/dbadfa2c3 )**: [Fizz] Classes Follow Up ([#21253](https://github.com/facebook/react/pull/21253)) //<Sebastian Markbåge>//
- **[686b635b7](https://github.com/facebook/react/commit/686b635b7 )**: Prevent reading canonical property of null ([#21242](https://github.com/facebook/react/pull/21242)) //<Joshua Gross>//
- **[bb88ce95a](https://github.com/facebook/react/commit/bb88ce95a )**: Bugfix: Don't rely on `finishedLanes` for passive effects ([#21233](https://github.com/facebook/react/pull/21233)) //<Andrew Clark>//
- **[343710c92](https://github.com/facebook/react/commit/343710c92 )**: [Fizz] Fragments and Iterable support ([#21228](https://github.com/facebook/react/pull/21228)) //<Sebastian Markbåge>//
- **[933880b45](https://github.com/facebook/react/commit/933880b45 )**: Make time-slicing opt-in ([#21072](https://github.com/facebook/react/pull/21072)) //<Ricky>//
- **[b0407b55f](https://github.com/facebook/react/commit/b0407b55f )**: Support more empty types ([#21225](https://github.com/facebook/react/pull/21225)) //<Sebastian Markbåge>//
- **[39713716a](https://github.com/facebook/react/commit/39713716a )**: Merge isObject branches ([#21226](https://github.com/facebook/react/pull/21226)) //<Sebastian Markbåge>//
- **[8a4a59c72](https://github.com/facebook/react/commit/8a4a59c72 )**: Remove textarea special case from child fiber ([#21222](https://github.com/facebook/react/pull/21222)) //<Sebastian Markbåge>//
- **[dc108b0f5](https://github.com/facebook/react/commit/dc108b0f5 )**: Track which fibers scheduled the current render work ([#15658](https://github.com/facebook/react/pull/15658)) //<Brian Vaughn>//
- **[6ea749170](https://github.com/facebook/react/commit/6ea749170 )**: Fix typo in comment ([#21214](https://github.com/facebook/react/pull/21214)) //<inokawa>//
- **[b38ac13f9](https://github.com/facebook/react/commit/b38ac13f9 )**: DevTools: Add post-commit hook ([#21183](https://github.com/facebook/react/pull/21183)) //<Brian Vaughn>//
- **[b943aeba8](https://github.com/facebook/react/commit/b943aeba8 )**: Fix: Passive effect updates are never sync ([#21215](https://github.com/facebook/react/pull/21215)) //<Andrew Clark>//
- **[d389c54d1](https://github.com/facebook/react/commit/d389c54d1 )**: Offscreen: Use JS stack to track hidden/unhidden subtree state ([#21211](https://github.com/facebook/react/pull/21211)) //<Brian Vaughn>//
- **[c486dc1a4](https://github.com/facebook/react/commit/c486dc1a4 )**: Remove unnecessary processUpdateQueue ([#21199](https://github.com/facebook/react/pull/21199)) //<Sebastian Markbåge>//
- **[cf45a623a](https://github.com/facebook/react/commit/cf45a623a )**: [Fizz] Implement Classes ([#21200](https://github.com/facebook/react/pull/21200)) //<Sebastian Markbåge>//
- **[75c616554](https://github.com/facebook/react/commit/75c616554 )**: Include actual type of `Profiler#id` on type mismatch ([#20306](https://github.com/facebook/react/pull/20306)) //<Sebastian Silbermann>//
- **[1214b302e](https://github.com/facebook/react/commit/1214b302e )**: test: Fix "couldn't locate all inline snapshots" ([#21205](https://github.com/facebook/react/pull/21205)) //<Sebastian Silbermann>//
- **[1a02d2792](https://github.com/facebook/react/commit/1a02d2792 )**: style: delete unused isHost check ([#21203](https://github.com/facebook/react/pull/21203)) //<wangao>//
- **[782f689ca](https://github.com/facebook/react/commit/782f689ca )**: Don't double invoke getDerivedStateFromProps for module pattern ([#21193](https://github.com/facebook/react/pull/21193)) //<Sebastian Markbåge>//
- **[e90c76a65](https://github.com/facebook/react/commit/e90c76a65 )**: Revert "Offscreen: Use JS stack to track hidden/unhidden subtree state" ([#21194](https://github.com/facebook/react/pull/21194)) //<Brian Vaughn>//
- **[1f8583de8](https://github.com/facebook/react/commit/1f8583de8 )**: Offscreen: Use JS stack to track hidden/unhidden subtree state ([#21192](https://github.com/facebook/react/pull/21192)) //<Brian Vaughn>//
- **[ad6e6ec7b](https://github.com/facebook/react/commit/ad6e6ec7b )**: [Fizz] Prepare Recursive Loop for More Types ([#21186](https://github.com/facebook/react/pull/21186)) //<Sebastian Markbåge>//
- **[172e89b4b](https://github.com/facebook/react/commit/172e89b4b )**: Reland Remove redundant initial of isArray ([#21188](https://github.com/facebook/react/pull/21188)) //<Sebastian Markbåge>//
- **[7c1ba2b57](https://github.com/facebook/react/commit/7c1ba2b57 )**: Proposed new Suspense layout effect semantics ([#21079](https://github.com/facebook/react/pull/21079)) //<Brian Vaughn>//
- **[316aa3686](https://github.com/facebook/react/commit/316aa3686 )**: [Scheduler] Fix de-opt caused by out-of-bounds access ([#21147](https://github.com/facebook/react/pull/21147)) //<Andrey Marchenko>//
- **[b4f119cdf](https://github.com/facebook/react/commit/b4f119cdf )**: Revert "Remove redundant initial of isArray ([#21163](https://github.com/facebook/react/pull/21163))" //<Sebastian Markbage>//
- **[c03197063](https://github.com/facebook/react/commit/c03197063 )**: Revert "apply prettier ([#21165](https://github.com/facebook/react/pull/21165))" //<Sebastian Markbage>//
- **[94fd1214d](https://github.com/facebook/react/commit/94fd1214d )**: apply prettier ([#21165](https://github.com/facebook/react/pull/21165)) //<Behnam Mohammadi>//
- **[b130a0f5c](https://github.com/facebook/react/commit/b130a0f5c )**: Remove redundant initial of isArray ([#21163](https://github.com/facebook/react/pull/21163)) //<Behnam Mohammadi>//
- **[2c9fef32d](https://github.com/facebook/react/commit/2c9fef32d )**: Remove redundant initial of hasOwnProperty ([#21134](https://github.com/facebook/react/pull/21134)) //<Behnam Mohammadi>//
- **[1cf9978d8](https://github.com/facebook/react/commit/1cf9978d8 )**: Don't pass internals to callbacks ([#21161](https://github.com/facebook/react/pull/21161)) //<Sebastian Markbåge>//
- **[b9e4c10e9](https://github.com/facebook/react/commit/b9e4c10e9 )**: [Fizz] Implement all the DOM attributes and special cases ([#21153](https://github.com/facebook/react/pull/21153)) //<Sebastian Markbåge>//
- **[f8ef4ff57](https://github.com/facebook/react/commit/f8ef4ff57 )**: Flush discrete passive effects before paint ([#21150](https://github.com/facebook/react/pull/21150)) //<Andrew Clark>//
- **[b48b38af6](https://github.com/facebook/react/commit/b48b38af6 )**: Support nesting of startTransition and flushSync (alt) ([#21149](https://github.com/facebook/react/pull/21149)) //<Sebastian Markbåge>//

Changelog:
[General][Changed] - React Native sync for revisions c9aab1c...f7cdc89

jest_e2e[run_all_tests]

Reviewed By: rickhanlonii

Differential Revision: D27740113

fbshipit-source-id: 6e27204d78e3e16ed205170006cb97c0d6bfa957
2021-04-20 05:51:09 -07:00
Rubén Norte 114be1d217 Check existence of native methods before calling them in NativeEventEmitter
Summary:
Check the existence of `addListener` and `removeListeners` in the native module passed to `NativeEventEmitter` to determine if it can be used.

Changelog: [General][Changed] Show warning when native module without `addListener` or `removeListeners` is passed to `NativeEventEmitter`

Reviewed By: yungsters

Differential Revision: D27851425

fbshipit-source-id: c0ad3ba65a9239f5bf84548dab36e8dfbc51058a
2021-04-19 13:14:38 -07:00
Nadiia D 17be3a0032 Remove legacy context API usage
Summary:
Changelog:
[General][Removed] - Remove legacy context API usage in AppContainer

Reviewed By: kacieb

Differential Revision: D27681097

fbshipit-source-id: 7391be577955171ade5b8fd53cf274900f88e7ca
2021-04-18 16:40:40 -07:00
Kacie Bawiec 2824b68ee8 Remove defaultProps from KeyboardAvoidingView
Summary:
Changelog:
[General][Removed] Remove defaultProps from KeyboardAvoidingView

Reviewed By: lunaleaps

Differential Revision: D27770146

fbshipit-source-id: 61d56c50978cc67287d56349283959b9a32c9a0b
2021-04-16 18:30:22 -07:00