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

24904 Коммитов

Автор SHA1 Сообщение Дата
Rick Hanlon d1321d88bd React Native sync for revisions d300ceb...256aefb
Summary:
This sync includes the following changes:
- **[5cc2487e0](https://github.com/facebook/react/commit/5cc2487e0 )**: bump versions for next release ([#24725](https://github.com/facebook/react/pull/24725)) //<Josh Story>//
- **[54f17e490](https://github.com/facebook/react/commit/54f17e490 )**: [Transition Tracing] Fix Cache and Transitions Pop Order ([#24719](https://github.com/facebook/react/pull/24719)) //<Luna Ruan>//
- **[7cf8dfd94](https://github.com/facebook/react/commit/7cf8dfd94 )**: [Transition Tracing] Create/Process Marker Complete Callback ([#24700](https://github.com/facebook/react/pull/24700)) //<Luna Ruan>//
- **[327e4a1f9](https://github.com/facebook/react/commit/327e4a1f9 )**: [Follow-up] Land enableClientRenderFallbackOnTextMismatch //<Andrew Clark>//
- **[a8c9cb18b](https://github.com/facebook/react/commit/a8c9cb18b )**: Land enableSuspenseLayoutEffectSemantics flag ([#24713](https://github.com/facebook/react/pull/24713)) //<Andrew Clark>//
- **[a8555c308](https://github.com/facebook/react/commit/a8555c308 )**: [Transition Tracing] Add Tracing Marker Stack ([#24661](https://github.com/facebook/react/pull/24661)) //<Luna Ruan>//
- **[8186b1937](https://github.com/facebook/react/commit/8186b1937 )**: Check for infinite update loops even if unmounted ([#24697](https://github.com/facebook/react/pull/24697)) //<Andrew Clark>//
- **[060505e9d](https://github.com/facebook/react/commit/060505e9d )**: Fix misapplying prod error opt-out ([#24688](https://github.com/facebook/react/pull/24688)) //<Josh Story>//
- **[47944142f](https://github.com/facebook/react/commit/47944142f )**: `now` isn't part of the react-reconciler config anymore ([#24689](https://github.com/facebook/react/pull/24689)) //<Mathieu Dutour>//
- **[b34552352](https://github.com/facebook/react/commit/b34552352 )**: [Fizz] Support abort reasons ([#24680](https://github.com/facebook/react/pull/24680)) //<Josh Story>//
- **[79f54c16d](https://github.com/facebook/react/commit/79f54c16d )**: Bugfix: Revealing a hidden update ([#24685](https://github.com/facebook/react/pull/24685)) //<Andrew Clark>//
- **[7e8a020a4](https://github.com/facebook/react/commit/7e8a020a4 )**: Remove extra Server Context argument ([#24683](https://github.com/facebook/react/pull/24683)) //<Sebastian Markbåge>//
- **[4f29ba1cc](https://github.com/facebook/react/commit/4f29ba1cc )**: support errorInfo in onRecoverableError ([#24591](https://github.com/facebook/react/pull/24591)) //<Josh Story>//
- **[1cd90d2cc](https://github.com/facebook/react/commit/1cd90d2cc )**: Refactor of interleaved ("concurrent") update queue ([#24663](https://github.com/facebook/react/pull/24663)) //<Andrew Clark>//

Changelog:
[General][Changed] - React Native sync for revisions d300ceb...256aefb

jest_e2e[run_all_tests]

Reviewed By: cortinico

Differential Revision: D37155957

fbshipit-source-id: 4c0afc95abe8fa13c3803584922c8dc0059ff562
2022-06-15 12:23:01 -07:00
Nikita Lutsenko 70788313fe react-native | Fix a crash on deserilization of props when using 'px'/'em' units.
Summary:
A huge set of props use YGValue directly, say something really basic like `margin`/`position`/`padding`/`border`.
All of these according to CSS spec actually support `number | "em" | "px" | %` units, but we are going to throw and hard crash on `em` and `px`, which are unsupported in React Native.

Using `tryTo` instead of `to` (noexcept vs throwing method) for conversion, and treating things like `margin: 50px` same way as we would treat `margin: false` which is not really supported.

Changelog:
    [General][Fixed] - Fixed a crash on deserialization of props when using 'px'/'em' units.

Reviewed By: bvanderhoof

Differential Revision: D37163250

fbshipit-source-id: 59cbe65a821052f6c7e9588b6d4a0ac14e344684
2022-06-15 00:12:58 -07:00
Ruslan Latypov c78babac39 fixing more imports
Summary: Some files relying on -include_pch and therefore they miss Foundation.h and UIKit.h includes. This diff is fixing missing imports

Reviewed By: rmaz

Differential Revision: D37140239

fbshipit-source-id: bc57921e0c8365e0e9a5a571d607ba40ff1b31f3
2022-06-14 13:37:04 -07:00
Artem Goncharov bcc69dfb3d Back out "PointerEvents: Don't dispatch when no listeners for hover events" because hover events stopped working in felios apps in headsets
Summary:
Changelog: [Internal][Changed]

The diff I'm backing out accidentally made Hover events in Felios apps that use RN under the hood stopped working in headsets (Oculus, Arcata). So we can't test our apps properly without these events.

We, with the diff author Luna tried to fix that but it turned out to be not easy so we decided to revert the commit in order to unblock experiences teams.

Original commit changeset: d6b5c32ae50b

Original Phabricator Diff: D36601638 (40769f2212)

(Note: this ignores all push blocking failures!)

Reviewed By: arhelmus

Differential Revision: D37135208

fbshipit-source-id: 4f7d5f168b795690e951ce7063ae3feec3338772
2022-06-14 03:47:36 -07:00
Bartosz Kaszubowski 5471afeebf ECOSYSTEM.md: update Partner entries (#34006)
Summary:
This PR updates the Ecosystem Partners entries and performs the following changes:
* **Facebook**: renamed to Meta, URL updated
* **Expo**: URL updated, [EAS](https://expo.dev/eas) mention
* **Software Mansion**: [App.js Conf](https://appjs.co/) mention

## Changelog

N/A

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

Test Plan: N/A

Reviewed By: robhogan

Differential Revision: D37121100

Pulled By: cortinico

fbshipit-source-id: dc1c8b93d2fd8cb7cdd2377542f825dbd1ae1999
2022-06-13 17:18:50 -07:00
Alex Hunt 1dbc5840ae Upgrade Metro dependencies to 0.71.1
Summary: Changelog: [Internal]

Reviewed By: robhogan

Differential Revision: D37085382

fbshipit-source-id: 21c0a6fd095d858e3cdf694d677a5c57fd7d63a1
2022-06-13 12:55:23 -07:00
CodemodService FBSourceClangFormatLinterBot 90998a8f85 Daily `arc lint --take CLANGFORMAT`
Reviewed By: ivanmurashko

Differential Revision: D37102721

fbshipit-source-id: a19267b5c06d8da4ca51fc33d9f62ca768fc6f3a
2022-06-13 02:39:39 -07:00
Genki Kondo c80309e5ae Support animation events in ViewEventModule
Summary:
Adds support for handling animations in response to events on the platform side, without needing a JS round trip. With this TM, NativeViewEvents will no longer affected by JS thread - hover events will not be delayed when JS thread is busy. This makes a significant difference for VR panel apps - see test plan for an example for the before and after in Store.

Changelog:
[Internal] - Make NativeAnimatedNodesManager public

Reviewed By: JoshuaGross

Differential Revision: D37082069

fbshipit-source-id: 330acd78c547587de5545b61895e0d821fb99552
2022-06-12 12:42:08 -07:00
Pieter De Baets 34e51191e7 Optimize lookup of PlatformColor on Android
Summary:
We currently wrap colors in an object to make it look similar to a `PlatformColor` object, but since this is a hot codepath, let's just optimize it to a simple array of strings. The next step is to apply a layer of caching here, but this should be a simple improvement.

Changelog: [internal]

Reviewed By: JoshuaGross

Differential Revision: D31057046

fbshipit-source-id: f68e17167ddd5bba3b545d039600c7c9b40808f5
2022-06-10 16:20:22 -07:00
Pieter Vanderwerff 90cb8ea2a6 Deploy 0.180.0 to xplat
Summary: Changelog: [Internal]

Reviewed By: gkz

Differential Revision: D37075801

fbshipit-source-id: 2e5eef84b4dde7fe789d7506a32dbbaeb7ae3b8f
2022-06-10 13:39:59 -07:00
Xin Chen 59476d06f3 Back out "Remove useOverflowInset flag as we rolled out 100% to public for over three months"
Summary:
Original commit changeset: 77da78a29270

Original Phabricator Diff: D36990986 (df80ed40c7)

Reviewed By: mdvacca

Differential Revision: D37074879

fbshipit-source-id: 82668c90d50b4cc6c53986aa9450eea7934402b3
2022-06-10 13:21:38 -07:00
Olivier Payen 114d31feee Use monotonic clock for performance.now() (#33983)
Summary:
In https://github.com/facebook/react-native/pull/32695, the `Performance.now()` implementation changed to use unix epoch timestamps instead of a monotonic clock.

This is problematic, because it means that performance measurements get skewed if the device clock changes between two measurements.

With this change, the clock is now monotonic (and the implementation stays consistent between platforms).

More details and repro steps can be found in [this issue](https://github.com/facebook/react-native/issues/33977)
Closes https://github.com/facebook/react-native/issues/33977

## Changelog

[General] [Fixed] - Use monotonic clock for performance.now()

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

Test Plan:
Run on iOS and Android:
```
const now = global.performance.now()
console.log(`${Platform.OS}: ${now}`)
```

Reviewed By: JoshuaGross, cipolleschi

Differential Revision: D37066999

Pulled By: dmitryrykun

fbshipit-source-id: 298547bf39faea1b025c17ff2d2e1a03f929865b
2022-06-10 12:52:34 -07:00
Riccardo Cipolleschi 4f732ba9ee Move utilities out of `react_native_pods` - Part 2 (#33982)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/33982

This Diff moves another part of the utilities from the `react_native_pods` file to a specific `utils.rb` file.

It adds tests for these utils and improve our test mocks.

The goal is to simplify the `react_native_pods.rb` so it's easier to work with it.

I decided to split this diff in 2 because it was becoming quite big.

## Changelog

[iOS][Changed] - Refactoring part of the react_native_pods.rb script

Reviewed By: cortinico

Differential Revision: D37006265

fbshipit-source-id: ffaac3270cb098fa30b73c97ce7cd350dfb8d7d6
2022-06-10 07:25:52 -07:00
Riccardo Cipolleschi 7a2704455f Move cocoapods utilities to utils.rb - Part 1 (#33978)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/33978

This Diff moves part of the utilities from the `react_native_pods` file to a specific `utils.rb` file.

It adds tests for these utils and improve our test mocks.

The goal is to simplify the `react_native_pods.rb` so it's easier to work with it.

I decided to split this diff in 2 because it was becoming quite big.

## Changelog

[iOS][Changed] - Refactoring part of the react_native_pods.rb script

Reviewed By: cortinico

Differential Revision: D37004347

fbshipit-source-id: a5156f7c199d082d5d895a58af80948556c51c2a
2022-06-10 07:25:52 -07:00
Janic Duplessis 780fe80fca Don't validate ENTRY_FILE in react-native-xcode.sh (#32762)
Summary:
Reverts https://github.com/facebook/react-native/pull/29012

It is not really possible to properly validate if ENTRY_FILE exists since it is resolved by metro, and the server is not always running from the app root, like in a monorepo with multiple RN apps running on the same metro server.

In my case I run metro on the repo root and entry file will be something like `apps/app/index.js`. `-f "$ENTRY_FILE"` will fail since the script is run from the project folder (`PROJECT_ROOT`, in my case the `apps/app` folder, so it tries to resolve `apps/app/apps/app/index.js`).

I don't think this check is actually useful since metro will report the error if the entry file is invalid (fixed in https://github.com/facebook/react-native/pull/30150). The error is not as user friendly, but I think it is still fine. Maybe it could be improved in metro.

## Changelog

[iOS] [Fixed] - Don't validate ENTRY_FILE in react-native-xcode.sh

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

Test Plan:
Before

<img width="854" alt="image" src="https://user-images.githubusercontent.com/2677334/146100834-39310c9f-1767-496a-8698-1026726a1120.png">

After if file is actually missing

<img width="987" alt="image" src="https://user-images.githubusercontent.com/2677334/146100893-d01e2247-c787-4174-ac60-2f308c338c8f.png">

After if file exists, builds successfully.

Reviewed By: cortinico

Differential Revision: D37066073

Pulled By: cipolleschi

fbshipit-source-id: 8f6b149099a39d9179996bb965daa6cd9e06feac
2022-06-10 06:56:26 -07:00
Supreet Singh 9eb2826f9b Response headers to image - iOS (#33880)
Summary:
Please see this issue https://github.com/facebook/react-native/issues/33034 for details on the problem solved by this PR.

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

[CATEGORY] [TYPE] - Message
[ios] [changed] - HTTP Response headers added to the error object passed to JS code.

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

Test Plan:
Tested:
(All tests done on images in rn-tester app, which is a part of this repo)
1. onError method in case image has an HTTP Error
2. onError method in case of non http error (DNS error)
3. Successful image load

Reviewed By: cortinico

Differential Revision: D37066159

Pulled By: cipolleschi

fbshipit-source-id: 546f7678fa0321fe6c6fbef55288715cb6ddc2fd
2022-06-10 04:17:22 -07:00
Nicola Corti 6d2872d5a3 Encapsulate all the CMake build logic inside a `ReactNative-application.cmake` file for RN Tester (#33985)
Summary:
The idea behind this is to encapsulate as much build logic as possible inside a `.cmake` file which is contained inside React Native.

This reduces the API surface for the users, once we apply this change to the `template` project, and makes easier for us to evolve native library dependencies on Android, without having to worry about asking users to replicate those changes.

Currently the change is only on RN Tester, will replicate to the template afterwards

## Changelog

[Internal] [Changed] - Encapsulate all the CMake build logic inside a `ReactNative-application.cmake` file for RN Tester

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

Test Plan: Circle CI

Reviewed By: cipolleschi

Differential Revision: D37039658

Pulled By: cortinico

fbshipit-source-id: 536593e3b7227158acba3f0fb6561efaaa9720a5
2022-06-10 02:13:20 -07:00
Kudo Chien c2088e1267 revert #33381 changes (#33973)
Summary:
https://github.com/facebook/yoga/pull/1150 is better than the tricky https://github.com/facebook/react-native/issues/33381 and fix the build error on react-native 0.69 with swift clang module. as https://github.com/facebook/yoga/pull/1150 is landed as 43f831b23c, i'm reverting the previous change, only leaving the necessary react_native_pods.rb change.

## Changelog

[iOS] [Changed] - Better fix for yoga + swift clang module build error

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

Test Plan: ci passed

Reviewed By: cortinico, cipolleschi

Differential Revision: D36998007

Pulled By: dmitryrykun

fbshipit-source-id: fa11bd950e2a1be6396f286086f4e7941ad2ff5b
2022-06-10 02:09:13 -07:00
Dmitry Rykun 2f940db9d3 Updated CocoaPods offline mirrors
Summary:
Changelog:
[Internal][Fixed] - https://github.com/facebook/react-native/pull/33973 breaks the internal CI, as it depends on the outdated offline mirror for `Pods/Target Support Files`.

Reviewed By: cortinico

Differential Revision: D37038213

fbshipit-source-id: 1d27c9c32f2c3ddecd15a83935c520d1e1524b21
2022-06-10 01:41:05 -07:00
Kevin Gozali 8b837268b4 Android: Added back touch event handling based on reactTag
Summary:
It turned out the previous attempt to rely on the Event's UIManagerType wasn't sufficient, as not all Fabric touch event had a surfaceId set on them, e.g. Modal etc.

This brings back the UIManagerType detection based on reactTag, but do it only for non-rootView to keep handling touch via the right dispatcher for rootView as well.

Changelog: [Fixed][Android] Bring back non-rootview touch handling based on reactTag

Reviewed By: JoshuaGross, sshic

Differential Revision: D37063335

fbshipit-source-id: 76e2d7ae5f00006c5ecaf50c86920ea6e85155b7
2022-06-10 01:11:20 -07:00
Pieter De Baets 1b6584b9f5 Fix TurboModule binding improvements for TurboCxxModule
Summary:
TurboCxxModule doesn't use the the default JSI getter that TurboModule offers, and has custom behaviour for `getConstants` which broke the I18nAssets module in the binding experiment.

Changelog: [Internal]

Reviewed By: ryancat

Differential Revision: D37030917

fbshipit-source-id: 187f159abc76f792ad2c7045dc2852d216ea978d
2022-06-09 17:25:24 -07:00
Vincent Riemer 656d1cef24 Add optimizations to RNTesterPlatformTest result rendering
Summary: Changelog: [Internal] Add optimizations to RNTesterPlatformTest result rendering

Reviewed By: kacieb

Differential Revision: D37046543

fbshipit-source-id: 53ff6560e65ddfa26c470e5ae04b642154c43d1c
2022-06-09 15:54:11 -07:00
Kacie Bawiec 8ced165e53 Make Text use Android's "auto" focus by default instead of setting focus to true
Summary:
[A recent fix](https://github.com/facebook/react-native/pull/33076) to Android to set focusable to true when accessible is true, and this caused several components not to work correctly.

This JS change essentially reverts the default back to Text not being focusable unless it is explicitly set. Android's "auto" behavior is better than setting `accessible=true`, and it's also the behavior React Native has had since accessibility on Android was implemented.

# Wall of Text Explanation

Explanation From Brett's comment [here](https://www.internalfb.com/diff/D35908559?dst_version_fbid=700876567897063&transaction_fbid=477905564133412)

blavalla

Generally speaking, "accessible" in react native maps to "focusable" in Android views, and the default value for "focusabe" for a TextView (and actually all views) is "auto" not "false".  The difference here is that "false" is telling the system to explicitly disallow focus on this element, where as "auto" is telling the system that it's up to whatever service is trying to focus to determine if it should or not.

In the case of text, Talkback generally does default to focusing on Text when it's set to "auto", though it also does try to combine this text together with other not-explicitly focusable siblings and roll the focus up to some common ancestor element.

In the case of TetraButton here, I would expect the default behavior would be that the text is "auto" focusable, so Talkback would combine the text here with the parent <TetraPressable> (which is explicitly focusable via accessible="true").

...

[This diff](https://github.com/facebook/react-native/pull/33076) was to fix the issue with "disabled" not properly announcing on text views, which was commonly occuring due to the description-combining feature described above. Basically, when Talkback decides to combine not-explicitly-focusable elements together, it ignores properties like "disabled", "selected", etc. so when combined only the text is transferred.

The "fix" here was to make sure that if disabled was set, that an element was always explicitly focusable so that it wouldn't be eligible to be combined with others. I think that as a general concept makes sense, but the fix actually surfaced an issue that is likely a much older bug.

This line in <Text>
```
accessible={accessible !== false}
```

Is basically always setting accessible="true" unless it's explicitly set to false, and has been in there for years. It was likely added to force text to be accessible by default for iOS.  But until [this diff](https://github.com/facebook/react-native/pull/33076) this line was basically a no-op for Android, since setting accessible="true" on text would do nothing at all.

[This diff](https://github.com/facebook/react-native/pull/33076)  changed this so that setting accessible="true" worked how you'd expect, by making the view explicitly focusable, which was necessary for the disabled behavior to work properly. But that means that now by default all text views are explicitly focusable on both iOS and Android, and this there is likely many components that were built that don't expect this to be the case.

It doesn't seem like the right fix here is to revert this behavior to its previous state, as it wasn't working how anyone would expect it to if they looked at the code, and it seems like we were relying on some fairly undocumented behavior of Talkback to get it to work how we wanted. If we truly only wanted accessible="true" to be set on all TextViews for iOS, we should be explicit about it and do a platform check before setting that property. If we didn't want this to be iOS-specific, then everything is now actually working as originally intended.

For reference, this is the diff that introduced the default-accessible text - https://www.internalfb.com/diff/D1561326, and the description makes it clear that this was only tested on iOS, and the behavior was explicitly trying to map to iOS norms such as not allowing nested accessible elements.

Changelog:
[Android][Fixed] Make Text not focusable by default

Reviewed By: ryancat

Differential Revision: D36991394

fbshipit-source-id: c45d2ada72bb2d6ffeee6947d676a07fb8899449
2022-06-09 13:27:09 -07:00
Héctor Ramos 340612a200 Hermes: Use shared JSI from React Native on iOS (#33885)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/33885

When building Hermes for React Native, point to the React Native JSI location to ensure both React Native and Hermes use the exact same version of JSI.

Changelog:
[iOS] [Changed] - When Hermes is enabled, it will use the same copy of JSI as React Native

Reviewed By: cortinico, cipolleschi

Differential Revision: D36567471

fbshipit-source-id: 97d954ef34007bd31f008fab451512194060d670
2022-06-09 13:11:46 -07:00
Xin Chen df80ed40c7 Remove useOverflowInset flag as we rolled out 100% to public for over three months
Summary:
Remove overflow inset optimization flags as they've been rolled out 100% to public.

Changelog:
[Android][Internal] - Clean up feature flags for overflowInset

Reviewed By: nlutsenko

Differential Revision: D36990986

fbshipit-source-id: 77da78a2927034893f25937c2ccbd0b53e08031d
2022-06-09 12:30:14 -07:00
Héctor Ramos d592bdcbd3 Hermes: Use pre-built Hermes runtime in iOS Template tests (#33974)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/33974

Enable Hermes in iOS Template tests and use pre-built Hermes binaries from Circle CI.

Changelog: [Internal]

Reviewed By: cortinico, cipolleschi

Differential Revision: D36989241

fbshipit-source-id: a240713d0bd0383fa218f8fc031e81467ebeb376
2022-06-09 11:18:30 -07:00
Héctor Ramos 6154cb7512 Hermes: Use arbitrary path to hermes-runtime-darwin if ENV set
Summary:
Allow an arbitrary path to hermes-runtime-darwin-vX.Y.Z.tgz to be specified. This can be used in CI or in local e2e tests to test with Hermes enabled without having a matching GitHub release.

Usage:

```
HERMES_ENGINE_TARBALL_PATH=~/Downloads/hermes- runtime-darwin-v0.69.0.tar.gz \
  USE_HERMES=1 \
  pod install
```

Changelog: [Internal]

Reviewed By: cortinico

Differential Revision: D36985477

fbshipit-source-id: 853829c89e6f0ac3f63781c7f290cf3994b8e0cd
2022-06-09 11:18:30 -07:00
Nicola Corti a0e6ffebbf Format .kts files with ktfmt
Summary:
I'm extending ktfmt setup to run on kotlin script files as well.

Changelog:
[Internal] [Changed] - Reformat .kts files with ktfmt

skip-linter-coverage-verification

Reviewed By: zertosh

Differential Revision: D36967010

fbshipit-source-id: a83f3facbb5f30b935b69fc70a5588e4da5996b2
2022-06-09 02:50:45 -07:00
Dmitry Rykun 4e4b9e2111 Fix reatain cycle RCTPullToRefreshViewComponentView <-> RCTScrollViewComponentView
Summary:
Changelog: [iOS][Fixed] - `_scrollViewComponentView` is set to `RCTPullToRefreshViewComponentView's` superview:
```
_scrollViewComponentView = [RCTScrollViewComponentView findScrollViewComponentViewForView:self];
```
It should be safe to make it weak.

Reviewed By: javache

Differential Revision: D36998626

fbshipit-source-id: 2130b743d181e15986cb68636d60507a986968e1
2022-06-09 02:39:54 -07:00
Scott Kyle 68e4e91bd4 Support optional return types
Summary:
This fixes an issue in the C++ TurboModule codegen where optional return types would result in a compiler error because they were not being defaulted to `null` when converting to `jsi::Value`.

Changelog:
Internal

Reviewed By: javache

Differential Revision: D36989312

fbshipit-source-id: 525f9ce7a5638ba5a655fa69ba9647978030ab0b
2022-06-08 21:15:53 -07:00
luoxuhai 47bd78f64f Added userInterfaceStyle to Alert to override user interface style for iOS 13+ (#33553)
Summary:
Support to override Alert interface style to match your app. For example, You want to change the style on the alert.

## 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] [Added] - Add userInterfaceStyle to Alert to override user interface style for iOS 13+

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

Test Plan:
**`userInterfaceStyle: 'light'`:**
<img width="320" src="https://user-images.githubusercontent.com/37284154/161358408-50dbf0a5-ae46-458e-a075-8595cce1b046.png"  />

**`userInterfaceStyle: 'dark'`:**
<img width="320" src="https://user-images.githubusercontent.com/37284154/161358326-bc54effb-1635-43df-97e0-522328713259.PNG"  />

Reviewed By: philIip

Differential Revision: D35371697

Pulled By: ryancat

fbshipit-source-id: 597c1a97ca94571abada2b5fb97cb2adcb5337f5
2022-06-08 18:28:16 -07:00
Xin Chen 472e0e4a3c Make sure we only queue events when event emitter is null
Summary:
This diff adds an assertion to make sure the pending events are enqueued only when the event emitter is null. This is to avoid unexpected workflow when we queue events but we should just dispatch them.

Changelog:
[Android][Internal] - Make sure we only queue events when event emitter is null

Reviewed By: javache

Differential Revision: D36916482

fbshipit-source-id: fff305615b302ece26bc2482c826b74de4f70266
2022-06-08 14:19:01 -07:00
Janic Duplessis 77e6bff629 Use `GCC_PREPROCESSOR_DEFINITIONS` to set `FB_SONARKIT_ENABLED` (#33972)
Summary:
`OTHER_CFLAGS` doesn't seem to work when the file is imported from Objc++. This causes flipper to not be included.

## Changelog

[iOS] [Fixed] - Use `GCC_PREPROCESSOR_DEFINITIONS` to set `FB_SONARKIT_ENABLED`

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

Test Plan: Tested the change in an app. Used a breakpoint to see that flipper code is not executed before this change, and is after. Also made sure other `GCC_PREPROCESSOR_DEFINITIONS` set by cocoapods are still properly inherited.

Reviewed By: cipolleschi

Differential Revision: D37001624

Pulled By: dmitryrykun

fbshipit-source-id: 920f3fe368a9fbe2cde9aa1e6d5b3b883c42119d
2022-06-08 05:58:04 -07:00
Charles Dudley edb27e3aa1 Backout D36784563
Summary:
D36784563 (ec307e0167) caused some issues with TextInputs with numeric keyboard types not respecting the secureTextEntry prop

Changelog
[Android] [Fixed] - Revert PR 33924 because of issues with TextInputs with numeric keyboard types not respecting the secureTextEntry prop

Reviewed By: makovkastar

Differential Revision: D36994688

fbshipit-source-id: 89cd556ca1cf8fd89560aeb9ead129607b4c13c6
2022-06-07 20:36:19 -07:00
Genki Kondo d8c25ca1b6 Use initial value of natively driven nodes on renders
Summary:
D36902220 (a04195167b) changed Animated to only use value of natively driven nodes on initial render.

However, there remained a case where we could end up with a race condition between Fabric prop update (via SurfaceMountingManager.updateProps) and Animated (via NativeAnimatedNodesManager.runUpdates), when an animation on a node that was created natively is triggered close to render (such as in componentDidUpdate). This happens as Animated and Fabric aren't synchronized, and at the platform level, they do not know each other's state.

Say we have two items, where opacity is used to indicate whether the item is selected. On initial render, A's opacity is set to 1, and animated sets opacity to 1; B's opacity is set to 0, and animated sets opacity to 0. When B is selected (and causes A and B to rerender), A's opacity is now set to null, and animated sets opacity to 0; B's opacity is also now set to null, and animated sets opacity to 1. A's props have changed, and thus the default opacity value of 1 is applied via Fabric, but Animated also sets the opacity to 0 - either may end up being the value visible to the user due to the nondeterministic order of Fabric update props and Animated. This is what is causing T122469354.

This diff addresses this edge case by using the initial prop values for native animated nodes, for subsequent renders, to ensure that values of native animated nodes do not impact rerenders.

This diff also fixes a bug in OCAnimation where translateX/Y values of 0 in transition will result in render props containing translateX/Y instead of transform, resulting in potentially incorrect pressability bounds.

Changelog:
[Internal][Fixed] - Only use initial value of natively driven nodes on render

Reviewed By: JoshuaGross, javache

Differential Revision: D36958882

fbshipit-source-id: 10be2ad91b645fa4b8a4a12808e9299da33aaf7d
2022-06-07 20:02:57 -07:00
Christian Ruink b869680c11 Fixing onEndReachedThreshold === 0 not firing onEndReached function on Android.
Summary:
Changelog:
[Android][Fix] - When `onEndReachedThreshold` is set to 0 `onEndReached` function on `VirtualizedList` properly fires once the user scrolls to the bottom of the list.

Reviewed By: genkikondo

Differential Revision: D36488189

fbshipit-source-id: b95f3291f2957273280696d8840c1e000d669380
2022-06-07 16:22:12 -07:00
Vincent Riemer 21a4c1f6d6 Add dispatch of pointerover/pointerout events
Summary: Changelog: [iOS][Internal] - Add dispatching of pointerover/pointerout events

Reviewed By: lunaleaps

Differential Revision: D36718156

fbshipit-source-id: c2fee2332ac52e617db938e321e3b38fd5c35ad3
2022-06-07 16:08:50 -07:00
Janic Duplessis 43f831b23c Make all headers public and add #ifdef __cplusplus (#1150)
Summary:
This change is mostly needed to support the new react-native architecture with Swift. Some private yoga headers end up being included in the swift build and result in compilation failure since swift cannot compile c++ modules. See https://github.com/facebook/react-native/pull/33381.

The most reliable fix is to include all headers as public headers, and add `#ifdef __cplusplus` to those that include c++. This is already what we do for other headers, this applies this to all headers.

Tested in the YogaKitSample, and also in a react-native app.

Changelog:
[iOS] [Changed] - Make all Yoga headers public and add #ifdef __cplusplus

X-link: https://github.com/facebook/yoga/pull/1150

Reviewed By: dmitryrykun

Differential Revision: D36966687

Pulled By: cortinico

fbshipit-source-id: a34a54d56df43ab4934715070bab8e790b9abd39
2022-06-07 07:42:49 -07:00
Janic Duplessis 9ef30456c6 Pass string by ref in TurboModule template (#33970)
Summary:
3337add547 made some changes to method signature but the template wasn't updated. This adds the missing changes.

## Changelog

[Internal] [Fixed] - Pass string by ref in TurboModule template

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

Test Plan: Didn't test the template directly, but the change is trivial.

Reviewed By: cortinico

Differential Revision: D36964481

Pulled By: dmitryrykun

fbshipit-source-id: 561e32f218baf398b8d4d8c77381a2642e22ef42
2022-06-07 04:37:45 -07:00
Carmi Grushko f296e0e5b3 Update ktfmt component on FBS:master
Differential Revision: D36926167

fbshipit-source-id: e5c262e269b3ccb2afe04b45398ec66fc5c48df2
2022-06-07 02:59:31 -07:00
Joshua Gross b0c2b10cec Fix typo in width / height parsing
Summary:
Seems like an obvious typo! Whoops!

Not causing any known issues, but... this should be fixed.

Changelog: [Internal]

Reviewed By: genkikondo

Differential Revision: D36940476

fbshipit-source-id: d534ca3763b1f91e41c56953bf3d665e86db9e2b
2022-06-06 22:17:54 -07:00
Xin Chen ea7c9f2ad9 Fix edge case when we enqueue a pending event to views on stopped surface
Summary:
This diff address an edge case when the pending events are enqueued when the surface is stopped. In this case we will reset map that holds view state to null, which will cause NPE.

Changelog:
[Android][Fixed] - Fix edge case when we enqueue a pending event to views on stopped surface

Reviewed By: javache, gorodscy

Differential Revision: D36912786

fbshipit-source-id: 3ae5a4b08a0a6bf55538d69ac80a101c2c3d899a
2022-06-06 15:44:13 -07:00
Zolboobayar Gantumur 8a2be3e143 Add `READ_VOICEMAIL` and `WRITE_VOICEMAIL` permissions (#33965)
Summary:
This PR adds `READ_VOICEMAIL` and `WRITE_VOICEMAIL` permissions to the PermissionsAndroid library. Resolves https://github.com/facebook/react-native/issues/33922.

https://developer.android.com/reference/android/Manifest.permission#READ_VOICEMAIL
https://developer.android.com/reference/android/Manifest.permission#WRITE_VOICEMAIL

## 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] [Added] - Add READ_VOICEMAIL and WRITE_VOICEMAIL permissions to PermisionsAndroid library.

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

Test Plan:
```
PermissionsAndroid.READ_VOICEMAIL === 'com.android.voicemail.permission.READ_VOICEMAIL'
PermissionsAndroid.WRITE_VOICEMAIL === 'com.android.voicemail.permission.WRITE_VOICEMAIL'
```

Reviewed By: kacieb

Differential Revision: D36933524

Pulled By: cortinico

fbshipit-source-id: f5283d526aeb68c2724654e22ae16c8c3f69f740
2022-06-06 11:37:34 -07:00
Rick Hanlon 118cf68914 React Native sync for revisions bd4784c...d300ceb
Summary:
This sync includes the following changes:
- **[dd4950c90](https://github.com/facebook/react/commit/dd4950c90 )**: [Flight] Implement useId hook ([#24172](https://github.com/facebook/react/pull/24172)) //<Josh Story>//
- **[26a5b3c7f](https://github.com/facebook/react/commit/26a5b3c7f )**: Explicitly set `highWaterMark` to 0 for `ReadableStream` ([#24641](https://github.com/facebook/react/pull/24641)) //<Josh Larson>//
- **[aec575914](https://github.com/facebook/react/commit/aec575914 )**: [Fizz] Send errors down to client ([#24551](https://github.com/facebook/react/pull/24551)) //<Josh Story>//
- **[a2766387e](https://github.com/facebook/react/commit/a2766387e )**: [Fizz] Improve text separator byte efficiency ([#24630](https://github.com/facebook/react/pull/24630)) //<Josh Story>//
- **[f7860538a](https://github.com/facebook/react/commit/f7860538a )**: Fix typo in useSyncExternalStore main entry point error ([#24631](https://github.com/facebook/react/pull/24631)) //<François Chalifour>//
- **[1bed20731](https://github.com/facebook/react/commit/1bed20731 )**: Add a module map option to the Webpack Flight Client ([#24629](https://github.com/facebook/react/pull/24629)) //<Sebastian Markbåge>//
- **[b2763d3ea](https://github.com/facebook/react/commit/b2763d3ea )**: Move hydration code out of normal Suspense path ([#24532](https://github.com/facebook/react/pull/24532)) //<Andrew Clark>//
- **[357a61324](https://github.com/facebook/react/commit/357a61324 )**: [DevTools][Transition Tracing] Added support for Suspense Boundaries ([#23365](https://github.com/facebook/react/pull/23365)) //<Luna Ruan>//
- **[2c8a1452b](https://github.com/facebook/react/commit/2c8a1452b )**: Fix ignored setState in Safari when iframe is touched ([#24459](https://github.com/facebook/react/pull/24459)) //<dan>//
- **[62662633d](https://github.com/facebook/react/commit/62662633d )**: Remove enableFlipOffscreenUnhideOrder ([#24545](https://github.com/facebook/react/pull/24545)) //<Ricky>//
- **[34da5aa69](https://github.com/facebook/react/commit/34da5aa69 )**: Only treat updates to lazy as a new mount in legacy mode ([#24530](https://github.com/facebook/react/pull/24530)) //<Ricky>//
- **[46a6d77e3](https://github.com/facebook/react/commit/46a6d77e3 )**: Unify JSResourceReference Interfaces ([#24507](https://github.com/facebook/react/pull/24507)) //<Timothy Yung>//
- **[6cbf0f7fa](https://github.com/facebook/react/commit/6cbf0f7fa )**: Fork ReactSymbols ([#24484](https://github.com/facebook/react/pull/24484)) //<Ricky>//
- **[a10a9a6b5](https://github.com/facebook/react/commit/a10a9a6b5 )**: Add test for hiding children after layout destroy ([#24483](https://github.com/facebook/react/pull/24483)) //<Ricky>//
- **[b4eb0ad71](https://github.com/facebook/react/commit/b4eb0ad71 )**: Do not replay erroring beginWork with invokeGuardedCallback when suspended or previously errored ([#24480](https://github.com/facebook/react/pull/24480)) //<Josh Story>//
- **[99eef9e2d](https://github.com/facebook/react/commit/99eef9e2d )**: Hide children of Offscreen after destroy effects ([#24446](https://github.com/facebook/react/pull/24446)) //<Ricky>//
- **[ce1386028](https://github.com/facebook/react/commit/ce1386028 )**: Remove enablePersistentOffscreenHostContainer flag ([#24460](https://github.com/facebook/react/pull/24460)) //<Andrew Clark>//
- **[72b7462fe](https://github.com/facebook/react/commit/72b7462fe )**: Bump local package.json versions for 18.1 release ([#24447](https://github.com/facebook/react/pull/24447)) //<Andrew Clark>//
- **[22edb9f77](https://github.com/facebook/react/commit/22edb9f77 )**: React `version` field should match package.json ([#24445](https://github.com/facebook/react/pull/24445)) //<Andrew Clark>//
- **[6bf3deef5](https://github.com/facebook/react/commit/6bf3deef5 )**: Upgrade react-shallow-renderer to support react 18 ([#24442](https://github.com/facebook/react/pull/24442)) //<Michael サイトー 中村 Bashurov>//

Changelog:
[General][Changed] - React Native sync for revisions bd4784c...d300ceb

jest_e2e[run_all_tests]

Reviewed By: cortinico, kacieb

Differential Revision: D36874368

fbshipit-source-id: c0ee015f4ef2fa56e57f7a1f6bc37dd05c949877
2022-06-06 10:58:29 -07:00
Kevin Gozali f0b5d42b50 Android: Dispatch root view touch events to the right dispatcher
Summary:
When tapping on ReactRootView and having Fabric enabled, the touch logic mistakenly dispatch the event to JS via the legacy renderer. This is because the destination was computed based on reactTag (odd = legacy, even = Fabric), but root view tag happens to be always odd (always ends with 1). This change uses the right destination based on what the Event itself tells us, instead of deriving from the reactTag.

Changelog: [Android][Fixed] Fix Fabric touch event dispatching for root views

Reviewed By: JoshuaGross, sshic

Differential Revision: D36917300

fbshipit-source-id: 838b4e135d7df07c37040bd47d71370ff10df067
2022-06-06 10:51:58 -07:00
Arinjay Sharma 086c13dd5f fixed SDK issue while uploading app in debug scheme (#33153)
Summary:
Problem - Error when trying to publish to Apple Store in debug scheme

Error thread - https://github.com/facebook/react-native/issues/31507

## 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][Removed] - The diffs renames the required variable which was causing conflicts in names with Apple core SDK's

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

Reviewed By: lunaleaps

Differential Revision: D34392529

Pulled By: sshic

fbshipit-source-id: 78387999f94e0db71f5d3dafff51e58d7d0c1847
2022-06-06 10:08:11 -07:00
Nicola Corti f1c614bd0e Build RN Tester with CMake (#33937)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/33937

This moves the build of RNTester from Unix Make to CMake
This will serve as a blueprint for users that are looking into using CMake end-to-end in their buildls.

In order to make this possible I had to:
* Add an `Android-prebuilt.cmake` file that works similar to the `Android-prebuilt.mk` for feeding prebuilt .so files to the consumer build.
* Update the codegen to use `JSI_EXPORT` on several objects/classes as CMake has stricter visibility rules than Make
* Update the sample native module in `nativemodule/samples/platform/android/` to use CMake instead of Make

Changelog:
[Internal] [Changed] - Build RN Tester with CMake

Reviewed By: cipolleschi

Differential Revision: D36760309

fbshipit-source-id: b99449a4b824b6c0064e833d4bcd5969b141df70
2022-06-06 08:07:14 -07:00
David Vacca a9659ce86d Fix rendering of transparent borders in RN Android
Summary:
This diff fixes the rendering of transparent borders in RN Android views
The fix clips the view ONLY when there is a border color that's non transparent

This change unifies the rendering of transparent and semitransparent borders for Views between RN Android, iOS and Web

Changelog: [Android][Fix] Fix rendering of transparent borders in RN Android

Reviewed By: JoshuaGross

Differential Revision: D36890856

fbshipit-source-id: 38fc2ae215f136160a73ca470e03fada8cb81ced
2022-06-05 15:18:39 -07:00
Paige Sun 5ed6ac1f25 Protect _handlers in RCTNetworking with mutex even if RCTNetworking has been deallocated
Summary:
Changelog:
[iOS][Fixed][Internal] - Protect handlers in RCTNetworking with mutex even if RCTNetworking has been deallocated

# The Logview
We get this error in LogView: `Unhandled JS Exception: Error: Exception in HostFunction: mutex lock failed: Invalid argument`, which is an C++ std::error. "This typically happens when .lock() is called on a mutex that is not yet constructed, or has already been destructed."

# Hypothesis of issue
The LogView says the line that throws this softerror is [RCTNetworking.ios.js](8bd3edec88/Libraries/Network/RCTNetworking.ios.js (L87)).

Inside RCTNetworking, there's only [one mutex and only one line where is is being used](8bd3edec88/Libraries/Network/RCTNetworking.mm (L207-L215)
), to protect the _handlers array.

My guess is that RCTNetworking was deallocated, which made `_handlersLock` nil, so it resulted in this error when we tried to lock it.

# This diff

* Add `std::lock_guard<std::mutex> lock(_handlersLock);` to `invalidate()`
* Move `_handlersLock` logic to its own method instead of using a lambda. If `self` is being deallocated, I would guess that this method (`[self prioritizedHandlers]`) would return nil.

Referencing this for correct ways to use lock_guard with mutex: https://devblogs.microsoft.com/oldnewthing/20210709-00/?p=105425

Reviewed By: fkgozali

Differential Revision: D36886233

fbshipit-source-id: 60246f4d9bbc1d834497e4fb8a61d9c0e9623510
2022-06-05 11:02:11 -07:00
Neil Dhar 0035cc9292 Fix throwing exceptions from asHostObject
Summary:
The current implementation of `throwJSError` places it in jsi.cpp, but
does not actually export it. This means that when JSI is being provided
by a dynamic library, `detail::throwJSError` will not be available.

To fix this, move the definition of `throwJSError` into jsi-inl.h,
similar to all of the other functions in the `detail` namespace. This
uses a roundabout implementation of `throwJSError` in order to avoid
directly using `throw`, which would fail to compile when exceptions are
turned off.

Changelog: [Internal]

Reviewed By: jpporto

Differential Revision: D36873154

fbshipit-source-id: bbea48e0d4d5fd65d67a029ba12e183128b96322
2022-06-03 15:04:46 -07:00