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

6833 Коммитов

Автор SHA1 Сообщение Дата
Paige Sun 3eae11e72f Migrate dev method codegenNativeComponent to be Bridgeless compatible
Summary: Changelog: [Internal] Migrate dev method codegenNativeComponent to be Bridgeless compatible

Reviewed By: RSNara

Differential Revision: D34513074

fbshipit-source-id: d71fbf066453ac8c407d0cf41c2dc7fa80c87688
2022-03-01 13:30:55 -08:00
Mo Wang 46bc521513 fix the crash caused by nil partialLoadHandler
Summary:
## Problem
the partialLoadHandler is nil on line 338 of RCTImageLoader, therefore, if there is a cached image, it would crash on line 495.

## Change
Check if partialLoadHandler is nil on line 495 to prevent the crash

Changelog: [iOS][Changed] - fix the crash caused by nil partialLoadHandler

Reviewed By: appden

Differential Revision: D34544090

fbshipit-source-id: f9965700e529c5add1e25867a3772c053447d99a
2022-03-01 00:25:02 -08:00
Rubén Norte 9d1400a1ef Add annotation to report the use of concurrent root in TTRC
Summary:
Annotate use of `ConcurrentRoot` in React in performance logger.

Changelog: [Internal]

Reviewed By: sammy-SC

Differential Revision: D34453147

fbshipit-source-id: 813a58ae964e5ae4ddf806a30597ee39d315e800
2022-02-28 19:30:41 -08:00
Gabriel Donadel Dall'Agnol e139ef0de8 chore: Add comments explaining the existence of NativeDatePickerAndroid (#33159)
Summary:
This PR adds comments explaining the reason why the `NativeDatePickerAndroid.js` file was kept when removing `DatePickerAndroid`(7a770526c6 ) in order to prevent people from trying to delete it, as this file has no references in the Github repo

## Changelog

[Internal] [Added] - Add comments explaining the existence of NativeDatePickerAndroid

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

Test Plan: Ensure builds are still working correctly, although this just adds a comment

Reviewed By: cortinico

Differential Revision: D34487638

Pulled By: lunaleaps

fbshipit-source-id: 42cb7331e98d69ff2f69f19bfbb2e65c063120f7
2022-02-28 06:25:20 -08:00
Mo Wang 189c2c8958 Synchronously render cached images
Summary:
## Problem
Previously the RN Image render the cached images asynchronously (line 555 and 594 prior to the change), which caused the images to render at least a frame later than the adjacent components.

## Change
In this change, we call partialLoadHandler with the cached image synchronously on the main thread.

Changelog: [iOS][Changed] - Synchronously render cached images

Reviewed By: p-sun

Differential Revision: D34487673

fbshipit-source-id: 0600c2fa5f7a1eca71b8582bbe968694cf211468
2022-02-25 19:38:18 -08:00
jonathanmos 8d50bf1133 Fix Switch causing RetryableMountingLayerException (#32602)
Summary:
Added a null check to native.value in Switch to fix regression from RN 66 -> stuck operation in mViewCommandOperations list in Android Release on initial layout of a screen with Switch component. If approved, please incorporate this fix into an RN 66 release.

## Changelog
[Android][Fixed] - Added a null check to native.value in Switch to fix https://github.com/facebook/react-native/issues/32594

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

Test Plan: To reproduce, put a log in UIViewOperationQueue in dispatchViewUpdates you can see that the RetryableMountingException is no longer thrown for a screen with the Switch component on Android Release. As a result, mViewCommandOperations no longer has a stuck operation on initial layout.

Reviewed By: charlesbdudley

Differential Revision: D34397788

Pulled By: lunaleaps

fbshipit-source-id: 1cee3516fb987942dfa50ad1f2d11c965a947f05
2022-02-24 17:46:41 -08:00
Dave McCabe f035f9e6bb React Native sync for revisions 27b5699...4de99b3
Summary:
This sync includes the following changes:
- **[4de99b3ca](https://github.com/facebook/react/commit/4de99b3ca )**: fix getSnapshot warning when a selector returns NaN ([#23333](https://github.com/facebook/react/pull/23333)) //<OGURA Daiki>//
- **[40eaa22d9](https://github.com/facebook/react/commit/40eaa22d9 )**: Remove dependency on Offscreen Fiber updateQueue for React Cache ([#23229](https://github.com/facebook/react/pull/23229)) //<Luna Ruan>//
- **[caf6d4707](https://github.com/facebook/react/commit/caf6d4707 )**: Enable enableCache on Test Renderer native ([#23314](https://github.com/facebook/react/pull/23314)) //<David McCabe>//
- **[419ccc2b1](https://github.com/facebook/react/commit/419ccc2b1 )**: Land skipUnmountedBoundaries experiment ([#23322](https://github.com/facebook/react/pull/23322)) //<Andrew Clark>//
- **[54f785bc5](https://github.com/facebook/react/commit/54f785bc5 )**: Disallow comments as DOM containers for createRoot ([#23321](https://github.com/facebook/react/pull/23321)) //<Andrew Clark>//
- **[e9aa9592c](https://github.com/facebook/react/commit/e9aa9592c )**: change ReactBatchConfig.transition //<Luna Ruan>//
- **[51c8411d9](https://github.com/facebook/react/commit/51c8411d9 )**: Log a recoverable error whenever hydration fails ([#23319](https://github.com/facebook/react/pull/23319)) //<Andrew Clark>//
- **[79ed5e18f](https://github.com/facebook/react/commit/79ed5e18f )**: Delete vestigial RetryAfterError logic ([#23312](https://github.com/facebook/react/pull/23312)) //<Andrew Clark>//
- **[80059bb73](https://github.com/facebook/react/commit/80059bb73 )**: Switch to client rendering if root receives update ([#23309](https://github.com/facebook/react/pull/23309)) //<Andrew Clark>//
- **[f7f7ed089](https://github.com/facebook/react/commit/f7f7ed089 )**: Allow suspending in the shell during hydration ([#23304](https://github.com/facebook/react/pull/23304)) //<Andrew Clark>//

Changelog:
[General][Changed] - React Native sync for revisions 27b5699...4de99b3

jest_e2e[run_all_tests]

Reviewed By: rickhanlonii

Differential Revision: D34399162

fbshipit-source-id: 5c49e2bdcf63eb6a601cfa6a4e4b8f2e1f83e2dd
2022-02-23 19:56:24 -08:00
Riccardo Cipolleschi 235f168574 Move the `SegmentedComponentIOS` away from React Native Core (#33140)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/33140

Pull Request resolved: https://github.com/facebook/metro/pull/776

This Diff moves the `SegmentedComponentIOS` away from the core of React Native to move forward with the Lean Core effort

## Changelog
[General][Removed] - This diff removes the `SegmentedControlIOS` export from React Native. Internally, we are requiring `SegmentedControlIOS` directly now and externally people will have to use the community maintained module (https://github.com/react-native-segmented-control).

Reviewed By: cortinico

Differential Revision: D34304255

fbshipit-source-id: d4e2b0bda56708769603be6f164e6bf89997fd93
2022-02-21 05:23:16 -08:00
David Vacca 05b4570d3f Refactor LayoutAnimation to use ReactNativeFeatureFlags
Summary:
This diff refactors LayoutAnimation to use ReactNativeFeatureFlags.ENABLE_LAYOUT_ANIMATION to enable / disable this feature

changelog: [internal] internal

Reviewed By: JoshuaGross

Differential Revision: D34349648

fbshipit-source-id: 90d1db6560867e44eeffbf03e5a84edadcdd55f9
2022-02-18 18:23:00 -08:00
David Vacca 33aba77456 Introduce ReactNativeFeatureFlags file to control FeatureFlags in React Native
Summary:
introduce ReactNativeFeatureFlags file to control FeatureFlags in React Native

changelog: [JS][Added] Create new API to configure FeatureFlags in ReactNative

Reviewed By: JoshuaGross

Differential Revision: D34349458

fbshipit-source-id: 73bb3704fc47e950ee1fcefcfaec1a85dfbcef59
2022-02-18 18:23:00 -08:00
Andrei Shikov e912c462eb Add a feature flag to disable Fabric layout animations
Summary:
tsia

Changelog: [Internal]

Reviewed By: rubennorte

Differential Revision: D34340023

fbshipit-source-id: 61956f1819f1f7e10dc2520c444fa5dd305d1363
2022-02-18 08:21:06 -08:00
Amy Lee 16feabf676 Address some RN build warnings
Summary:
Addresses build warnings for some additional compiler flags.

Changelog: [Internal]

Reviewed By: nlutsenko

Differential Revision: D34299822

fbshipit-source-id: d3d873fb600990a869cb0e6fbe9fff4ebc8c5d0e
2022-02-17 19:18:11 -08:00
Moti Zilberman c56754ae39 Add default Instance type and variance to AnimatedComponentType
Summary:
Updates `AnimatedComponentType`'s type arguments to match [`React.AbstractComponent`](https://flow.org/en/docs/react/types/#toc-react-abstractcomponent)'s more closely in [variance](https://flow.org/en/docs/types/generics/#toc-variance-sigils) and defaults (`Instance = mixed`).

Changelog: [Internal]

Reviewed By: genkikondo

Differential Revision: D34254030

fbshipit-source-id: 622d1e4ecbc493bba8ec857454dd28583b677d78
2022-02-17 13:10:58 -08:00
Andrei Shikov aca9037813 React Native sync for revisions a3bde79...27b5699
Summary:
This sync includes the following changes:
- **[27b569969](https://github.com/facebook/react/commit/27b569969 )**: Simplify cache pool contexts ([#23280](https://github.com/facebook/react/pull/23280)) //<Andrew Clark>//
- **[1fb0d0687](https://github.com/facebook/react/commit/1fb0d0687 )**: [Devtools][Transition Tracing] Add Transition callbacks to createRoot ([#23276](https://github.com/facebook/react/pull/23276)) //<Luna Ruan>//
- **[a6987bee7](https://github.com/facebook/react/commit/a6987bee7 )**: add <TracingMarker> component boilerplate ([#23275](https://github.com/facebook/react/pull/23275)) //<Luna Ruan>//
- **[796fff548](https://github.com/facebook/react/commit/796fff548 )**: Allow suspending outside a Suspense boundary ([#23267](https://github.com/facebook/react/pull/23267)) //<Andrew Clark>//
- **[64223fed8](https://github.com/facebook/react/commit/64223fed8 )**: Fix: Multiple hydration errors in same render ([#23273](https://github.com/facebook/react/pull/23273)) //<Andrew Clark>//
- **[efd8f6442](https://github.com/facebook/react/commit/efd8f6442 )**: Resolve default onRecoverableError at root init ([#23264](https://github.com/facebook/react/pull/23264)) //<Andrew Clark>//
- **[e0af1aabe](https://github.com/facebook/react/commit/e0af1aabe )**: Fix wrong context argument to `apply` //<Andrew Clark>//
- **[9b5e0517b](https://github.com/facebook/react/commit/9b5e0517b )**: Remove deprecated wildcard folder mapping ([#23256](https://github.com/facebook/react/pull/23256)) //<Andrew Clark>//
- **[274b9fb16](https://github.com/facebook/react/commit/274b9fb16 )**: Remove path resolution from internal forks plugin ([#23255](https://github.com/facebook/react/pull/23255)) //<Andrew Clark>//

Changelog:
[General][Changed] - React Native sync for revisions a3bde79...27b5699

jest_e2e[run_all_tests]

Reviewed By: rickhanlonii, kacieb

Differential Revision: D34241986

fbshipit-source-id: f6ab62df2a918728864283b4f13201275eb3b8a3
2022-02-17 12:56:13 -08:00
Moti Zilberman 35800962c1 Deprecate nonstandard Promise.prototype.done
Summary:
Deprecates the nonstandard `Promise.prototype.done` method. This also removes one call site within React Native itself that relied on this method.

As part of this we are also removing React Native's custom Flow definition for `Promise` in favour of the standard one built into Flow. This will flag uses of `done` as type errors for anyone using the default app template's `.flowconfig`.

In a future release of React Native, we will remove the `done` method from the built-in `Promise` polyfill.

Changelog:
[General][Deprecated] - Deprecate the Promise.prototype.done method and log a warning when it's called in development.

Reviewed By: yungsters

Differential Revision: D34222667

fbshipit-source-id: 4b9708ac20c45b3966fdb93e883ab7f8d80017c1
2022-02-17 09:15:03 -08:00
fabriziobertoglio1987 b2e625a517 Switch component does not disable click (#33070)
Summary:
This issue fixes https://github.com/facebook/react-native/issues/30944 fixes https://github.com/facebook/react-native/issues/30840 ([Test Case 7.1][7.1], [Test Case 7.3][7.3], [Test Case 7.5][7.5]) which affects Platform Android. Previous PR https://github.com/facebook/react-native/pull/31199.
The issue is caused by the missing prop `accessibilityState` in the Switch component.

The solution consists of passing the accessibilityState to the `AndroidSwitchNativeComponent` component as previously implemented in other components (for example, [Button][8]).

Relevant discussions https://github.com/facebook/react-native/issues/30840#issuecomment-780981316 and https://github.com/facebook/react-native/pull/31001/files#r578827409.

[8]: https://github.com/facebook/react-native/pull/31001/files#diff-4f225d043edf4cf5b8288285b6a957e2187fc0242f240bde396e41c4c25e4124R281-R289

The solution proposed in this pull request consists of:
1. Passing `accessibilityState` to the `AndroidSwitchNativeComponent`
2. If the value of prop `accessibilityState.disabled` is different from the prop `disabled`, the prop `disabled` over-rides the `accessibilityState.disabled` value.

For example:
```jsx
<Switch disabled={true} accessibilityState={{disabled: false}} />
````
becomes:
````jsx
<Switch disabled={true} accessibilityState={{disabled: true}} />
````

## 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] - Switch Component doesn't disable click functionality when disabled

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

Test Plan:
[1]. Switch has `disabled` and `accessibilityState={{disabled: false}}`
[2]. Switch has `disabled`
[3]. Switch has `accessibilityState={{disabled: true}}`
[4]. Switch has `accessibilityState={{disabled:false}}`
[5]. Switch has `disabled={false}`  and `accessibilityState={{disabled:true}}`
7. Test Cases on the main branch
[7.1]. Switch has `disabled` and `accessibilityState={{disabled: false}}`
[7.3] Switch has `accessibilityState={{disabled: true}}`
[7.5] Switch has `disabled={false}`  and `accessibilityState={{disabled:true}}`

[1]: https://github.com/fabriziobertoglio1987/react-native-notes/issues/5#issuecomment-1031168488
[2]: https://github.com/fabriziobertoglio1987/react-native-notes/issues/5#issuecomment-1031168868
[3]: https://github.com/fabriziobertoglio1987/react-native-notes/issues/5#issuecomment-1031169167
[4]: https://github.com/fabriziobertoglio1987/react-native-notes/issues/5#issuecomment-1031170883
[5]: https://github.com/fabriziobertoglio1987/react-native-notes/issues/5#issuecomment-1031170989
[7.1]: https://github.com/fabriziobertoglio1987/react-native-notes/issues/5#issuecomment-1031171560
[7.3]: https://github.com/fabriziobertoglio1987/react-native-notes/issues/5#issuecomment-1031172605
[7.5]: https://github.com/fabriziobertoglio1987/react-native-notes/issues/5#issuecomment-1031173437

Reviewed By: kacieb

Differential Revision: D34189484

Pulled By: blavalla

fbshipit-source-id: 8ea9221a5641d05c20d0309abdb3f0d02c569f2f
2022-02-16 15:02:59 -08:00
Paige Sun af793dd14d Don't error to Logview APIs not supported by new architecture that are expected to happen often
Summary:
Changelog: [Internal]

In the new architecture, when an interop component is being called, log instead of warn/error, since at the moment we expect this to happen often.

Reviewed By: fkgozali

Differential Revision: D34252666

fbshipit-source-id: 971156a1cd9ef9b788f677c49fa2c55bd86ad4fa
2022-02-16 14:18:08 -08:00
fabriziobertoglio1987 7b2d8178b1 Text Component does not announce disabled and disables click functionality when disabled (#33076)
Summary:
This issue fixes https://github.com/facebook/react-native/issues/30937 fixes https://github.com/facebook/react-native/issues/30947 fixes https://github.com/facebook/react-native/issues/30840 ([Test Case 7.1][7.1], [Test Case 7.3][7.3], [Test Case 7.5][7.5]) .
The issue is caused by:

1) The missing javascript logic on the `accessibilityState` in the Text component 6ab7ab34e5 (as previously implemented in [Button][20]).
2) The missing setter for prop `accessible` in `ReactTextAnchorViewManager` 17095c6615 (More information in previous PR https://github.com/facebook/react-native/pull/31252)

Related PR https://github.com/facebook/react-native/pull/33070 PR https://github.com/callstack/react-native-slider/pull/354

[20]: https://github.com/facebook/react-native/pull/31001/files#diff-4f225d043edf4cf5b8288285b6a957e2187fc0242f240bde396e41c4c25e4124R281-R289

## Changelog

[Android] [Fixed] - Text Component does not announce disabled and disables click functionality when disabled

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

Test Plan:
[1]. Text has `disabled` and `accessibilityState={{disabled: false}}` ([link][1])
[2]. Text has `disabled` ([link][2])
[3]. Text has `accessibilityState={{disabled: true}}` ([link][3])
[4]. Text has `accessibilityState={{disabled:false}}` ([link][4])
[5]. Text has `disabled={false}`  and `accessibilityState={{disabled:true}}` ([link][5])
[6]. Text has `accessibilityState={{disabled:true}}` and method `setAccessible` in `ReactTextAnchorViewManager` (tested on commit [b4cd8][10]) ([link][6])
7. Test Cases on the main branch
[7.1]. Text has `disabled` and `accessibilityState={{disabled: false}}` ([link][7.1])
[7.3] Text has `accessibilityState={{disabled: true}}` ([link][7.3])
[7.5] Text has `disabled={false}`  and `accessibilityState={{disabled:true}}` ([link][7.5])
[7.6] Text has `onPress callback` and `accessibilityState={{disabled: true}}` ([link][7.6])
[7.7] Text has `accessibilityState={{disabled:true}}` and no method `setAccessible` in `ReactTextAnchorViewManager` (tested on commit [c4f98dd][11]) ([link][7.7])

[1]: https://github.com/fabriziobertoglio1987/react-native-notes/issues/1#issuecomment-1033465424
[2]: https://github.com/fabriziobertoglio1987/react-native-notes/issues/1#issuecomment-1033465631
[3]: https://github.com/fabriziobertoglio1987/react-native-notes/issues/1#issuecomment-1033465706
[4]: https://github.com/fabriziobertoglio1987/react-native-notes/issues/1#issuecomment-1033465755
[5]: https://github.com/fabriziobertoglio1987/react-native-notes/issues/1#issuecomment-1033465813
[6]: https://github.com/fabriziobertoglio1987/react-native-notes/issues/1#issuecomment-1038473783
[7.1]: https://github.com/fabriziobertoglio1987/react-native-notes/issues/1#issuecomment-1033465874
[7.3]: https://github.com/fabriziobertoglio1987/react-native-notes/issues/1#issuecomment-1033465961
[7.5]: https://github.com/fabriziobertoglio1987/react-native-notes/issues/1#issuecomment-1033466018
[7.6]: https://github.com/fabriziobertoglio1987/react-native-notes/issues/1#issuecomment-1033321965
[7.7]: https://github.com/fabriziobertoglio1987/react-native-notes/issues/1#issuecomment-1038471984

[10]: 17095c6615
[11]: 6ab7ab34e5

Reviewed By: blavalla

Differential Revision: D34211793

Pulled By: ShikaSD

fbshipit-source-id: e153fb48c194f5884e30beb9172e66aca7ce1a41
2022-02-15 11:23:11 -08:00
Moti Zilberman 370c65b943 Refactor StyleSheetTypes for (internal) extensibility
Summary: Changelog: [Internal]

Reviewed By: arushikesarwani94

Differential Revision: D34188705

fbshipit-source-id: 017285553f24144f8f7eff3a126a99be6c9b2f25
2022-02-15 08:50:55 -08:00
Moti Zilberman 1814bffcc2 Minor changes to Flow types
Summary: Changelog: [Internal]

Reviewed By: arushikesarwani94

Differential Revision: D34171528

fbshipit-source-id: c3fdc4a8c77731f1f43f0e6d830d172906ed79a1
2022-02-15 08:50:55 -08:00
Paige Sun f8158f8a03 Replace DummyUIManager with BridgelessUIManager. Log errors for deprecated methods in Bridgeless.
Summary:
Changelog: [Internal]

* Rename DummyUIManager to BridgelessUIManager
* Cleanup `RCTVirtualText` & `RCTShimmeringView` since the native changes from T107747313 are already in production, so these two will components always return a viewConfig in prod.

- `console.error` when deprecated Bridge UIManager method are being accessed.
- Make sure new BridgelessUIManager.js has the same method definition as [NativeUIManager.js](https://www.internalfb.com/code/fbsource/[e80c98b816183dcdfde1e81de01ba99aa6e30ed2]/xplat/js/react-native-github/Libraries/ReactNative/NativeUIManager.js?lines=15)

Reviewed By: RSNara

Differential Revision: D34203081

fbshipit-source-id: 99aafc2372b118d0c8cc41f7376e136dabae9bd5
2022-02-14 16:31:15 -08:00
Genki Kondo 47820cba39 Optimize AnimatedColor when setting platform color
Summary:
Before, when we called setValue with a PlatformColor, we unnecessarily called setValue on all component AnimatedValues before updateAnimatedNodeConfig.

This diff also fixes a bug where if we set a PlatformColor as the initial color, calling setValue with a non-PlatformColor would not have any effect. The fix is to reset AnimatedColor.nativeColor to null upon calling setValue.

Changelog:
[Internal] Optimize AnimatedColor when setting platform color

Reviewed By: javache

Differential Revision: D34187540

fbshipit-source-id: a0005d13f392a858d2eade912f2353f67eec1fd9
2022-02-14 11:15:19 -08:00
Genki Kondo 1b3581e245 Export isSupportedProp checks in NativeAnimatedHelper
Summary:
More convenient to call these

Changelog:
[Internal] - Export isSupportedProp checks in NativeAnimatedHelper

Reviewed By: javache

Differential Revision: D34163370

fbshipit-source-id: 9e3b5e5e4a9272f9b807863dfde2c3b0fb13acd8
2022-02-11 09:56:10 -08:00
Moti Zilberman 7374dba6b0 Use ImageSource type in LogBox implementation
Summary:
Changes an internal call site that assumes image assets are `number`s to use the more general `ImageSource` type.

Changelog: [Internal]

Reviewed By: javache

Differential Revision: D34076216

fbshipit-source-id: dc0dc0c39982c87c21385828bb3357f9654d029f
2022-02-11 07:04:06 -08:00
Moti Zilberman 83b1975b90 Extend ColorValue Flow type to include numbers
Summary:
Adds `number` to the `ColorValue` union type.

Per our docs, React Native supports specifying colours as RGBA values packed into ints: https://reactnative.dev/docs/colors#color-ints. It looks like this case was missed in D6226807 (da047966e4) when we started typing the `StyleSheet` API with Flow.

Changelog: [General][Fixed] - Support numeric color values in StyleSheet's Flow types

Reviewed By: yungsters

Differential Revision: D34140748

fbshipit-source-id: 5bfe2995a473260926fa3c8b6926bb841615d393
2022-02-11 06:54:24 -08:00
Moti Zilberman 4cd50aee78 Make TimingAnimationConfig read-only
Summary:
Makes `TimingAnimationConfig` read-only, as it's purely an input type.

Changelog: [Internal]

Reviewed By: yungsters

Differential Revision: D34146703

fbshipit-source-id: 77ac7ee0641a869b62e5f95b6a7f711c71e82c7d
2022-02-11 06:02:24 -08:00
Genki Kondo 201f355479 Allow color styles to be animated with native driver
Summary:
Now that animating color styles using native driver is supported on both Android and iOS, add color styles to the allowlist in NativeAnimatedHelper.

Changelog:
[General][Added] - Allow color styles to be animated using native driver

Reviewed By: mdvacca

Differential Revision: D34148038

fbshipit-source-id: c20dc149b805ec691a3936a77ab130fb4477a4c3
2022-02-10 17:41:08 -08:00
Genki Kondo 49f3f47b1e Support color animation with native driver for iOS
Summary:
Adds support for Animated.Color with native driver for iOS. Reads the native config for the rbga channel AnimatedNodes, and on update(), converts the values into a SharedColor.

Followup changes will include support for platform colors.

Ran update_pods: https://www.internalfb.com/intern/wiki/React_Native/Preparing_to_Ship/Open_Source_Pods/

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

Reviewed By: sammy-SC

Differential Revision: D33860583

fbshipit-source-id: 990ad0f754a21e3939f2cb233bcfa793ef12eb14
2022-02-10 11:18:39 -08:00
Ramanpreet Nara e254073b17 Update ViewConfigIgnore comment
Summary:
This comment was out of date.

Changelog: [Internal]

Reviewed By: sshic

Differential Revision: D34113966

fbshipit-source-id: 0768baa9238736aea26e354792096fea6bb7fcdb
2022-02-10 08:47:22 -08:00
Andrei Shikov 980c52de41 Disable view flattening when the view has event handlers on Android
Summary:
The views with touch event props are currently flattened by Fabric core, as we don't take event listeners into account when calculating whether the view should be flattened. This results in a confusing situation when components with touch event listeners (e.g. `<View onTouchStart={() => {}} /> `) or ones using `PanResponder` are either ignored (iOS) or cause a crash (Android).

This change passes touch event props to C++ layer and uses them to calculate whether the view node should be flattened or not. It also refactors events to be kept as a singular bitset with 32 bit (~`uint32_t`).

Changelog: [Changed][General] Avoid flattening nodes with event props

Reviewed By: sammy-SC

Differential Revision: D34005536

fbshipit-source-id: 96255b389a7bfff4aa208a96fd0c173d9edf1512
2022-02-10 06:07:39 -08:00
Moti Zilberman 159eb0bdf4 Normalize platform colors early
Summary:
Changelog: [Internal]

Fixes `normalizeColor` to always return the normalized color. Previously, when normalization was delegated to `normalizeColorObject`, we would return the *original* color object, which is a bug.

Reviewed By: javache

Differential Revision: D34048595

fbshipit-source-id: 083cbe36be2311ea9cffe8ef61e6a986840aec71
2022-02-10 04:57:47 -08:00
Minsik Kim 1a83dc36ce Fix a broken input for the Korean alphabet in TextInput (#32523)
Summary:
<!-- Explain the **motivation** for making this change. What existing problem does the pull request solve? -->

Fix https://github.com/facebook/react-native/issues/32503

Updating the attributed text in TextView/TextField while inputting Korean language will break input mechanism of the Korean alphabet. This results unexpected text input.

This PR supersedes the previous fixes: https://github.com/facebook/react-native/issues/19809, https://github.com/facebook/react-native/issues/22546

## 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
-->

[iOS] [Fixed] - Fix a broken input for the Korean alphabet in TextInput

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

Test Plan: https://user-images.githubusercontent.com/20317121/140013434-1674c391-54d6-4410-b4c1-c633697e639d.mov

Reviewed By: lunaleaps, sammy-SC

Differential Revision: D32470543

Pulled By: philIip

fbshipit-source-id: e7e34bd362fa2ab2ca579103db01ad8d1a891c35
2022-02-09 22:06:55 -08:00
Kacie Bawiec a6c792db0b React Native sync for revisions 51947a1...a3bde79
Summary:
This sync includes the following changes:
- **[a3bde7974](https://github.com/facebook/react/commit/a3bde7974 )**: Exclude react-dom/unstable_testing entry point from stable releases ([#23258](https://github.com/facebook/react/pull/23258)) //<Sebastian Markbåge>//
- **[569093276](https://github.com/facebook/react/commit/569093276 )**: Add onErrorShell Callback ([#23247](https://github.com/facebook/react/pull/23247)) //<Sebastian Markbåge>//
- **[0dedfcc68](https://github.com/facebook/react/commit/0dedfcc68 )**: Update the exports field ([#23257](https://github.com/facebook/react/pull/23257)) //<Sebastian Markbåge>//
- **[9d4e8e84f](https://github.com/facebook/react/commit/9d4e8e84f )**: React Native raw event EventEmitter - intended for app-specific perf listeners and debugging ([#23232](https://github.com/facebook/react/pull/23232)) //<Joshua Gross>//
- **[1dece5235](https://github.com/facebook/react/commit/1dece5235 )**: Add back warning with component stack on Hydration mismatch ([#23241](https://github.com/facebook/react/pull/23241)) //<salazarm>//
- **[cd4eb116c](https://github.com/facebook/react/commit/cd4eb116c )**: Revert "update node.js version for CI ([#23236](https://github.com/facebook/react/pull/23236))" ([#23239](https://github.com/facebook/react/pull/23239)) //<dan>//
- **[1d7728bf9](https://github.com/facebook/react/commit/1d7728bf9 )**: update node.js version for CI ([#23236](https://github.com/facebook/react/pull/23236)) //<sunderls>//
- **[848e802d2](https://github.com/facebook/react/commit/848e802d2 )**: Add onRecoverableError option to hydrateRoot, createRoot ([#23207](https://github.com/facebook/react/pull/23207)) //<Andrew Clark>//
- **[5318971f5](https://github.com/facebook/react/commit/5318971f5 )**: Remove logic for multiple error recovery attempts ([#23227](https://github.com/facebook/react/pull/23227)) //<Andrew Clark>//
- **[3a4462129](https://github.com/facebook/react/commit/3a4462129 )**: Disable avoidThisFallback support in Fizz  ([#23224](https://github.com/facebook/react/pull/23224)) //<salazarm>//
- **[0318ac2c4](https://github.com/facebook/react/commit/0318ac2c4 )**: Revert 4f5449 //<Ricky>//
- **[4f5449eb4](https://github.com/facebook/react/commit/4f5449eb4 )**: Remove main from scheduler `index.js` //<Ricky>//
- **[3f5ff16c1](https://github.com/facebook/react/commit/3f5ff16c1 )**: [Hydration] Fallback to client render if server rendered extra nodes ([#23176](https://github.com/facebook/react/pull/23176)) //<salazarm>//
- **[529dc3ce8](https://github.com/facebook/react/commit/529dc3ce8 )**: Fix context providers in SSR when handling multiple requests ([#23171](https://github.com/facebook/react/pull/23171)) //<Fran Dios>//
- **[505c15c9e](https://github.com/facebook/react/commit/505c15c9e )**: Don't inject timeline hooks unless React supports profiling ([#23151](https://github.com/facebook/react/pull/23151)) //<Brian Vaughn>//
- **[e12a9dfc9](https://github.com/facebook/react/commit/e12a9dfc9 )**: Fix production-only updateSyncExternalStore() crash when doing setState in render ([#23150](https://github.com/facebook/react/pull/23150)) //<Douglas Armstrong>//
- **[e48940255](https://github.com/facebook/react/commit/e48940255 )**: Warn when a callback ref returns a function ([#23145](https://github.com/facebook/react/pull/23145)) //<Dan Abramov>//
- **[d8cfeaf22](https://github.com/facebook/react/commit/d8cfeaf22 )**: Fix context propagation for offscreen/fallback trees ([#23095](https://github.com/facebook/react/pull/23095)) //<Dan Abramov>//
- **[d50482478](https://github.com/facebook/react/commit/d50482478 )**: Enable scheduling profiler flag in react-dom/testing builds ([#23142](https://github.com/facebook/react/pull/23142)) //<Brian Vaughn>//
- **[790b5246f](https://github.com/facebook/react/commit/790b5246f )**: Fix setState ignored in Safari when iframe is added to DOM in the same commit ([#23111](https://github.com/facebook/react/pull/23111)) //<Dan Abramov>//

Changelog:
[General][Changed] - React Native sync for revisions 51947a1...a3bde79

jest_e2e[run_all_tests]

Reviewed By: ShikaSD

Differential Revision: D34108924

fbshipit-source-id: 96acb66c1a7da79d6ef9403490cd0e29ad23d9fb
2022-02-09 11:24:29 -08:00
Ramanpreet Nara 971ba5c26b Re-introduce {eventName}: true ViewConfig ValidAttributes in Static ViewConfigs
Summary:
# Problem
I removed the {eventName}: true entries from ViewConfigs validAttributes in D33303950 (ca5aaa7663). These entries were iOS-only. I removed them to achieve platform-consistency in native ViewConfigs.

This change broke the onLayout event for all React Native components. So, I reverted D33303950 (ca5aaa7663) for native ViewConfigs server-side. But I never got around to reverting D33303950 (ca5aaa7663) for static ViewConfigs.

# Changes
This diff reverts D33303950 (ca5aaa7663) for Static ViewConfigs, with server-side gating.

Now, these {eventName}: true ViewConfig validAttribute will be inserted into all view configs (static and native) **by default**.

Calling RCTDisableViewConfigEventValidAttributes(YES) on iOS will remove {eventName}: true ViewConfig ValidAttributes entries from Static ViewConfigs. (Previously, this method only removed the entries from native ViewConfigs).

https://www.internalfb.com/code/fbsource/[6615b0675bdf]/fbobjc/Apps/Wilde/FBReactModule2/FBReactModuleAPI/FBReactModuleAPI/Exported/FBReactModule.mm?lines=344

Changelog: [Internal]

Reviewed By: yungsters

Differential Revision: D33933403

fbshipit-source-id: 17823ed99f97d7851f04e5cdab9c95667df13253
2022-02-08 19:11:08 -08:00
Ramanpreet Nara f89ed90a1e Remove the onChange event for Slider
Summary:
The onChange event for slider isn't necessary. Instead, it uses onValueChanged.

## What motivated this change?
After D33933403, the SliderNativeComponent starts generating an onChange: true entry in its static ViewConfig's validAttributes map.

**The Problem:** Slider inherits the onChange event from RCTViewManager. And in RCTViewManager, onChange is defined as an event that doesn't generate a ViewConfig validAttribute:
1. onChange is exported from [RCTViewManager customBubblingEventTypes](https://www.internalfb.com/code/fbsource/[210a214c9da7a847dd8840cae9f8341ed39a2ff6]/xplat/js/react-native-github/React/Views/RCTViewManager.m?lines=99%2C105%2C118)
2. Events exported from customBubblingEventTypes [don't insert into validAttributes](https://www.internalfb.com/code/fbsource/[8237815744b8cf7e38d9cf107a55c015f7b1545b]/xplat/js/react-native-github/React/Views/RCTComponentData.m?lines=393-398).

To summarize:
- onChange isn't used by slider
- onChange generates an onChange: true entry in SVCs
- onChange **doesn't** generate an onChange: true entry in NVC

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D34052662

fbshipit-source-id: 76bfd75c1ecbaa40d33e2b097b1f4458bf200ac2
2022-02-08 19:11:07 -08:00
Ramanpreet Nara 95f950de2a Move validateStaticViewConfigs to RNHostComponentList route
Summary:
This function is only used by the RNHostComponentList route. Let's move it into the route, so that we could keep the StaticViewConfigValidator slim.

This will also allow us to more heavily customize this function for the route.

Changelog: [Internal]

Reviewed By: p-sun

Differential Revision: D34026073

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

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

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

Reviewed By: javache, mdvacca

Differential Revision: D34025193

fbshipit-source-id: 8b368f6b7cb2cf7cebe8b66461cd4185cbadd44c
2022-02-08 16:31:14 -08:00
Joshua Gross 271b9132bc Rename RawEventTelemetryEventEmitter to RawEventEmitter
Summary:
This event listener does nothing by default and will do nothing if (developer) users don't explicitly create some telemetry system for their own app.

This EventEmitter makes that easier but isn't necessarily tied to telemetry, especially since it does nothing at all by default.

Changelog: [Internal]

Reviewed By: yungsters

Differential Revision: D34060116

fbshipit-source-id: 9345a52f502e0225358fdaa1431c052a70fa54ce
2022-02-07 18:19:53 -08:00
Joshua Gross 1f15a64028 Add RawEventTelemetryEventEmitter interface to ReactNativePrivateInterface
Summary:
This will be used from the React JS renderer in a followup PR.

Changelog: [Added][JS] New event telemetry mechanism exposed from JS to supercede the Pressability-specific telemetry mechanism

Reviewed By: ryancat

Differential Revision: D33986916

fbshipit-source-id: 912d0b351869348f0ca6e5f6a882fc0501c2c7f0
2022-02-07 15:44:17 -08:00
Hetan Thakkar 3eddc9abb7 Opacity in TouchableOpacity properly react to state change (#32956)
Summary:
This PR fixes the opacity bug where it fails to properly react to state change. This PR resolves the issue detailed in https://github.com/facebook/react-native/issues/32476

## 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] - Fixed opacity value in TouchableOpacity

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

Test Plan: The code I added in componentDidUpdate does solve the issue and passes all the test cases

Reviewed By: ryancat

Differential Revision: D33766718

Pulled By: cortinico

fbshipit-source-id: 951bedf22619fc12e66156d0a6074cd8adf1d3eb
2022-02-07 04:23:01 -08:00
Moses DeJong eb19499484 Enable custom sound for local notification in PushNotificationIOS
Summary:
Add soundName property in NativePushNotificationManagerIOS JS module and deliver to native local notification API.
Changelog:
[iOS][Fixed] - Enable custom sound for local push notifications.

Reviewed By: RSNara

Differential Revision: D33898630

fbshipit-source-id: c6362032601f0f6d20479465ce1f0a84c450ea72
2022-02-04 18:16:19 -08:00
Moses DeJong 3633a05299 Invoke registerForRemoteNotifications on main UI thread to avoid error messages in Xcode
Summary:
Invoke registerForRemoteNotifications on main UI thread to avoid error messages in Xcode.

Changelog:
[iOS][Fixed] - Invoke registerForRemoteNotifications on main UI thread.

Reviewed By: philIip

Differential Revision: D33780141

fbshipit-source-id: 64b825dfc15e7ac262e210b90bb334a7e415e402
2022-02-04 18:16:19 -08:00
Ramanpreet Nara b8a2f34dee Make lefthandObjectDiff private to verifyComponentAttributeEquivalence
Summary:
## Rationale
verifyComponentAttributeEquivalence is the legacy check for making sure that Static ViewConfigs match Native ViewConfigs. Eventually, we should just delete this module/check from the codebase.

## Changes
This diff migrates the RNHostComponentViewConfig differences screen to display the ViewConfig differences using the new StaticViewConfigValidator validation result vs the legacy validator's lefthandObjectDiff method.

## Benefits:
- Now, **all the diffing logic** on this route uses the new StaticViewConfigValidator.
- This takes us one step closer towards deleting verifyComponentAttributeEquivalence
- StaticViewConfigValidator [supports ignoring ViewConfig properties](https://fburl.com/code/2it5r7py). Now, the RNHostComponentViewConfig respects these ignores.

Changelog: [Internal]

Reviewed By: p-sun

Differential Revision: D34017602

fbshipit-source-id: 3ad909adcbb95b932a269dd55dd5445834a9cfd4
2022-02-04 16:21:00 -08:00
Moti Zilberman 8c5cacf30e Fix type import style in EventEmitter and Linking
Summary:
Changelog: [Internal]

Fixes some files to use the preferred `import type {Foo}` syntax instead of `import {type Foo}`.

Reviewed By: rh389

Differential Revision: D34001108

fbshipit-source-id: 64675fefa71b6832118eabc60c825c65b87514d9
2022-02-04 05:27:56 -08:00
Moti Zilberman b2f871a6fa Fix crash with SectionList.scrollToLocation and private property munging
Summary:
Changelog:
[General][Fixed] - Remove illegal private property access in VirtualizedSectionList.scrollToLocation

`VirtualizedSectionList.scrollToLocation` internally uses `VirtualizedList`'s `_getFrameMetricsApprox` method. This method is private by convention (since it's `_`-prefixed), but under certain build setups this is also enforced at runtime, so using `scrollToLocation` can throw an error.

Here, we rename this internal method to `__getFrameMetricsApprox` (adding another leading underscore) which opts it out of being treated as private, while still communicating that it's not part of the public API. We also delete the Flow error suppression that masked this issue.

For reference: This convention for private methods (including the double-underscore opt out) has its roots in Facebook's pre-Babel [JSTransform](https://github.com/facebookarchive/jstransform/blob/master/visitors/es6-class-visitors.js) compiler and is implemented in Flow as [`munge_underscores=true`](https://flow.org/en/docs/config/options/#toc-munge-underscores-boolean).

Reviewed By: yungsters

Differential Revision: D33982339

fbshipit-source-id: 498563c59d42549c94fe90d363677d6d3ea35d2d
2022-02-03 17:34:50 -08:00
Moti Zilberman 6584304c10 Make Animated.Interpolation config read-only
Summary:
Changelog:
[General] [Changed] Type the argument of Animated.interpolate as read-only

Reviewed By: javache

Differential Revision: D33950698

fbshipit-source-id: b959d34eb9752358f4a8ba1d290b56c099f535e0
2022-02-03 03:45:23 -08:00
Genki Kondo 1f778014a7 Fix JS animated node value updating when listener is attached
Summary:
The JS-side animated node values were not being updated on AnimatedValue (and thus AnimatedValueXY); however, the native event "onAnimatedValueUpdate" is being handled properly in AnimatedNode. It turns out that single underscore prefixed methods are obfuscated at FB. And thus AnimatedValue._onAnimatedValueUpdateReceived was not getting called. Changing the method name to double underscore as a way to denote "protected" fixes the issue.

Changelog:
[General][Fixed] - JS animated node value updates properly when listener is attached

Reviewed By: yungsters

Differential Revision: D33962038

fbshipit-source-id: c4f60e1f1ccc0cef3e65b89034bdb91376a26416
2022-02-02 19:56:43 -08:00
Tim Yung 3e229f27bc RN: Remove `propTypes` from Image, Text, and TextInput
Summary:
Removes the `propTypes` member from the `Image`, `Text`, and `TextInput` components.

They have been deprecated since React Native v0.66.

Changelog:
[General][Removed] - Removed `Image.propTypes`, `Text.propTypes`, and `TextInput.propTypes`.

Reviewed By: kacieb

Differential Revision: D33750298

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

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

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

Reviewed By: yungsters

Differential Revision: D33922266

fbshipit-source-id: 04d39a5ce0872b31d06ffbd4639d2f2213cf3314
2022-02-01 16:12:30 -08:00
Ramanpreet Nara 7b9490b4b1 Introduce PlatformBaseViewConfig and fix SVC for RCTView
Summary:
## Impact
Fix the Static ViewConfig for <View/>.

This diff fixes the base ViewConfig for all HostComponents on both platforms. Consequently, it simplifies SVC reconciliation efforts, by nearly eliminating the first of these classes of SVC errors:
1. Unexpected properties in SVC
2. Missing properties in SVC
3. Not matching properites in SVC

## What is the base ViewConfig on each iOS/Android?
**On iOS:**
- All props come from ViewManagers
- All HostComponent ViewManagers extend <View/> ViewManager

https://pxl.cl/1SxdF

Therefore, the base ViewConfig for all components should be <View/>'s static ViewConfig.

**On Android:**

The component model is a bit more complicated:

https://pxl.cl/1Vmp5

Takeaways:
- Props come from Shadow Nodes **and** ViewManagers
- Nearly all HostComponent ViewManagers extend BaseViewManager. But, that's not <View/>'s ViewManager.
- <View/>'s ViewManager is [ReactViewManager](https://fburl.com/code/0zalv8zk), which is a descendent of BaseViewManager, and declares its own ReactProps.

So, on Android, it's not safe for the base ViewConfig to be <View>'s ViewConfig:
1. No components actualy incorportate <View/>'s props
2. Some components don't even incorporate BaseViewManager's props.

So, what should the base ViewConfig be on Android?
- Nearly all components extend BaseViewManager. BaseViewManager must have a shadow node [that extends LayoutShadowNode](https://www.internalfb.com/code/fbsource/[47d68ebc06e64d97da9d069f1ab662b392f0df8a]/xplat/js/react-native-github/ReactAndroid/src/main/java/com/facebook/react/uimanager/BaseViewManager.java?lines=40). Therefore, we'll make the base ViewConfig on Android be generated by BaseViewManager + LayoutShadowNode.

## Changes
In this diff, I removed ReactNativeViewViewConfig, and introduced a new view config called PlatformBaseViewConfig. This ViewConfig partial will capture all the props available on all HostComponents on **both** platforms. This may not necessarily be the props made available on <View/>.

The only components that don't extend the base platform props are: RCTTextInlineImage. What we do with these components is TBD.

Changelog: [Internal]

Reviewed By: p-sun, yungsters

Differential Revision: D33135055

fbshipit-source-id: 7299f60ae45ed499ce47c0d0a6309a047bff90bb
2022-01-31 14:52:32 -08:00