Summary:
This diff breaks the RNTester app at runtime and it prevents us from cutting RN 0.69.
Original commit changeset: a879787d8683
Original Phabricator Diff: D35435562 (f4c4f446e4)
## Changelog
[General][Fixed] - Revert change which breaks RNTester
Reviewed By: cortinico, kacieb
Differential Revision: D35936298
fbshipit-source-id: c4ec92002fde9c1de691bcda17ebc5d0747914f6
Summary:
Ideally, the application should always be able to create the TurboModule object given an ObjC class. This debugging information will help track down these classes of issues, when they surface.
Changelog: [Internal]
Reviewed By: fkgozali
Differential Revision: D35945399
fbshipit-source-id: 1621a4a64bc8fb0411123fb1470bbb52ccf0edcf
Summary:
During the TurboModule init path, the TurboModuleManager asks the application to create the TurboModule object, given its class.
If the application is unable to create the TurboModule object, what should we do?
0. **What we do now:** Continue executing TurboModule init path.
1. Silently return nil early.
2. Silently return nil early, and RCTLogError.
If we Continue executing the TurobModule init path, we'll run into a segfault, because we'll call objc_setAssociatedObject(nil, ...).
This diff prevents that segfault, by doing a silent return of nil.
Changelog: [iOS][Fixed] - Prevent Nullptr segfault in TurboModule init path
Reviewed By: fkgozali
Differential Revision: D35942323
fbshipit-source-id: 7755800379c4bc733502314f3af3f401e9b04872
Summary:
The `notifyNativeGestureEnded` API is added to notify user gesture ended, so that any optimization we had during handling the gesture can be restored.
It's possible that when the gesture finishes, the RootView is already unmounted from the native side. This might happen when user starts a gesture that caused leave of the RN screen, or close the app.
Changelog:
[Android][Internal] - Avoid NPE for gesture notifier
Reviewed By: javache
Differential Revision: D35902523
fbshipit-source-id: 9bb5819a53dd053290031eebaae1b8f0318ae534
Summary:
# First issue - incorrect ref
In this example, `AccessibilityInfo.setAccessibilityFocus_unstable` is being called on the Button ref. This fails because Button is not a HostComponent and does not accept a forwarded ref.
Since the button needs to be focused in order to click on it, I don't think the intention of this example actually makes sense. Since even if it worked, it would just reset the focus in the same place.
Instead, I alter this to set accessibility focus on the preceding Text element, which makes it more clear that setAccessibilityFocus is working.
# Second Issue - focus after closing Alert doesn't work
I am not sure why this is the case, but removing the alert causes focus to work correctly. i'm guessing the set focus command is conflicting with Alert's default resetting focus behavior.
# Minor Fix
I also quickly cleaned this up to be a function component because class components make refs more confusing (to me).
Changelog:
[Genera] Fix sendAccessibilityEvent_unstable Example in RNTester
Reviewed By: p-sun
Differential Revision: D35725018
fbshipit-source-id: f5a1dbbcf2635f038c41db9ef2a0b31389d2c745
Summary:
This commit moves the resolution of the hermesc inside the TaskAction block of the
HermesBinaryTask. Therefore the hermesc path will be investigated only during the
execution of the task, and not when the task is created.
Changelog:
[Internal] [Changed] - Lazily resolve the hermesc path rather than eagerly
Reviewed By: motiz88
Differential Revision: D35930548
fbshipit-source-id: a517dda0fa9b10f53c25cd256ceb68d37d533d3b
Summary:
This diff updates the CMake command used for configuring the Hermes build
from `cmake` from $PATH to the `cmake` bundled with the Android SDK.
If not found, fallsback to the previous behavior.
This relaxes the requirement of having to ask our users to install CMake
in their CLIs.
Changelog:
[Internal] [Changed] - Use Android SDK version of CMake rather than an external one
Reviewed By: neildhar
Differential Revision: D35931306
fbshipit-source-id: 8d6c554e5e9040e3bd4fed5f72fbdb0eb61d745a
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/33688
These methods used to be public in the legacy implementation, and hiding them significantly reduces amount of customization available to other clients outside Fabric core.
Changelog: [Internal] Allow external callers to call UIManager methods
Reviewed By: cipolleschi
Differential Revision: D35818114
fbshipit-source-id: 4dc4177c82b5db9ae3d136a1a83f5ec3123b971f
Summary:
Minimal set of changes to intercept events in external modules. Current intended use-case is for Reanimated to handle events for the Animated properties.
Changelog: [Added] Add listeners to allow intercepting events in C++ core.
Reviewed By: cipolleschi
Differential Revision: D35312534
fbshipit-source-id: ec924b57fd0c0dabf7be7b886dbef23bf3170d6c
Summary:
When a FlatList is nested inside another FlatList, it may be re-rendered whenever the outer FlatList renders. Apply the same optimization we already had in `VirtualizedListContextProvider` to avoid changing the context object if no values have changed.
Changelog: [General][Changed] - Optimized VirtualizedList context when used with nested lists
Reviewed By: genkikondo
Differential Revision: D35905952
fbshipit-source-id: 695253c85db2043d22e208ad94ecc7daa1455055
Summary:
Refactor of TouchTargetHelper.findTargetPathAndCoordinatesForTouch to avoid unnecessary lookup of views during the dispatching of Hover Events
changelog: [internal] internal
Reviewed By: lunaleaps, mdvacca
Differential Revision: D32296003
fbshipit-source-id: 93834c37331ad5d75645a5665a1c8c3d965765fb
Summary:
When searching for the `hermesc` path, we should also honor the `REACT_NATIVE_OVERRIDE_HERMES_DIR` variable.
Changelog:
[Internal] [Changed] - Honor the REACT_NATIVE_OVERRIDE_HERMES_DIR variable when searching for `hermesc`
Reviewed By: neildhar
Differential Revision: D35903601
fbshipit-source-id: 31e1255a558eece8cd84669861328db72e9ed17b
Summary:
This would fix test errors caused by including <string> in non-C++ compatible files.
Changelog:
[General][Changed] - Remove usage of std::string in EarlyJsErrorHandler.
Reviewed By: RSNara
Differential Revision: D35645334
fbshipit-source-id: 7f04d2c66d53dc1eef63367de1a64ed9273898f5
Summary:
Ensures that transaction telemetry modified by transaction controller is the same as sent in the view callbacks.
Changelog: [Internal]
Reviewed By: cortinico, cipolleschi
Differential Revision: D35827347
fbshipit-source-id: 123ae01d4a7fe1a9c97ebccae3ae248f7f2cf654
Summary:
Changelog:
[iOS][Fixed] - Expose the extraData dict attached to JavaScript errors to the native ExceptionManager on iOS, similar to Android
Attaching the `extraData` dict to JavaScript crash reports is something that was done for Android only in 2019 (D16133080 (3a825c0360)), and somehow we never really got around to adding it in iOS. This diff finally adds the capability to iOS as well. `extraData` can be used to attach various bits of data to a crash report for better debugging and categorization. As with the Android implementation, `extraData` is not attached if the `reportException` API is not used.
Reviewed By: dmitryrykun
Differential Revision: D35743658
fbshipit-source-id: de4060cb6e514db1d85907441a8962f98e9b8392
Summary:
Apple suggested to this new API on iOS 10+.
> // Any new bitmap drawing code is encouraged to use UIGraphicsImageRenderer in lieu of this API.
WWDC18 Reference: https://developer.apple.com/videos/play/wwdc2018/219/
> Use UIGraphicsImageRenderer to create and draw to an image buffer
Supports Wide Color, unlike UIGraphicsBeginImageContext()
Combine with UIImageView for efficient offscreen rendering
Per https://nshipster.com/image-resizing/#performance-benchmarks, the new API runs even faster than the C version, probably due to more smart context reuses/management.
Changelog:
[iOS][Changed] - Adopt UIGraphicsImageRenderer API
Reviewed By: philIip
Differential Revision: D35699584
fbshipit-source-id: 7a1e2109d5e121fb396c1014f4ed0a892211b0cc
Summary:
WHen porting TurboModules or adding new TurboModules, ReactModuleSpecProcessor may fail during buck build, and when the failure is caused by typeElement.getAnnotation, no useful information gets collected, making it difficult to debug.
So here I am adding a try & catch so we can get useful debugging info.
Changelog: [Internal]
Reviewed By: RSNara
Differential Revision: D35767207
fbshipit-source-id: 7e1f9dfbfd31339ab37af19c51d85085e100955a
Summary:
We're adding a native module that returns a Nullable type. This makes the Java spec and the implementation to be the same.
Changelog:
[Android][Added] - Generate `Nullable` for optional objects and arrays in module codegen.
Reviewed By: yungsters
Differential Revision: D35651333
fbshipit-source-id: d73c87340e33cf79831915ce6892e457ef369175
Summary:
This diff allows to customize the Hermes version exposed by the VM with
a version provided by React Native. This will make clearer that a specific
version of Hermes was built at a specific point of the RN release process.
Changelog:
[Internal] [Changed] - Customize the Hermes version using the RN one
Reviewed By: neildhar
Differential Revision: D35820268
fbshipit-source-id: 3e76db921c12a599743fb9312f52edd06d223bad
Summary:
If Hermes is enabled, it will be built from source instead of using the CocoaPods hermes-engine pod.
Changelog:
[iOS] [Changed] Build Hermes from source when Hermes is used
Reviewed By: cortinico
Differential Revision: D35693945
fbshipit-source-id: eadc638106180b183fd6d1e2a272dc3df66fa8b6
Summary:
https://fb.workplace.com/groups/fbapp.commerce.engsupport/permalink/2074812256012212/
Back out "[react-native][PR] Pass mutation list to RCTMountingTransactionObserving callbacks"
Original commit changeset: f40afc512f2c
Original Phabricator Diff: D35214478 (91fc2c0091)
Changelog: [Internal]
Reviewed By: cipolleschi
Differential Revision: D35825832
fbshipit-source-id: b53b616dca39c84b3a8e8e4cbaa4a45834e53fe3
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/33547
Now that Hermes is being built from source, Circle CI iOS unit tests can be re-enabled.
Changelog: [Internal]
Reviewed By: cortinico, neildhar
Differential Revision: D35328103
fbshipit-source-id: ea99d8f1fa02997e9c4f55048012b4b55c0bb2b3
Summary:
This diff extends the Gradle algo used to search for `hermesc`.
Currently we look into `node_modules/hermes-engine/%OS-BIN%/hermesc`
With this change the algo will look into:
- A user provided path to hermesc
- Built from source version of hermesc (for users of New Architecture)
- Bundled version of hermesc inside react-native
- hermesc from the hermes-engine NPM package
I've added tests for the new algo. I also realized our tests were broken
(since they stopped running on CI), I fixed them as well.
Changelog:
[Android] [Changed] - Gradle: extend the algoritm to find hermesc paths
Reviewed By: ShikaSD
Differential Revision: D35649911
fbshipit-source-id: d4bcbe06a6bfa8d98b91c1612fc28b300de91661
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/33671
With React 18, we now need to allow users on Fabric to opt-in for Concurrent Root.
This commit adds a new method that can be customized in the AppDelegate to turn the feature on and off.
The flag is passed as an initialProps to the rootView.
## Changelog:
[iOS][Added] - Prepare a method in the AppDelegate to control the concurrentRoot.
Reviewed By: cortinico, dmitryrykun
Differential Revision: D35757833
fbshipit-source-id: 192cf74c796554cba39366aa90c53c191f960c20
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/33672
This pr adds a parameter to the `create-artifacts.js` script to accept the path to a node executable, falling back to `node` in case the parameter has not been passed.
Then, it passes the NODE_BINARY to the script in the `script_phases.sh` script.
This PR decouples the `node` environment from the system one and fixes a build issue in the new architecture when the environment has no `node`
## Changelog
[iOS][Changed] - Update CodeGen scripts to accept custom node executable
Reviewed By: cortinico, dmitryrykun
Differential Revision: D35748497
fbshipit-source-id: 41b102de6427d6ef0ba1f8725f4b939d3b8c63db
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/33674
## Issue
In D35317070 (0480f56c5b) we introduced a way to configuring the Xcode environment via he `.xcode.env`, falling back to the old `find-node-for-xcode.sh` behavior in case of a misconfiguration.
Unfortunately, there were an issue with the new architecture for which the pods were not able to locate the `find-node-for-xcode.sh`, crashing while building the new architecture.
## Solution
This Diff solves the issue in two steps:
1. it exposes to the project the REACT_NATIVE_PATH like Android does here: D35451821 (f8d7e0a968)
2. it leverages this new variables to reach the script
## Changelog
[iOS][Changed] - Fixed the fallback behavior when the `.xcode.env` file is missing, actually using the old `find-node-for-xcode.sh` script
Reviewed By: dmitryrykun
Differential Revision: D35779165
fbshipit-source-id: 393ef9a0b98d32d9cf226f7d109fdefd772e5120
Summary:
This PR updates `RCTMountingTransactionObserving` protocol to accept full `MountingTransaction` object as an argument to its methods as opposed to just `MountingTransactionMetdata` which contained only some subset of information.
This change makes it possible for components implementing the protocol to analyze the list of mutations and hence only take action when certain mutations are about to happen.
One of the use cases for `RCTMountingTransactionObserving` protocol is to allow for Modal to take view snapshot before it is closed, such that an animated close transition can be performed over the snapshotted content. Note that when modal is removed from the view hierarchy its children are gone too and therefore the snapshot mechanism makes it possible for children to still be visible while the animated closing transition is ongoing. A similar use-case to that can be seen in react-native-screens library, where we use the same snapshot mechanism for views that are removed from navigation stack.
Before this change, we'd use `mountingTransactionDidMountWithMetadata` to take a snapshot. However, making a snapshot of relatively complex view hierarchy can be expensive, and we'd like to make sure that we only perform a snapshot when the given modal is about to be removed. Because the mentioned method does not provide an information about what changes are going to be performed in a given transaction, we'd make the snapshot for every single view transaction that happens while the modal is mounted.
In this PR we're updating `RCTMountingTransactionObserving` protocol's methods, in particular, we rename methods to no longer contain "Metadata" in them and to accept `MountingTransaction` as the only argument instead of `MountingTransactionMetadata` object. With this change we are also deleting `MountingTransactionMetadata` altogether as it has no uses outside the protocol. Finally, we update the two uses of the protocol in `RCTScrollViewComponentView` and `RCTModalHostViewComponentView`.
## Changelog
[iOS][Fabric] - Update RCTMountingTransactionObserving protocol to consume MountingTransaction objects
Pull Request resolved: https://github.com/facebook/react-native/pull/33510
Test Plan:
As there are not that many uses of `RCTMountingTransactionObserving` protocol during testing I focused on checking if the updated method is called and if the provided objects contains the proper data. Unfortunately, despite code for the modal protocol being present in OSS version it does seem like some parts of modal implementation are still missing and the component only renders an unimplemented view (checked this with rn-tester). I only managed to verify the use in `RCTScrollViewComponentView` with the following steps:
1. Build for iOS
2. Put a breakpoint in mountingTransactionDidMount method in `RCTScrollViewComponentView.mm`
3. Verify that the program stops on the breakpoint when a scrollview is rendered (use any screen on rn-tester app)
4. Inspect the provided object in the debugger (ensure the list of transactions is not empty)
Outside of that we verified the transactions can be processed in `mountingTransactionDidMount` after the changes from this PR are applied in FabricExample app in [react-native-screens](https://github.com/software-mansion/react-native-screens/tree/main/FabricExample) repo.
Reviewed By: cipolleschi
Differential Revision: D35214478
Pulled By: ShikaSD
fbshipit-source-id: f40afc512f2c8cfa6262d2fb82fb1ccb05aa734c
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/33654
In D35116757 (2c87b7466e) we bumped the Circle CI macOS executor to use the Xcode 13.3.0 machine image, which has CocoaPods 1.11.3 installed. The RNTester Gemfile and CocoaPods cache is updated to reflect this change.
In D35116757 (2c87b7466e) the Ruby version was bumped to 2.7.5, so we update the Sandcastle tests to reflect this change as well.
Changelog: [Internal]
Reviewed By: cortinico
Differential Revision: D35679327
fbshipit-source-id: e6b5f9af13e95d335e0f89ebd7e1778a56bba601
Summary:
`hotkeysEnabled` property is added to `RCTDevMenu` which allows enabling/disabling hotkeys that triggers developer menu popup
Changelog:
[iOS][Added] - `hotkeysEnabled` property is added to `RCTDevMenu` which allows enabling/disabling hotkeys that triggers developer menu popup
Reviewed By: arhelmus
Differential Revision: D35777883
fbshipit-source-id: a7435358701bedb54e33198724180eb1c27248b8
Summary:
Changelog: [Internal] Bump react-native-community/eslint-plugin
It looks like we `*` version on the package.json so no updates needed, published 1.2.0: https://www.npmjs.com/package/react-native-community/eslint-plugin
Reviewed By: cortinico, neildhar
Differential Revision: D35590075
fbshipit-source-id: 11402cedea3067018c03e7b59202a48dc3a6b084
Summary:
This PR re-enables bundling of the precompiled `hermesc` binary inside the react-native NPM package. To handle this I've stripped over all the unnecessary files and kept only the relevant binary. It now follows the same structure as the `hermes-engine` NPM package.
## Changelog
[Internal] - Re-enable bundling of hermesc inside the react-native NPM package
Pull Request resolved: https://github.com/facebook/react-native/pull/33677
Test Plan:
Will wait for a successful CI job to produce a commitlies of RN.
https://app.circleci.com/pipelines/github/facebook/react-native/13020/workflows/9b59c6e0-4e90-4008-be73-aaa3155cefc9/jobs/248841
Here the output of the RN commitlies with the file correctly placed:
```
tar -tvf ~/Downloads/react-native-1000.0.0-1520d36ba.tgz | grep hermesc
-rwxr-xr-x 0 0 0 3516952 Oct 26 1985 package/sdks/hermesc/linux64-bin/hermesc
-rwxr-xr-x 0 0 0 2618232 Oct 26 1985 package/sdks/hermesc/osx-bin/hermesc
-rwxr-xr-x 0 0 0 1613312 Oct 26 1985 package/sdks/hermesc/win64-bin/hermesc.exe
```
Reviewed By: neildhar
Differential Revision: D35784619
Pulled By: cortinico
fbshipit-source-id: 334ed03c40f6838ae8365a1f1c6e86e38a8dbc59
Summary:
Fixes https://github.com/facebook/react-native/issues/33529 (note that I reproduced the bug on iOS too).
The bug comes from the fact that we were using `this._scrollMetrics.offset` to determine if the initial scroll was done. But sometimes it equals 0 even after the initial scroll is done, for example when the content does not fill the list. So I replaced it with `this._hasDoneInitialScroll`.
I believe that `this._hasDoneInitialScroll` was not used in the first place because it was introduced later (3 years ago vs 5 years ago for the original code).
The replacement correctly fixes the broken test case and the example given in the issue.
Then I had to update two test cases (rename the first and remove the second), that shows explicitly the broken behavior:
we have to simulate the initial scroll for the content to be adjusted, so when the content does not fill the view and the scroll cannot be executed, the content is not adjusted.
## Changelog
[General] [Fix] - Fix VirtualizedList with initialScrollIndex not rendering all elements when data is updated
Pull Request resolved: https://github.com/facebook/react-native/pull/33558
Test Plan:
- I added a broken test case based on the issue
- I tested with the RNTesterApp using the code example given in the issue
Reviewed By: ryancat
Differential Revision: D35503114
Pulled By: yungsters
fbshipit-source-id: 67bb75d7cf1ebac0d59127d0d45afbaa3167dcf3
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/33673
This PR solves a TODO in a script that required a link to the documentation on the website.
## Changelog
[iOS][Changed] - Adding a link in a message for the users.
Reviewed By: cortinico
Differential Revision: D35742810
fbshipit-source-id: b7416a5bead5fa525ca69f05391b307195f5c987