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

24148 Коммитов

Автор SHA1 Сообщение Дата
Alfonso Curbelo c1db41f060 Fixed - Text with adjustsFontSizeToFit changes the text layout infinitely (#33135)
Summary:
Fixes the infinite loop explained in the issue https://github.com/facebook/react-native/issues/33129 by reverting commit  59021521e7. PR https://github.com/facebook/react-native/pull/31538.

`onCollectExtraUpdates` is part of the node update cycle. By marking the node as updated `markUpdated()` in `onCollectExtraUpdates` we are restarting the update infinitely.

Unfortunately, reverting this PR also reintroduces the original issue https://github.com/facebook/react-native/issues/30717 which IMO is minor compared to the infinite loop.

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

[Android] [Fixed] - Text with adjustsFontSizeToFit changes the text layout infinitely

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

Test Plan:
I added a console.log to the Text `onTextLayout` in [packages/rn-tester/js/examples/Text/TextAdjustsDynamicLayoutExample.js ](https://github.com/facebook/react-native/blob/main/packages/rn-tester/js/examples/Text/TextAdjustsDynamicLayoutExample.js) to see if the infinite loop is gone.

![image](https://user-images.githubusercontent.com/3791120/154523914-e6aa7cf5-7a1c-488f-a392-898f4c85a833.png)

![Screen Shot 2022-02-17 at 11 20 31 AM](https://user-images.githubusercontent.com/3791120/154524274-880c3bed-d2c6-456b-8947-42e75793c424.jpg)

```

Reviewed By: ShikaSD

Differential Revision: D34310218

Pulled By: lunaleaps

fbshipit-source-id: 0d40f49d15c562ec25983145897bd95dc182f897
2022-02-17 13:46:23 -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
Nicola Corti e695bc0bb5 Set a resolution strategy for com.facebook.react:react-native when on New Architecture. (#33134)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/33134

When a user is enabling New Architecture, we should make sure they don't accidentally mix
imports of React Native from source vs prebuilts.

With this resolution strategy, we'll make sure all the import of `com.facebook.react:react-native:+`
will be resolved to the correct dependency.

Changelog:
[Android] [Fixed] - Set a resolution strategy for com.facebook.react:react-native when on New Architecture

Reviewed By: ShikaSD

Differential Revision: D34303267

fbshipit-source-id: 492fec59175c5887571e1b09ca8e233584b45dd1
2022-02-17 12:31:30 -08:00
Yann Pringault 2db1bca952 Remove prettier from dependencies (#33125)
Summary:
`prettier` should not be declared in dependencies in the ESLint config because it can trigger issues when a different version is installed on the client app.

`prettier` is already declared as `peerDependencies` and in the [README](https://github.com/facebook/react-native/blob/main/packages/eslint-config-react-native-community/README.md), it's explicitly asked to install it:

```
yarn add --dev eslint prettier react-native-community/eslint-config
```

## 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] - Remove prettier from dependencies in eslint-config

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

Test Plan: - Install the package `react-native-community/eslint-config` and ensure everything works the same as before

Reviewed By: yungsters

Differential Revision: D34305118

Pulled By: ShikaSD

fbshipit-source-id: 65a3a79008cd5e28cc6aa93ef4a5032990b4e9f8
2022-02-17 09:18:55 -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
Nicola Corti 062c1f7277 Unblock CI by disabling integration testing for `test_ios_unit_hermes` (#33128)
Summary:
I'm disabling the integration test step for `test_ios_unit_hermes` as they're currently failign wiht a
`SIGSEGV` introduced by 9010bfe457

The change is legit, but is introducing an ABI incompatibility that is making the app crash at runtime.
We can re-enable them as soon as Hermes 0.12.0 is released.

## Changelog

[Internal] - Unblock CI by disabling integration testing for `test_ios_unit_hermes`

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

Test Plan: Will wait for a Circle CI green before merging

Reviewed By: neildhar

Differential Revision: D34285751

Pulled By: cortinico

fbshipit-source-id: 40f8e3d1b41fc4d5f0459003dcd19d651aefbeb7
2022-02-16 15:18:56 -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
Nicola Corti f11dcfaea1 Allow to setup a Gradle Enterprise instance via an external script
Summary:
This diff allows to setup a Gradle Enterprise instance
either locally or on CI via an external Gradle script.

I've create a `.sample` script that users can copy to
start setting up their GE instance, should they have one.

Moreover, it applies the `com.gradle.enterprise` Gradle
plugin by default. This has the positive side effect of
not invalidating build cache for the included build if
you happen to pass the `--scan` flag in OSS (as the
classpath isn't changed).

Changelog:
[Android] [Added] - Allow to setup a Gradle Enterprise instance via an external script

Reviewed By: mdvacca

Differential Revision: D33582388

fbshipit-source-id: 0c2f073cf7a8e39963b0adfc3b339b14c1e7759b
2022-02-16 06:37:56 -08:00
maaxg 7e8cce3d2d @react-native-community/viewpager is no longer supported (#33095)
Summary:
This pull request makes a simple change in the link of the lib [react-native-community/viewpager](https://www.npmjs.com/package/react-native-community/viewpager) that is no longer supported, the recommendation it's to use [react-native-pager-view](https://github.com/callstack/react-native-pager-view) instead.

## 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
-->
[Android] [Changed] - ViewPagerAndroid recommendation link.

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

Reviewed By: cortinico

Differential Revision: D34216746

Pulled By: ShikaSD

fbshipit-source-id: c813d11557d0abc08ef4350538e2f211417f025b
2022-02-16 04:44:55 -08:00
Janic Duplessis 8935d6e697 Fix action sheet callback invoked more than once on iPad (#33099)
Summary:
iOS will sometimes invoke the UIAlertAction handler for the cancel button more than once on iPad. This can be reproduced relatively easily by having a button that opens an action sheet and spam tapping outside the action sheet while it is opening. Since native module callbacks can only be invoked once this causes the app to crash here https://github.com/facebook/react-native/blob/main/ReactCommon/react/nativemodule/core/platform/ios/RCTTurboModule.mm#L206.

## Changelog

[iOS] [Fixed] - Fix action sheet callback invoked more than once on iPad

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

Test Plan: Tested on iPad simulator to reproduce the crash and verified that this fixes it.

Reviewed By: philIip

Differential Revision: D34215327

Pulled By: ShikaSD

fbshipit-source-id: 6f406e4df737a57e6dd702dd54260aa72eab31d6
2022-02-16 04:38:50 -08:00
Tim Yung c1a55c766f RN: Upgrade to `coveralls@^3.1.1`
Summary: Upgrades `repo-config/package.json` to `coveralls@^3.1.1`, which removes the security vulnerability in `json-schema<0.4.0`.

Reviewed By: GijsWeterings

Differential Revision: D33961117

fbshipit-source-id: 375bd641686533d52f42adb9155dd642ae4c7cef
2022-02-16 00:23:59 -08:00
Tim Yung 297a43de99 RN: Upgrade `bots/` Dependencies
Summary:
Updates all dependencies in `bots/`, which also removes a security vulnerability with `websocket-extensions@<0.1.4`.

Changelog:
[Internal]

Reviewed By: GijsWeterings

Differential Revision: D33960461

fbshipit-source-id: 2d32ceba5ab09dc1bed5d6edc26a5134042dd29f
2022-02-16 00:23:59 -08:00
David Vacca 78e03b6fb7 Refactor of Fb4aReactFabricPerfLogger
Summary:
This diff refactors Fb4aReactFabricPerfLogger in order consume fabric commit statistics outside of fabric

changelog: [internal] internal

Reviewed By: sshic

Differential Revision: D34056540

fbshipit-source-id: 8f3b8003e1601ca36c9ba57be874a40bad455235
2022-02-16 00:23:59 -08:00
David Vacca 8dddff5547 Refactor logging of Fabric commit statistics
Summary:
This is a refactor of the logging of Fabric commit statistics to simplify the way we track performance points.

we'll later refactor and iterate on the API to integrate fabric perf point into developer tools

changelog: [internal] internal

Reviewed By: ShikaSD

Differential Revision: D34006700

fbshipit-source-id: 93a01accd90dfacc8b44edd158033b442a843284
2022-02-16 00:23:59 -08:00
David Vacca 6ab5bb6869 Rename ReactNativeConfig.getInt64 -> ReactNativeConfig.getLong
Summary:
In this I'm renaming ReactNativeConfig.getInt64 -> ReactNativeConfig.getLong

changelog: [internal] internal

Reviewed By: javache, philIip

Differential Revision: D33901536

fbshipit-source-id: 688aff9a849299eb8ad904b75b03d7fb5f0d8172
2022-02-15 15:21:38 -08:00
Pieter De Baets 45af635b1e Fix some nits/typos in MapBuffer
Summary:
Was trying out some behaviour when using the MapBuffer experiment and fixed some small issues.

Changelog: [Internal]

Reviewed By: ShikaSD

Differential Revision: D34108859

fbshipit-source-id: 550ca0847419006ec17472cc4b70d38fc8d05396
2022-02-15 14:06:42 -08:00
Genki Kondo 9f6f97151c Fix ReactHorizontalScrollView contentOffset
Summary:
Brings the same fix https://www.internalfb.com/diff/D34015853 (be260b9f47) for ReactScrollView to ReactHorizontalScrollView

When setting ScrollView's contentOffset, if the ScrollView hasn't been laid out yet when ReactHorizontalScrollViewManager.setContentOffset is called, then scroll position is never set properly. This is because the actual scroll offset (0, 0) was being passed into setPendingContentOffsets, instead of the desired scroll offset. Thus, when ReactHorizontalScrollView.onLayout gets called, ReactHorizontalScrollView.scrollTo gets called with (0, 0).

Changelog:
[Android][Fixed] - Fix ReactHorizontalScrollView contentOffset

Reviewed By: bvanderhoof

Differential Revision: D34246489

fbshipit-source-id: d923f7c9f136f7275d64bd658ffd5c2cc049d392
2022-02-15 13:09:29 -08:00
Pieter De Baets 90b98efa73 Resume LockFreeEventDispatcher from onHostResume
Summary:
Found that after backgrounding `mShouldStop` would always remain true, which prevents events from being dispatched / scheduled.

Changelog: [Internal]

Reviewed By: JoshuaGross

Differential Revision: D34247567

fbshipit-source-id: 63876986dc0cee5e2a73cb4f8a35d90379d9f8ea
2022-02-15 13:05:38 -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
Andrei Shikov a86c521f50 Remove optional codegen config inside template (#33108)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/33108

The codegen config is optional and can be removed from the default package.json configuration in the template to simplify 0.68 upgrade for people who are not opted-in to the new arch.

Changelog: [Internal] - Remove optional codegenConfig field from template

Reviewed By: cortinico

Differential Revision: D34216988

fbshipit-source-id: 5c448472eed99bc112aef204c4025454171a83c5
2022-02-15 05:45:24 -08:00
Kunal Farmah 8c573d9336 Added fail-safe check to catch MissingWebViewPackage Exception. (#33088)
Summary:
The check implemented in PR https://github.com/facebook/react-native/issues/29089 is flawed as the exception class name and message depends on the OS version as well as the OEM. In OxygenOS running android 11, it comes out as RuntimeException and the check fails and hence the crash occurs again. But on observing closely, its clear that the exception message is consistent across OEMs with similar strings appearing in them that have been included in the if check.
Hence there is a simple fix to this issue, by checking the message instead of the exception class.

Here is the snippet:

```
private Nullable CookieManager getCookieManager() {
    if (mCookieManager == null) {
      possiblyWorkaroundSyncManager(mContext);
      try {
        mCookieManager = CookieManager.getInstance();
      } catch (IllegalArgumentException ex) {
        // https://bugs.chromium.org/p/chromium/issues/detail?id=559720
        return null;
      } catch (Exception exception) {
        String message = exception.getMessage();
        // We cannot catch MissingWebViewPackageException as it is in a private / system API
        // class. This validates the exception's message to ensure we are only handling this
        // specific exception.
        // The exception class doesn't always contain the correct name as it depends on the OEM
        // and OS version. It is better to check the message for clues regarding the exception
        // as that is somewhat consistent across OEMs.
        // For instance, the Exception thrown on OxygenOS 11 is a RuntimeException but the message contains the required strings.
        // https://android.googlesource.com/platform/frameworks/base/+/master/core/java/android/webkit/WebViewFactory.java#348
       if (exception.getClass().getCanonicalName().contains("MissingWebViewPackageException") ||
            (message!=null && (message.contains("WebView provider") ||
               message.contains("No WebView installed")))){
            return null;
        } else {
          throw exception;
        }
      }
    }

    return mCookieManager;
  }
```

## Changelog

[General] [Added] - A fail proof check to catch any crash involving webview:
if (exception.getClass().getCanonicalName().contains("MissingWebViewPackageException") || (message!=null && (message.contains("WebView provider") || message.contains("No WebView installed"))))
[General] [Removed] - Flawed check to catch WebViewProvider crash:
if (message != null && exception.getClass().getCanonicalName().contains("MissingWebViewPackageException"))

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

Test Plan:
This code has been tested rigorously on OnePlus Nord CE 5G (Oxygen OS 11.0) and Realme X (Realme UI 2.0) both running on Android 11 and reproducing the crash on a hybrid (Native android + ReactNative) app that showed this crash in production being dependent on WebViews. I have implemented an entire patched fork of 0.67.2 to fix this issue in our app.

How to test:

Launch any app that has a webview.
Go to settings->apps->Android System Webview -> disable.
Resume/Restart the app.

In this fix:
Open a webview and notice that the app will not crash.

In current version:
App crashes on startup as the exception escapes the catch block.
Even if it survives startup (did on Realme X), it will crash once you try to open a webview.

Reviewed By: rh389

Differential Revision: D34240097

Pulled By: cortinico

fbshipit-source-id: 0f1f9a3b078c0ad3074c7841392892cb70b427eb
2022-02-15 04:50:51 -08:00
Neil Dhar 9010bfe457 Add PropNameID::fromSymbol
Summary:
Changelog:
[General][Added] - Add ability to access properties with symbol keys through JSI

Reviewed By: mhorowitz

Differential Revision: D33830544

fbshipit-source-id: 8de366b4c7d5ea9d2fd5df70dfb776a056e23806
2022-02-14 22:29:16 -08:00
Paige Sun 3c4850d76b (Easy) Log errors to Logview when Bridge is used in Bridgeless
Summary:
Changelog: [Internal]

# Diff Changes
- Set `RCTEnableNewArchitectureViolationReporting` to YES in app-wide Bridgeless mode.
- Rename `RCTWarnNotAllowedForNewArchitecture` to `RCTErrorNotAllowedForNewArchitecture`, and use `RCTLogError` instead of `RCTLogWarn` so the error goes to Logview.

Reviewed By: RSNara

Differential Revision: D34202682

fbshipit-source-id: 471486c65f7a42f8f11140e61ff60592dc826f61
2022-02-14 19:42:07 -08:00
Paige Sun 74f5697fdc Fix RCTLogError and RCTLogWarn to display RedBox or LogBox in Bridgeless
Summary:
Changelog: [Internal]

After the diff Bridgeless and Bridge behaves the same for `RCTLogError` and `RCTLogWarn`.

Reviewed By: RSNara

Differential Revision: D34197703

fbshipit-source-id: 0645857aad609fa911df6681de9c0c251cf72a36
2022-02-14 19:42:07 -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
David Vacca 2b845d5585 Integrate DeviceConfig into ReactNativePanelApps
Summary:
This diff integrates DeviceConfig into ReactNativeConfig used by ReactNativePanelApps. The goal is to be able to control Fabric MCs using GKs and QEs in RN VR apps

I did an audit of the MCs that were used by RNPanelApps:

```
"react_fabric:enabled_android_fabric_logs": -> will get data from GK (disabled by default)
"react_fabric:disable_virtual_node_preallocation": -> does not exist in code anymore
"react_fabric:enable_early_event_emitter_update": -> will get data from MC (disabled using static value)
"react_fabric:enable_background_executor_android": -> does not exist in code anymore
"react_fabric:enable_props_forwarding_android": -> does not exist in code anymore
"react_fabric:remove_outstanding_surfaces_on_destruction_android":  -> will get data from MC static value (ENABLED using static value)
"react_fabric:enable_large_text_measure_cache_android":  -> will get data from MC default value (ENABLED by default)
```

changelog: [internal] internal

Reviewed By: JoshuaGross

Differential Revision: D33898210

fbshipit-source-id: 0ea1e0e2fc15929bec328f7dcc9410efa9925b34
2022-02-14 11:19:01 -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
Janic Duplessis 899da15a31 Remove unused _callbacks hashmap (#33097)
Summary:
Stumbled upon this unused code.

## Changelog

[Internal] [Fixed] - Remove unused _callbacks hashmap

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

Test Plan: Test it still builds

Reviewed By: philIip

Differential Revision: D34215314

Pulled By: ShikaSD

fbshipit-source-id: 7357a9be725d57b37f697f7222b95c1fd1d9f67c
2022-02-14 11:01:49 -08:00
Rob Hogan f89a0b765c Bump direct Metro dependencies to 0.68.0
Summary:
While React Native depends on the `metro` package indirectly (via the CLI package), it depends on some secondary Metro packages directly. This diff updates those direct dependencies to use [Metro 0.68.0](https://github.com/facebook/metro/releases/tag/v0.68.0).

Changelog:
[General] Update direct Metro dependencies to 0.68.0

Reviewed By: motiz88

Differential Revision: D34108380

fbshipit-source-id: 06bddfcc16e0f715d6d120e48b37c64fda300c38
2022-02-14 03:49:45 -08:00
Phillip Pan 7cece34233 test RCTView with c swizzling example
Summary:
writing a test that has an example of c swizzling in oss. testing this:

https://www.internalfb.com/code/fbsource/[c58818169205f1e0fa816968efdb4c3fac8333e9]/xplat/js/react-native-github/React/Views/RCTView.m?lines=452-454%2C460-468

Changelog: [Internal]

Reviewed By: RSNara

Differential Revision: D31949237

fbshipit-source-id: f16c98ec1a736f3f2152d1e411b693083519a7b9
2022-02-11 13:46:02 -08:00
Dark Knight 8b24ce6720 Revert D34149878
Summary:
This diff is reverting D34149878 (9bc6c0f8a5)
D34149878 (9bc6c0f8a5) is making the following tests to fail and this revert diff is either the revert of the blame diff or the revert of the stack of diffs that need to be reverted to revert the blame diff
Tests affected:
- https://www.internalfb.com/intern/test/281475012591721/
Multisect link:
https://www.internalfb.com/intern/testinfra/multisect/725030

Reviewed By: mdvacca

Differential Revision: D34163348

fbshipit-source-id: 697b42474aec6168c916c1271678d11ae1c4b749
2022-02-11 13:33:07 -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
Samuel Susla cefc056241 Remove flag react_native_new_architecture:runtimescheduler_enable_yielding_ios
Summary:
changelog: [internal]

This is shipped on iOS, let's remove gating.

Reviewed By: javache

Differential Revision: D34144360

fbshipit-source-id: 8ca1b3a061470155405bf1b71cdc9ddda6fc2be3
2022-02-11 07:16:30 -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
Rob Hogan 89c3aac6e1 Remove `@babel/plugin-transform-object-assign` from preprocessor
Summary:
React Native has an *implicit* dev dependency on this transform via `metro-react-native-babel-transformer`. The transform replaces `Object.assign` with `babelHelpers.extend`, but `Object.assign` has been available natively since node 4.

We intend remove it from metro (https://github.com/facebook/metro/pull/745) as it's no longer needed by any supported runtime - removing RN's small dependency in advance so RN's tests won't break when we do.

Changelog:
[Internal][Changed] - Remove `babel/plugin-transform-object-assign` from jest preprocessor

Reviewed By: motiz88

Differential Revision: D34110208

fbshipit-source-id: 064f8241461fb338de1cd8b53077e8660301aa77
2022-02-11 06:11:05 -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 1aec881958 Add Animated Color example
Summary:
Changelog:
[Internal] - Add an example to demo Animated colors with both JS and native drivers

Reviewed By: mdvacca

Differential Revision: D34153047

fbshipit-source-id: 9b61fd4e5f597b0440bed7ff1a33716e50ec34e5
2022-02-10 21:08:01 -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
Paige Sun f9fa385eb1 Log softerror when attempting to use ReactInstanceManager in Bridgeless Mode
Summary: Changelog: [Internal]

Reviewed By: fkgozali

Differential Revision: D34060026

fbshipit-source-id: 41441c0b16c4ef0248957eae11d9c9bc642f6d34
2022-02-10 15:00:50 -08:00
Joshua Gross 9bc6c0f8a5 Fix UIManager detection in touch event emitter
Summary:
Certain events (practically always touch events probably?) will not be correctly emitted to JS in Fabric if there is no View underneath the touch - if there is no touch target besides the ReactRootView.

We can just rely on the UIManagerType annotation on the Event, which is correct and reliable.

Instead, what we do today is derive UIManagerType from ViewTag, which is correct UNLESS the viewtag is the same as the SurfaceId, in which case we may incorrectly detect that the touch is on a non-Fabric View when in fact it is on a Fabric ReactRootView.

ViewTag is not a reliable way to detect Fabric vs non-Fabric /when looking at the RootView/, where ViewTag is the same as SurfaceId. Ironically, only Fabric RootViews have a SurfaceId at all.

Practically, this won't change anything since events emitted to ReactRootView don't go anywhere (they don't have EventEmitters). So this is a pretty low-stakes fix, but is still technically correct.

Changelog: [internal]

Reviewed By: mdvacca

Differential Revision: D34149878

fbshipit-source-id: f01da556865eb597a50cd49e9787316a0ed56f70
2022-02-10 14:07:24 -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
Gabriel Donadel Dall'Agnol 6b61995647 build(deps): Bump android Appcompat to 1.4.1 (#33072)
Summary:
Currently we are using Appcompat in version 1.0.2 which is almost 4 years old now, this PR updates it to version 1.4.1.

Using Appcompat 1.0.2 was also causing a crash on RNTester due to an error where FontFamily's method was not found (Related to https://github.com/facebook/react-native/issues/33065)

Closes https://github.com/facebook/react-native/issues/31620

## Changelog

[Android] [Changed] - Bump android Appcompat to 1.4.1

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

Test Plan: Use `./scripts/test-manual-e2e.sh` to test both RNTester and a new app

Reviewed By: cortinico

Differential Revision: D34107105

Pulled By: ShikaSD

fbshipit-source-id: 966e4687b09ae50a88ee518622f073d72e8c6550
2022-02-10 09:52:59 -08:00
Nicola Corti 327c4d7a08 Place Android.mk dependencies on separate lines for codegen.
Summary:
That's a really nit change, but when we moved the Makefile deps to be on separate
lines, we havent' done the same for the codegen. Here I'm doing it.

Changelog:
[Internal] [Changed] - Place Android.mk dependencies on separate lines for codegen

Reviewed By: ShikaSD

Differential Revision: D34144715

fbshipit-source-id: be9d5fb75b6b93c0b2bb479145053ae6f201e1fc
2022-02-10 09:40:52 -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
Ian Childs 172f990dcf exported and provided dep should be exported_provided_dep
Reviewed By: astreet

Differential Revision: D34108185

fbshipit-source-id: 72a6c9fb3654d674df405faac49dfbe67fe193b7
2022-02-10 07:47:52 -08:00