Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/37676
## Stack
React Native on iOS adds strings to Voiceover interactions to supply more information to users . Internally, and out-of-the-box externally, these are today always announced in English instead of being localized.
This stack adds a limited new internal API, `RCTLocalizedString(string, description)` to allow auto-translated strings which are consumed by both Meta and OSS.
Reviewed By: javache
Differential Revision: D46399962
fbshipit-source-id: 2188a1faba9339cff00f897990b727febc178361
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/37810
Changelog: [Internal]
in this change, i introduce a helper file for swizzling selectors that can be used for building custom shims and fakes. i tried putting this in the cxx target, but i struggled a lot with managing the dependencies and understanding the extra behavior that was happening from being in a `rn_xplat_cxx_library`. this file is also not obj-c++, so i feel like we should decouple if possible.
it does seem like this is a new practice i'm introducing, so let me know if there's something that i'm missing.
Reviewed By: cipolleschi
Differential Revision: D46507803
fbshipit-source-id: 9be63d992b9838e9a98ee0c1c6d684fc59c3fc80
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/37811
Changelog: [Internal]
i am looking to add ios unit tests to venice and this is the first unit test suite that will test native ios code in the new architecture afaik, so i wanted to open this up to discussion.
currently, all `XCTest` in `react-native-github` are coupled with the `RNTester` target. my main qualm with this is i am concerned that it won't scale well. currently we have only ~30ish tests but ultimately if we want a proper testing suite, surely this count will be in the hundreds and that won't be able to reasonably live in a single test target.
however, the trade is that this test will not show up in RNTester. i have added a unit test to RNTester before in D31949237, however the experience was extremely painful as i had to manually update the `project.pbxproj` to include my file, and i had to manually determine what hex value was the next one (for whatever reason, this doesn't increment at the endian...).
i am wondering if we can treat the current unit testing experience in RNTester as pretty much maintenance mode and start thinking of a improved version starting with something more modular like this.
Reviewed By: cipolleschi
Differential Revision: D46467229
fbshipit-source-id: 09de9cf8bc5f8b9c86abcaf7750a6f63686d8d1a
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/37812
Changelog: [Internal]
I would like to add iOS unit tests, but this testing directory has a subdirectory based on features and not platform, which makes the organization challenging, so i'm moving it to a more aptly named directory.
Reviewed By: javache
Differential Revision: D46467041
fbshipit-source-id: f2ba714dc79ecb509b86b4708320c68235354240
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/37832
This parameter is currently unused and is causing Android builds to fail
as they compile with `-Wall`
This is a follow-up to https://github.com/facebook/react-native/pull/37454/ as that PR updated only the `fromJs` and not the `toJs` method as well.
Changelog:
[Internal] [Changed] - Remove CallInvoker parameter from toJs method in Codegen
Reviewed By: rshest
Differential Revision: D46647110
fbshipit-source-id: 1f3e22aca7a3df11ac02b5c4b89c9311b8b1798c
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/37783
We're not checking the number of arguments received before accessing the `arguments` array in JSI methods in `UIManagerBinding`, which could cause access to garbage values. This fixes that by adding a check in all methods to ensure the number of arguments received is at least the arity of the function.
Changelog: [internal]
Reviewed By: rshest
Differential Revision: D46564580
fbshipit-source-id: 7012e0d6fb12c5024e4d6a4c0fb7a8c00263ccac
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/37755
This implements the `id` property in `ReadOnlyElement` as an alias for the `id` or `nativeID` props of the element.
This is currently implemented using an internal API in React but we should find an alternative solution for this in Fabric in the near future. Adding this now because it's useful for debugging.
Changelog: [internal]
Reviewed By: javache
Differential Revision: D46518381
fbshipit-source-id: 1a72fe0349c248744f49b795022b6fdb3359885d
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/37754
This adds a new method in Fabric to get the scroll position for an element, and uses it to implement the following methods as defined in as defined in https://github.com/react-native-community/discussions-and-proposals/pull/607 :
* `scrollTop`: indicates the number of pixels (in device independent pixels) from the content that have moved in the vertical axis in the scroll container.
* `scrollLeft`: indicates the number of pixels (in device independent pixels) from the content that have moved in the horizontal axis in the scroll container.
These API can provide decimal values.
Changelog: [internal]
Reviewed By: javache
Differential Revision: D44757811
fbshipit-source-id: e1b58db8d9f61e823b62d54620a9a0deaae1566b
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/37808
When passing entries of type "event" to `console.log` we only see the fields defined in the base `PerformanceEntry` class because it defines a `toJSON` method but the `PerformanceEventTiming` subclass doesn't.
This implements the method in that class too to improve debuggability (while also making it more spec compliant).
Changelog: [internal]
Reviewed By: rshest
Differential Revision: D46597764
fbshipit-source-id: ca6fba3fdbb74a4f767eebc647681e5b65ba65d8
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/37807
We implemented `PerformanceObserver` but didn't create a `setUp*` module for it like we did for the rest of globals in RN.
This creates the module but doesn't enable it by default (until stable in OSS). We'll require this in a case by case basis for testing.
Changelog: [internal]
Reviewed By: rshest
Differential Revision: D46597766
fbshipit-source-id: 661d009754f4310c6b83483188ed020fc1d4d63b
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/37786
When using the native driver for animations that involve layout changes (ie. translateY and other transforms, but not styles such as opacity), because it bypasses Fabric, the new coordinates are not updated so the Pressability responder region/tap target is incorrect.
Prior diffs ensure that upon completion of natively driven animations, the final values are synced to the JS side AnimatedValue nodes. In this diff, on completion of a natively driven animation, AnimatedProps.update() is called, which in turn calls the value update callback on AnimatedProps, which [triggers a rerender (via setState)](https://www.internalfb.com/code/fbsource/[566daad5db45807260a8af1f85385ca86aebf894]/xplat/js/react-native-github/packages/react-native/Libraries/Animated/useAnimatedProps.js?lines=80) which has the effect of pushing the latest animated values to Fabric.
Alternative considered was using setNativeProps, but that approach was dropped as setNativeProps was only introduced to make migration easier and should not be used for new code, as per sammy-SC.
Changelog:
[General][Fixed] - When animating using native driver, trigger rerender on animation completion in order to update Pressability responder regions
Reviewed By: rshest
Differential Revision: D46574511
fbshipit-source-id: 185471b28f5f7e3ba9d62d2ac196e9b65b07a86e
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/37779
For natively driven animations, we now get the final value of the animation on JS side in the animation end callback. We sync this value into the JS-side AnimatedValue node.
Changelog:
[General][Changed] - Sync AnimatedValue JS node value when animation completes
Differential Revision: D46498320
fbshipit-source-id: 550a3bbbd5323f917c175801b6414a721aa69be5
Summary:
This PR converts DialogModuleTest into Kotlin as requested in [this issue](https://github.com/facebook/react-native/issues/37708).
## Changelog:
<!-- Help reviewers and the release process by writing your own changelog entry.
Pick one each for the category and type tags:
[ANDROID|GENERAL|IOS|INTERNAL] [BREAKING|ADDED|CHANGED|DEPRECATED|REMOVED|FIXED|SECURITY] - Message
For more details, see:
https://reactnative.dev/contributing/changelogs-in-pull-requests
-->
[INTERNAL] [CHANGED] - Convert DialogModuleTest to Kotlin
Pull Request resolved: https://github.com/facebook/react-native/pull/37795
Test Plan:
1. Run `./gradlew :packages:react-native:ReactAndroid:test`.
2. All tests should pass.
Reviewed By: cortinico
Differential Revision: D46596235
Pulled By: mdvacca
fbshipit-source-id: ef4184664ad885ebd2e8c1d51ca5bb7dc48f0610
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/37707
Changelog: [Internal] - Refactor nightly monorepo publish script to also return a map of packages and their current nightly version and rename to reflect. This may refer to a nightly version that was just published (if we detect changes) or the nightly tag on npm if no changes.
In subsequent diffs, will update the react-native nightly script to use this map to set the versions for nightly react-native versions.
Reviewed By: hoxyq
Differential Revision: D46450703
fbshipit-source-id: c4e425924aa6cfdcf10e932e1b151ba05d9b7237
Summary:
When trying to build an app using 0.72.0-RC.5 inside a project that uses `.xcode.env.local` the `[CP-User] Generate Legacy Components Interop` Phase script fails to run due to a `Permission denied` error. That's because `.xcode.env.local` is not being loaded, resulting in `NODE_BINARY=" "` and then the `React-RCTAppDelegate` script tries to run `generate-legacy-interop-components.js` directly.
E.g

In order to fix this we should run the `with-environment.sh` script instead of directly loading `.${PODS_ROOT}/../.xcode.env`
## Changelog:
[IOS] [FIXED] - Fix loading `NODE_BINARY` inside Generate Legacy Components Interop
Pull Request resolved: https://github.com/facebook/react-native/pull/37802
Test Plan: Make sure you don't have a `.xcode.env` file and run locally a project that uses React-RCTAppDelegate
Reviewed By: cortinico
Differential Revision: D46596246
Pulled By: cipolleschi
fbshipit-source-id: 5616395f39b0fae7b2fa9e59bd72c70f39198b4d
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/37785
Changelog: [Android] [Fixed] - W3CPointerEvents: fix NPE due to null targetView
For reasons not entirely understood, we sometimes end up with a null `targetView` in this code path during the dispatch of an `ACTION_CANCEL`. This results in an NPE during the call to `getChildOffsetRelativeToRoot`. This change adds a null check before the call to avoid the crash.
Reviewed By: cortinico
Differential Revision: D46562263
fbshipit-source-id: fe60fe08929ed29a570a860d49915b6f5ae4a542
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/37723
React-hermes pod sets the `GCC_PREPROCESSOR_DEFINITIONS` flag for Debug config only, by leveraging the `PRODUCTION=1` flag.
This flag is not standard for iOS, therefore we want to remove it from the condebase to simplify the build APIs.
This change moves the setting of the `GCC_PREPROCESSOR_DEFINITIONS` flag from the podspec xcconfig (which can't distinguish between Debug and Release configurations) to a post install hook (which can).
## Changelog:
[internal] - Remove dependency on PRODUCTION=1 from React-hermes podspec
Reviewed By: dmytrorykun
Differential Revision: D46316662
fbshipit-source-id: b5764e1bf60f2e71ff171556bccbc00c0c0c62aa
Summary:
Adds changelog for new patch.
## Changelog:
<!-- Help reviewers and the release process by writing your own changelog entry. For an example, see:
https://reactnative.dev/contributing/changelogs-in-pull-requests
-->
[Internal] [Changed] - add changelog entry for 0.71.9 and 0.71.10
Pull Request resolved: https://github.com/facebook/react-native/pull/37760
Test Plan: N/A
Reviewed By: NickGerleman, cipolleschi
Differential Revision: D46525847
Pulled By: lunaleaps
fbshipit-source-id: 044e6c9f62db29c26754ab6981adf5cbeabf67b1
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/37782
Pull Request resolved: https://github.com/facebook/react-native/pull/36731
When using the native driver for animations that involve layout changes (ie. translateY and other transforms, but not styles such as opacity), because it bypasses Fabric, the new coordinates are not updated so the Pressability responder region/tap target is incorrect
**This diff:**
- Returning the final values from the native side, at the same place it sets the "finished" flag. This gets sent to JS in `animated/animations/Animation.js`. In this diff I'm passing the value when 'hasFinishedAnimations' is true, but in a follow up diff I will look into other cases such as cancelled animations
Next:
2. Update the Animated.Value to reflect the new values
3. Call the onEnd function if there is one set
4. Pass the new values down for layout calculations and the correct Pressability responder region
Changelog:
[General][Changed] - return animated values to JS for natively driven animations
Reviewed By: javache
Differential Revision: D44110833
fbshipit-source-id: ce8c09fbe20c0c155260ce9561a67f7dfba30515
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/37777
This extracts the state and logic VirtualizedList uses to query information related to cell metrics. We will need to modify this (and other places) when fixing up RTL support for horizontal FlatList.
Changelog: [Internal]
Reviewed By: javache
Differential Revision: D46427052
fbshipit-source-id: 0a23f6c726447de0f20c583b4d507003efd6a754
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/37778
These functions describe how to get the metrics of a specific cell. "Frame" here seems non-descriptive and redundant to the "Metrics" part. Renaming this before a larger refactor.
Changelog: [Internal]
Reviewed By: philIip
Differential Revision: D46427058
fbshipit-source-id: e9ad9cf15e1adfd07604eb11526de0ed8cf99000
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/37553
## Context
I added some getters in EventTarget/EventEmitter to access the React instance handle for a given shadow node/shadow node family in https://github.com/facebook/react-native/commit/43864a1d6025bfc4483dded115d51f7613018199 (D44022477), so I could implement DOM traversal methods easily.
I wanted to reuse that method to implement `MutationObserver` and `IntersectionObserver`, but unfortunately `EventEmitter`/`EventTarget` only allow access to the instance handle as long as the shadow node is mounted. That makes sense for events, but not for this use case, as with `MutationObserver` we intentionally want to have access to unmounted nodes when creating the list of `addedNodes` and `removedNodes` for the `MutationRecord` (depending on when exactly we generate this list, either `addedNodes` or `removedNodes` wouldn't be mounted).
## Changes
This reverts my original change and adds a new field in `ShadowNodeFamily` to provide access to the `InstanceHandle` at any point (even if the node isn't mounted).
This provides the same guarantees as the original method, keeping weak references to the handles to avoid memory leaks.
Changelog: [internal]
Reviewed By: sammy-SC
Differential Revision: D46149084
fbshipit-source-id: f76abae50134a5d55a98cab42eebeb62084024f9
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/37772
Changelog: [internal]
`ShadowNodeFragment` is used in multiple places as a general definition for the fragment, but it lacks information that's going to be constructed in the fragment itself in the future (like `eventEmitter` in D46149084).
This migrates some of the usages of this fragment to the `ShadowNodeFamily` directly (as they already have access to it).
Reviewed By: javache, sammy-SC
Differential Revision: D46190382
fbshipit-source-id: 3a879861106594d66a2580410d4d83523c288314
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/37771
While working on debugging tools, I noticed that we ask in every template app to
- Add a "com.facebook.react.devsupport.DevSettingsActivity" activity
- Add the <uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/>
This is error prone and can be cleanup as we now distribute React Native that is variant aware (debug/release).
So I'm creating a manifest inside `src/debug` that contains those directive so we don't need to ask users
to add them (I'm removing them from the template).
Changelog:
[Internal] [Changed] - Create a Debug manifest inside React Native Android
Reviewed By: cipolleschi
Differential Revision: D46556884
fbshipit-source-id: 10034a6b245bf419dfa663bc998c4d1ad5d24a90
Summary:
Adds changelog for new patches.
## Changelog:
<!-- Help reviewers and the release process by writing your own changelog entry. For an example, see:
https://reactnative.dev/contributing/changelogs-in-pull-requests
-->
[Internal] [Changed] - add changelog entry for 0.70.10 and 0.69.11
Pull Request resolved: https://github.com/facebook/react-native/pull/37781
Test Plan: N/A
Reviewed By: NickGerleman
Differential Revision: D46564493
Pulled By: cipolleschi
fbshipit-source-id: c850e057d34f8862488b769076e36ebb5132f6cf
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/37727
We currently throw an exception when trying to access `node.offsetParent` in direct children of the root node in Fabric. This fixes that with an additional check.
Changelog: [internal]
Reviewed By: twobassdrum
Differential Revision: D46485786
fbshipit-source-id: f64156ef774ae600c4042c0718b099cfb92cf7f1
Summary:
## Changelog:
[Internal] [Changed] - Convert ProgressiveStringDecoderTest to Kotlin
<!-- Help reviewers and the release process by writing your own changelog entry.
Pick one each for the category and type tags:
[ANDROID|GENERAL|IOS|INTERNAL] [BREAKING|ADDED|CHANGED|DEPRECATED|REMOVED|FIXED|SECURITY] - Message
For more details, see:
https://reactnative.dev/contributing/changelogs-in-pull-requests
Pull Request resolved: https://github.com/facebook/react-native/pull/37728
Reviewed By: cipolleschi
Differential Revision: D46552406
Pulled By: cortinico
fbshipit-source-id: 9fd75991cff98fcf71223c5bc386a7ee0b435d8d
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/37716
We call `surfaceHandler.stop` both from `SurfaceHandlerBinding` as well as `Binding`. Since we don't check asserts in production, the second one should generally be a no-op, but may be causing a crash due to incorrectly de-referencing a unique_ptr.
Changelog: [Internal]
Reviewed By: mdvacca
Differential Revision: D46441620
fbshipit-source-id: e93b9722fd717947ebf772f545f692c2e31f816e
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/37767
`test_android` is currently broken on main due to a wrong import for the `encodeUtf8` function from OkIO
Changelog:
[Internal] [Changed] - Fix broken test_android on main due to wrong import
Reviewed By: cipolleschi
Differential Revision: D46555207
fbshipit-source-id: 4fd5dd2f8ddda0602873169c833420a7154b830b