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

24813 Коммитов

Автор SHA1 Сообщение Дата
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
Genki Kondo a04195167b Only use value of natively driven nodes on initial render
Summary:
D36612758 (40f4c662bc) attempted to remove the check that the animated node was native when fetching animated prop values for render, in order to fix an issue that arises when a node is converted to native before the initial call to render to mount the component, where the initial value is not applied.

However, this causes issues for cases where we call setValue on an animated node soon after render, such as on componentDidUpdate. setValue first updates the animated node value on JS side, then calls the native API setAnimatedNodeValue. The problem is that the next render will then use these updated values in the style props (because we removed the check for native in D36612758 (40f4c662bc)), resulting in a diff in props. Since Animated and Fabric aren't synchronized, there's a race condition between SurfaceMountingManager.updateProps and NativeAnimatedNodesManager.runUpdates

To allow proper rendering of initial values of native animated nodes, and mitigate the issue when calling setValue on an animated node soon after render, during initial render we use the initial values of both native and non-native driven nodes, and on subsequent renders we only use the initial values of non-native driven nodes.

An alternative considered was to add internal state to the nodes themselves (AnimatedProps, AnimatedStyle), but keeping it in sync with the component state is not easy/clean as AnimatedProps can be recreated and reattached at any time for a mounted component.

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

Reviewed By: JoshuaGross

Differential Revision: D36902220

fbshipit-source-id: c20f711aa97d18a2ed549b5f90c6296bf19bb327
2022-06-03 13:33:50 -07:00
Joshua Gross 11141b8b3c Fix alignment during recycling of ReactTextView
Summary:
In the constructor we should get the default gravity params (as we did previously) and then never change these; thus, we can also make these fields final. These are used in `initView` during construction and upon recycling to reset vertical and horizontal alignment to their defaults.

Changelog: [Internal]

Reviewed By: genkikondo

Differential Revision: D36885646

fbshipit-source-id: 2f4d0b125b8645a380a08965e08db3ba1f12cae3
2022-06-03 10:21:40 -07:00
Joshua Gross 00751f64c7 Fix out-of-order prop parsing deoptimization in TextView/Paragraph
Summary:
See also D36889794. This is a very similar idea, except the core problem is that BaseTextProps is accessing the same props as ViewProps; and for ParagraphProps parsing, it first defers to ViewProps' parser and then BaseTextProps. RawPropsParser is optimized to access the same props in the same order, *exactly once*, so if we access a prop out-of-order, or for a second time, that access and the next access are deoptimized. Paragraph/Text, in particular, were quite bad because we did this several times, and each out-of-order access requires scanning /all/ props.

This fixes the issue, at least partially, by (1) pulling all the duplicate accesses to the beginning of BaseTextProps, and (2) accessing them all in the same order as ViewProps, relatively (some props are skipped, but that matters less).

Practically what this means is that now, all of Props' accesses have a cost of O(1) for lookup, or a total of O(n) for all of them; each access is at the n+1 position in the internal RawPropsParser array, so each access is cheap. BaseTextProps' duplicate accesses, even though there are only 4 of them: (1) the first one scans the entire array until we reach the prop in question; (2) the next accesses require scans, but not whole-array scans, since they're in order. (3) The BaseTextProps accesses /after/ the duplicate accesses are all O(1).

tl;dr is that before we had something like O(n*6) cost for BaseTextProps parsing and now it is O(n*2).

Similar to my summary in the last diff: we may want to revisit the RawPropsParser API... but I want to tread gently there, and this gets us a large improvement without major, risky changes.

Empirically, based on a couple of systraces, average time for a single UIManager::createNode called from JS thread, before this stack: 17us. After: 667ns (3% as long). On average, for every 60 createNode calls, we will save 1ms on the UI thread. The savings will be greater for certain screens that use many Views or Text nodes, and lesser for screens that use fewer of these components.

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D36890072

fbshipit-source-id: 5d24b986c391d7bb158ed2f43d130a71960837d1
2022-06-02 23:36:54 -07:00
Joshua Gross 782e004e49 Fix pref deoptimizations due to out-of-order prop parsing
Summary:
Without getting into the weeds too much, RawPropParser "requires" that props be accessed in the same order every time a Props struct is parsed in order to most optimally fetch the values in a linear-ish fashion, basically ensuring that each rawProps.at() call is an O(1) operation, and overall getting all props for a particular component is O(n) in the number of props for a given struct. If props are called out of order, this breaks and worst-case we can end up with an O(n^2) operation.

Unfortunately, calling .at(x) twice with the same prop name triggers the deoptimized behavior. So as much as possible, always fetch exactly once and in the same order every time. In this case, we move initialization of two fields into the constructor body so that we can call .at() a single time instead of twice.

In the debug props of ViewProps I'm also reordering the fields to fetch them in the same order the constructor fetches them in, which will make this (debug-only) method slightly faster.

What's the impact of this? If you dig into the Tracery samples, the average/median RawPropsParser::at takes 1us or less. However, in /every single/ call to createNode for View components, there is at least one RawPropsParser::at call that takes 250+us. This was a huge red flag when analyzing traces, after which it was trivial (for View) to find the offending out-of-order calls. Since this is happening for every View and every type of component that derives from View, that's 1ms lost per every 4 View-type ShadowNodes created by ReactJS. After just 100 views created, that's 25ms. Etc.

There are other out-of-order calls lurking in the codebase that can be addressed separately. Impact scales with the size of the screen, the number of Views they render, etc.

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D36889794

fbshipit-source-id: 91e0a7ca39ed10778e60a0f0339a4b4dc8b14436
2022-06-02 23:36:54 -07:00
Shubho Sadhu 39e81a1703 Revert D36707915: Create Apple MSYS Mailbox Provider TurboModule
Differential Revision:
D36707915 (528414cc89)

Original commit changeset: 9a246f238efd

Original Phabricator Diff: D36707915 (528414cc89)

fbshipit-source-id: a581b745abd781a97d5ffde303db69ba3e23c51c
2022-06-02 19:36:46 -07:00
Jake Holland 528414cc89 Create Apple MSYS Mailbox Provider TurboModule
Summary: Creates a base TurboModule for Catalyst.

Reviewed By: ann-ss

Differential Revision: D36707915

fbshipit-source-id: 9a246f238efdcdde45e0332f7b868478deadf50e
2022-06-02 16:41:12 -07:00
Nicola Corti d5e0659fcc Backport Changes needed to let Hermes actually download the compiled tarball.
Summary:
I'm backporting PR https://github.com/facebook/react-native/pull/33945 to main
as it was merged on the release branch to unblock 0.69.

Those changes are necessary as Hermes was not being donwloaded at all during `pod install`
on .69 and the app was failing to build with a missing `hermes/hermes.h` import.

Changelog:
[iOS] [Fixed] - Fix Hermes not being properly downloaded during pod install

Reviewed By: hramos

Differential Revision: D36810787

fbshipit-source-id: f898e61b6536dfcfc81feeff740703fbd697b000
2022-06-02 12:34:15 -07:00
Evan Yeung 0262b49db9 Deploy 0.179.0 to xplat
Summary: Changelog: [Internal]

Reviewed By: gkz

Differential Revision: D36710466

fbshipit-source-id: 4dff0bf2f57d695abc183be9f89147f239fb4953
2022-06-02 09:43:05 -07:00
Daniel Espino García ec307e0167 Fix keyboard staying as email when switching between default and email (#33924)
Summary:
Right now, when we change the keyboardType on android between between default and email, the value keyboard type stays as email (specially noticeable with the key next to the spacebar, that changes between the comma (`,`) to the at sign (`@`)).

This is because the mask we are using when updating the input is only taking into account the class, and not the flags nor the variations.

We don't apply all masks because it may interfere with flags assigned by other props, like multiline or secure text entry. Therefore, we have created our own mask, taking into account all the variations and flags that the keyboardType prop may set. This may be hard to maintain, since whenever we add any other keyboard type, we have to take these flags into mind.

The error I was trying to fix was in particular regarding going back and forward from email, but this fix may solve other similar issues with other keyboard styles.

## Changelog

[Android] [Fixed] - Fix a bug where the keyboard, once set as email, won't change back to default.

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

Test Plan: In order to test this PR, any test code with a TextInput, and a way to change the value of the keyboardType should work. We should be able to see how the keyboard changes to the correct type without staying, for example, on the email state.

Reviewed By: lunaleaps

Differential Revision: D36784563

Pulled By: makovkastar

fbshipit-source-id: 74d7b61b3c07feea4e4050d7a07603a68b98e835
2022-06-01 18:48:38 -07:00
Antoine Doubovetzky dbcada0391 fire: (FileReader) remove unused _subscriptions attribute (#33946)
Summary:
I was reading source code, and I noticed the _subscriptions attribute (and the _clearSubscriptions method) of the FileReader is not used.

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

[Internal] [Changed] - Remove unused _subscriptions attribute in FileReader

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

Test Plan: I checked that flow and jest are still green as I can't think about another way.

Reviewed By: lunaleaps

Differential Revision: D36807828

Pulled By: cortinico

fbshipit-source-id: 9bb599bbc7b79d2b4c010ba84cc8777e29b974ca
2022-06-01 17:13:11 -07:00
Jérémy Barbet 927b43d47c typo for the automaticallyAdjustKeyboardInsets description (#33948)
Summary:
Minor typo change

## Changelog

[iOS] [Fixed] - Typo in the documation for the `automaticallyAdjustKeyboardInsets` prop

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

Test Plan: Read the paragraph, solid.

Reviewed By: kacieb

Differential Revision: D36810184

Pulled By: cortinico

fbshipit-source-id: af586beb4eb3fd4337d2df8612d39c6abb0a37bf
2022-06-01 13:25:20 -07:00
vincent-paing 0a854c7c8b feat: Add permission introduced in Android 13 (#33471)
Summary:
Android 13 introduces two new permission,
- [NEARBY_WIFI_DEVICES](https://developer.android.com/about/versions/13/features/nearby-wifi-devices-permission) for scanning nearby wifi devices.
- [POST_NOTIFICATIONS](https://developer.android.com/about/versions/13/changes/notification-permission) for posting notifications.

This PR adds all the new permission (as of this PR creation) in Android 13.

## Changelog

[Android] [Added] - Add POST_NOTIFICATIONS, NEARBY_WIFI_DEVICES permission

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

Test Plan:
```
PermissionsAndroid.POST_NOTIFICATIONS === 'android.permission.POST_NOTIFICATIONS'
PermissionsAndroid.NEARBY_WIFI_DEVICES === 'android.permission.NEARBY_WIFI_DEVICES'
```

Reviewed By: cortinico

Differential Revision: D35080683

Pulled By: GijsWeterings

fbshipit-source-id: cd5ba7f519feb77f939d5076ef414a01357329ab
2022-06-01 09:11:39 -07:00
Andy Zolyak 92ebb298e2 Fix ReactEditText so it works with Android Emoji2 automatic support (#33920)
Summary:
tldr; `ReactEditText` and Android's emoji support in Android's AppCompat 1.4.0 / 1.4.x conflict in an odd way, causing NPEs.

`ReactEditText` defines an `InternalKeyListener`, `mKeyListener`, that it uses to make sure input from all keyboards works correctly. This listener is normally initialized at the end of the constructor.

Unfortunately, some versions of `AppCompatEditText`, most notably the version in the App Compat `1.4.0-alpha0x`, the [minimum version required for the Play Store's emoji compliance](https://developer.android.com/guide/topics/ui/look-and-feel/emoji2#appcompat) call  `setInputType` from `AppCompatEditText`'s constructor. `ReactEditText` operates on the key listener inside of `setInputType` and since the `AppCompatEditText` constructor is called via call to `super` before the key listener is initialized, these versions of app compat can cause NPEs when used with React Native.

The fix is simple; check to see if `mKeyListener` is null, and initialize it if it is. This is necessary in both the constructor and inside of `setInputType`.

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

https://github.com/facebook/react-native/wiki/Changelog

[Android] [Fixed] - NPE in `ReactEditText.setInputType` when React Native is used with some versions of a AppCompat 1.4.x. (and possibly others)

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

Test Plan:
1. Build an app with both React Native and load it inside an app that is using AppCompat 1.4.x
2. Add a text field using React Native.
3. Open the screen of the app that contains the text field.

If you're working from this branch, you'll be fine. If you're working from main you'll get an NPE.

I can put together a test repo if needed.

Reviewed By: kacieb

Differential Revision: D36802622

Pulled By: cortinico

fbshipit-source-id: e7646da9a1ef0e0334152aecab0f972ca25092ec
2022-06-01 08:07:40 -07:00
Moti Zilberman 55a1cfedc5 Exclude *._reactvr.js from Buck
Summary: Changelog: [Internal]

Reviewed By: GijsWeterings

Differential Revision: D36805013

fbshipit-source-id: c8c0fafe2a60e4d5f21e99b1c34bcc2b45d302d9
2022-06-01 06:27:57 -07:00
Nicola Corti f1775ba67b Make sure sdks/.hermesversion is included inside the NPM package.
Summary:
The sdks/.hermesversion file should be included inside the React Native NPM package.
While this file is available on the release branch, so it's effectively used during artifact preparation,
the file should also be included inside the react-native NPM package.

This commit addresses it.

Changelog:
[Internal] - Make sure sdks/.hermesversion is included inside the NPM package

Reviewed By: dmitryrykun

Differential Revision: D36785480

fbshipit-source-id: 1152de77818e92814b402a57ca5a05c235747eac
2022-06-01 02:56:42 -07:00
Kevin Gozali 8db233670f Added bridgeless feature flag
Summary:
Adding a flag to prepare for the phase 3 of the new architecture. This is still work in progress, not usable yet.

Changelog: [Internal]

Reviewed By: RSNara

Differential Revision: D36767843

fbshipit-source-id: 338d775681f2890461608b403749c3a7f05f84ff
2022-05-31 18:12:30 -07:00
Joshua Gross a68dca3c46 Clean up View Recycling
Summary:
Followups to View Recycling diffs to improve things / clean up things a bit. This also fixes memory warnings which were not hooked up before.

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D36707792

fbshipit-source-id: 410e70bf0eeec5569566138af547e1601394d0e6
2022-05-31 14:34:33 -07:00
Nicola Corti bffad4351c Backports fixes on the 0.69 release branch to main (#33938)
Summary:
This PR includes a set of changes that landed only on the 0.69-stable release branch and need to be backported to main:

- a72d1960ff
- 659b693fcd
- 2a6832a7e3
- 0ca6e41059
- f50936bef2

Most of the fixes are working around the assumption that
`version != 1000.0.0 => Build Hermes From Source`.

That is not true in the release branch as the version is named (e.g. 0.69.0-rc4) and we need to build Hermes there.

## Changelog

[Internal] - Backports fixes on the 0.69 release branch to main

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

Test Plan: Tested that those commits are working fine on the release branch.

Reviewed By: hramos

Differential Revision: D36776291

Pulled By: cortinico

fbshipit-source-id: 66e28232d80054fab4a2a97c8d2de12e3c1cf392
2022-05-31 10:37:12 -07:00
LeoTM f56d701e56 Bump iOS from 11.0 to 12.4 in Hermes eng podspec (#33939)
Summary:
Deprecate iOS/tvOS SDK 11.0 support now that 12.4+ is required

Context: https://github.com/facebook/react-native/pull/33935#issuecomment-1142253352

## Changelog

[iOS] [Fixed] - Deprecate iOS/tvOS SDK 11.0 support now that 12.4+ is required

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

Reviewed By: hramos

Differential Revision: D36780553

Pulled By: cortinico

fbshipit-source-id: 64dd12742d1f9f949a89306dd3353ea24a31983d
2022-05-31 10:29:08 -07:00
fortmarek 91452fc1ed Fix downloading prebuilt hermes from the Github release (#33935)
Summary:
This:
```ruby
source[:http] = `https://github.com/facebook/react-native/releases/download/v#{version}/hermes-runtime-darwin-v#{version}.tar.gz`
```
currently fails with the following error:
```
[!] Failed to load 'hermes-engine' podspec:
[!] Invalid `hermes-engine.podspec` file: No such file or directory - https://github.com/facebook/react-native/releases/download/v0.69.0-rc.4/hermes-runtime-darwin-v0.69.0-rc.4.tar.gz.
```

For some reasons, the string with backticks is treated differently than with double quotes since this works:
```ruby
source[:http] = "https://github.com/facebook/react-native/releases/download/v#{version}/hermes-runtime-darwin-v#{version}.tar.gz"
```

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

[Internal] - Fix downloading prebuilt hermes from the Github release

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

Test Plan:
- `npx react-native init RN069RC4 --version 0.69.0-rc.4`
- in the created project, run `pod install` with hermes enabled
- run `git init && git add . && git commit -m "Initial commit" && git remote add origin https://github.com/fortmarek/some-fake-repository` (this is necessary due to an unrelated bug in the RC4)
- observe error
- update `node_modules/react-native/sdks/hermes-engine/hermes-engine.podspec` with the change from this commit
- run `pod install`
- 🎉

Reviewed By: dmitryrykun

Differential Revision: D36775047

Pulled By: cortinico

fbshipit-source-id: 3772adca32fe9898cde33c187d19b7b181af3677
2022-05-31 04:43:00 -07:00
Nicola Corti f4123b0bd1 Fix broken test_android on CircleCI
Summary:
This diff addresses a couple of failures introduced on D36608419 (7b778fbebb)

Changelog:
[Internal] [Fixed] - Fix broken test_android on CircleCI

Reviewed By: robhogan

Differential Revision: D36758484

fbshipit-source-id: 6e822553e1f6b405a1ced5fccad6c81b03bb46b0
2022-05-30 03:25:03 -07:00
Héctor Ramos 54c346a03a Hermes: Add hermesc unit tests (#33914)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/33914

Add test coverage for the new hermesc functions in hermes-utils.js

Changelog: [Internal]

Reviewed By: cortinico

Differential Revision: D36361612

fbshipit-source-id: 270f30917245c8d81baf136d9f58da4d77f7ad55
2022-05-30 02:59:35 -07:00
Jordan Brown 4f1aa4d686 Turn on env-mode ssa
Summary:
Turns on the ssa env mode in Flow, which supercedes constrained writes with additional fixes
to refinement invalidation.

Reviewed By: SamChou19815

Differential Revision: D36717890

fbshipit-source-id: 20ee963591e8b454458273ac5aa86798e94a8bbd
2022-05-26 15:09:37 -07:00
Jordan Brown 6064fd0600 Presuppress xplat and upgrade to 0.178.1
Summary:
This diff upgrades xplat to 0.178.1 and pre-suppresses errors from turning on constrained writes.

To generate this diff I:
* Modified every `env_mode=constrain_writes` to `env_mode=ssa` and made a commit (this is so our upgrade script will work)
* Ran   scripts/flow/upgrade.sh 0.178.1 to upgrade all the flowconfigs to 178.1 and suppress new-env errors
* Modified arvr/js/flowconfig.ejs to use 0.178.1 and ran `scripts/gen-flowconfig/gen-flowconfig --project arvr`
* Modified xplat/js/flowconfig.ejs to use 0.178.1 and ran `scripts/gen-flowconfig/gen-flowconfig --project xplat`
* Unstacked from the commit in point 1

Reviewed By: SamChou19815

Differential Revision: D36676019

fbshipit-source-id: c3032f18ed838afc327f00de563e7f20713bdc26
2022-05-26 12:59:52 -07:00
Tommy Nguyen eb7cc85a91 Fix `pod install --project-directory=ios` failing when Hermes is enabled (#33909)
Summary:
`pod install --project-directory=ios` silently fails to prep Hermes:

```
% pod install --project-directory=ios
[Codegen] Generating ios/build/generated/ios/React-Codegen.podspec.json
[Hermes] Downloading Hermes source code for commit 515e112edc267ad58d3c70991b3d9a721cc66b19
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
100 9478k    0 9478k    0     0  3939k      0 --:--:--  0:00:02 --:--:-- 5591k
[Hermes] Expanding Hermes tarball for commit 515e112edc267ad58d3c70991b3d9a721cc66b19
[Hermes] Using pre-built HermesC

[!] One or more resources were not found and will not be included in the project. If they are found later and you want to include them, run `pod install` again.
warn Multiple Podfiles were found: ios/Podfile,macos/Podfile. Choosing ios/Podfile automatically. If you would like to select a different one, you can configure it via "project.ios.sourceDir". You can learn more about it here: https://github.com/react-native-community/cli/blob/master/docs/configuration.md
Auto-linking React Native module for target `ReactTestApp`: ReactTestApp-DevSupport
Analyzing dependencies
Fetching podspec for `DoubleConversion` from `../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec`
[Codegen] Found FBReactNativeSpec
Fetching podspec for `RCT-Folly` from `../node_modules/react-native/third-party-podspecs/RCT-Folly.podspec`
Fetching podspec for `boost` from `../node_modules/react-native/third-party-podspecs/boost.podspec`
Fetching podspec for `glog` from `../node_modules/react-native/third-party-podspecs/glog.podspec`
[!] No podspec found for `hermes-engine` in `../node_modules/react-native/sdks/hermes/hermes-engine.podspec`

% ls -l node_modules/react-native/sdks
total 0
hermes-engine
hermesc
```

## Changelog

[iOS] [Fixed] - `pod install --project-directory=ios` fails when Hermes is enabled

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

Test Plan: Instead of running `pod install` inside `ios` folder, run `pod install --project-directory=ios`.

Reviewed By: cortinico

Differential Revision: D36693625

Pulled By: hramos

fbshipit-source-id: 8757a9c388348276b07c785c211979ec8f2e2f84
2022-05-26 10:07:57 -07:00
Michael Lee (Engineering) 2d66bd4851 Rename the folly `headers_only` target to warn
Summary:
This target is not a good idea for a number of reasons:
1. It groups up multiple targets which breaks the dependency graph
2. It does not handle dependency remapping correctly
3. It has no mirror into fbcode

We should warn people this is a bad idea

Reviewed By: alexmalyshev

Differential Revision: D36519357

fbshipit-source-id: d60ca3237c7710118732578fecd1b2fc8903321b
2022-05-26 08:17:27 -07:00
Daniel Abramowitz a3e25b23c6 Improve exception thrown when classes can't compile to be more clear (#33897)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/33897

Now the exception will display the class which caused the exception as well as helpful information as to why.

We've seen this happen a bunch due and have been very confused by the error message. It turns out that this processor runs before the classes listed are compiled. This means that if there's a compile error (or a missing import) the user will only see that this processor crashed, and not the compile error.

The additional information in the error is:

`java.lang.RuntimeException: Could not load classes set in ReactModuleList.nativeModules. Check that they exist and are imported correctly on class: com.meta.x.y.ReactPackage`

In this case,  `com.meta.x.y.ReactPackage` is the class which needs to be fixed. Before, the error message made no mention of this class or the annotation.

Changelog: [Internal] This will change the way the annotation processor crashes. It will throw a RuntimeException instead of a ClassCastException.

Reviewed By: javache

Differential Revision: D36606279

fbshipit-source-id: aedf9682286fba49e23716b7eda16b2dd3b13422
2022-05-26 08:13:22 -07:00
Nicola Corti 833222fa10 Remove shelljs dependency and duplicated scripts in files (#33915)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/33915

We don't need to import shelljs as a dependency anymore,
plus we had a duplicated entry in the files array for package.json

Changelog:
[Internal] [Changed] - Remove shelljs dependency and duplicated scripts in files

Reviewed By: dmitryrykun

Differential Revision: D36698750

fbshipit-source-id: 94f449f2c3c5d73d0f9ffd29df6b26f5fd6ef129
2022-05-26 05:17:30 -07:00
Joshua Gross b1701bd20f ReactTextView View recycling
Summary:
See previous diff for details on general approach and benchmarks.

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D36676887

fbshipit-source-id: b177dcd19f1ea687bf7d2d4f2f637d2924723340
2022-05-26 03:40:21 -07:00
Joshua Gross 7b778fbebb Prototype View recycling for View
Summary:
Prototype of View Recycling for View + generic APIs.

Changelog: [Added][Android] Adding experimental View Recycling for Fabric on Android.

Reviewed By: mdvacca

Differential Revision: D36608419

fbshipit-source-id: c469ce2fe12ef9332d3def591118befc4a619870
2022-05-26 03:40:21 -07:00
Eric Hartzog 0ef73f2a82 Restore early return to NativeAnimatedHelper.flushQueue
Summary:
Brings back a small performance win of avoiding starting/stopping a batch if the queue is empty.

## Background

This was attempted previously but it happened to expose a single frame animation visual regression in VR.

1. First added in D36298399 (55ee8ce0c4), reverted in D36378363
2. Added in a different form in D36338606 (35e2a63b8d), reverted in D36479089 (a4690d054f)
3. Root cause of the visual regressions introduced was fixed in D36612758 (40f4c662bc)

Now that we've fixed the root cause of the visual regression, this is safe to restore.

Changelog: [Internal]

Reviewed By: JoshuaGross

Differential Revision: D36670591

fbshipit-source-id: 42b6bc9c7764484f2dbb9edb122780a91b7393b4
2022-05-25 16:35:11 -07:00
Genki Kondo 27bbb5ef37 Add RTL option to FlatList example
Summary:
Followup task for S271544.

There were no tests covering RTL on FlatLists, which would have prevented the above SEV. Adding an RNTester example for this.

Changelog:
[Internal] - Added RNTester example FlatList with RTL

Reviewed By: lunaleaps, javache

Differential Revision: D36601583

fbshipit-source-id: 054ac4eee876a514152f83ecc0522c62337cfea5
2022-05-25 13:24:13 -07:00
Ramanpreet Nara 40a86b0650 Add more information to JavaScript module not registered as callable error message
Summary:
When a JavaScript module is not registered as callable, the bridge will throw an error. Let's clean up the error message so that it's more helpful.

Now, it logs the number of registered callable JavaScript modules, as well as the list of callable JavaScript modules.

Changelog: [Internal]

Reviewed By: sshic

Differential Revision: D36646936

fbshipit-source-id: 62d091cda35e296ef9e569b444cd5b6f09b8bc54
2022-05-25 13:21:08 -07:00
David Vacca fd9c677f0c EZ sort of annotations
Summary:
EZ sort of annotations

changelog: [internal] internal

Reviewed By: sshic

Differential Revision: D35682782

fbshipit-source-id: 5763b140ee4ce54e467e0a80c6d835ae0c4234db
2022-05-25 13:08:29 -07:00
David Vacca ddad5d1265 Remove DevToolsReactPerfLoggerListener when FabricUIManager is deallocated
Summary:
Remove DevToolsReactPerfLoggerListener when FabricUIManager is deallocated

changelog: [internal] internal

Reviewed By: JoshuaGross

Differential Revision: D36500223

fbshipit-source-id: d44e0d07390724191360540e04a51261803eb57c
2022-05-25 12:22:29 -07:00
Luna Wei 40769f2212 PointerEvents: Don't dispatch when no listeners for hover events
Summary:
Changelog: [Internal][Changed] - Make the same optimization on enter/leave/move pointer events being dispatched by a mouse input.

If any ancestor view is listening to enter/leave events (just capture) then we dispatch the enter/leave event.

Reviewed By: vincentriemer

Differential Revision: D36601638

fbshipit-source-id: d6b5c32ae50bcf000100bcb878ca2ca89bd5c02e
2022-05-25 11:49:56 -07:00
Héctor Ramos 0ad38a0eae Bump React Native iOS tests to Xcode 13.3.1
Summary:
Upgrade the version of Xcode used in Sandcastle to Xcode 13.3.1, and the version used on Circle CI to Xcode 13.3.1.

Added a reminder to the Circle CI config to ensure we keep these versions in sync in future updates.

Circle CI software manifest: https://circle-macos-docs.s3.amazonaws.com/image-manifest/v7555/index.html

Changelog: [Internal]

Reviewed By: makovkastar

Differential Revision: D36671468

fbshipit-source-id: 8c028915d38738c92b5f759186b0fb95a9274211
2022-05-25 11:44:42 -07:00
Genki Kondo 40f4c662bc Set correct initial value for AnimatedComponent for styles backed by native animated nodes
Summary:
In AnimatedComponent.render, we get the initial values of any styles backed by AnimatedNode, but ONLY for non-native animations. Thus, if convert an animated node to native before the call to render to mount the component, we will end up not applying the initial value until after the component is mounted. This may result in a visible flicker as the expected value is applied some time after the component is mounted and visible.
- Without native driver: BaseViewManager.setTransform called during view preallocation (ViewManager.createViewInstance)
- With native driver: BaseViewManager.setTransform called during MountingManager.updateProps (called from PropsAnimatedNode.updateView)

This diff removes the isNative check in AnimatedStyle and AnimatedProps when traversing style props. This shouldn't be a problem:
- Created as non-native, animated with JS driver
  - This diff does not affect this scenario
- Created as non-native, animated with native driver
  - Initial value is applied correctly on render/mount. On subsequent renders, the outdated value from JS side will not apply on the platform view as it has not changed.
- Created as native, animated with native driver
  - Initial value is applied correctly on render/mount. On subsequent renders, the outdated value from JS side will not apply on the platform view as it has not changed.

Changelog:
[Internal][Fixed] - Set correct initial value for AnimatedComponent for styles backed by native animated nodes

Reviewed By: JoshuaGross, javache

Differential Revision: D36612758

fbshipit-source-id: 922d6534c605b3eb0a1d9476753111b726f138f2
2022-05-25 10:33:17 -07:00
Nicola Corti ba6bf5a3ce Fix NPE on RN-Tester due to null mFabricViewStateManager (#33910)
Summary:
RN-Tester is currently crashing at startup time due to an NPE.
This PR fixes it.

## Changelog

[Android] [Fixed] - Fix NPE on `ReactEditText` due to null mFabricViewStateManager

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

Test Plan: Tested locally that RN Tester runs both in Debug and in Release

Reviewed By: cipolleschi

Differential Revision: D36666440

Pulled By: cortinico

fbshipit-source-id: f004ff228fb4f9ff339aac606858d47de3706426
2022-05-25 10:10:35 -07:00
David Vacca d315e9c743 Add feature flag to enable / disable SpannableCache in TextLayoutManagerMapBuffer
Summary:
Quick diff to add feature flag to enable / disable SpannableCache in TextLayoutManagerMapBuffer

changelog: [internal] internal

Reviewed By: genkikondo

Differential Revision: D36498646

fbshipit-source-id: 4cabb75441ddbafeff65f3e9b2df6a38431a996a
2022-05-25 09:14:44 -07:00
Lulu Wu 089ff4555a Revamp touch event dispatching methods
Summary:
There are two methods in ReactRootView to handle touch events "onInterceptTouchEvent" and "onTouchEvent", for Venice we have ReactSurfaceView inherits ReactRootView but the implementation for above 2 touch handling methods still calls into it's super implementation which uses the bridge.

In this diff we make ReactSurfaceView inherits ReactRootView's "dispatchJSTouchEvent" and "dispatchJSPointerEvent". So that Venice has separate implementation for touch events handling.

Changelog:
[Android][Changed] - Revamp touch event dispatching methods

Reviewed By: fkgozali, JoshuaGross

Differential Revision: D36629466

fbshipit-source-id: fb7c5950afe6249d22edd3fac3fa5d3b83b3af84
2022-05-25 09:12:35 -07:00