Compare commits

..
Author SHA1 Message Date
Christian Falch f217bce77a [ios][prebuilt] fixed using continue in loop
Instead of returning when creating the list of header files from our podspecs, we now call `continue`. This is a bug that causes all subsequent globs in the header file list to be omitted after the first omitted glob.
2025-07-08 16:38:43 +02:00
Christian Falch e2087457f8 [ios][prebuild] add support for USE_FRAMEWORKS
When using prebuilts the USE_FRAMEWORKS setting is not really relevant for the React Native code, since there will not be any source code to build frameworks for - and because we already have a framework for the code in React.XCFramework.

This commit adds a new command to the React Native podspecs like we did with the ReactNativeDependencies framework. The method is called `add_rncore_dependency` and it does nothing when building from source - but when linking with the React.XCFramework it explicitly adds linking with the framework.

In addition there are a few places in the ruby code where we check for the USE_FRAMEWORK value and changes some settings - where needed this commit will add a separate check to ensure we're building from source when making these changes.

Testing:
- Builds without USE_FRAMEWORKS as before with/without prebuilt
- Builds with USE_FRAMEWORKS=dynamic as before with source - and now also with prebuilt code.
- Same goes for the static variant.
2025-07-08 16:35:14 +02:00
107 changed files with 859 additions and 2758 deletions
+1 -1
View File
@@ -4,7 +4,7 @@ inputs:
node-version:
description: 'The node.js version to use'
required: false
default: '22.14.0'
default: '22'
runs:
using: "composite"
steps:
-2
View File
@@ -2,8 +2,6 @@ name: yarn-install
runs:
using: composite
steps:
- name: Setup node.js
uses: ./.github/actions/setup-node
- name: Install dependencies
shell: bash
run: |
@@ -38,7 +38,7 @@ describe('#verifyArtifactsAreOnMaven', () => {
expect(mockSleep).toHaveBeenCalledTimes(1);
expect(mockFetch).toHaveBeenCalledWith(
'https://repo1.maven.org/maven2/com/facebook/react/react-native-artifacts/0.78.1/react-native-artifacts-0.78.1.pom',
'https://repo1.maven.org/maven2/com/facebook/react/react-native-artifacts/0.78.1',
);
});
@@ -55,7 +55,7 @@ describe('#verifyArtifactsAreOnMaven', () => {
expect(mockSleep).toHaveBeenCalledTimes(1);
expect(mockFetch).toHaveBeenCalledWith(
'https://repo1.maven.org/maven2/com/facebook/react/react-native-artifacts/0.78.1/react-native-artifacts-0.78.1.pom',
'https://repo1.maven.org/maven2/com/facebook/react/react-native-artifacts/0.78.1',
);
});
@@ -67,7 +67,7 @@ describe('#verifyArtifactsAreOnMaven', () => {
expect(mockSleep).toHaveBeenCalledTimes(0);
expect(mockFetch).toHaveBeenCalledWith(
'https://repo1.maven.org/maven2/com/facebook/react/react-native-artifacts/0.78.1/react-native-artifacts-0.78.1.pom',
'https://repo1.maven.org/maven2/com/facebook/react/react-native-artifacts/0.78.1',
);
});
@@ -81,7 +81,7 @@ describe('#verifyArtifactsAreOnMaven', () => {
expect(mockSleep).toHaveBeenCalledTimes(90);
expect(mockExit).toHaveBeenCalledWith(1);
expect(mockFetch).toHaveBeenCalledWith(
'https://repo1.maven.org/maven2/com/facebook/react/react-native-artifacts/0.78.1/react-native-artifacts-0.78.1.pom',
'https://repo1.maven.org/maven2/com/facebook/react/react-native-artifacts/0.78.1',
);
});
});
@@ -13,14 +13,13 @@ const SLEEP_S = 60; // 1 minute
const MAX_RETRIES = 90; // 90 attempts. Waiting between attempt: 1 min. Total time: 90 min.
const ARTIFACT_URL =
'https://repo1.maven.org/maven2/com/facebook/react/react-native-artifacts/';
const ARTIFACT_NAME = 'react-native-artifacts-';
async function verifyArtifactsAreOnMaven(version, retries = MAX_RETRIES) {
if (version.startsWith('v')) {
version = version.substring(1);
}
const artifactUrl = `${ARTIFACT_URL}${version}/${ARTIFACT_NAME}${version}.pom`;
const artifactUrl = `${ARTIFACT_URL}${version}`;
for (let currentAttempt = 1; currentAttempt <= retries; currentAttempt++) {
const response = await fetch(artifactUrl);
-4
View File
@@ -18,10 +18,6 @@ jobs:
run: |
git config --local user.email "bot@reactnative.dev"
git config --local user.name "React Native Bot"
- name: Setup xcode
uses: ./.github/actions/setup-xcode
with:
xcode-version: '16.2.0'
- name: Extract branch name
run: |
TAG="${{ github.ref_name }}";
+1 -1
View File
@@ -83,7 +83,7 @@ jobs:
# Move the XCFramework in the destination directory
mv /tmp/third-party/packages/react-native/third-party/ReactNativeDependencies.xcframework packages/react-native/third-party/ReactNativeDependencies.xcframework
VERSION=$(jq -r '.version' packages/react-native/package.json)
VERSION=$(jq -r '.version' package.json)
echo "$VERSION-${{matrix.flavor}}" > "packages/react-native/third-party/version.txt"
cat "packages/react-native/third-party/version.txt"
# Check destination directory
-25
View File
@@ -319,31 +319,6 @@ ChuiHW))
- **JSC:** Clean up RCTBridgeDelegate to remove shouldBridgeUseCustomJSC method ([c8f1506f13](https://github.com/facebook/react-native/commit/c8f1506f13310ffafe370273805684e696d72d50) by [@zhongwuzw](https://github.com/zhongwuzw))
- **Layout:** Remove no longer needed UISceneDelegate ([a033cf9d5e](https://github.com/facebook/react-native/commit/a033cf9d5e8ffbda8b6f86cf3ce152b4ccb73187) by [@okwasniewski](https://github.com/okwasniewski))
## v0.78.3
### Added
#### Android specific
- **Gradle:** RNGP - Add support for `exclusiveEnterpriseRepository` to specify an internal Maven mirror. ([6cb8dc37c7](https://github.com/facebook/react-native/commit/6cb8dc37c74995cba3f9f0a845919f305de53c3d) by [@cortinico](https://github.com/cortinico))
### Fixed
- **DevTools**: Temporarily disable eager evaluation and live expressions in the console tab ([07717b5275](https://github.com/facebook/react-native/commit/07717b5275d80cde7b2b4edbe032ab629127fbf0) by [@huntie](https://github.com/huntie))
- **InteropLayer:** Fixed adding child views to a native view using the interop layer ([d53a60dd23](https://github.com/facebook/react-native/commit/d53a60dd23c5df8afca058a867c50df8b61f62e2) by [@chrfalch](https://github.com/chrfalch))
- **Runtime:** Align timer IDs and timer function argument error handling with web standards. ([480a4642e5](https://github.com/facebook/react-native/commit/480a4642e5a644becf1c477d3d239f9b57efff3a) by [@kitten](https://github.com/kitten))
#### Android specific
- **StyleSheet:** Wrong `borderBottomEndRadius` on RTL ([68d6ada448](https://github.com/facebook/react-native/commit/68d6ada44893701b6006a6b1753131c7e880a30a) by [@riteshshukla04](https://github.com/riteshshukla04))
#### iOS specific
- **Codegen:** Skip codegen for selectively disabled libraries in react-native.config.js ([be8595b18a](https://github.com/facebook/react-native/commit/be8595b18a46635bf679d8e7473f2960c33530fa) by [@ismarbesic](https://github.com/ismarbesic))
- **Layout:** Layout direction changes are now honored on bundle reload ([36f29beac4](https://github.com/facebook/react-native/commit/36f29beac47259768612bf56e5d9acfa4b94ab1a) by [@chrsmys](https://github.com/chrsmys))
- **Runtime:** Re-enable enableFixForViewCommandRace feature flag ([ae59702f8e](https://github.com/facebook/react-native/commit/ae59702f8ee89e7bddec971e0a041744cb91e65c) by [@okwasniewski](https://github.com/okwasniewski))
- **Switch:** Fixed switches correctly reverting to controlled state ([aa8c072870](https://github.com/facebook/react-native/commit/aa8c072870f6f9740e567a0f455c0e500ff1400c) by [@javache](https://github.com/javache))
## v0.78.2
### Changed
-192
View File
@@ -1,193 +1,5 @@
# Changelog
## v0.81.0-rc.0
### Breaking
- **APIs:** All `react-native/Libraries/BugReporting` APIs have been removed ([9d4d8dcb02](https://github.com/facebook/react-native/commit/9d4d8dcb0264273cc1522ed6e9de47cdb05606f4) by [@huntie](https://github.com/huntie))
- **APIs:** Add public JS API breaking change detection under `yarn diff-api-snapshot` script. ([6b40f35032](https://github.com/facebook/react-native/commit/6b40f35032462de8a9bad0e9f186916562475a40) by [@coado](https://github.com/coado))
- **APIs:** Community CLI users: user-defined `resolver.resolveRequest` and `serializer.getModulesRunBeforeMainModule` Metro config now takes precedence over CLI defaults ([fe2bcbf4ba](https://github.com/facebook/react-native/commit/fe2bcbf4ba7ce983fac0cd09727c165517b6337f) by [@robhogan](https://github.com/robhogan))
- **Error Handling:** Improve messaging and add error stack trace for uncaught throws. ([5ba0e1f97a](https://github.com/facebook/react-native/commit/5ba0e1f97ad40f84d83efaa9cfdbaf9ad22a18e8) by [@vzaidman](https://github.com/vzaidman))
- **Flow:** The `react-native` package no longer ships with the `flow` directory ([38acb4c074](https://github.com/facebook/react-native/commit/38acb4c0746e48ebb10729360788e26454736d1b) by [@huntie](https://github.com/huntie))
- **Node:** Minimum Node version is now bumped to Node.js 22.14.0 ([df39eadc03](https://github.com/facebook/react-native/commit/df39eadc03edcd23fab47712d24818d2d0c75d16) by [@huntie](https://github.com/huntie))
- **View:** `View` no longer sets any default accessibility props, which should not result in visible changes in behaviour but may affect snapshot tests. ([039a333df5](https://github.com/facebook/react-native/commit/039a333df57e20133af3ec77e995ec8fe4dc7f5c) by [@javache](https://github.com/javache))
- **View:** Upgrade `View` component to React 19. ([eedd60b9e6](https://github.com/facebook/react-native/commit/eedd60b9e6b595801d05c2fa223124fb8a895c3c) by [@EvanBacon](https://github.com/EvanBacon))
#### Android specific
- **APIs:** Cleanup and internalize `FpsDebugFrameCallback` ([cf6569bc18](https://github.com/facebook/react-native/commit/cf6569bc18082253fa84feecdfaa7a28413bc993) by [@cortinico](https://github.com/cortinico))
- **CMake:** Correctly propagate `RN_SERIALIZABLE_STATE` to 3rd party `CMake` targets. Users with custom `CMake` and C++ code should update to use `target_compile_reactnative_options` inside their `CMakeLists.txt` files.([c059ae1b77](https://github.com/facebook/react-native/commit/c059ae1b77b073e6990dc2a5d81979de679c2b01) by [@cortinico](https://github.com/cortinico))
- **FabricUIManager:** Remove `FabricUIManager.measure` overload which accepts attachment positions ([2ba86caf18](https://github.com/facebook/react-native/commit/2ba86caf18d86f6902f987ec9a0aa94bf67c1b4e) by [@NickGerleman](https://github.com/NickGerleman))
- **Kotlin:** Migrate `ViewManagerInterfaces` to kotlin. Some types in code generated ViewManagerInterfaces might differ. e.g. this will start enforcing nullability in parameters of viewManagerInterface methods (e.g. String commands parameters are not nullable, view params are not nullable in any method, etc) ([76ff1aa5c6](https://github.com/facebook/react-native/commit/76ff1aa5c6d30935ec33708d3a13ac7e5a82f551) by [@mdvacca](https://github.com/mdvacca))
- **Kotlin:** Migrate `com.facebook.react.ReactDelegate` to Kotlin. Some users implementing this class in Kotlin could have breakages. ([50ea5b4380](https://github.com/facebook/react-native/commit/50ea5b43806a9047bace81267c97d5dd73e0e74d) by [@mateoguzmana](https://github.com/mateoguzmana))
- **Kotlin:** Convert to Kotlin and internalize `MountingManager` ([f33fdca876](https://github.com/facebook/react-native/commit/f33fdca87679d5cc628a2e9dccada728cbb0335b) by [@cortinico](https://github.com/cortinico))
- **textAlignVertical:** Move `textAlignVertical` to paragraph attributes instead of text attributes ([55fd8b26f8](https://github.com/facebook/react-native/commit/55fd8b26f8791848dd886bd7fb5110b401038234) by [@joevilches](https://github.com/joevilches))
- **TextLayoutManager:** Make Java Side `TextLayoutManager` Internal ([e82a677c79](https://github.com/facebook/react-native/commit/e82a677c7966209b05fe55209fcb26c067427393) by [@NickGerleman](https://github.com/NickGerleman))
#### iOS specific
- **RCTDisplayLink:** Migrate `RCTDisplayLink`'s API from `RCTModuleData` ([70eeb9f541](https://github.com/facebook/react-native/commit/70eeb9f54194cc807017bec8c71080972c5c4e65) by [@RSNara](https://github.com/RSNara))
- **SynchronouslyUpdateViewOnUIThread:** `SynchronouslyUpdateViewOnUIThread` now accepts `folly::dynamic` instead of `NSDictionary`. Use https://github.com/facebook/react-native/blob/main/packages/react-native/ReactCommon/react/utils/platform/ios/react/utils/FollyConvert.h#L14 for conversion. ([82279bd981](https://github.com/facebook/react-native/commit/82279bd9811c406d21496d03a1572b98946c50b6) by [@sammy-SC](https://github.com/sammy-SC))
- **Xcode:** Bump min Xcode to 16.1 ([c27a8804a6](https://github.com/facebook/react-native/commit/c27a8804a6fdaea2d4bef4a4c689bfe2c343daaa) by [@NickGerleman](https://github.com/NickGerleman))
### Added
- **APIs:** Expose `unstable_TextAncestorContext` API ([962a7dda44](https://github.com/facebook/react-native/commit/962a7dda440863e7888fd2cc01c065c8762857e6) by [@huntie](https://github.com/huntie))
- **APIs:** Expose additional `*AnimationConfig` types on the `Animated` namespace ([11a1ad7a98](https://github.com/facebook/react-native/commit/11a1ad7a98a71cd1189550a8ae5666e5a2ed8d57) by [@huntie](https://github.com/huntie))
- **APIs:** `InterpolationConfig` is now exposed on the `Animated` namespace ([b01a5f91fe](https://github.com/facebook/react-native/commit/b01a5f91fedc19495e8a9d6ce079feb5898e7b87) by [@huntie](https://github.com/huntie))
- **APIs:** Expose `ScrollViewImperativeMethods` and `ScrollViewScrollToOptions` types to public API ([f184b591cf](https://github.com/facebook/react-native/commit/f184b591cfb49ed372efb0bdd55a145230112f45) by Antonio Pires)
- **APIs:** Add `--validate` flag to `build-types` script for JS API snapshot validation. ([f529fd6ba5](https://github.com/facebook/react-native/commit/f529fd6ba590101a3dfa710a92befb81994ed2dd) by [@coado](https://github.com/coado))
- **Bridging:** Added support for bridging `Class` methods return types ([e403b510d0](https://github.com/facebook/react-native/commit/e403b510d0de74ac7e62defeb1e80eff84b956e2) by [@hoxyq](https://github.com/hoxyq))
- **Error Handling:** Improve error messages when enum members are missing ([12ced22f70](https://github.com/facebook/react-native/commit/12ced22f70438064bf815c2413cbd12a80dbf0a7) by Yannick Loriot)
- **Fantom:** Add `Fantom.getFabricUpdateProps` for reading fabric update props scheduled via `UIManager::updateShadowTree` ([cc442eb8c8](https://github.com/facebook/react-native/commit/cc442eb8c85d516701f840046d73683a7cd51424) by [@zeyap](https://github.com/zeyap))
- **Flow:** Add support for Flow opaque types in codegen for native modules ([a15fc102e6](https://github.com/facebook/react-native/commit/a15fc102e63eb3b37852ca45fe4c65e894ecef7d) by [@rubennorte](https://github.com/rubennorte))
- **HMR:** Process HMR `registerBundle` calls from the same origin only ([a9007ea586](https://github.com/facebook/react-native/commit/a9007ea586f6e87db47c6305be3232d760abfd57) by [@jbroma](https://github.com/jbroma))
- **IntersectionObserver:** `IntersectionObserver` support for `root` with fixes for viewport offsets ([c5b6716311](https://github.com/facebook/react-native/commit/c5b67163117e13c99a9c57816f0ff36efc80ccf5) by [@lunaleaps](https://github.com/lunaleaps))
- **ReactNativeFeatureFlags:** Allow Custom ReactNativeFeatureFlags for Shell 2.0 ([bbc1e121c7](https://github.com/facebook/react-native/commit/bbc1e121c71d14803d29a931f642bf8ea6ee2023) by Maddie Lord)
- **ScrollView:** Added more Pending Decleration for `ScrollView` ([a6908ad1a5](https://github.com/facebook/react-native/commit/a6908ad1a5d998505b2bb6ba3e39910fee17329a) by [@riteshshukla04](https://github.com/riteshshukla04))
- **ShadowNode:** Added `cloneMultiple` to `ShadowNode` class. ([1161fb4fcd](https://github.com/facebook/react-native/commit/1161fb4fcd6a0cac3a691de1f37cc7f9d6a861a5) by [@bartlomiejbloniarz](https://github.com/bartlomiejbloniarz))
- **Typescript:** Add `pressRetentionOffset` prop to be recognised by typescript in `Text.d.ts` ([d94f4d8c9d](https://github.com/facebook/react-native/commit/d94f4d8c9deef78c0345a7fd3de74424f864c080) by [@iamAbhi-916](https://github.com/iamAbhi-916))
- **URLSearchParams:** Added size property to `URLSearchParams` implementation ([9b1a8ffac4](https://github.com/facebook/react-native/commit/9b1a8ffac4368b9304939359917c7cfd0a9501bf) by [@louix](https://github.com/louix))
#### Android specific
- **BaseViewManager:** Adds support for `onFocus` / `onBlur` event dispatching logic to all native views that implement `BaseViewManager` ([e960a28af7](https://github.com/facebook/react-native/commit/e960a28af7f4541dcf67d3c7148b2d32a39e1b04) by [@Abbondanzo](https://github.com/Abbondanzo))
- **Edge To Edge:** Add Android edge-to-edge opt-in support ([09ef774ff6](https://github.com/facebook/react-native/commit/09ef774ff6dac10a00a8b35670f9b3941d810dfb) by [@zoontek](https://github.com/zoontek))
- **RNGP:** `RNGP`- Add support for `exclusiveEnterpriseRepository` to specify an internal Maven mirror. ([6cb8dc37c7](https://github.com/facebook/react-native/commit/6cb8dc37c74995cba3f9f0a845919f305de53c3d) by [@cortinico](https://github.com/cortinico))
- **RNTester:** Added explicit build tool version to `RNTester` `build.gradle` to avoid automatic installation of Android SDK Build Tools. ([35dba09724](https://github.com/facebook/react-native/commit/35dba097243ff2d21466f860ec9831e1ff2a97ac) by [@mojavad](https://github.com/mojavad))
- **ScrollView:** Allow `fadingEdgeLength` to be set independently on the start and end of the `ScrollView` ([a21a4b87c3](https://github.com/facebook/react-native/commit/a21a4b87c337f3f2d998a30841430f587c066580) by Mark Verlingieri)
- **View:** Support for `onFocus` and `onBlur` function calls in `View` components ([af0a76cf5f](https://github.com/facebook/react-native/commit/af0a76cf5fdb8107294dff2c9aa0dbc36c7d5443) by [@Abbondanzo](https://github.com/Abbondanzo))
#### iOS specific
- **borderWidth:** Add support for different `borderWidth`s ([70962ef3ed](https://github.com/facebook/react-native/commit/70962ef3ed06a76a96cb2e72c374dc028628c829) by [@a-klotz-p8](https://github.com/a-klotz-p8))
- **Modal:** Allow to interactively swipe down `Modal`s. ([28986a7599](https://github.com/facebook/react-native/commit/28986a7599952a77b8b8e433f72ca837afde310e) by [@okwasniewski](https://github.com/okwasniewski))
- **Package.swift:** Added missing search path to `Package.swift` ([592b09781b](https://github.com/facebook/react-native/commit/592b09781bb94fe6dc00ba49c7a86649980fed5d) by [@chrfalch](https://github.com/chrfalch))
- **Prebuild:** Add more logging around `computeNightlyTarballURL` in ios pre-build ([1a6887bd70](https://github.com/facebook/react-native/commit/1a6887bd70cdefb8fbc421467de841ece74d5c6b) by [@cortinico](https://github.com/cortinico))
- **Prebuild:** Added backwards compatible use of prebuild through cocoapods ([d8e00f0bb1](https://github.com/facebook/react-native/commit/d8e00f0bb1940fc9cc7e5cbb68b26c2d05824486) by [@chrfalch](https://github.com/chrfalch))
- **Prebuild:** Ship the `React-Core-prebuilt.podspec` in `package.json` ([46b562b9b3](https://github.com/facebook/react-native/commit/46b562b9b3bf4c0b8c5af25ab84a43509979c4a7) by [@cipolleschi](https://github.com/cipolleschi))
- **Prebuild:** Added support for using prebuilt `RNCore` with Cocoapods ([90654e4ba2](https://github.com/facebook/react-native/commit/90654e4ba2f3cc2f6b0d8f08769ce58b4e5d1b51) by [@chrfalch](https://github.com/chrfalch))
- **Prebuild:** Add `React-Core-prebuild.podspec` to integrate React native core prebuilds using Cocoapods ([1a86ee17fb](https://github.com/facebook/react-native/commit/1a86ee17fb80cfa1b8bcff30f4f3d5cdb193900d) by [@chrfalch](https://github.com/chrfalch))
- **Prebuild:** Added building `XCFframework` from the prebuild script ([55534f518a](https://github.com/facebook/react-native/commit/55534f518aab53bcdc3fe12d987ab7ef6e620c77) by [@chrfalch](https://github.com/chrfalch))
- **Prebuild:** Added building swift package from the prebuild script ([3c01b1b6f0](https://github.com/facebook/react-native/commit/3c01b1b6f04d285c97bb182131135903b0c1cdd5) by [@chrfalch](https://github.com/chrfalch))
- **Prebuild:** Added downloading of hermes artifacts when pre-building for iOS. ([41d2b5de0a](https://github.com/facebook/react-native/commit/41d2b5de0af21c72227ef030dcddf208e2eb221a) by [@chrfalch](https://github.com/chrfalch))
- **runtime:** Added `HERMES_ENABLE_DEBUGGER` to debug configuration for the `reactRuntime` target. ([560ac23001](https://github.com/facebook/react-native/commit/560ac23001b02f19d4c6ca4ea493c17060cfaf5f) by [@chrfalch](https://github.com/chrfalch))
### Changed
- **Animated:** Animated now always flattens `props.style`, which fixes an error that results from `props.style` objects in which `AnimatedNode` instances are shadowed (i.e. flattened to not exist in the resulting `props.style` object). ([da520848c9](https://github.com/facebook/react-native/commit/da520848c931f356d013623c412af11dce7ff114) by [@yungsters](https://github.com/yungsters))
- **Animated:** Creates a feature flag that changes `Animated` to no longer produce invalid `props.style` if every `AnimatedNode` instance is shadowed via style flattening. ([5c8c5388fc](https://github.com/facebook/react-native/commit/5c8c5388fc53ef2430b0bb6bbbc628479819e23d) by [@yungsters](https://github.com/yungsters))
- **Animated:** Enabled a feature flag that optimizes `Animated` to reduce memory usage. ([2a13d20085](https://github.com/facebook/react-native/commit/2a13d200850e4f161a29b252a0ccedc158e53937) by [@yungsters](https://github.com/yungsters))
- **Error handling:** Errors will no longer have the "js engine" suffix. ([a293925280](https://github.com/facebook/react-native/commit/a2939252803d5cd4b68340da08820174c30a53e6) by [@yungsters](https://github.com/yungsters))
- **Fibers:** Reduces memory usage, by improving memory management of parent alternate fibers. (Previously, a parent fiber might retain memory associated with shadow nodes from a previous commit.) ([0411c43b3a](https://github.com/facebook/react-native/commit/0411c43b3a239384c778baad22c7b4c501008449) by [@yungsters](https://github.com/yungsters))
- **infoLog:** Removed `infoLog` from `react-native` package ([8a0cfec815](https://github.com/facebook/react-native/commit/8a0cfec81584e966c9e6ea0f5e438022e0129bcd) by [@coado](https://github.com/coado))
- **IntersectionObserver:** Fixed `IntersectionObserver#observe` to avoid retaining memory for unmounted child nodes of observed views. ([d945c5863a](https://github.com/facebook/react-native/commit/d945c5863a5ed7b755e577bc25d681bfcc1c401b) by [@yungsters](https://github.com/yungsters))
- **Jest:** Improved default mocking for Jest unit tests. ([1fd9508ecc](https://github.com/facebook/react-native/commit/1fd9508ecc499df89b086e0c46035f43f6f78ad9) by [@yungsters](https://github.com/yungsters))
- **LegacyArchitecture:** Raise loglevel for assertion of `LegacyArchitecture` classes ([38a4b62211](https://github.com/facebook/react-native/commit/38a4b6221164d36eb4ac95c9f3bc7f7e7235e383) by [@mdvacca](https://github.com/mdvacca))
- **LegacyArchitecture:** Raise logLevel of `LegacyArchitecture` classes when minimizing of legacy architecture is enabled ([0d1cde7f36](https://github.com/facebook/react-native/commit/0d1cde7f36e9de72c997fc812bba023694c2a369) by [@mdvacca](https://github.com/mdvacca))
- **Metro:** Bump Metro to `^0.82.5` ([083644647e](https://github.com/facebook/react-native/commit/083644647eff502f484b3ba24f9d361d5df56546) by [@robhogan](https://github.com/robhogan))
- **React DevTools:** Bumped React DevTools to `6.1.5` ([c302902b1d](https://github.com/facebook/react-native/commit/c302902b1db7e8f8ac5b61472c095dc0755d6d1c) by [@hoxyq](https://github.com/hoxyq))
- **RuntimeExecutor:** `RuntimeExecutor`: Remove noexcept from sync ui thread utils ([7ef278af50](https://github.com/facebook/react-native/commit/7ef278af505deba6b8a47876c6824f9a7fefa427) by [@RSNara](https://github.com/RSNara))
- **Typescript:** Bump `types/react` to `19.1` ([3ae9328571](https://github.com/facebook/react-native/commit/3ae932857174e9c39cd5d9c53922f849aa1401b1) by [@gabrieldonadel](https://github.com/gabrieldonadel))
#### Android specific
- **APIs:** Deprecate `DefaultNewArchitectureEntryPoint.load(Boolean, Boolean, Boolean)` ([efdf73983c](https://github.com/facebook/react-native/commit/efdf73983cef1f371511b6e1efa5e01835ebcabb) by [@cortinico](https://github.com/cortinico))
- **APIs:** Make `com.facebook.react.views.common.ContextUtils` internal ([d1ef8f1fa3](https://github.com/facebook/react-native/commit/d1ef8f1fa36cbfc34d05c409abf693e4e1cac3de) by [@cortinico](https://github.com/cortinico))
- **deps:** Bump `AGP` to `8.11.0` ([04858ecbab](https://github.com/facebook/react-native/commit/04858ecbab808ddca80e20e76f1359619bb5e865) by [@cortinico](https://github.com/cortinico))
- **deps:** Bump `Gradle` to `8.14.2` ([e20bb56f3b](https://github.com/facebook/react-native/commit/e20bb56f3b4db0d3e69154b95b952b1fe8e29959) by [@cortinico](https://github.com/cortinico))
- **JS FPS:** Hide JS FPS on performance overlay as not accurate ([feec8d0148](https://github.com/facebook/react-native/commit/feec8d014877b2177f1c7dded7eb9664f53ee471) by [@cortinico](https://github.com/cortinico))
- Updated targetSdk to 36 in Android. ([477d8df312](https://github.com/facebook/react-native/commit/477d8df3126b325b8cc9b410f1eaeb56b727d4d9) by [@kikoso](https://github.com/kikoso))
- **Kotlin:** Convert `UIManagerModuleConstantsHelper` to Kotlin ([45fd7feb9f](https://github.com/facebook/react-native/commit/45fd7feb9f083e5c8afc916732aed9795d344e09) by [@cortinico](https://github.com/cortinico))
- **Kotlin:** Migrate `ThemedReactContext` to Kotlin ([78c9671c24](https://github.com/facebook/react-native/commit/78c9671c241a86bedb17862e549842b7e36d77ea) by [@cortinico](https://github.com/cortinico))
- **Kotlin:** Convert `ReactViewGroup` to Kotlin ([48395d346b](https://github.com/facebook/react-native/commit/48395d346bc89f63d38889e58508304df0088e4f) by [@cortinico](https://github.com/cortinico))
- **Kotlin:** Migrate `com.facebook.react.LazyReactPackage` to Kotlin. ([b4ae5c1de1](https://github.com/facebook/react-native/commit/b4ae5c1de1003c343d43c3be1b59ee2b800b9258) by [@Xintre](https://github.com/Xintre))
- **Kotlin:** Apply Collections Kotlin DSL helpers in `ReactAndroid` package ([b2ffd34a39](https://github.com/facebook/react-native/commit/b2ffd34a392de2bddba5ee13248796ccc2db6039) by [@l2hyunwoo](https://github.com/l2hyunwoo))
#### iOS specific
- **Accessibility:** Only generate recursive accessibility label for accessible elements ([7e2f17ffe2](https://github.com/facebook/react-native/commit/7e2f17ffe229e09288deba9061221835300ec153) by [@janicduplessis](https://github.com/janicduplessis))
- **GC:** Hermes GC is now triggered in response to iOS memory pressure warning. ([12b2b56102](https://github.com/facebook/react-native/commit/12b2b5610263cb145d1ade8eaf06d8a6e015b10e) by [@yungsters](https://github.com/yungsters))
- **Gradients:** Optimised Radial Gradients. ([f238b74658](https://github.com/facebook/react-native/commit/f238b74658fd155366d4909872ab06781403f31d) by [@intergalacticspacehighway](https://github.com/intergalacticspacehighway))
- **Gradients:** Optimised Linear Gradients. ([2f3b104224](https://github.com/facebook/react-native/commit/2f3b1042249411e84f9a1d5bb1191461cd2dc5ee) by [@intergalacticspacehighway](https://github.com/intergalacticspacehighway))
- **Prebuild:** Simplified logging in prebuild scripts ([1477cc0dbd](https://github.com/facebook/react-native/commit/1477cc0dbdee4b50fee4b1b98346812868148aa5) by [@chrfalch](https://github.com/chrfalch))
- **Prebuild:** Fail fast when pod install if using prebuild and frameworks are not present in the disk. ([60c01b4715](https://github.com/facebook/react-native/commit/60c01b4715053bccbeca2673ff1be1fca60bce9b) by [@chrfalch](https://github.com/chrfalch))
- **Prebuild:** Update `ReactCodegen` to support Core prebuilds ([152cb538f6](https://github.com/facebook/react-native/commit/152cb538f69cd07422526802defe3f3617302098) by [@chrfalch](https://github.com/chrfalch))
### Deprecated
- **hasTVPreferredFocus:** Deprecate `hasTVPreferredFocus` ([cfb6c968dd](https://github.com/facebook/react-native/commit/cfb6c968ddce56138553a9d2e0cc8dfc666eb943) by [@Abbondanzo](https://github.com/Abbondanzo))
- **SafeAreaView:** Deprecate `SafeAreaView` due to its iOS-only support and incompatibility with Android 15 edge-to-edge behavior; recommend using `react-native-safe-area-context` instead. ([73133a31d5](https://github.com/facebook/react-native/commit/73133a31d5a47e71edd4e6b798184df8045e2234) by [@kikoso](https://github.com/kikoso))
- **ShadowNode:** `ShadowNode::Shared` is now deprecated. Use `std::shared_ptr<const ShadowNode>` instead. ([0e175ce5b6](https://github.com/facebook/react-native/commit/0e175ce5b6c80a21237f5cd0f20c9876fa975935) by [@sammy-SC](https://github.com/sammy-SC))
- **ShadowNode:** Deprecate type aliases `ShadowNode::Unshared` and `ShadowNode::Weak` in favour of `std::shared_ptr<ShadowNode>` and `std::weak_ptr<ShadowNode>` ([12fb101e30](https://github.com/facebook/react-native/commit/12fb101e306778b6e5399b23f822cc0874a5c386) by [@sammy-SC](https://github.com/sammy-SC))
#### iOS specific
- **RCTFollyConvert:** `RCTFollyConvert.h` is deprecated please use `/ReactCommon/react/utils/platform/ios/react/utils/FollyConvert.h` instead ([685a60e6b4](https://github.com/facebook/react-native/commit/685a60e6b44018531abf47f98fd38d9c75f6aca6) by [@sammy-SC](https://github.com/sammy-SC))
### Removed
- **Yoga:** Remove `YogaLayoutableShadowNode::cleanLayout()` and Fix `ParagraphShadowNode` Font Size Invalidation Logic ([7979c7ce06](https://github.com/facebook/react-native/commit/7979c7ce0664bf019e17781e95a74baf95ec89f1) by [@NickGerleman](https://github.com/NickGerleman))
#### Android specific
- **APIs:** Internalize `NetworkingModule`'s `UriHandler`, `RequestBodyHandler`, and `ResponseHandler` APIs ([987e3f8c00](https://github.com/facebook/react-native/commit/987e3f8c0031affe89218675061eca3a4620e0cd) by [@huntie](https://github.com/huntie))
- **DeveloperSettings:** Remove deprecated `isStartSamplingProfilerOnInit` from `DeveloperSettings` ([ccb9edc717](https://github.com/facebook/react-native/commit/ccb9edc7179ec1b568038408118971c2ee4c1b27) by [@cortinico](https://github.com/cortinico))
- **JSC:** Remove 1st party JSC support ([8174d02811](https://github.com/facebook/react-native/commit/8174d028116f00b6e89968d368b719ec8b7f6ff6) by [@cortinico](https://github.com/cortinico))
- **JSEngineResolutionAlgorithm:** Remove and cleanup `JSEngineResolutionAlgorithm` ([0954c1db45](https://github.com/facebook/react-native/commit/0954c1db45511d1a640deb8d921d26457bb3777c) by [@cortinico](https://github.com/cortinico))
#### iOS specific
- **JSC:** Remove code from jsc folder from React Native ([331fab0683](https://github.com/facebook/react-native/commit/331fab068355a3ba78776fbdf7e75ff4af3b740f) by [@cipolleschi](https://github.com/cipolleschi))
- **JSC:** Remove the option to use JSC from core ([a6ea626255](https://github.com/facebook/react-native/commit/a6ea6262555e7a25e27934f33099e95cb45c8077) by [@cipolleschi](https://github.com/cipolleschi))
- **Turbo Modules** Disable Turbo Modules fix for #51103 (dictionary stripped out when value is null) until more testing can be done. ([ca5f4d1721](https://github.com/facebook/react-native/commit/ca5f4d1721878ccd81ddcb9267f30160c6d17dd4) by [@javache](https://github.com/javache))
### Fixed
- **APIs:** Renamed argument names in the `onContentSizeChange` callback's type definition ([0386b9bd51](https://github.com/facebook/react-native/commit/0386b9bd5144b785af51c96ea6bada5c55127e98) by [@pchalupa](https://github.com/pchalupa))
- **BindingsInstallerHolder:** Fixed deprecation message for `BindingsInstallerHolder` ([4a8fda83e3](https://github.com/facebook/react-native/commit/4a8fda83e3d0f8aa0e5ac0c427c30fd9170ad375) by [@tomekzaw](https://github.com/tomekzaw))
- **C++:** Add `default:` case to avoid warnings/errors for targets that compile with `-Wswitch-enum` and `-Wswitch-default` enabled ([22b8b53c77](https://github.com/facebook/react-native/commit/22b8b53c77cb2fe87aa54be92d1758a603b7dd35) by [@NSProgrammer](https://github.com/NSProgrammer))
- **C++:** Add `default:` case to avoid warnings/errors for targets that compile with `-Wswitch-enum` and `-Wswitch-default` enabled ([9079b53c6f](https://github.com/facebook/react-native/commit/9079b53c6fa4ec9494f22390a89d1d42b77108a8) by [@NSProgrammer](https://github.com/NSProgrammer))
- **C++:** Fix clang tidy for react-native ([3e49d17f58](https://github.com/facebook/react-native/commit/3e49d17f58b9b7cc051925f43b709b020745312c) by [@RSNara](https://github.com/RSNara))
- **Color APIs:** Fix the serialization of the alpha channel in the `rgba()` color string format. ([1cc12ce7fd](https://github.com/facebook/react-native/commit/1cc12ce7fd5c8c766872906b4175122558d369a0) by [@piaskowyk](https://github.com/piaskowyk))
- **Color APIs:** Fix incorrect flattening / non-rendering of views with `backgroundColor` set to `rgba(255, 255, 255, 127/256)` ([b1e8729f4d](https://github.com/facebook/react-native/commit/b1e8729f4dfcb065978887b94a9e0ca65cdcfa77) by [@rubennorte](https://github.com/rubennorte))
- **Fantom:** Support viewport offsets for Fantom root and fix `getBoundingClientRect` to respect viewport offsets ([b5c62f52d1](https://github.com/facebook/react-native/commit/b5c62f52d185d6427425e25e6f18d0d86acaebf0) by [@lunaleaps](https://github.com/lunaleaps))
- **IntersectionObserver:** Fix potential leak inside `IntersectionObserver` ([a55f430daa](https://github.com/facebook/react-native/commit/a55f430daa4c9168272482125998da849840f9dd) by [@RSNara](https://github.com/RSNara))
- **LogBox:** Remove LogBox patch, de-duplicating errors ([e0797d0e03](https://github.com/facebook/react-native/commit/e0797d0e03bde6cd3321ff76556c5e2f0454ec63) by [@rickhanlonii](https://github.com/rickhanlonii))
- **ScrollView:** Expose `ScrollView.getNativeScrollRef` on the type definition to allow accessing the underlying `HostInstance`. ([4b91b63094](https://github.com/facebook/react-native/commit/4b91b630945b3d0f82656791d089451066aad538) by [@zbauman3](https://github.com/zbauman3))
- **Typescript:** Add `ImageSource` type to TypeScript ([42ca46b95c](https://github.com/facebook/react-native/commit/42ca46b95cf9938de00b76dc61948a4ae7116e2b) by [@okwasniewski](https://github.com/okwasniewski))
- **Typescript:** Devtools TS Types ([8f189fce03](https://github.com/facebook/react-native/commit/8f189fce03db367abdceca6ad57ae28b613fdd7d) by [@krystofwoldrich](https://github.com/krystofwoldrich))
- **Yoga:** Fix possible invalid measurements with width or height is zero pixels ([5cc4d0a086](https://github.com/facebook/react-native/commit/5cc4d0a086d450e0f9d8ab6194013348f9de1f58) by [@NickGerleman](https://github.com/NickGerleman))
#### Android specific
- **BaseViewManager:** Remove focus change listener when dropping/recycling view instances ([94cbf206d6](https://github.com/facebook/react-native/commit/94cbf206d607477257c65039d97565a79e94c7dd) by [@Abbondanzo](https://github.com/Abbondanzo))
- **BoringLayout:** Include fallback line spacing in `BoringLayout` ([2fe6c1a947](https://github.com/facebook/react-native/commit/2fe6c1a94758223a5342fdfa90163971eb588e6a) by [@NickGerleman](https://github.com/NickGerleman))
- **Bridgeless:** Adding `shouldForwardToReactInstance` check in `ReactDelegate` for Bridgeless ([0f7bf66bba](https://github.com/facebook/react-native/commit/0f7bf66bba8498c89384e96ad9219cdad0107b0c) by [@arushikesarwani94](https://github.com/arushikesarwani94))
- **Codegen:** Fix combining schema in Codegen process to exclude platforms correctly ([6104ccdc6e](https://github.com/facebook/react-native/commit/6104ccdc6ef89c2d4da25e60dcc55d73038e023f) by [@arushikesarwani94](https://github.com/arushikesarwani94))
- **Edge To Edge:** Fix `Dimensions` `window` values on Android < 15 when edge-to-edge is enabled ([85d10ed904](https://github.com/facebook/react-native/commit/85d10ed90401a13de1f74aeddd773736195da285) by [@zoontek](https://github.com/zoontek))
- **FBReactNativeSpec:** Extract out `FBReactNativeSpec`'s core components including Unimplemented from auto-generated registry ([b417b0c2d5](https://github.com/facebook/react-native/commit/b417b0c2d56dc37f824c0e77e98d1014d21cd8f8) by [@arushikesarwani94](https://github.com/arushikesarwani94))
- **Gradle:** Fix Gradle v8.0 builds by using .set() for Property ([777397667c](https://github.com/facebook/react-native/commit/777397667c2625aab3fc907b9ef4bd564963d8bb) by [@meghancampbel9](https://github.com/meghancampbel9))
- **ImageFetcher:** Change `free` to `delete` to call destructor of `ImageFetcher` and release `contextContainer`. ([90da666691](https://github.com/facebook/react-native/commit/90da666691745ab9bf3930dc3347d8e51683099f) by [@WoLewicki](https://github.com/WoLewicki))
- **Modal:** Fix `Modal` first frame being rendered on top-left corner ([b950fa2afb](https://github.com/facebook/react-native/commit/b950fa2afb20e2213ff6c733cb1c2465b90406ef) by [@cortinico](https://github.com/cortinico))
- **onTextLayout:** Fix `onTextLayout` metrics not incorporating `ReactTextViewManagerCallback` ([a6a2884d63](https://github.com/facebook/react-native/commit/a6a2884d63717a42ac2bafd2054991ce8b32a2e9) by [@NickGerleman](https://github.com/NickGerleman))
- **Text:** Fix more text rounding bugs ([1fe3ff86c3](https://github.com/facebook/react-native/commit/1fe3ff86c364fad023ad1e426f26608699314339) by [@NickGerleman](https://github.com/NickGerleman))
- **Text:** Fix `TextLayoutManager` `MeasureMode` Regression ([99119a2104](https://github.com/facebook/react-native/commit/99119a210487af18983145fd374ff7ebc88931f3) by [@NickGerleman](https://github.com/NickGerleman))
- **TextInput:** Fix bug where focus would jump to top text input upon clearing a separate text input. ([79c47987b7](https://github.com/facebook/react-native/commit/79c47987b74ab044574fc542fd4b13a9f11aa491) by [@joevilches](https://github.com/joevilches))
#### iOS specific
- **Gradient**: Gradient interpolation for transparent colors ([097d482446](https://github.com/facebook/react-native/commit/097d482446b7a03ca0f8c7e0254f4d770e05c79c) by [@intergalacticspacehighway](https://github.com/intergalacticspacehighway))
- **Prebuild:** Fixed wrong path in prebuild hermes check ([be11f2ee77](https://github.com/facebook/react-native/commit/be11f2ee77fd793efe0a1aa225897a1924163925) by [@chrfalch](https://github.com/chrfalch))
- **Prebuild:** Fixed resolving build type when downloading hermes artifacts ([9371e20192](https://github.com/facebook/react-native/commit/9371e201927fd105e797bf06e43943dd21e04381) by [@chrfalch](https://github.com/chrfalch))
- **Package.swift:** Add missing `React-RCTSettings` to `Package.swift` ([e40c1d265a](https://github.com/facebook/react-native/commit/e40c1d265a2045730dcf751eed4ebf32e099f0c7) by [@chrfalch](https://github.com/chrfalch))
- **Package.swift:** Fixed defines in `Package.swift` ([e2f6ce4ddf](https://github.com/facebook/react-native/commit/e2f6ce4ddfbea5814fc5d8632df14daeae3636d1) by [@chrfalch](https://github.com/chrfalch))
- **RCTImage:** Allow for consuming `RCTImage` in Swift codebase by enabling "Defines Module" option ([1d80586730](https://github.com/facebook/react-native/commit/1d8058673085580f402ec3a320fce810db7ad2ef) by [@kkafar](https://github.com/kkafar))
- **RCTImageComponentView:** Fix `RCTImageComponentView` image loading after source props change with no layout invalidation ([cd5d74518b](https://github.com/facebook/react-native/commit/cd5d74518becb3355519373211d2f54ff7dbd208) by Nick Lefever)
- **RCTScreenSize:** Make `RCTScreenSize` take horizontal orientation into account ([50ce8c77a7](https://github.com/facebook/react-native/commit/50ce8c77a74f2f2574030db04dc88c6092e68ba8) by [@okwasniewski](https://github.com/okwasniewski))
- **TextInput:** Fixed blank space at the bottom of multiline `TextInput` on iOS ([2da4a6059a](https://github.com/facebook/react-native/commit/2da4a6059a82430fa7c1c078f0dcd38f0d3fe3cb) by [@tomekzaw](https://github.com/tomekzaw))
- **Turbo Modules:** Turbo Modules- Fixes dictionary stripped out when value is `null` ([4a4fd1cb8b](https://github.com/facebook/react-native/commit/4a4fd1cb8bb06eee185a3b2463caec4d2b7e9235) by [@zhongwuzw](https://github.com/zhongwuzw))
## v0.80.1
### Added
@@ -546,10 +358,6 @@ See [CHANGELOG-0.7x](./CHANGELOG-0.7x#v0791)
See [CHANGELOG-0.7x](./CHANGELOG-0.7x#v0790)
## v0.78.3
See [CHANGELOG-0.7x](./CHANGELOG-0.7x#v0783)
## v0.78.2
See [CHANGELOG-0.7x](./CHANGELOG-0.7x#v0782)
+1 -1
View File
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.14.3-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.14.1-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
+2 -2
View File
@@ -28,8 +28,8 @@
"set-version": "node ./scripts/releases/set-version.js",
"test-android": "./gradlew :packages:react-native:ReactAndroid:test",
"test-ci": "jest --maxWorkers=2 --ci --reporters=\"default\" --reporters=\"jest-junit\"",
"test-release-local-clean": "node ./scripts/release-testing/test-release-local-clean.js",
"test-release-local": "node ./scripts/release-testing/test-release-local.js",
"test-e2e-local-clean": "node ./scripts/release-testing/test-e2e-local-clean.js",
"test-e2e-local": "node ./scripts/release-testing/test-e2e-local.js",
"test-ios": "./scripts/objc-test.sh test",
"test-typescript": "tsc -p packages/react-native/types/tsconfig.json",
"test-generated-typescript": "tsc -p packages/react-native/types_generated/tsconfig.test.json",
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.14.3-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.14.2-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
+12 -17
View File
@@ -13,7 +13,10 @@ import {ThemedText, useTheme} from './Theme';
import * as React from 'react';
import {
Image,
Platform,
SafeAreaView,
ScrollView,
StatusBar,
StyleSheet,
Text,
TouchableHighlight,
@@ -26,32 +29,24 @@ import {version as ReactNativeVersion} from 'react-native/Libraries/Core/ReactNa
export type NewAppScreenProps = $ReadOnly<{
templateFileName?: string,
safeAreaInsets?: $ReadOnly<{
top: number,
bottom: number,
left: number,
right: number,
}>,
}>;
const statusBarHeightOffset = Platform.select({
android: StatusBar.currentHeight || 0,
default: 0,
});
export default function NewAppScreen({
templateFileName = 'App.tsx',
safeAreaInsets = {top: 0, bottom: 0, left: 0, right: 0},
}: NewAppScreenProps): React.Node {
const {colors} = useTheme();
const isDarkMode = useColorScheme() === 'dark';
const isLargeScreen = useWindowDimensions().width > 600;
return (
<View
style={{
backgroundColor: colors.background,
paddingTop: safeAreaInsets.top,
paddingLeft: safeAreaInsets.left,
paddingRight: safeAreaInsets.right,
}}>
<ScrollView style={{paddingBottom: safeAreaInsets.bottom}}>
<View style={styles.container}>
<SafeAreaView style={{backgroundColor: colors.background}}>
<ScrollView>
<View style={[styles.container, {paddingTop: statusBarHeightOffset}]}>
<View style={styles.header}>
<Image
style={styles.logo}
@@ -104,7 +99,7 @@ export default function NewAppScreen({
</View>
</View>
</ScrollView>
</View>
</SafeAreaView>
);
}
-8
View File
@@ -11,14 +11,6 @@ import type * as React from 'react';
export type NewAppScreenProps = Readonly<{
templateFileName?: string | undefined;
safeAreaInsets?:
| Readonly<{
top: number;
bottom: number;
left: number;
right: number;
}>
| undefined;
}>;
export function NewAppScreen(props: NewAppScreenProps): React.ReactNode;
@@ -65,15 +65,15 @@ const TestTemplate = ({
propValue: string,
}) => `
TEST(${componentName}_${testName}, etc) {
auto propParser = RawPropsParser();
RawPropsParser propParser{};
propParser.prepare<${componentName}>();
auto const &sourceProps = ${componentName}();
auto const &rawProps = RawProps(folly::dynamic::object("${propName}", ${propValue}));
${componentName} sourceProps{};
RawProps rawProps(folly::dynamic::object("${propName}", ${propValue}));
ContextContainer contextContainer{};
PropsParserContext parserContext{-1, contextContainer};
rawProps.parse(propParser, parserContext);
rawProps.parse(propParser);
${componentName}(parserContext, sourceProps, rawProps);
}
`;
@@ -673,7 +673,7 @@ type ScrollViewBaseProps = $ReadOnly<{
}>;
export type ScrollViewProps = $ReadOnly<{
...ViewProps,
...Omit<ViewProps, 'experimental_accessibilityOrder'>,
...ScrollViewPropsIOS,
...ScrollViewPropsAndroid,
...ScrollViewBaseProps,
@@ -1031,7 +1031,7 @@ type TextInputBaseProps = $ReadOnly<{
}>;
export type TextInputProps = $ReadOnly<{
...Omit<ViewProps, 'style'>,
...Omit<ViewProps, 'style' | 'experimental_accessibilityOrder'>,
...TextInputIOSProps,
...TextInputAndroidProps,
...TextInputBaseProps,
@@ -242,8 +242,6 @@ function reactConsoleErrorHandler(...args) {
if (__DEV__) {
// If we're not reporting to the console in reportException,
// we need to report it as a console.error here.
/* $FlowFixMe[constant-condition] Error discovered during Constant
* Condition roll out. See https://fburl.com/workplace/1v97vimq. */
if (!reportToConsole) {
require('../LogBox/LogBox').default.addConsoleLog('error', ...args);
}
@@ -73,8 +73,6 @@ const InteractionManagerImpl = {
* Notify manager that an interaction has started.
*/
createInteractionHandle(): Handle {
/* $FlowFixMe[constant-condition] Error discovered during Constant
* Condition roll out. See https://fburl.com/workplace/1v97vimq. */
DEBUG && console.log('InteractionManager: create interaction handle');
_scheduleUpdate();
const handle = ++_inc;
@@ -86,8 +84,6 @@ const InteractionManagerImpl = {
* Notify manager that an interaction has completed.
*/
clearInteractionHandle(handle: Handle) {
/* $FlowFixMe[constant-condition] Error discovered during Constant
* Condition roll out. See https://fburl.com/workplace/1v97vimq. */
DEBUG && console.log('InteractionManager: clear interaction handle');
invariant(!!handle, 'InteractionManager: Must provide a handle to clear.');
_scheduleUpdate();
@@ -99,13 +99,9 @@ class TaskQueue {
const task = queue.shift();
try {
if (typeof task === 'object' && task.gen) {
/* $FlowFixMe[constant-condition] Error discovered during Constant
* Condition roll out. See https://fburl.com/workplace/1v97vimq. */
DEBUG && console.log('TaskQueue: genPromise for task ' + task.name);
this._genPromise(task);
} else if (typeof task === 'object' && task.run) {
/* $FlowFixMe[constant-condition] Error discovered during Constant
* Condition roll out. See https://fburl.com/workplace/1v97vimq. */
DEBUG && console.log('TaskQueue: run task ' + task.name);
task.run();
} else {
@@ -114,8 +110,6 @@ class TaskQueue {
'Expected Function, SimpleTask, or PromiseTask, but got:\n' +
JSON.stringify(task, null, 2),
);
/* $FlowFixMe[constant-condition] Error discovered during Constant
* Condition roll out. See https://fburl.com/workplace/1v97vimq. */
DEBUG && console.log('TaskQueue: run anonymous task');
task();
}
@@ -145,8 +139,6 @@ class TaskQueue {
this._queueStack.length > 1
) {
this._queueStack.pop();
/* $FlowFixMe[constant-condition] Error discovered during Constant
* Condition roll out. See https://fburl.com/workplace/1v97vimq. */
DEBUG &&
console.log('TaskQueue: popped queue: ', {
stackIdx,
@@ -166,17 +158,11 @@ class TaskQueue {
this._queueStack.push({tasks: [], popable: false});
const stackIdx = this._queueStack.length - 1;
const stackItem = this._queueStack[stackIdx];
/* $FlowFixMe[constant-condition] Error discovered during Constant
* Condition roll out. See https://fburl.com/workplace/1v97vimq. */
DEBUG && console.log('TaskQueue: push new queue: ', {stackIdx});
/* $FlowFixMe[constant-condition] Error discovered during Constant
* Condition roll out. See https://fburl.com/workplace/1v97vimq. */
DEBUG && console.log('TaskQueue: exec gen task ' + task.name);
task
.gen()
.then(() => {
/* $FlowFixMe[constant-condition] Error discovered during Constant
* Condition roll out. See https://fburl.com/workplace/1v97vimq. */
DEBUG &&
console.log('TaskQueue: onThen for gen task ' + task.name, {
stackIdx,
@@ -802,7 +802,7 @@ describe('LogBox', () => {
expect(logBox.getNotificationUI()).toEqual({
count: '!',
message:
'Invalid prop `invalid` supplied to `React.Fragment`. React.Fragment can only have `key`, `ref`, and `children` props.',
'Invalid prop `invalid` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.',
});
// Open LogBox.
@@ -817,7 +817,7 @@ describe('LogBox', () => {
// This seems like a bug, should be "Render Error".
title: 'Console Error',
message:
'Invalid prop `invalid` supplied to `React.Fragment`. React.Fragment can only have `key`, `ref`, and `children` props.',
'Invalid prop `invalid` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.',
componentStackFrames: ['<TestComponent />'],
isDismissable: true,
});
@@ -51,7 +51,9 @@ RCT_EXPORT_MODULE();
{
// _surfacePresenter set in setSurfacePresenter:
_nodesManager = [[RCTNativeAnimatedNodesManager alloc] initWithBridge:nil surfacePresenter:_surfacePresenter];
[_surfacePresenter addObserver:self];
if (!facebook::react::ReactNativeFeatureFlags::animatedShouldSignalBatch()) {
[_surfacePresenter addObserver:self];
}
[[self.moduleRegistry moduleForName:"EventDispatcher"] addDispatchObserver:self];
}
@@ -60,7 +62,9 @@ RCT_EXPORT_MODULE();
[super invalidate];
[_nodesManager stopAnimationLoop];
[[self.moduleRegistry moduleForName:"EventDispatcher"] removeDispatchObserver:self];
[_surfacePresenter removeObserver:self];
if (!facebook::react::ReactNativeFeatureFlags::animatedShouldSignalBatch()) {
[_surfacePresenter removeObserver:self];
}
}
/*
@@ -76,7 +80,11 @@ RCT_EXPORT_MODULE();
RCT_EXPORT_METHOD(startOperationBatch) {}
RCT_EXPORT_METHOD(finishOperationBatch) {}
RCT_EXPORT_METHOD(finishOperationBatch)
{
// This method is only called from JS when animatedShouldSignalBatch is enabled.
[self flushOperationQueues];
}
RCT_EXPORT_METHOD(createAnimatedNode : (double)tag config : (NSDictionary<NSString *, id> *)config)
{
@@ -251,27 +259,39 @@ RCT_EXPORT_METHOD(queueAndExecuteBatchedOperations : (NSArray *)operationsAndArg
- (void)queueFlushedOperationBlock:(AnimatedOperation)operation
{
dispatch_async(RCTGetUIManagerQueue(), ^{
if (facebook::react::ReactNativeFeatureFlags::animatedShouldSignalBatch()) {
[self addOperationBlock:operation];
// In Bridge, flushing of native animations is done from RCTCxxBridge batchDidComplete().
// Since RCTCxxBridge doesn't exist in Bridgeless, and components are not remounted in Fabric for native
// animations, flush here for changes in Animated.Value for Animated.event.
[self flushOperationQueues];
});
} else {
dispatch_async(RCTGetUIManagerQueue(), ^{
[self addOperationBlock:operation];
// In Bridge, flushing of native animations is done from RCTCxxBridge batchDidComplete().
// Since RCTCxxBridge doesn't exist in Bridgeless, and components are not remounted in Fabric for native
// animations, flush here for changes in Animated.Value for Animated.event.
[self flushOperationQueues];
});
}
}
- (void)queueOperationBlock:(AnimatedOperation)operation
{
dispatch_async(RCTGetUIManagerQueue(), ^{
if (facebook::react::ReactNativeFeatureFlags::animatedShouldSignalBatch()) {
[self addOperationBlock:operation];
});
} else {
dispatch_async(RCTGetUIManagerQueue(), ^{
[self addOperationBlock:operation];
});
}
}
- (void)queuePreOperationBlock:(AnimatedOperation)operation
{
dispatch_async(RCTGetUIManagerQueue(), ^{
if (facebook::react::ReactNativeFeatureFlags::animatedShouldSignalBatch()) {
[self addPreOperationBlock:operation];
});
} else {
dispatch_async(RCTGetUIManagerQueue(), ^{
[self addPreOperationBlock:operation];
});
}
}
- (void)addOperationBlock:(AnimatedOperation)operation
@@ -646,8 +646,6 @@ class XMLHttpRequest extends EventTarget {
this.withCredentials,
);
};
/* $FlowFixMe[constant-condition] Error discovered during Constant
* Condition roll out. See https://fburl.com/workplace/1v97vimq. */
if (DEBUG_NETWORK_SEND_DELAY) {
setTimeout(doSend, DEBUG_NETWORK_SEND_DELAY);
} else {
@@ -35,8 +35,6 @@ class PerformanceLogger implements IPerformanceLogger {
endExtras?: Extras,
) {
if (this._closed) {
/* $FlowFixMe[constant-condition] Error discovered during Constant
* Condition roll out. See https://fburl.com/workplace/1v97vimq. */
if (PRINT_TO_CONSOLE && __DEV__) {
console.log(
'PerformanceLogger: addTimespan - has closed ignoring: ',
@@ -46,8 +44,6 @@ class PerformanceLogger implements IPerformanceLogger {
return;
}
if (this._timespans[key]) {
/* $FlowFixMe[constant-condition] Error discovered during Constant
* Condition roll out. See https://fburl.com/workplace/1v97vimq. */
if (PRINT_TO_CONSOLE && __DEV__) {
console.log(
'PerformanceLogger: Attempting to add a timespan that already exists ',
@@ -83,8 +79,6 @@ class PerformanceLogger implements IPerformanceLogger {
this._timespans = {};
this._extras = {};
this._points = {};
/* $FlowFixMe[constant-condition] Error discovered during Constant
* Condition roll out. See https://fburl.com/workplace/1v97vimq. */
if (PRINT_TO_CONSOLE) {
console.log('PerformanceLogger.js', 'clear');
}
@@ -98,8 +92,6 @@ class PerformanceLogger implements IPerformanceLogger {
}
this._extras = {};
this._points = {};
/* $FlowFixMe[constant-condition] Error discovered during Constant
* Condition roll out. See https://fburl.com/workplace/1v97vimq. */
if (PRINT_TO_CONSOLE) {
console.log('PerformanceLogger.js', 'clearCompleted');
}
@@ -138,8 +130,6 @@ class PerformanceLogger implements IPerformanceLogger {
}
logEverything() {
/* $FlowFixMe[constant-condition] Error discovered during Constant
* Condition roll out. See https://fburl.com/workplace/1v97vimq. */
if (PRINT_TO_CONSOLE) {
// log timespans
for (const key in this._timespans) {
@@ -166,8 +156,6 @@ class PerformanceLogger implements IPerformanceLogger {
extras?: Extras,
) {
if (this._closed) {
/* $FlowFixMe[constant-condition] Error discovered during Constant
* Condition roll out. See https://fburl.com/workplace/1v97vimq. */
if (PRINT_TO_CONSOLE && __DEV__) {
console.log(
'PerformanceLogger: markPoint - has closed ignoring: ',
@@ -177,8 +165,6 @@ class PerformanceLogger implements IPerformanceLogger {
return;
}
if (this._points[key] != null) {
/* $FlowFixMe[constant-condition] Error discovered during Constant
* Condition roll out. See https://fburl.com/workplace/1v97vimq. */
if (PRINT_TO_CONSOLE && __DEV__) {
console.log(
'PerformanceLogger: Attempting to mark a point that has been already logged ',
@@ -201,8 +187,6 @@ class PerformanceLogger implements IPerformanceLogger {
setExtra(key: string, value: ExtraValue) {
if (this._closed) {
/* $FlowFixMe[constant-condition] Error discovered during Constant
* Condition roll out. See https://fburl.com/workplace/1v97vimq. */
if (PRINT_TO_CONSOLE && __DEV__) {
console.log('PerformanceLogger: setExtra - has closed ignoring: ', key);
}
@@ -210,8 +194,6 @@ class PerformanceLogger implements IPerformanceLogger {
}
if (this._extras.hasOwnProperty(key)) {
/* $FlowFixMe[constant-condition] Error discovered during Constant
* Condition roll out. See https://fburl.com/workplace/1v97vimq. */
if (PRINT_TO_CONSOLE && __DEV__) {
console.log(
'PerformanceLogger: Attempting to set an extra that already exists ',
@@ -229,8 +211,6 @@ class PerformanceLogger implements IPerformanceLogger {
extras?: Extras,
) {
if (this._closed) {
/* $FlowFixMe[constant-condition] Error discovered during Constant
* Condition roll out. See https://fburl.com/workplace/1v97vimq. */
if (PRINT_TO_CONSOLE && __DEV__) {
console.log(
'PerformanceLogger: startTimespan - has closed ignoring: ',
@@ -241,8 +221,6 @@ class PerformanceLogger implements IPerformanceLogger {
}
if (this._timespans[key]) {
/* $FlowFixMe[constant-condition] Error discovered during Constant
* Condition roll out. See https://fburl.com/workplace/1v97vimq. */
if (PRINT_TO_CONSOLE && __DEV__) {
console.log(
'PerformanceLogger: Attempting to start a timespan that already exists ',
@@ -256,8 +234,6 @@ class PerformanceLogger implements IPerformanceLogger {
startTime: timestamp,
startExtras: extras,
};
/* $FlowFixMe[constant-condition] Error discovered during Constant
* Condition roll out. See https://fburl.com/workplace/1v97vimq. */
if (PRINT_TO_CONSOLE) {
console.log('PerformanceLogger.js', 'start: ' + key);
}
@@ -269,8 +245,6 @@ class PerformanceLogger implements IPerformanceLogger {
extras?: Extras,
) {
if (this._closed) {
/* $FlowFixMe[constant-condition] Error discovered during Constant
* Condition roll out. See https://fburl.com/workplace/1v97vimq. */
if (PRINT_TO_CONSOLE && __DEV__) {
console.log(
'PerformanceLogger: stopTimespan - has closed ignoring: ',
@@ -282,8 +256,6 @@ class PerformanceLogger implements IPerformanceLogger {
const timespan = this._timespans[key];
if (!timespan || timespan.startTime == null) {
/* $FlowFixMe[constant-condition] Error discovered during Constant
* Condition roll out. See https://fburl.com/workplace/1v97vimq. */
if (PRINT_TO_CONSOLE && __DEV__) {
console.log(
'PerformanceLogger: Attempting to end a timespan that has not started ',
@@ -293,8 +265,6 @@ class PerformanceLogger implements IPerformanceLogger {
return;
}
if (timespan.endTime != null) {
/* $FlowFixMe[constant-condition] Error discovered during Constant
* Condition roll out. See https://fburl.com/workplace/1v97vimq. */
if (PRINT_TO_CONSOLE && __DEV__) {
console.log(
'PerformanceLogger: Attempting to end a timespan that has already ended ',
@@ -307,8 +277,6 @@ class PerformanceLogger implements IPerformanceLogger {
timespan.endExtras = extras;
timespan.endTime = timestamp;
timespan.totalTime = timespan.endTime - (timespan.startTime || 0);
/* $FlowFixMe[constant-condition] Error discovered during Constant
* Condition roll out. See https://fburl.com/workplace/1v97vimq. */
if (PRINT_TO_CONSOLE) {
console.log('PerformanceLogger.js', 'end: ' + key);
}
+1 -2
View File
@@ -398,7 +398,6 @@ let reactFabric = RNTarget(
"components/textinput/platform/ios/",
"components/unimplementedview",
"components/virtualview",
"components/virtualviewexperimental",
"components/root/tests",
],
dependencies: [.reactNativeDependencies, .reactJsiExecutor, .rctTypesafety, .reactTurboModuleCore, .jsi, .logger, .reactDebug, .reactFeatureFlags, .reactUtils, .reactRuntimeScheduler, .reactCxxReact, .reactRendererDebug, .reactGraphics, .yoga],
@@ -434,7 +433,7 @@ let reactFabricComponents = RNTarget(
"conponents/rncore", // this was the old folder where RN Core Components were generated. If you ran codegen in the past, you might have some files in it that might make the build fail.
],
dependencies: [.reactNativeDependencies, .reactCore, .reactJsiExecutor, .reactTurboModuleCore, .jsi, .logger, .reactDebug, .reactFeatureFlags, .reactUtils, .reactRuntimeScheduler, .reactCxxReact, .yoga, .reactRendererDebug, .reactGraphics, .reactFabric, .reactTurboModuleBridging],
sources: ["components/inputaccessory", "components/modal", "components/safeareaview", "components/text", "components/text/platform/cxx", "components/textinput", "components/textinput/platform/ios/", "components/unimplementedview", "components/virtualview", "components/virtualviewexperimental", "textlayoutmanager", "textlayoutmanager/platform/ios"]
sources: ["components/inputaccessory", "components/modal", "components/safeareaview", "components/text", "components/text/platform/cxx", "components/textinput", "components/textinput/platform/ios/", "components/unimplementedview", "components/virtualview", "textlayoutmanager", "textlayoutmanager/platform/ios"]
)
/// React-FabricImage.podspec
@@ -62,7 +62,8 @@ Pod::Spec.new do |s|
CONFIG="Debug"
fi
"$NODE_BINARY" "$REACT_NATIVE_PATH/scripts/replace-rncore-version.js" -c "$CONFIG" -r "#{version}" -p "$PODS_ROOT"
# TODO(T228219721): Add this for React Native Core as well
##### "$NODE_BINARY" "$REACT_NATIVE_PATH/third-party-podspecs/replace_dependencies_version.js" -c "$CONFIG" -r "#{version}" -p "$PODS_ROOT"
EOS
}
@@ -72,7 +73,7 @@ Pod::Spec.new do |s|
# always run the script without warning
script_phase[:always_out_of_date] = "1"
end
s.script_phase = script_phase
end
end
@@ -1,24 +0,0 @@
/*
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
#import <UIKit/UIKit.h>
#import <React/RCTViewComponentView.h>
NS_ASSUME_NONNULL_BEGIN
@interface RCTVirtualViewExperimentalComponentView : RCTViewComponentView
+ (instancetype)new NS_UNAVAILABLE;
- (instancetype)init NS_UNAVAILABLE;
- (instancetype)initWithCoder:(NSCoder *)coder NS_UNAVAILABLE;
- (instancetype)initWithFrame:(CGRect)frame NS_DESIGNATED_INITIALIZER;
@end
NS_ASSUME_NONNULL_END
@@ -1,384 +0,0 @@
/*
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
#import "RCTVirtualViewExperimentalComponentView.h"
#import <React/RCTAssert.h>
#import <React/RCTConversions.h>
#import <React/RCTScrollViewComponentView.h>
#import <React/RCTScrollableProtocol.h>
#import <React/UIView+React.h>
#import <jsi/jsi.h>
#import <react/featureflags/ReactNativeFeatureFlags.h>
#import <react/renderer/components/FBReactNativeSpec/ComponentDescriptors.h>
#import <react/renderer/components/FBReactNativeSpec/EventEmitters.h>
#import <react/renderer/components/FBReactNativeSpec/Props.h>
#import <react/renderer/components/virtualviewexperimental/VirtualViewExperimentalComponentDescriptor.h>
#import <react/renderer/components/virtualviewexperimental/VirtualViewExperimentalShadowNode.h>
#import "RCTFabricComponentsPlugins.h"
using namespace facebook;
using namespace facebook::react;
typedef NS_ENUM(NSInteger, RCTVirtualViewMode) {
RCTVirtualViewModeVisible = 0,
RCTVirtualViewModePrerender = 1,
RCTVirtualViewModeHidden = 2,
};
typedef NS_ENUM(NSInteger, RCTVirtualViewRenderState) {
RCTVirtualViewRenderStateUnknown = 0,
RCTVirtualViewRenderStateRendered = 1,
RCTVirtualViewRenderStateNone = 2,
};
/**
* Checks whether one CGRect overlaps with another CGRect.
*
* This is different from CGRectIntersectsRect because a CGRect representing
* a line or a point is considered to overlap with another CGRect if the line
* or point is within the rect bounds. However, two CGRects are not considered
* to overlap if they only share a boundary.
*/
static BOOL CGRectOverlaps(CGRect rect1, CGRect rect2)
{
CGFloat minY1 = CGRectGetMinY(rect1);
CGFloat maxY1 = CGRectGetMaxY(rect1);
CGFloat minY2 = CGRectGetMinY(rect2);
CGFloat maxY2 = CGRectGetMaxY(rect2);
if (minY1 >= maxY2 || minY2 >= maxY1) {
// No overlap on the y-axis.
return NO;
}
CGFloat minX1 = CGRectGetMinX(rect1);
CGFloat maxX1 = CGRectGetMaxX(rect1);
CGFloat minX2 = CGRectGetMinX(rect2);
CGFloat maxX2 = CGRectGetMaxX(rect2);
if (minX1 >= maxX2 || minX2 >= maxX1) {
// No overlap on the x-axis.
return NO;
}
return YES;
}
@interface RCTVirtualViewExperimentalComponentView () <UIScrollViewDelegate>
@end
@implementation RCTVirtualViewExperimentalComponentView {
RCTScrollViewComponentView *_lastParentScrollViewComponentView;
std::optional<enum RCTVirtualViewMode> _mode;
enum RCTVirtualViewRenderState _renderState;
std::optional<CGRect> _targetRect;
}
- (instancetype)initWithFrame:(CGRect)frame
{
if ((self = [super initWithFrame:frame]) != nil) {
_props = VirtualViewExperimentalShadowNode::defaultSharedProps();
_renderState = RCTVirtualViewRenderStateUnknown;
}
return self;
}
- (void)updateProps:(const Props::Shared &)props oldProps:(const Props::Shared &)oldProps
{
const auto &newViewProps = static_cast<const VirtualViewExperimentalProps &>(*props);
if (!_mode.has_value()) {
_mode = newViewProps.initialHidden ? RCTVirtualViewModeHidden : RCTVirtualViewModeVisible;
if (ReactNativeFeatureFlags::hideOffscreenVirtualViewsOnIOS()) {
self.hidden = newViewProps.initialHidden && !sIsAccessibilityUsed;
}
}
// If disabled, `_renderState` will always be `RCTVirtualViewRenderStateUnknown`.
if (ReactNativeFeatureFlags::enableVirtualViewRenderState()) {
switch (newViewProps.renderState) {
case 1:
_renderState = RCTVirtualViewRenderStateRendered;
break;
case 2:
_renderState = RCTVirtualViewRenderStateNone;
break;
default:
_renderState = RCTVirtualViewRenderStateUnknown;
break;
}
}
[super updateProps:props oldProps:oldProps];
}
- (RCTScrollViewComponentView *)getParentScrollViewComponentView
{
UIView *view = self.superview;
while (view != nil) {
if ([view isKindOfClass:[RCTScrollViewComponentView class]]) {
return (RCTScrollViewComponentView *)view;
}
view = view.superview;
}
return nil;
}
/**
* Static flag that tracks whether accessibility services are being used.
* When accessibility is detected, virtual views will remain visible even when
* they would normally be hidden when off-screen, ensuring that accessibility
* features will work correctly.
*/
static BOOL sIsAccessibilityUsed = NO;
- (void)_unhideIfNeeded
{
if (!sIsAccessibilityUsed) {
// accessibility is detected for the first time. Make views visible.
sIsAccessibilityUsed = YES;
}
if (self.hidden) {
self.hidden = NO;
}
}
- (NSInteger)accessibilityElementCount
{
// From empirical testing, method `accessibilityElementCount` is called lazily only
// when accessibility is used.
[self _unhideIfNeeded];
return [super accessibilityElementCount];
}
- (NSArray<id<UIFocusItem>> *)focusItemsInRect:(CGRect)rect
{
// From empirical testing, method `focusItemsInRect:` is called lazily only
// when keyboard navigation is used.
[self _unhideIfNeeded];
return [super focusItemsInRect:rect];
}
- (void)prepareForRecycle
{
[super prepareForRecycle];
// No need to remove the scroll listener here since the view is always removed from window before being recycled and
// we do that in didMoveToWindow, which gets called when the view is removed from window.
RCTAssert(
_lastParentScrollViewComponentView == nil,
@"_lastParentScrollViewComponentView should already have been cleared in didMoveToWindow.");
self.hidden = NO;
_mode.reset();
_targetRect.reset();
}
// Handles case when sibling changes size.
// TODO(T202601695): This doesn't yet handle the case of elements in the ScrollView outside a VirtualColumn changing
// size.
- (void)updateLayoutMetrics:(const LayoutMetrics &)layoutMetrics
oldLayoutMetrics:(const LayoutMetrics &)oldLayoutMetrics
{
[super updateLayoutMetrics:layoutMetrics oldLayoutMetrics:_layoutMetrics];
[self dispatchOnModeChangeIfNeeded:YES];
}
- (void)didMoveToWindow
{
[super didMoveToWindow];
if (_lastParentScrollViewComponentView != nil) {
[_lastParentScrollViewComponentView removeScrollListener:self];
_lastParentScrollViewComponentView = nil;
}
if (RCTScrollViewComponentView *parentScrollViewComponentView = [self getParentScrollViewComponentView]) {
if (self.window != nil) {
// TODO(T202601695): We also want the ScrollView to emit layout changes from didLayoutSubviews so that any event
// that may affect visibily of this view notifies the listeners.
[parentScrollViewComponentView addScrollListener:self];
_lastParentScrollViewComponentView = parentScrollViewComponentView;
// We want to dispatch the event immediately when the view is added to the window before any scrolling occurs.
[self dispatchOnModeChangeIfNeeded:NO];
}
}
}
- (void)scrollViewDidScroll:(UIScrollView *)scrollView
{
[self dispatchOnModeChangeIfNeeded:NO];
}
- (void)dispatchOnModeChangeIfNeeded:(BOOL)checkForTargetRectChange
{
if (_lastParentScrollViewComponentView == nullptr) {
return;
}
UIScrollView *scrollView = _lastParentScrollViewComponentView.scrollView;
CGRect targetRect = [self convertRect:self.bounds toView:scrollView];
// While scrolling, the `targetRect` does not change, so we don't check for changed `targetRect` in that case.
if (checkForTargetRectChange) {
if (_targetRect.has_value() && CGRectEqualToRect(targetRect, _targetRect.value())) {
return;
}
_targetRect = targetRect;
}
enum RCTVirtualViewMode newMode;
CGRect thresholdRect = CGRectMake(
scrollView.contentOffset.x,
scrollView.contentOffset.y,
scrollView.frame.size.width,
scrollView.frame.size.height);
if (CGRectOverlaps(targetRect, thresholdRect)) {
newMode = RCTVirtualViewModeVisible;
} else {
auto prerender = false;
const CGFloat prerenderRatio = ReactNativeFeatureFlags::virtualViewPrerenderRatio();
if (prerenderRatio > 0) {
thresholdRect = CGRectInset(
thresholdRect, -thresholdRect.size.width * prerenderRatio, -thresholdRect.size.height * prerenderRatio);
prerender = CGRectOverlaps(targetRect, thresholdRect);
}
if (prerender) {
newMode = RCTVirtualViewModePrerender;
} else {
newMode = RCTVirtualViewModeHidden;
thresholdRect = CGRectZero;
}
}
if (_mode.has_value() && newMode == _mode.value()) {
return;
}
// NOTE: Make sure to keep these props in sync with dispatchSyncModeChange below where we have to explicitly copy all
// props.
VirtualViewEventEmitter::OnModeChange event = {
.mode = (int)newMode,
.targetRect =
{.x = targetRect.origin.x,
.y = targetRect.origin.y,
.width = targetRect.size.width,
.height = targetRect.size.height},
.thresholdRect =
{.x = thresholdRect.origin.x,
.y = thresholdRect.origin.y,
.width = thresholdRect.size.width,
.height = thresholdRect.size.height},
};
const std::optional<enum RCTVirtualViewMode> oldMode = _mode;
_mode = newMode;
switch (newMode) {
case RCTVirtualViewModeVisible:
if (_renderState == RCTVirtualViewRenderStateUnknown) {
// Feature flag is disabled, so use the former logic.
[self dispatchSyncModeChange:event];
} else {
// If the previous mode was prerender and the result of dispatching that event was committed, we do not need to
// dispatch an event for visible.
const auto wasPrerenderCommitted = oldMode.has_value() && oldMode == RCTVirtualViewModePrerender &&
_renderState == RCTVirtualViewRenderStateRendered;
if (!wasPrerenderCommitted) {
[self dispatchSyncModeChange:event];
}
}
break;
case RCTVirtualViewModePrerender:
if (!oldMode.has_value() || oldMode != RCTVirtualViewModeVisible) {
[self dispatchAsyncModeChange:event];
}
break;
case RCTVirtualViewModeHidden:
[self dispatchAsyncModeChange:event];
break;
}
if (ReactNativeFeatureFlags::hideOffscreenVirtualViewsOnIOS()) {
switch (newMode) {
case RCTVirtualViewModeVisible:
self.hidden = NO;
break;
case RCTVirtualViewModePrerender:
self.hidden = !sIsAccessibilityUsed;
break;
case RCTVirtualViewModeHidden:
self.hidden = YES;
break;
}
}
}
- (void)dispatchAsyncModeChange:(VirtualViewEventEmitter::OnModeChange &)event
{
if (!_eventEmitter) {
return;
}
std::shared_ptr<const VirtualViewEventEmitter> emitter =
std::static_pointer_cast<const VirtualViewEventEmitter>(_eventEmitter);
emitter->onModeChange(event);
}
- (void)dispatchSyncModeChange:(VirtualViewEventEmitter::OnModeChange &)event
{
if (!_eventEmitter) {
return;
}
std::shared_ptr<const VirtualViewEventEmitter> emitter =
std::static_pointer_cast<const VirtualViewEventEmitter>(_eventEmitter);
// TODO: Move this into a custom event emitter. We had to duplicate the codegen code here from onModeChange in order
// to dispatch synchronously and discrete.
emitter->experimental_flushSync([&emitter, &event]() {
emitter->dispatchEvent(
"modeChange",
[event](jsi::Runtime &runtime) {
auto payload = jsi::Object(runtime);
payload.setProperty(runtime, "mode", event.mode);
{
auto targetRect = jsi::Object(runtime);
targetRect.setProperty(runtime, "x", event.targetRect.x);
targetRect.setProperty(runtime, "y", event.targetRect.y);
targetRect.setProperty(runtime, "width", event.targetRect.width);
targetRect.setProperty(runtime, "height", event.targetRect.height);
payload.setProperty(runtime, "targetRect", targetRect);
}
{
auto thresholdRect = jsi::Object(runtime);
thresholdRect.setProperty(runtime, "x", event.thresholdRect.x);
thresholdRect.setProperty(runtime, "y", event.thresholdRect.y);
thresholdRect.setProperty(runtime, "width", event.thresholdRect.width);
thresholdRect.setProperty(runtime, "height", event.thresholdRect.height);
payload.setProperty(runtime, "thresholdRect", thresholdRect);
}
return payload;
},
RawEvent::Category::Discrete);
});
}
+ (ComponentDescriptorProvider)componentDescriptorProvider
{
return concreteComponentDescriptorProvider<VirtualViewExperimentalComponentDescriptor>();
}
@end
Class<RCTComponentViewProtocol> VirtualViewExperimentalCls(void)
{
return RCTVirtualViewExperimentalComponentView.class;
}
@@ -7,4 +7,4 @@
#import <Foundation/Foundation.h>
using ReactTag = NSInteger;
typedef NSInteger ReactTag;
@@ -13,7 +13,7 @@ NS_ASSUME_NONNULL_BEGIN
@class RCTFabricSurface;
using RCTSurfaceEnumeratorBlock = void (^)(NSEnumerator<RCTFabricSurface *> *_Nonnull __strong);
typedef void (^RCTSurfaceEnumeratorBlock)(NSEnumerator<RCTFabricSurface *> *enumerator);
/**
* Registry of Surfaces.
@@ -3286,7 +3286,6 @@ public abstract class com/facebook/react/uimanager/BaseViewManager : com/faceboo
public fun setAccessibilityLabel (Landroid/view/View;Ljava/lang/String;)V
public fun setAccessibilityLabelledBy (Landroid/view/View;Lcom/facebook/react/bridge/Dynamic;)V
public fun setAccessibilityLiveRegion (Landroid/view/View;Ljava/lang/String;)V
public fun setAccessibilityOrder (Landroid/view/View;Lcom/facebook/react/bridge/ReadableArray;)V
public fun setAccessibilityRole (Landroid/view/View;Ljava/lang/String;)V
public fun setAccessibilityValue (Landroid/view/View;Lcom/facebook/react/bridge/ReadableMap;)V
public fun setBackgroundColor (Landroid/view/View;I)V
@@ -3777,6 +3776,14 @@ public final class com/facebook/react/uimanager/ReactAccessibilityDelegate$Role
public static fun values ()[Lcom/facebook/react/uimanager/ReactAccessibilityDelegate$Role;
}
public final class com/facebook/react/uimanager/ReactAxOrderHelper {
public static final field INSTANCE Lcom/facebook/react/uimanager/ReactAxOrderHelper;
public final fun buildAxOrderList (Landroid/view/View;Ljava/util/List;[Landroid/view/View;)V
public static final fun cleanUpAxOrder (Landroid/view/ViewGroup;)V
public final fun disableFocusForSubtree (Landroid/view/ViewGroup;Ljava/util/List;)V
public static final fun restoreFocusability (Landroid/view/ViewGroup;)V
}
public abstract interface class com/facebook/react/uimanager/ReactClippingProhibitedView {
}
@@ -5252,16 +5259,6 @@ public abstract interface class com/facebook/react/viewmanagers/UnimplementedNat
public abstract fun setName (Landroid/view/View;Ljava/lang/String;)V
}
public class com/facebook/react/viewmanagers/VirtualViewExperimentalManagerDelegate : com/facebook/react/uimanager/BaseViewManagerDelegate {
public fun <init> (Lcom/facebook/react/uimanager/BaseViewManager;)V
public fun setProperty (Landroid/view/View;Ljava/lang/String;Ljava/lang/Object;)V
}
public abstract interface class com/facebook/react/viewmanagers/VirtualViewExperimentalManagerInterface : com/facebook/react/uimanager/ViewManagerWithGeneratedInterface {
public abstract fun setInitialHidden (Landroid/view/View;Z)V
public abstract fun setRenderState (Landroid/view/View;I)V
}
public class com/facebook/react/viewmanagers/VirtualViewManagerDelegate : com/facebook/react/uimanager/BaseViewManagerDelegate {
public fun <init> (Lcom/facebook/react/uimanager/BaseViewManager;)V
public fun setProperty (Landroid/view/View;Ljava/lang/String;Ljava/lang/Object;)V
@@ -5706,7 +5703,7 @@ public class com/facebook/react/views/scroll/ReactHorizontalScrollViewManager :
public final class com/facebook/react/views/scroll/ReactHorizontalScrollViewManager$Companion {
}
public class com/facebook/react/views/scroll/ReactScrollView : android/widget/ScrollView, android/view/View$OnLayoutChangeListener, android/view/ViewGroup$OnHierarchyChangeListener, com/facebook/react/uimanager/ReactClippingViewGroup, com/facebook/react/uimanager/ReactOverflowViewWithInset, com/facebook/react/views/scroll/ReactAccessibleScrollView, com/facebook/react/views/scroll/ReactScrollViewHelper$HasFlingAnimator, com/facebook/react/views/scroll/ReactScrollViewHelper$HasScrollEventThrottle, com/facebook/react/views/scroll/ReactScrollViewHelper$HasScrollState, com/facebook/react/views/scroll/ReactScrollViewHelper$HasSmoothScroll, com/facebook/react/views/scroll/ReactScrollViewHelper$HasStateWrapper, com/facebook/react/views/scroll/VirtualViewContainer {
public class com/facebook/react/views/scroll/ReactScrollView : android/widget/ScrollView, android/view/View$OnLayoutChangeListener, android/view/ViewGroup$OnHierarchyChangeListener, com/facebook/react/uimanager/ReactClippingViewGroup, com/facebook/react/uimanager/ReactOverflowViewWithInset, com/facebook/react/views/scroll/ReactAccessibleScrollView, com/facebook/react/views/scroll/ReactScrollViewHelper$HasFlingAnimator, com/facebook/react/views/scroll/ReactScrollViewHelper$HasScrollEventThrottle, com/facebook/react/views/scroll/ReactScrollViewHelper$HasScrollState, com/facebook/react/views/scroll/ReactScrollViewHelper$HasSmoothScroll, com/facebook/react/views/scroll/ReactScrollViewHelper$HasStateWrapper {
public fun <init> (Landroid/content/Context;)V
public fun <init> (Landroid/content/Context;Lcom/facebook/react/views/scroll/FpsListener;)V
public fun abortAnimation ()V
@@ -5734,7 +5731,6 @@ public class com/facebook/react/views/scroll/ReactScrollView : android/widget/Sc
public fun getScrollEventThrottle ()I
public fun getStateWrapper ()Lcom/facebook/react/uimanager/StateWrapper;
protected fun getTopFadingEdgeStrength ()F
public fun getVirtualViewContainerState ()Lcom/facebook/react/views/scroll/VirtualViewContainerState;
protected fun handleInterceptedTouchEvent (Landroid/view/MotionEvent;)V
public fun isPartiallyScrolledInView (Landroid/view/View;)Z
protected fun onAttachedToWindow ()V
@@ -6002,12 +5998,6 @@ public final class com/facebook/react/views/scroll/ScrollEventType$Companion {
public final fun getJSEventName (Lcom/facebook/react/views/scroll/ScrollEventType;)Ljava/lang/String;
}
public abstract interface class com/facebook/react/views/scroll/VirtualView {
public abstract fun getContainerRelativeRect ()Landroid/graphics/Rect;
public abstract fun getVirtualViewID ()Ljava/lang/String;
public abstract fun onModeChange (Lcom/facebook/react/views/virtual/VirtualViewMode;Landroid/graphics/Rect;)V
}
public final class com/facebook/react/views/swiperefresh/ReactSwipeRefreshLayout : androidx/swiperefreshlayout/widget/SwipeRefreshLayout {
public fun <init> (Lcom/facebook/react/bridge/ReactContext;)V
public fun canChildScrollUp ()Z
@@ -6564,6 +6554,8 @@ public final class com/facebook/react/views/view/ReactDrawableHelper {
public class com/facebook/react/views/view/ReactViewGroup : android/view/ViewGroup, com/facebook/react/touch/ReactHitSlopView, com/facebook/react/touch/ReactInterceptingViewGroup, com/facebook/react/uimanager/ReactClippingViewGroup, com/facebook/react/uimanager/ReactOverflowViewWithInset, com/facebook/react/uimanager/ReactPointerEventsView, com/facebook/react/uimanager/ReactZIndexedViewGroup {
public fun <init> (Landroid/content/Context;)V
public fun addChildrenForAccessibility (Ljava/util/ArrayList;)V
public final fun cleanUpAxOrderListener ()V
protected fun dispatchDraw (Landroid/graphics/Canvas;)V
public fun dispatchGenericMotionEvent (Landroid/view/MotionEvent;)Z
public fun dispatchProvideStructure (Landroid/view/ViewStructure;)V
@@ -6571,6 +6563,7 @@ public class com/facebook/react/views/view/ReactViewGroup : android/view/ViewGro
public fun draw (Landroid/graphics/Canvas;)V
protected fun drawChild (Landroid/graphics/Canvas;Landroid/view/View;J)Z
public fun endViewTransition (Landroid/view/View;)V
public final fun getAxOrderList ()Ljava/util/List;
protected fun getChildDrawingOrder (II)I
public fun getClippingRect (Landroid/graphics/Rect;)V
public fun getHitSlopRect ()Landroid/graphics/Rect;
@@ -6590,6 +6583,7 @@ public class com/facebook/react/views/view/ReactViewGroup : android/view/ViewGro
public fun onViewAdded (Landroid/view/View;)V
public fun onViewRemoved (Landroid/view/View;)V
public fun requestLayout ()V
public final fun setAxOrderList (Ljava/util/List;)V
public final fun setBackfaceVisibility (Ljava/lang/String;)V
public final fun setBackfaceVisibilityDependantOpacity ()V
public fun setBackgroundColor (I)V
@@ -6626,12 +6620,15 @@ public class com/facebook/react/views/view/ReactViewManager : com/facebook/react
public fun nextFocusLeft (Lcom/facebook/react/views/view/ReactViewGroup;I)V
public fun nextFocusRight (Lcom/facebook/react/views/view/ReactViewGroup;I)V
public fun nextFocusUp (Lcom/facebook/react/views/view/ReactViewGroup;I)V
public synthetic fun onDropViewInstance (Landroid/view/View;)V
public fun onDropViewInstance (Lcom/facebook/react/views/view/ReactViewGroup;)V
public synthetic fun prepareToRecycleView (Lcom/facebook/react/uimanager/ThemedReactContext;Landroid/view/View;)Landroid/view/View;
protected fun prepareToRecycleView (Lcom/facebook/react/uimanager/ThemedReactContext;Lcom/facebook/react/views/view/ReactViewGroup;)Lcom/facebook/react/views/view/ReactViewGroup;
public synthetic fun receiveCommand (Landroid/view/View;ILcom/facebook/react/bridge/ReadableArray;)V
public synthetic fun receiveCommand (Landroid/view/View;Ljava/lang/String;Lcom/facebook/react/bridge/ReadableArray;)V
public fun receiveCommand (Lcom/facebook/react/views/view/ReactViewGroup;ILcom/facebook/react/bridge/ReadableArray;)V
public fun receiveCommand (Lcom/facebook/react/views/view/ReactViewGroup;Ljava/lang/String;Lcom/facebook/react/bridge/ReadableArray;)V
public fun setAccessibilityOrder (Lcom/facebook/react/views/view/ReactViewGroup;Lcom/facebook/react/bridge/ReadableArray;)V
public fun setAccessible (Lcom/facebook/react/views/view/ReactViewGroup;Z)V
public fun setBackfaceVisibility (Lcom/facebook/react/views/view/ReactViewGroup;Ljava/lang/String;)V
public fun setBackgroundImage (Lcom/facebook/react/views/view/ReactViewGroup;Lcom/facebook/react/bridge/ReadableArray;)V
@@ -6664,79 +6661,3 @@ public final class com/facebook/react/views/view/WindowUtilKt {
public static final fun setEdgeToEdgeFeatureFlagOn ()V
}
public final class com/facebook/react/views/virtual/VirtualViewMode : java/lang/Enum {
public static final field Hidden Lcom/facebook/react/views/virtual/VirtualViewMode;
public static final field Prerender Lcom/facebook/react/views/virtual/VirtualViewMode;
public static final field Visible Lcom/facebook/react/views/virtual/VirtualViewMode;
public static fun getEntries ()Lkotlin/enums/EnumEntries;
public final fun getValue ()I
public static fun valueOf (Ljava/lang/String;)Lcom/facebook/react/views/virtual/VirtualViewMode;
public static fun values ()[Lcom/facebook/react/views/virtual/VirtualViewMode;
}
public final class com/facebook/react/views/virtual/view/ReactVirtualView : com/facebook/react/views/view/ReactViewGroup, android/view/View$OnLayoutChangeListener, com/facebook/react/views/scroll/ReactScrollViewHelper$LayoutChangeListener, com/facebook/react/views/scroll/ReactScrollViewHelper$ScrollListener {
public fun <init> (Landroid/content/Context;)V
public fun onLayout (Landroid/view/ViewGroup;)V
public fun onLayoutChange (Landroid/view/View;IIIIIIII)V
public fun onLayoutChange (Landroid/view/ViewGroup;)V
public fun onScroll (Landroid/view/ViewGroup;Lcom/facebook/react/views/scroll/ScrollEventType;FF)V
public synthetic fun recycleView$xplat_js_react_native_github_packages_react_native_ReactAndroid_src_main_java_com_facebook_react_views_view_viewAndroid ()V
}
public final class com/facebook/react/views/virtual/view/ReactVirtualViewManager : com/facebook/react/uimanager/ViewGroupManager, com/facebook/react/viewmanagers/VirtualViewManagerInterface {
public static final field Companion Lcom/facebook/react/views/virtual/view/ReactVirtualViewManager$Companion;
public static final field REACT_CLASS Ljava/lang/String;
public fun <init> ()V
public synthetic fun addEventEmitters (Lcom/facebook/react/uimanager/ThemedReactContext;Landroid/view/View;)V
public synthetic fun createViewInstance (Lcom/facebook/react/uimanager/ThemedReactContext;)Landroid/view/View;
public fun getName ()Ljava/lang/String;
public synthetic fun prepareToRecycleView (Lcom/facebook/react/uimanager/ThemedReactContext;Landroid/view/View;)Landroid/view/View;
public synthetic fun setInitialHidden (Landroid/view/View;Z)V
public fun setInitialHidden (Lcom/facebook/react/views/virtual/view/ReactVirtualView;Z)V
public synthetic fun setNativeId (Landroid/view/View;Ljava/lang/String;)V
public fun setNativeId (Lcom/facebook/react/views/virtual/view/ReactVirtualView;Ljava/lang/String;)V
public synthetic fun setRenderState (Landroid/view/View;I)V
public fun setRenderState (Lcom/facebook/react/views/virtual/view/ReactVirtualView;I)V
}
public final class com/facebook/react/views/virtual/view/ReactVirtualViewManager$Companion {
}
public final class com/facebook/react/views/virtual/view/VirtualViewEventEmitter : com/facebook/react/views/virtual/VirtualViewModeChangeEmitter {
public fun <init> (IILcom/facebook/react/uimanager/events/EventDispatcher;)V
public fun emitModeChange (Lcom/facebook/react/views/virtual/VirtualViewMode;Landroid/graphics/Rect;Landroid/graphics/Rect;Z)V
}
public final class com/facebook/react/views/virtual/viewexperimental/ReactVirtualViewExperimental : com/facebook/react/views/view/ReactViewGroup, android/view/View$OnLayoutChangeListener, com/facebook/react/views/scroll/VirtualView {
public fun <init> (Landroid/content/Context;)V
public fun getContainerRelativeRect ()Landroid/graphics/Rect;
public fun getVirtualViewID ()Ljava/lang/String;
public fun onLayoutChange (Landroid/view/View;IIIIIIII)V
public fun onModeChange (Lcom/facebook/react/views/virtual/VirtualViewMode;Landroid/graphics/Rect;)V
public synthetic fun recycleView$xplat_js_react_native_github_packages_react_native_ReactAndroid_src_main_java_com_facebook_react_views_view_viewAndroid ()V
}
public final class com/facebook/react/views/virtual/viewexperimental/ReactVirtualViewExperimentalManager : com/facebook/react/uimanager/ViewGroupManager, com/facebook/react/viewmanagers/VirtualViewExperimentalManagerInterface {
public static final field Companion Lcom/facebook/react/views/virtual/viewexperimental/ReactVirtualViewExperimentalManager$Companion;
public static final field REACT_CLASS Ljava/lang/String;
public fun <init> ()V
public synthetic fun addEventEmitters (Lcom/facebook/react/uimanager/ThemedReactContext;Landroid/view/View;)V
public synthetic fun createViewInstance (Lcom/facebook/react/uimanager/ThemedReactContext;)Landroid/view/View;
public fun getName ()Ljava/lang/String;
public synthetic fun prepareToRecycleView (Lcom/facebook/react/uimanager/ThemedReactContext;Landroid/view/View;)Landroid/view/View;
public synthetic fun setInitialHidden (Landroid/view/View;Z)V
public fun setInitialHidden (Lcom/facebook/react/views/virtual/viewexperimental/ReactVirtualViewExperimental;Z)V
public synthetic fun setNativeId (Landroid/view/View;Ljava/lang/String;)V
public fun setNativeId (Lcom/facebook/react/views/virtual/viewexperimental/ReactVirtualViewExperimental;Ljava/lang/String;)V
public synthetic fun setRenderState (Landroid/view/View;I)V
public fun setRenderState (Lcom/facebook/react/views/virtual/viewexperimental/ReactVirtualViewExperimental;I)V
}
public final class com/facebook/react/views/virtual/viewexperimental/ReactVirtualViewExperimentalManager$Companion {
}
public final class com/facebook/react/views/virtual/viewexperimental/VirtualViewEventEmitter : com/facebook/react/views/virtual/VirtualViewModeChangeEmitter {
public fun <init> (IILcom/facebook/react/uimanager/events/EventDispatcher;)V
public fun emitModeChange (Lcom/facebook/react/views/virtual/VirtualViewMode;Landroid/graphics/Rect;Landroid/graphics/Rect;Z)V
}
@@ -112,8 +112,6 @@ val preparePrefab by
Pair(
"../ReactCommon/react/renderer/animations/",
"react/renderer/animations/"),
// react_renderer_bridging
Pair("../ReactCommon/react/renderer/bridging/", "react/renderer/bridging/"),
// react_renderer_componentregistry
Pair(
"../ReactCommon/react/renderer/componentregistry/",
@@ -4,7 +4,7 @@
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @generated SignedSource<<48a25f3bf3e45c8864f84a8cccca473d>>
* @generated SignedSource<<a4a7c66f4603fc6a56018aba12c942ee>>
*/
/**
@@ -36,6 +36,12 @@ public object ReactNativeFeatureFlags {
@JvmStatic
public fun commonTestFlag(): Boolean = accessor.commonTestFlag()
/**
* Enables start- and finishOperationBatch on any platform.
*/
@JvmStatic
public fun animatedShouldSignalBatch(): Boolean = accessor.animatedShouldSignalBatch()
/**
* Use a C++ implementation of Native Animated instead of the platform implementation.
*/
@@ -4,7 +4,7 @@
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @generated SignedSource<<a2faaafc4bf1b41b69ea4341a16eeb76>>
* @generated SignedSource<<9b6d83d6ea0acbc13bce19d869699079>>
*/
/**
@@ -21,6 +21,7 @@ package com.facebook.react.internal.featureflags
internal class ReactNativeFeatureFlagsCxxAccessor : ReactNativeFeatureFlagsAccessor {
private var commonTestFlagCache: Boolean? = null
private var animatedShouldSignalBatchCache: Boolean? = null
private var cxxNativeAnimatedEnabledCache: Boolean? = null
private var cxxNativeAnimatedRemoveJsSyncCache: Boolean? = null
private var disableMainQueueSyncDispatchIOSCache: Boolean? = null
@@ -87,6 +88,15 @@ internal class ReactNativeFeatureFlagsCxxAccessor : ReactNativeFeatureFlagsAcces
return cached
}
override fun animatedShouldSignalBatch(): Boolean {
var cached = animatedShouldSignalBatchCache
if (cached == null) {
cached = ReactNativeFeatureFlagsCxxInterop.animatedShouldSignalBatch()
animatedShouldSignalBatchCache = cached
}
return cached
}
override fun cxxNativeAnimatedEnabled(): Boolean {
var cached = cxxNativeAnimatedEnabledCache
if (cached == null) {
@@ -4,7 +4,7 @@
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @generated SignedSource<<e72a46d573dedebd70f763843eb459fa>>
* @generated SignedSource<<75760457dea789ab0951d3a22be3341c>>
*/
/**
@@ -30,6 +30,8 @@ public object ReactNativeFeatureFlagsCxxInterop {
@DoNotStrip @JvmStatic public external fun commonTestFlag(): Boolean
@DoNotStrip @JvmStatic public external fun animatedShouldSignalBatch(): Boolean
@DoNotStrip @JvmStatic public external fun cxxNativeAnimatedEnabled(): Boolean
@DoNotStrip @JvmStatic public external fun cxxNativeAnimatedRemoveJsSync(): Boolean
@@ -4,7 +4,7 @@
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @generated SignedSource<<c7dc0406f2a4e8b4bedde09e8dec5b07>>
* @generated SignedSource<<48fa8921cc2947a713974c9926e1d806>>
*/
/**
@@ -25,6 +25,8 @@ public open class ReactNativeFeatureFlagsDefaults : ReactNativeFeatureFlagsProvi
override fun commonTestFlag(): Boolean = false
override fun animatedShouldSignalBatch(): Boolean = false
override fun cxxNativeAnimatedEnabled(): Boolean = false
override fun cxxNativeAnimatedRemoveJsSync(): Boolean = false
@@ -4,7 +4,7 @@
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @generated SignedSource<<5e082a56b9e6594828e50e2dfef76ea9>>
* @generated SignedSource<<356261385b837def94ac5a4ca7ffd05d>>
*/
/**
@@ -25,6 +25,7 @@ internal class ReactNativeFeatureFlagsLocalAccessor : ReactNativeFeatureFlagsAcc
private val accessedFeatureFlags = mutableSetOf<String>()
private var commonTestFlagCache: Boolean? = null
private var animatedShouldSignalBatchCache: Boolean? = null
private var cxxNativeAnimatedEnabledCache: Boolean? = null
private var cxxNativeAnimatedRemoveJsSyncCache: Boolean? = null
private var disableMainQueueSyncDispatchIOSCache: Boolean? = null
@@ -92,6 +93,16 @@ internal class ReactNativeFeatureFlagsLocalAccessor : ReactNativeFeatureFlagsAcc
return cached
}
override fun animatedShouldSignalBatch(): Boolean {
var cached = animatedShouldSignalBatchCache
if (cached == null) {
cached = currentProvider.animatedShouldSignalBatch()
accessedFeatureFlags.add("animatedShouldSignalBatch")
animatedShouldSignalBatchCache = cached
}
return cached
}
override fun cxxNativeAnimatedEnabled(): Boolean {
var cached = cxxNativeAnimatedEnabledCache
if (cached == null) {
@@ -4,7 +4,7 @@
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @generated SignedSource<<d6de753a08bc272f918066ad90fda301>>
* @generated SignedSource<<8abf9bfb81265ae0c840457eb6c199bd>>
*/
/**
@@ -25,6 +25,8 @@ import com.facebook.proguard.annotations.DoNotStrip
public interface ReactNativeFeatureFlagsProvider {
@DoNotStrip public fun commonTestFlag(): Boolean
@DoNotStrip public fun animatedShouldSignalBatch(): Boolean
@DoNotStrip public fun cxxNativeAnimatedEnabled(): Boolean
@DoNotStrip public fun cxxNativeAnimatedRemoveJsSync(): Boolean
@@ -30,7 +30,6 @@ import com.facebook.react.bridge.ReadableMapKeySetIterator;
import com.facebook.react.bridge.ReadableType;
import com.facebook.react.common.MapBuilder;
import com.facebook.react.common.ReactConstants;
import com.facebook.react.internal.featureflags.ReactNativeFeatureFlags;
import com.facebook.react.uimanager.ReactAccessibilityDelegate.AccessibilityRole;
import com.facebook.react.uimanager.ReactAccessibilityDelegate.Role;
import com.facebook.react.uimanager.annotations.ReactProp;
@@ -312,61 +311,9 @@ public abstract class BaseViewManager<T extends View, C extends LayoutShadowNode
public void setNativeId(@NonNull T view, @Nullable String nativeId) {
view.setTag(R.id.view_tag_native_id, nativeId);
/*
* If we change the nativeId we need to notify the relevant accessibility parent to update the
* focusing order.
*/
if (view.getTag(R.id.accessibility_order_parent) != null) {
ViewGroup accessibilityParent = (ViewGroup) view.getTag(R.id.accessibility_order_parent);
accessibilityParent.setTag(R.id.accessibility_order_dirty, true);
accessibilityParent.notifySubtreeAccessibilityStateChanged(
accessibilityParent, accessibilityParent, AccessibilityEvent.CONTENT_CHANGE_TYPE_SUBTREE);
}
ReactFindViewUtil.notifyViewRendered(view);
}
@ReactProp(name = ViewProps.ACCESSIBILITY_ORDER)
public void setAccessibilityOrder(@NonNull T view, @Nullable ReadableArray nativeIds) {
if (!ReactNativeFeatureFlags.enableAccessibilityOrder()) {
return;
}
view.setTag(R.id.accessibility_order, nativeIds);
view.setTag(R.id.accessibility_order_dirty, true);
if (view instanceof ViewGroup) {
((ViewGroup) view)
.setOnHierarchyChangeListener(
new ViewGroup.OnHierarchyChangeListener() {
@Override
public void onChildViewAdded(View parent, View child) {
view.setTag(R.id.accessibility_order_dirty, true);
// We also want to listen to changes on the hierarchy of nested ViewGroups
if (child instanceof ViewGroup) {
ViewGroup childGroup = (ViewGroup) child;
childGroup.setOnHierarchyChangeListener(this);
for (int i = 0; i < childGroup.getChildCount(); i++) {
onChildViewAdded(childGroup, childGroup.getChildAt(i));
}
}
}
@Override
public void onChildViewRemoved(View parent, View child) {
view.setTag(R.id.accessibility_order_dirty, true);
}
});
((ViewGroup) view)
.notifySubtreeAccessibilityStateChanged(
view, view, AccessibilityEvent.CONTENT_CHANGE_TYPE_SUBTREE);
}
}
@ReactProp(name = ViewProps.ACCESSIBILITY_LABELLED_BY)
public void setAccessibilityLabelledBy(@NonNull T view, @Nullable Dynamic nativeId) {
if (nativeId.isNull()) {
@@ -91,10 +91,7 @@ public abstract class BaseViewManagerDelegate<
val dynamicFromObject: Dynamic = DynamicFromObject(value)
mViewManager.setAccessibilityLabelledBy(view, dynamicFromObject)
}
ViewProps.ACCESSIBILITY_ORDER ->
mViewManager.setAccessibilityOrder(view, value as ReadableArray?)
ViewProps.OPACITY -> mViewManager.setOpacity(view, (value as Double?)?.toFloat() ?: 1.0f)
ViewProps.OUTLINE_COLOR -> mViewManager.setOutlineColor(view, value as Int?)
ViewProps.OUTLINE_OFFSET ->
@@ -0,0 +1,103 @@
/*
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
package com.facebook.react.uimanager
import android.view.View
import android.view.ViewGroup
import com.facebook.react.R
public object ReactAxOrderHelper {
@JvmStatic
public fun cleanUpAxOrder(host: ViewGroup) {
fun traverse(view: View) {
val originalFocusability = view.getTag(R.id.original_focusability) as Boolean?
if (originalFocusability != null) {
view.isFocusable = originalFocusability
}
val axOrderParent = view.getTag(R.id.accessibility_order_parent) as View?
if (axOrderParent != null) {
view.setTag(R.id.accessibility_order_parent, null)
}
if (view is ViewGroup) {
for (i in 0..<view.childCount) {
traverse(view.getChildAt(i))
}
}
}
for (i in 0..<host.childCount) {
traverse(host.getChildAt(i))
}
}
@JvmStatic
public fun restoreFocusability(host: ViewGroup) {
fun traverse(view: View) {
val originalFocusability = view.getTag(R.id.original_focusability) as Boolean?
if (originalFocusability != null) {
view.isFocusable = originalFocusability
}
if (view is ViewGroup) {
for (i in 0..<view.childCount) {
traverse(view.getChildAt(i))
}
}
}
for (i in 0..<host.childCount) {
traverse(host.getChildAt(i))
}
}
public fun disableFocusForSubtree(view: ViewGroup, axOrderList: MutableList<*>) {
fun traverse(view: View) {
if (!axOrderList.contains(view.getTag(R.id.view_tag_native_id))) {
if (view.getTag(R.id.original_focusability) == null) {
view.setTag(R.id.original_focusability, view.isFocusable)
}
view.isFocusable = false
}
if (view is ViewGroup) {
for (i in 0..<view.childCount) {
traverse(view.getChildAt(i))
}
}
}
for (i in 0..<view.childCount) {
traverse(view.getChildAt(i))
}
}
public fun buildAxOrderList(
view: View,
axOrderList: MutableList<*>,
result: Array<View?>,
) {
val nativeId = view.getTag(R.id.view_tag_native_id)
view.setTag(R.id.accessibility_order_parent, this)
if (axOrderList.contains(nativeId)) {
val idx = axOrderList.indexOf(nativeId)
if (idx != -1) {
result[idx] = view
}
}
if (view is ViewGroup) {
for (i in 0..<view.childCount) {
buildAxOrderList(view.getChildAt(i), axOrderList, result)
}
}
}
}
@@ -86,8 +86,7 @@ public class ReactScrollView extends ScrollView
HasStateWrapper,
HasFlingAnimator,
HasScrollEventThrottle,
HasSmoothScroll,
VirtualViewContainer {
HasSmoothScroll {
private static @Nullable Field sScrollerField;
private static boolean sTriedToGetScrollerField = false;
@@ -100,7 +99,6 @@ public class ReactScrollView extends ScrollView
private final Rect mTempRect = new Rect();
private final Rect mOverflowInset = new Rect();
private @Nullable VirtualViewContainerState mVirtualViewContainerState;
private boolean mActivelyScrolling;
private @Nullable Rect mClippingRect;
private Overflow mOverflow = Overflow.SCROLL;
@@ -152,15 +150,6 @@ public class ReactScrollView extends ScrollView
ViewCompat.setAccessibilityDelegate(this, new ReactScrollViewAccessibilityDelegate());
}
@Override
public VirtualViewContainerState getVirtualViewContainerState() {
if (mVirtualViewContainerState == null) {
mVirtualViewContainerState = new VirtualViewContainerState(this);
}
return mVirtualViewContainerState;
}
@Override
public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info) {
super.onInitializeAccessibilityNodeInfo(info);
@@ -1,136 +0,0 @@
/*
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
package com.facebook.react.views.scroll
import android.graphics.Rect
import android.view.ViewGroup
import com.facebook.common.logging.FLog
import com.facebook.react.common.build.ReactBuildConfig
import com.facebook.react.views.virtual.VirtualViewMode
import java.util.*
internal interface VirtualViewContainer {
public val virtualViewContainerState: VirtualViewContainerState
}
public interface VirtualView {
public val virtualViewID: String
public val containerRelativeRect: Rect
public fun onModeChange(newMode: VirtualViewMode, thresholdRect: Rect): Unit
}
/**
* Checks whether one Rect overlaps with another Rect.
*
* This is different from [Rect.intersects] because a Rect representing a line or a point is
* considered to overlap with another Rect if the line or point is within the rect bounds. However,
* two Rects are not considered to overlap if they only share a boundary.
*/
private fun rectsOverlap(rect1: Rect, rect2: Rect): Boolean {
if (rect1.top >= rect2.bottom || rect2.top >= rect1.bottom) {
// No overlap on the y-axis.
return false
}
if (rect1.left >= rect2.right || rect2.left >= rect1.right) {
// No overlap on the x-axis.
return false
}
return true
}
internal class VirtualViewContainerState(private val scrollView: ViewGroup) :
ReactScrollViewHelper.ScrollListener {
private val prerenderRatio: Int = 1
private val virtualViews: MutableSet<VirtualView> = mutableSetOf()
private val emptyRect: Rect = Rect()
private val visibleRect: Rect = Rect()
private val prerenderRect: Rect = Rect()
init {
ReactScrollViewHelper.addScrollListener(this)
}
public fun add(virtualView: VirtualView) {
assert(virtualViews.add(virtualView)) {
"Attempting to add duplicate VirtualView: ${virtualView.virtualViewID}"
}
updateModes(virtualView)
}
public fun remove(virtualView: VirtualView) {
assert(virtualViews.remove(virtualView)) {
"Attempting to remove non-existent VirtualView: ${virtualView.virtualViewID}"
}
}
// ReactScrollViewHelper.ScrollListener.onLayout
// Emitted from ScrollView's onLayout
override fun onLayout(scrollView: ViewGroup?) {
// ReactScrollViewHelper is global
if (this.scrollView == scrollView) {
debugLog("ReactScrollViewHelper.onLayout")
updateModes()
}
}
// ReactScrollViewHelper.ScrollListener.onScroll
// Emitted from ScrollView's onLayout
override fun onScroll(
scrollView: ViewGroup?,
scrollEventType: ScrollEventType?,
xVelocity: Float,
yVelocity: Float
) {
// ReactScrollViewHelper is global
if (this.scrollView == scrollView) {
debugLog("ReactScrollViewHelper.onScroll")
updateModes()
}
}
public fun update(virtualView: VirtualView) {
updateModes(virtualView)
}
private fun updateModes(virtualView: VirtualView? = null) {
scrollView.getDrawingRect(visibleRect)
prerenderRect.set(visibleRect)
prerenderRect.inset(
(-prerenderRect.width() * prerenderRatio).toInt(),
(-prerenderRect.height() * prerenderRatio).toInt())
val virtualViewsIt = if (virtualView != null) listOf(virtualView) else virtualViews
virtualViewsIt.forEach { vv ->
val rect = vv.containerRelativeRect
when {
rectsOverlap(rect, visibleRect) -> {
vv.onModeChange(VirtualViewMode.Visible, visibleRect)
}
rectsOverlap(rect, prerenderRect) -> {
vv.onModeChange(VirtualViewMode.Prerender, prerenderRect)
}
else -> {
vv.onModeChange(VirtualViewMode.Hidden, emptyRect)
}
}
}
}
}
private const val DEBUG_TAG: String = "VirtualViewContainerState"
private val IS_DEBUG_BUILD =
ReactBuildConfig.DEBUG || ReactBuildConfig.IS_INTERNAL_BUILD || ReactBuildConfig.ENABLE_PERFETTO
internal inline fun debugLog(subtag: String, block: () -> String = { "" }) {
if (IS_DEBUG_BUILD) {
FLog.d("$DEBUG_TAG:$subtag", block())
}
}
@@ -22,6 +22,7 @@ import android.view.MotionEvent
import android.view.View
import android.view.ViewGroup
import android.view.ViewStructure
import android.view.accessibility.AccessibilityManager
import com.facebook.common.logging.FLog
import com.facebook.react.R
import com.facebook.react.bridge.ReactNoCrashSoftException
@@ -49,6 +50,7 @@ import com.facebook.react.uimanager.PixelUtil.toDIPFromPixel
import com.facebook.react.uimanager.PointerEvents
import com.facebook.react.uimanager.PointerEvents.Companion.canBeTouchTarget
import com.facebook.react.uimanager.PointerEvents.Companion.canChildrenBeTouchTarget
import com.facebook.react.uimanager.ReactAxOrderHelper
import com.facebook.react.uimanager.ReactClippingProhibitedView
import com.facebook.react.uimanager.ReactClippingViewGroup
import com.facebook.react.uimanager.ReactClippingViewGroupHelper.calculateClippingRect
@@ -63,6 +65,7 @@ import com.facebook.react.uimanager.style.BorderStyle
import com.facebook.react.uimanager.style.LogicalEdge
import com.facebook.react.uimanager.style.Overflow
import com.facebook.react.views.view.CanvasUtil.enableZ
import java.util.ArrayList
import kotlin.concurrent.Volatile
import kotlin.math.max
@@ -139,12 +142,17 @@ public open class ReactViewGroup public constructor(context: Context?) :
public override var hitSlopRect: Rect? = null
public override var pointerEvents: PointerEvents = PointerEvents.AUTO
public var axOrderList: MutableList<String>? = null
private var childrenLayoutChangeListener: ChildrenLayoutChangeListener? = null
private var onInterceptTouchEventListener: OnInterceptTouchEventListener? = null
private var needsOffscreenAlphaCompositing = false
private var backfaceOpacity = 0f
private var backfaceVisible = false
private var childrenRemovedWhileTransitioning: MutableSet<Int>? = null
private var accessibilityStateChangeListener:
AccessibilityManager.AccessibilityStateChangeListener? =
null
init {
initView()
@@ -931,6 +939,70 @@ public open class ReactViewGroup public constructor(context: Context?) :
alpha = 0f
}
override fun addChildrenForAccessibility(outChildren: ArrayList<View>) {
val axOrderParentOrderList =
(getTag(R.id.accessibility_order_parent) as ReactViewGroup?)?.axOrderList
val axOrder: MutableList<*>? = axOrderList
if (axOrder != null) {
val am: AccessibilityManager? =
this.getContext().getSystemService(Context.ACCESSIBILITY_SERVICE) as AccessibilityManager?
if (accessibilityStateChangeListener == null && am != null) {
val newAccessibilityStateChangeListener =
AccessibilityManager.AccessibilityStateChangeListener { enabled ->
if (!enabled) {
ReactAxOrderHelper.restoreFocusability(this)
}
}
am.addAccessibilityStateChangeListener(newAccessibilityStateChangeListener)
accessibilityStateChangeListener = newAccessibilityStateChangeListener
}
val result = arrayOfNulls<View?>(axOrder.size)
for (i in 0..<childCount) {
ReactAxOrderHelper.buildAxOrderList(getChildAt(i), axOrder, result)
}
for (i in result.indices) {
val view = result[i]
if (view != null) {
if (view.isFocusable) {
outChildren.add(view)
} else {
view.addChildrenForAccessibility(outChildren)
}
}
}
} else if (axOrderParentOrderList != null) {
// view is a container so add its children normally
if (!isFocusable) {
super.addChildrenForAccessibility(outChildren)
return
// If this view can coopt, turn the focusability off its children but add them to the tree
} else if (isFocusable && (contentDescription == null || contentDescription == "")) {
super.addChildrenForAccessibility(outChildren)
ReactAxOrderHelper.disableFocusForSubtree(this, axOrderParentOrderList)
// if this view is focusable and has a contentDescription then we don't care about its
// descendants for accessibility
} else if (isFocusable && !(contentDescription == null || contentDescription == "")) {
return
}
} else {
super.addChildrenForAccessibility(outChildren)
}
}
public fun cleanUpAxOrderListener() {
val am = this.context.getSystemService(Context.ACCESSIBILITY_SERVICE) as? AccessibilityManager
if (am != null) {
accessibilityStateChangeListener?.let { am.removeAccessibilityStateChangeListener(it) }
}
accessibilityStateChangeListener = null
}
private companion object {
private const val ARRAY_CAPACITY_INCREMENT = 12
private val defaultLayoutParam = LayoutParams(0, 0)
@@ -25,6 +25,7 @@ import com.facebook.react.uimanager.LengthPercentage
import com.facebook.react.uimanager.LengthPercentageType
import com.facebook.react.uimanager.PixelUtil.dpToPx
import com.facebook.react.uimanager.PointerEvents
import com.facebook.react.uimanager.ReactAxOrderHelper
import com.facebook.react.uimanager.Spacing
import com.facebook.react.uimanager.ThemedReactContext
import com.facebook.react.uimanager.UIManagerHelper
@@ -83,11 +84,41 @@ public open class ReactViewManager : ReactClippingViewManager<ReactViewGroup>()
return preparedView
}
override fun onDropViewInstance(view: ReactViewGroup) {
super.onDropViewInstance(view)
view.cleanUpAxOrderListener()
}
@ReactProp(name = "accessible")
public open fun setAccessible(view: ReactViewGroup, accessible: Boolean) {
view.isFocusable = accessible
}
@ReactProp(name = ViewProps.ACCESSIBILITY_ORDER)
public open fun setAccessibilityOrder(view: ReactViewGroup, nativeIds: ReadableArray?) {
if (!ReactNativeFeatureFlags.enableAccessibilityOrder()) {
return
}
ReactAxOrderHelper.cleanUpAxOrder(view)
if (nativeIds == null) {
view.axOrderList = null
return
}
val axOrderList = mutableListOf<String>()
for (i in 0 until nativeIds.size()) {
val id = nativeIds.getString(i)
if (id != null) {
axOrderList.add(id)
}
}
view.axOrderList = axOrderList
}
@ReactProp(name = "hasTVPreferredFocus")
public open fun setTVPreferredFocus(view: ReactViewGroup, hasTVPreferredFocus: Boolean) {
if (hasTVPreferredFocus) {
@@ -7,7 +7,7 @@
package com.facebook.react.views.virtual
public enum class VirtualViewMode(public val value: Int) {
internal enum class VirtualViewMode(val value: Int) {
Visible(0),
Prerender(1),
Hidden(2),
@@ -1,19 +0,0 @@
/*
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
package com.facebook.react.views.virtual
import android.graphics.Rect
internal fun interface VirtualViewModeChangeEmitter {
public fun emitModeChange(
mode: VirtualViewMode,
targetRect: Rect,
thresholdRect: Rect,
synchronous: Boolean,
)
}
@@ -25,11 +25,10 @@ import com.facebook.react.views.scroll.ReactScrollViewHelper
import com.facebook.react.views.scroll.ScrollEventType
import com.facebook.react.views.view.ReactViewGroup
import com.facebook.react.views.virtual.VirtualViewMode
import com.facebook.react.views.virtual.VirtualViewModeChangeEmitter
import com.facebook.react.views.virtual.VirtualViewRenderState
import com.facebook.systrace.Systrace
public class ReactVirtualView(context: Context) :
internal class ReactVirtualView(context: Context) :
ReactViewGroup(context),
ReactScrollViewHelper.ScrollListener,
ReactScrollViewHelper.LayoutChangeListener,
@@ -37,7 +36,7 @@ public class ReactVirtualView(context: Context) :
internal var mode: VirtualViewMode? = null
internal var renderState: VirtualViewRenderState = VirtualViewRenderState.Unknown
internal var modeChangeEmitter: VirtualViewModeChangeEmitter? = null
internal var modeChangeEmitter: ModeChangeEmitter? = null
internal var prerenderRatio: Double = ReactNativeFeatureFlags.virtualViewPrerenderRatio()
internal val debugLogEnabled: Boolean = ReactNativeFeatureFlags.enableVirtualViewDebugFeatures()
internal val detectWindowFocus = ReactNativeFeatureFlags.enableVirtualViewWindowFocusDetection()
@@ -370,6 +369,15 @@ public class ReactVirtualView(context: Context) :
}
}
internal fun interface ModeChangeEmitter {
fun emitModeChange(
mode: VirtualViewMode,
targetRect: Rect,
thresholdRect: Rect,
synchronous: Boolean,
)
}
private const val DEBUG_TAG: String = "ReactVirtualView"
private val IS_DEBUG_BUILD =
@@ -20,12 +20,11 @@ import com.facebook.react.uimanager.events.EventDispatcher
import com.facebook.react.viewmanagers.VirtualViewManagerDelegate
import com.facebook.react.viewmanagers.VirtualViewManagerInterface
import com.facebook.react.views.virtual.VirtualViewMode
import com.facebook.react.views.virtual.VirtualViewModeChangeEmitter
import com.facebook.react.views.virtual.VirtualViewModeChangeEvent
import com.facebook.react.views.virtual.VirtualViewRenderState
@ReactModule(name = ReactVirtualViewManager.REACT_CLASS)
public class ReactVirtualViewManager :
internal class ReactVirtualViewManager :
ViewGroupManager<ReactVirtualView>(), VirtualViewManagerInterface<ReactVirtualView> {
private val _delegate = VirtualViewManagerDelegate(this)
@@ -82,11 +81,11 @@ public class ReactVirtualViewManager :
}
@VisibleForTesting
public class VirtualViewEventEmitter(
internal class VirtualViewEventEmitter(
private val viewId: Int,
private val surfaceId: Int,
private val dispatcher: EventDispatcher
) : VirtualViewModeChangeEmitter {
) : ModeChangeEmitter {
override fun emitModeChange(
mode: VirtualViewMode,
targetRect: Rect,
@@ -1,200 +0,0 @@
/*
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
package com.facebook.react.views.virtual.viewexperimental
import android.content.Context
import android.graphics.Rect
import android.view.View
import android.view.ViewParent
import androidx.annotation.VisibleForTesting
import com.facebook.common.logging.FLog
import com.facebook.react.R
import com.facebook.react.common.build.ReactBuildConfig
import com.facebook.react.uimanager.ReactRoot
import com.facebook.react.views.scroll.VirtualView
import com.facebook.react.views.scroll.VirtualViewContainer
import com.facebook.react.views.view.ReactViewGroup
import com.facebook.react.views.virtual.VirtualViewMode
import com.facebook.react.views.virtual.VirtualViewModeChangeEmitter
import com.facebook.react.views.virtual.VirtualViewRenderState
public class ReactVirtualViewExperimental(context: Context) :
ReactViewGroup(context), VirtualView, View.OnLayoutChangeListener {
internal var mode: VirtualViewMode? = null
internal var modeChangeEmitter: VirtualViewModeChangeEmitter? = null
internal var renderState: VirtualViewRenderState = VirtualViewRenderState.Unknown
private var scrollView: VirtualViewContainer? = null
override val containerRelativeRect: Rect = Rect()
private var offsetX: Int = 0
private var offsetY: Int = 0
internal val nativeId: String?
get() = getTag(R.id.view_tag_native_id) as? String
override fun onAttachedToWindow() {
super.onAttachedToWindow()
doAttachedToWindow()
}
@VisibleForTesting
internal fun doAttachedToWindow() {
// Assuming that layout has been called before this
scrollView = getScrollView()?.also { scrollView?.virtualViewContainerState?.add(this) }
}
/** From [View#onLayout] */
// This is when the view itself has layout changes
override fun onLayout(changed: Boolean, left: Int, top: Int, right: Int, bottom: Int) {
super.onLayout(changed, left, top, right, bottom)
if (changed) {
containerRelativeRect.set(
left + offsetX,
top + offsetY,
right + offsetX,
bottom + offsetY,
)
updateContainer()
}
}
// Here we're subscribing to all parent views up to scrollView and when their layout changes
override fun onLayoutChange(
v: View?,
left: Int,
top: Int,
right: Int,
bottom: Int,
oldLeft: Int,
oldTop: Int,
oldRight: Int,
oldBottom: Int
) {
if (oldLeft != left || oldTop != top) {
val virtualViewScrollView = scrollView ?: return
offsetX = 0
offsetY = 0
var parent: ViewParent? = parent
while (parent != null && parent != virtualViewScrollView) {
if (parent is View) {
offsetX += parent.left
offsetY += parent.top
}
parent = parent.parent
}
containerRelativeRect.set(
left + offsetX,
top + offsetY,
right + offsetX,
bottom + offsetY,
)
updateContainer()
}
}
override fun onDetachedFromWindow() {
super.onDetachedFromWindow()
recycleView()
}
override internal fun recycleView() {
cleanupLayoutListeners()
scrollView?.virtualViewContainerState?.remove(this)
scrollView = null
mode = null
modeChangeEmitter = null
}
override val virtualViewID: String
get() {
return "${nativeId ?: "unknown"}:${id}"
}
override fun onModeChange(newMode: VirtualViewMode, thresholdRect: Rect) {
if (newMode == mode) {
return
}
val oldMode = mode
mode = newMode
debugLog("onModeChange") { "$oldMode->$newMode" }
when (newMode) {
VirtualViewMode.Visible -> {
if (renderState == VirtualViewRenderState.Unknown) {
// Feature flag is disabled, so use the former logic.
modeChangeEmitter?.emitModeChange(
VirtualViewMode.Visible, containerRelativeRect, thresholdRect, synchronous = true)
} else {
// If the previous mode was prerender and the result of dispatching that event was
// committed, we do not need to dispatch an event for visible.
val wasPrerenderCommitted =
oldMode == VirtualViewMode.Prerender && renderState == VirtualViewRenderState.Rendered
if (!wasPrerenderCommitted) {
modeChangeEmitter?.emitModeChange(
VirtualViewMode.Visible, containerRelativeRect, thresholdRect, synchronous = true)
}
}
}
VirtualViewMode.Prerender -> {
if (oldMode != VirtualViewMode.Visible) {
modeChangeEmitter?.emitModeChange(
VirtualViewMode.Prerender, containerRelativeRect, thresholdRect, synchronous = false)
}
}
VirtualViewMode.Hidden -> {
modeChangeEmitter?.emitModeChange(
VirtualViewMode.Hidden, containerRelativeRect, thresholdRect, synchronous = false)
}
}
}
private fun updateContainer() {
scrollView?.virtualViewContainerState?.update(this)
}
private fun getScrollView(): VirtualViewContainer? = traverseParentStack(true)
private fun cleanupLayoutListeners() {
traverseParentStack(false)
}
private fun traverseParentStack(addListeners: Boolean): VirtualViewContainer? {
var parent: ViewParent? = parent
while (parent != null) {
if (parent is VirtualViewContainer) {
return parent
}
if (parent is ReactRoot) {
// don't look past the root - it could traverse into a separate hierarchy
return null
}
if (parent is View) {
// always remove, to ensure listeners aren't added more than once
parent.removeOnLayoutChangeListener(this)
if (addListeners) {
parent.addOnLayoutChangeListener(this)
}
}
parent = parent.parent
}
return null
}
internal inline fun debugLog(subtag: String, block: () -> String = { "" }) {
if (IS_DEBUG_BUILD) {
FLog.d("$DEBUG_TAG:$subtag", "${block()} [$id][$nativeId]")
}
}
}
private const val DEBUG_TAG: String = "ReactVirtualViewExperimental"
private val IS_DEBUG_BUILD =
ReactBuildConfig.DEBUG || ReactBuildConfig.IS_INTERNAL_BUILD || ReactBuildConfig.ENABLE_PERFETTO
@@ -1,109 +0,0 @@
/*
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
package com.facebook.react.views.virtual.viewexperimental
import android.graphics.Rect
import androidx.annotation.VisibleForTesting
import com.facebook.react.internal.featureflags.ReactNativeFeatureFlags
import com.facebook.react.module.annotations.ReactModule
import com.facebook.react.uimanager.ThemedReactContext
import com.facebook.react.uimanager.UIManagerHelper
import com.facebook.react.uimanager.ViewGroupManager
import com.facebook.react.uimanager.ViewManagerDelegate
import com.facebook.react.uimanager.annotations.ReactProp
import com.facebook.react.uimanager.events.EventDispatcher
import com.facebook.react.viewmanagers.VirtualViewExperimentalManagerDelegate
import com.facebook.react.viewmanagers.VirtualViewExperimentalManagerInterface
import com.facebook.react.views.virtual.VirtualViewMode
import com.facebook.react.views.virtual.VirtualViewModeChangeEmitter
import com.facebook.react.views.virtual.VirtualViewModeChangeEvent
import com.facebook.react.views.virtual.VirtualViewRenderState
@ReactModule(name = ReactVirtualViewExperimentalManager.REACT_CLASS)
public class ReactVirtualViewExperimentalManager :
ViewGroupManager<ReactVirtualViewExperimental>(),
VirtualViewExperimentalManagerInterface<ReactVirtualViewExperimental> {
private val _delegate = VirtualViewExperimentalManagerDelegate(this)
override fun getDelegate(): ViewManagerDelegate<ReactVirtualViewExperimental> = _delegate
override fun getName(): String = REACT_CLASS
override fun createViewInstance(reactContext: ThemedReactContext): ReactVirtualViewExperimental =
ReactVirtualViewExperimental(reactContext)
@ReactProp(name = "initialHidden")
override fun setInitialHidden(view: ReactVirtualViewExperimental, value: Boolean) {
if (view.mode == null) {
view.mode = if (value) VirtualViewMode.Hidden else VirtualViewMode.Visible
}
}
@ReactProp(name = "renderState")
override fun setRenderState(view: ReactVirtualViewExperimental, value: Int) {
// If disabled, `renderState` will always be `VirtualViewRenderState.Unknown`.
if (ReactNativeFeatureFlags.enableVirtualViewRenderState()) {
view.renderState =
when (value) {
1 -> VirtualViewRenderState.Rendered
2 -> VirtualViewRenderState.None
else -> VirtualViewRenderState.Unknown
}
}
}
override fun setNativeId(view: ReactVirtualViewExperimental, nativeId: String?) {
super.setNativeId(view, nativeId)
}
override fun addEventEmitters(
reactContext: ThemedReactContext,
view: ReactVirtualViewExperimental
) {
val dispatcher = UIManagerHelper.getEventDispatcherForReactTag(reactContext, view.id) ?: return
view.modeChangeEmitter =
VirtualViewEventEmitter(view.id, UIManagerHelper.getSurfaceId(reactContext), dispatcher)
}
override fun prepareToRecycleView(
reactContext: ThemedReactContext,
view: ReactVirtualViewExperimental,
): ReactVirtualViewExperimental? {
view.recycleView()
return super.prepareToRecycleView(reactContext, view)
}
public companion object {
public const val REACT_CLASS: String = "VirtualViewExperimental"
}
}
@VisibleForTesting
public class VirtualViewEventEmitter(
private val viewId: Int,
private val surfaceId: Int,
private val dispatcher: EventDispatcher
) : VirtualViewModeChangeEmitter {
override fun emitModeChange(
mode: VirtualViewMode,
targetRect: Rect,
thresholdRect: Rect,
synchronous: Boolean,
) {
dispatcher.dispatchEvent(
VirtualViewModeChangeEvent(
surfaceId,
viewId,
mode,
targetRect,
thresholdRect,
synchronous,
))
}
}
@@ -25,7 +25,6 @@
#include <react/renderer/components/view/LayoutConformanceComponentDescriptor.h>
#include <react/renderer/components/view/ViewComponentDescriptor.h>
#include <react/renderer/components/virtualview/VirtualViewComponentDescriptor.h>
#include <react/renderer/components/virtualviewexperimental/VirtualViewExperimentalComponentDescriptor.h>
namespace facebook::react::CoreComponentsRegistry {
@@ -73,8 +72,6 @@ sharedProviderRegistry() {
LayoutConformanceComponentDescriptor>());
providerRegistry->add(
concreteComponentDescriptorProvider<VirtualViewComponentDescriptor>());
providerRegistry->add(concreteComponentDescriptorProvider<
VirtualViewExperimentalComponentDescriptor>());
return providerRegistry;
}();
@@ -4,7 +4,7 @@
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @generated SignedSource<<d2e4ec09356f6857d789cfcc44a83552>>
* @generated SignedSource<<5effd7d4ac8034424144ea68c82b61a7>>
*/
/**
@@ -45,6 +45,12 @@ class ReactNativeFeatureFlagsJavaProvider
return method(javaProvider_);
}
bool animatedShouldSignalBatch() override {
static const auto method =
getReactNativeFeatureFlagsProviderJavaClass()->getMethod<jboolean()>("animatedShouldSignalBatch");
return method(javaProvider_);
}
bool cxxNativeAnimatedEnabled() override {
static const auto method =
getReactNativeFeatureFlagsProviderJavaClass()->getMethod<jboolean()>("cxxNativeAnimatedEnabled");
@@ -390,6 +396,11 @@ bool JReactNativeFeatureFlagsCxxInterop::commonTestFlag(
return ReactNativeFeatureFlags::commonTestFlag();
}
bool JReactNativeFeatureFlagsCxxInterop::animatedShouldSignalBatch(
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop> /*unused*/) {
return ReactNativeFeatureFlags::animatedShouldSignalBatch();
}
bool JReactNativeFeatureFlagsCxxInterop::cxxNativeAnimatedEnabled(
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop> /*unused*/) {
return ReactNativeFeatureFlags::cxxNativeAnimatedEnabled();
@@ -704,6 +715,9 @@ void JReactNativeFeatureFlagsCxxInterop::registerNatives() {
makeNativeMethod(
"commonTestFlag",
JReactNativeFeatureFlagsCxxInterop::commonTestFlag),
makeNativeMethod(
"animatedShouldSignalBatch",
JReactNativeFeatureFlagsCxxInterop::animatedShouldSignalBatch),
makeNativeMethod(
"cxxNativeAnimatedEnabled",
JReactNativeFeatureFlagsCxxInterop::cxxNativeAnimatedEnabled),
@@ -4,7 +4,7 @@
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @generated SignedSource<<a8d656adc624995ca1e6720829889cb8>>
* @generated SignedSource<<f7bf09b9287dc649901b99ca3f250c28>>
*/
/**
@@ -33,6 +33,9 @@ class JReactNativeFeatureFlagsCxxInterop
static bool commonTestFlag(
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop>);
static bool animatedShouldSignalBatch(
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop>);
static bool cxxNativeAnimatedEnabled(
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop>);
@@ -12,10 +12,7 @@
<!-- tag is used to store whether the view is coopted by an accessibilityOrder-->
<item type="id" name="accessibility_order_parent"/>
<!-- tag is used to store the current state of the accessibility order tree-->
<item type="id" name="accessibility_order_dirty"/>
<!-- tag is used to store the original focusability value of a view within the accessibility order tree if it was changed-->
<!-- tag is used to store the original focusability value of a view -->
<item type="id" name="original_focusability"/>
<!-- tag is used to store the nativeID tag -->
@@ -144,12 +144,6 @@ Pod::Spec.new do |s|
sss.header_dir = "react/renderer/components/virtualview"
end
ss.subspec "virtualviewexperimental" do |sss|
sss.source_files = "react/renderer/components/virtualviewexperimental/**/*.{m,mm,cpp,h}"
sss.exclude_files = "react/renderer/components/virtualviewexperimental/tests"
sss.header_dir = "react/renderer/components/virtualviewexperimental"
end
# Legacy header paths for backwards compat
ss.subspec "rncore" do |sss|
sss.source_files = podspec_sources("react/renderer/components/rncore/**/*.h", "react/renderer/components/rncore/**/*.h")
@@ -21,8 +21,6 @@ namespace facebook::react::jsinspector_modern::tracing {
using ConsoleTimeStampEntry = std::variant<HighResTimeStamp, std::string>;
// https://developer.chrome.com/docs/devtools/performance/extension#devtools_object
// Although warning is not listed in Chrome DevTools announcement, it is
// actually supported.
enum class ConsoleTimeStampColor {
Primary,
PrimaryLight,
@@ -33,7 +31,6 @@ enum class ConsoleTimeStampColor {
Tertiary,
TertiaryLight,
TertiaryDark,
Warning,
Error,
};
@@ -57,8 +54,6 @@ inline std::string consoleTimeStampColorToString(ConsoleTimeStampColor color) {
return "tertiary-light";
case ConsoleTimeStampColor::TertiaryDark:
return "tertiary-dark";
case ConsoleTimeStampColor::Warning:
return "warning";
case ConsoleTimeStampColor::Error:
return "error";
default:
@@ -86,8 +81,6 @@ inline std::optional<ConsoleTimeStampColor> getConsoleTimeStampColorFromString(
return ConsoleTimeStampColor::TertiaryLight;
} else if (str == "tertiary-dark") {
return ConsoleTimeStampColor::TertiaryDark;
} else if (str == "warning") {
return ConsoleTimeStampColor::Warning;
} else if (str == "error") {
return ConsoleTimeStampColor::Error;
} else {
@@ -4,7 +4,7 @@
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @generated SignedSource<<1f167a2a71f07b355dc8578cb114cc6f>>
* @generated SignedSource<<20c25bf5541e37cd5c918684925726df>>
*/
/**
@@ -30,6 +30,10 @@ bool ReactNativeFeatureFlags::commonTestFlag() {
return getAccessor().commonTestFlag();
}
bool ReactNativeFeatureFlags::animatedShouldSignalBatch() {
return getAccessor().animatedShouldSignalBatch();
}
bool ReactNativeFeatureFlags::cxxNativeAnimatedEnabled() {
return getAccessor().cxxNativeAnimatedEnabled();
}
@@ -4,7 +4,7 @@
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @generated SignedSource<<eb769df330eff243aa913b79807396e7>>
* @generated SignedSource<<20809734183aa7bfd7aad9b8d01ea080>>
*/
/**
@@ -44,6 +44,11 @@ class ReactNativeFeatureFlags {
*/
RN_EXPORT static bool commonTestFlag();
/**
* Enables start- and finishOperationBatch on any platform.
*/
RN_EXPORT static bool animatedShouldSignalBatch();
/**
* Use a C++ implementation of Native Animated instead of the platform implementation.
*/
@@ -4,7 +4,7 @@
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @generated SignedSource<<cc56ff1d73ed66d0608c1bd5b6150810>>
* @generated SignedSource<<59ec29e038344c52eaa10845efc5240b>>
*/
/**
@@ -47,6 +47,24 @@ bool ReactNativeFeatureFlagsAccessor::commonTestFlag() {
return flagValue.value();
}
bool ReactNativeFeatureFlagsAccessor::animatedShouldSignalBatch() {
auto flagValue = animatedShouldSignalBatch_.load();
if (!flagValue.has_value()) {
// This block is not exclusive but it is not necessary.
// If multiple threads try to initialize the feature flag, we would only
// be accessing the provider multiple times but the end state of this
// instance and the returned flag value would be the same.
markFlagAsAccessed(1, "animatedShouldSignalBatch");
flagValue = currentProvider_->animatedShouldSignalBatch();
animatedShouldSignalBatch_ = flagValue;
}
return flagValue.value();
}
bool ReactNativeFeatureFlagsAccessor::cxxNativeAnimatedEnabled() {
auto flagValue = cxxNativeAnimatedEnabled_.load();
@@ -56,7 +74,7 @@ bool ReactNativeFeatureFlagsAccessor::cxxNativeAnimatedEnabled() {
// be accessing the provider multiple times but the end state of this
// instance and the returned flag value would be the same.
markFlagAsAccessed(1, "cxxNativeAnimatedEnabled");
markFlagAsAccessed(2, "cxxNativeAnimatedEnabled");
flagValue = currentProvider_->cxxNativeAnimatedEnabled();
cxxNativeAnimatedEnabled_ = flagValue;
@@ -74,7 +92,7 @@ bool ReactNativeFeatureFlagsAccessor::cxxNativeAnimatedRemoveJsSync() {
// be accessing the provider multiple times but the end state of this
// instance and the returned flag value would be the same.
markFlagAsAccessed(2, "cxxNativeAnimatedRemoveJsSync");
markFlagAsAccessed(3, "cxxNativeAnimatedRemoveJsSync");
flagValue = currentProvider_->cxxNativeAnimatedRemoveJsSync();
cxxNativeAnimatedRemoveJsSync_ = flagValue;
@@ -92,7 +110,7 @@ bool ReactNativeFeatureFlagsAccessor::disableMainQueueSyncDispatchIOS() {
// be accessing the provider multiple times but the end state of this
// instance and the returned flag value would be the same.
markFlagAsAccessed(3, "disableMainQueueSyncDispatchIOS");
markFlagAsAccessed(4, "disableMainQueueSyncDispatchIOS");
flagValue = currentProvider_->disableMainQueueSyncDispatchIOS();
disableMainQueueSyncDispatchIOS_ = flagValue;
@@ -110,7 +128,7 @@ bool ReactNativeFeatureFlagsAccessor::disableMountItemReorderingAndroid() {
// be accessing the provider multiple times but the end state of this
// instance and the returned flag value would be the same.
markFlagAsAccessed(4, "disableMountItemReorderingAndroid");
markFlagAsAccessed(5, "disableMountItemReorderingAndroid");
flagValue = currentProvider_->disableMountItemReorderingAndroid();
disableMountItemReorderingAndroid_ = flagValue;
@@ -128,7 +146,7 @@ bool ReactNativeFeatureFlagsAccessor::disableTextLayoutManagerCacheAndroid() {
// be accessing the provider multiple times but the end state of this
// instance and the returned flag value would be the same.
markFlagAsAccessed(5, "disableTextLayoutManagerCacheAndroid");
markFlagAsAccessed(6, "disableTextLayoutManagerCacheAndroid");
flagValue = currentProvider_->disableTextLayoutManagerCacheAndroid();
disableTextLayoutManagerCacheAndroid_ = flagValue;
@@ -146,7 +164,7 @@ bool ReactNativeFeatureFlagsAccessor::enableAccessibilityOrder() {
// be accessing the provider multiple times but the end state of this
// instance and the returned flag value would be the same.
markFlagAsAccessed(6, "enableAccessibilityOrder");
markFlagAsAccessed(7, "enableAccessibilityOrder");
flagValue = currentProvider_->enableAccessibilityOrder();
enableAccessibilityOrder_ = flagValue;
@@ -164,7 +182,7 @@ bool ReactNativeFeatureFlagsAccessor::enableAccumulatedUpdatesInRawPropsAndroid(
// be accessing the provider multiple times but the end state of this
// instance and the returned flag value would be the same.
markFlagAsAccessed(7, "enableAccumulatedUpdatesInRawPropsAndroid");
markFlagAsAccessed(8, "enableAccumulatedUpdatesInRawPropsAndroid");
flagValue = currentProvider_->enableAccumulatedUpdatesInRawPropsAndroid();
enableAccumulatedUpdatesInRawPropsAndroid_ = flagValue;
@@ -182,7 +200,7 @@ bool ReactNativeFeatureFlagsAccessor::enableAndroidTextMeasurementOptimizations(
// be accessing the provider multiple times but the end state of this
// instance and the returned flag value would be the same.
markFlagAsAccessed(8, "enableAndroidTextMeasurementOptimizations");
markFlagAsAccessed(9, "enableAndroidTextMeasurementOptimizations");
flagValue = currentProvider_->enableAndroidTextMeasurementOptimizations();
enableAndroidTextMeasurementOptimizations_ = flagValue;
@@ -200,7 +218,7 @@ bool ReactNativeFeatureFlagsAccessor::enableBridgelessArchitecture() {
// be accessing the provider multiple times but the end state of this
// instance and the returned flag value would be the same.
markFlagAsAccessed(9, "enableBridgelessArchitecture");
markFlagAsAccessed(10, "enableBridgelessArchitecture");
flagValue = currentProvider_->enableBridgelessArchitecture();
enableBridgelessArchitecture_ = flagValue;
@@ -218,7 +236,7 @@ bool ReactNativeFeatureFlagsAccessor::enableCppPropsIteratorSetter() {
// be accessing the provider multiple times but the end state of this
// instance and the returned flag value would be the same.
markFlagAsAccessed(10, "enableCppPropsIteratorSetter");
markFlagAsAccessed(11, "enableCppPropsIteratorSetter");
flagValue = currentProvider_->enableCppPropsIteratorSetter();
enableCppPropsIteratorSetter_ = flagValue;
@@ -236,7 +254,7 @@ bool ReactNativeFeatureFlagsAccessor::enableCustomFocusSearchOnClippedElementsAn
// be accessing the provider multiple times but the end state of this
// instance and the returned flag value would be the same.
markFlagAsAccessed(11, "enableCustomFocusSearchOnClippedElementsAndroid");
markFlagAsAccessed(12, "enableCustomFocusSearchOnClippedElementsAndroid");
flagValue = currentProvider_->enableCustomFocusSearchOnClippedElementsAndroid();
enableCustomFocusSearchOnClippedElementsAndroid_ = flagValue;
@@ -254,7 +272,7 @@ bool ReactNativeFeatureFlagsAccessor::enableDestroyShadowTreeRevisionAsync() {
// be accessing the provider multiple times but the end state of this
// instance and the returned flag value would be the same.
markFlagAsAccessed(12, "enableDestroyShadowTreeRevisionAsync");
markFlagAsAccessed(13, "enableDestroyShadowTreeRevisionAsync");
flagValue = currentProvider_->enableDestroyShadowTreeRevisionAsync();
enableDestroyShadowTreeRevisionAsync_ = flagValue;
@@ -272,7 +290,7 @@ bool ReactNativeFeatureFlagsAccessor::enableDoubleMeasurementFixAndroid() {
// be accessing the provider multiple times but the end state of this
// instance and the returned flag value would be the same.
markFlagAsAccessed(13, "enableDoubleMeasurementFixAndroid");
markFlagAsAccessed(14, "enableDoubleMeasurementFixAndroid");
flagValue = currentProvider_->enableDoubleMeasurementFixAndroid();
enableDoubleMeasurementFixAndroid_ = flagValue;
@@ -290,7 +308,7 @@ bool ReactNativeFeatureFlagsAccessor::enableEagerRootViewAttachment() {
// be accessing the provider multiple times but the end state of this
// instance and the returned flag value would be the same.
markFlagAsAccessed(14, "enableEagerRootViewAttachment");
markFlagAsAccessed(15, "enableEagerRootViewAttachment");
flagValue = currentProvider_->enableEagerRootViewAttachment();
enableEagerRootViewAttachment_ = flagValue;
@@ -308,7 +326,7 @@ bool ReactNativeFeatureFlagsAccessor::enableFabricLogs() {
// be accessing the provider multiple times but the end state of this
// instance and the returned flag value would be the same.
markFlagAsAccessed(15, "enableFabricLogs");
markFlagAsAccessed(16, "enableFabricLogs");
flagValue = currentProvider_->enableFabricLogs();
enableFabricLogs_ = flagValue;
@@ -326,7 +344,7 @@ bool ReactNativeFeatureFlagsAccessor::enableFabricRenderer() {
// be accessing the provider multiple times but the end state of this
// instance and the returned flag value would be the same.
markFlagAsAccessed(16, "enableFabricRenderer");
markFlagAsAccessed(17, "enableFabricRenderer");
flagValue = currentProvider_->enableFabricRenderer();
enableFabricRenderer_ = flagValue;
@@ -344,7 +362,7 @@ bool ReactNativeFeatureFlagsAccessor::enableFixForParentTagDuringReparenting() {
// be accessing the provider multiple times but the end state of this
// instance and the returned flag value would be the same.
markFlagAsAccessed(17, "enableFixForParentTagDuringReparenting");
markFlagAsAccessed(18, "enableFixForParentTagDuringReparenting");
flagValue = currentProvider_->enableFixForParentTagDuringReparenting();
enableFixForParentTagDuringReparenting_ = flagValue;
@@ -362,7 +380,7 @@ bool ReactNativeFeatureFlagsAccessor::enableFontScaleChangesUpdatingLayout() {
// be accessing the provider multiple times but the end state of this
// instance and the returned flag value would be the same.
markFlagAsAccessed(18, "enableFontScaleChangesUpdatingLayout");
markFlagAsAccessed(19, "enableFontScaleChangesUpdatingLayout");
flagValue = currentProvider_->enableFontScaleChangesUpdatingLayout();
enableFontScaleChangesUpdatingLayout_ = flagValue;
@@ -380,7 +398,7 @@ bool ReactNativeFeatureFlagsAccessor::enableIOSTextBaselineOffsetPerLine() {
// be accessing the provider multiple times but the end state of this
// instance and the returned flag value would be the same.
markFlagAsAccessed(19, "enableIOSTextBaselineOffsetPerLine");
markFlagAsAccessed(20, "enableIOSTextBaselineOffsetPerLine");
flagValue = currentProvider_->enableIOSTextBaselineOffsetPerLine();
enableIOSTextBaselineOffsetPerLine_ = flagValue;
@@ -398,7 +416,7 @@ bool ReactNativeFeatureFlagsAccessor::enableIOSViewClipToPaddingBox() {
// be accessing the provider multiple times but the end state of this
// instance and the returned flag value would be the same.
markFlagAsAccessed(20, "enableIOSViewClipToPaddingBox");
markFlagAsAccessed(21, "enableIOSViewClipToPaddingBox");
flagValue = currentProvider_->enableIOSViewClipToPaddingBox();
enableIOSViewClipToPaddingBox_ = flagValue;
@@ -416,7 +434,7 @@ bool ReactNativeFeatureFlagsAccessor::enableInteropViewManagerClassLookUpOptimiz
// be accessing the provider multiple times but the end state of this
// instance and the returned flag value would be the same.
markFlagAsAccessed(21, "enableInteropViewManagerClassLookUpOptimizationIOS");
markFlagAsAccessed(22, "enableInteropViewManagerClassLookUpOptimizationIOS");
flagValue = currentProvider_->enableInteropViewManagerClassLookUpOptimizationIOS();
enableInteropViewManagerClassLookUpOptimizationIOS_ = flagValue;
@@ -434,7 +452,7 @@ bool ReactNativeFeatureFlagsAccessor::enableLayoutAnimationsOnAndroid() {
// be accessing the provider multiple times but the end state of this
// instance and the returned flag value would be the same.
markFlagAsAccessed(22, "enableLayoutAnimationsOnAndroid");
markFlagAsAccessed(23, "enableLayoutAnimationsOnAndroid");
flagValue = currentProvider_->enableLayoutAnimationsOnAndroid();
enableLayoutAnimationsOnAndroid_ = flagValue;
@@ -452,7 +470,7 @@ bool ReactNativeFeatureFlagsAccessor::enableLayoutAnimationsOnIOS() {
// be accessing the provider multiple times but the end state of this
// instance and the returned flag value would be the same.
markFlagAsAccessed(23, "enableLayoutAnimationsOnIOS");
markFlagAsAccessed(24, "enableLayoutAnimationsOnIOS");
flagValue = currentProvider_->enableLayoutAnimationsOnIOS();
enableLayoutAnimationsOnIOS_ = flagValue;
@@ -470,7 +488,7 @@ bool ReactNativeFeatureFlagsAccessor::enableMainQueueCoordinatorOnIOS() {
// be accessing the provider multiple times but the end state of this
// instance and the returned flag value would be the same.
markFlagAsAccessed(24, "enableMainQueueCoordinatorOnIOS");
markFlagAsAccessed(25, "enableMainQueueCoordinatorOnIOS");
flagValue = currentProvider_->enableMainQueueCoordinatorOnIOS();
enableMainQueueCoordinatorOnIOS_ = flagValue;
@@ -488,7 +506,7 @@ bool ReactNativeFeatureFlagsAccessor::enableMainQueueModulesOnIOS() {
// be accessing the provider multiple times but the end state of this
// instance and the returned flag value would be the same.
markFlagAsAccessed(25, "enableMainQueueModulesOnIOS");
markFlagAsAccessed(26, "enableMainQueueModulesOnIOS");
flagValue = currentProvider_->enableMainQueueModulesOnIOS();
enableMainQueueModulesOnIOS_ = flagValue;
@@ -506,7 +524,7 @@ bool ReactNativeFeatureFlagsAccessor::enableModuleArgumentNSNullConversionIOS()
// be accessing the provider multiple times but the end state of this
// instance and the returned flag value would be the same.
markFlagAsAccessed(26, "enableModuleArgumentNSNullConversionIOS");
markFlagAsAccessed(27, "enableModuleArgumentNSNullConversionIOS");
flagValue = currentProvider_->enableModuleArgumentNSNullConversionIOS();
enableModuleArgumentNSNullConversionIOS_ = flagValue;
@@ -524,7 +542,7 @@ bool ReactNativeFeatureFlagsAccessor::enableNativeCSSParsing() {
// be accessing the provider multiple times but the end state of this
// instance and the returned flag value would be the same.
markFlagAsAccessed(27, "enableNativeCSSParsing");
markFlagAsAccessed(28, "enableNativeCSSParsing");
flagValue = currentProvider_->enableNativeCSSParsing();
enableNativeCSSParsing_ = flagValue;
@@ -542,7 +560,7 @@ bool ReactNativeFeatureFlagsAccessor::enableNetworkEventReporting() {
// be accessing the provider multiple times but the end state of this
// instance and the returned flag value would be the same.
markFlagAsAccessed(28, "enableNetworkEventReporting");
markFlagAsAccessed(29, "enableNetworkEventReporting");
flagValue = currentProvider_->enableNetworkEventReporting();
enableNetworkEventReporting_ = flagValue;
@@ -560,7 +578,7 @@ bool ReactNativeFeatureFlagsAccessor::enableNewBackgroundAndBorderDrawables() {
// be accessing the provider multiple times but the end state of this
// instance and the returned flag value would be the same.
markFlagAsAccessed(29, "enableNewBackgroundAndBorderDrawables");
markFlagAsAccessed(30, "enableNewBackgroundAndBorderDrawables");
flagValue = currentProvider_->enableNewBackgroundAndBorderDrawables();
enableNewBackgroundAndBorderDrawables_ = flagValue;
@@ -578,7 +596,7 @@ bool ReactNativeFeatureFlagsAccessor::enablePreparedTextLayout() {
// be accessing the provider multiple times but the end state of this
// instance and the returned flag value would be the same.
markFlagAsAccessed(30, "enablePreparedTextLayout");
markFlagAsAccessed(31, "enablePreparedTextLayout");
flagValue = currentProvider_->enablePreparedTextLayout();
enablePreparedTextLayout_ = flagValue;
@@ -596,7 +614,7 @@ bool ReactNativeFeatureFlagsAccessor::enablePropsUpdateReconciliationAndroid() {
// be accessing the provider multiple times but the end state of this
// instance and the returned flag value would be the same.
markFlagAsAccessed(31, "enablePropsUpdateReconciliationAndroid");
markFlagAsAccessed(32, "enablePropsUpdateReconciliationAndroid");
flagValue = currentProvider_->enablePropsUpdateReconciliationAndroid();
enablePropsUpdateReconciliationAndroid_ = flagValue;
@@ -614,7 +632,7 @@ bool ReactNativeFeatureFlagsAccessor::enableResourceTimingAPI() {
// be accessing the provider multiple times but the end state of this
// instance and the returned flag value would be the same.
markFlagAsAccessed(32, "enableResourceTimingAPI");
markFlagAsAccessed(33, "enableResourceTimingAPI");
flagValue = currentProvider_->enableResourceTimingAPI();
enableResourceTimingAPI_ = flagValue;
@@ -632,7 +650,7 @@ bool ReactNativeFeatureFlagsAccessor::enableSynchronousStateUpdates() {
// be accessing the provider multiple times but the end state of this
// instance and the returned flag value would be the same.
markFlagAsAccessed(33, "enableSynchronousStateUpdates");
markFlagAsAccessed(34, "enableSynchronousStateUpdates");
flagValue = currentProvider_->enableSynchronousStateUpdates();
enableSynchronousStateUpdates_ = flagValue;
@@ -650,7 +668,7 @@ bool ReactNativeFeatureFlagsAccessor::enableViewCulling() {
// be accessing the provider multiple times but the end state of this
// instance and the returned flag value would be the same.
markFlagAsAccessed(34, "enableViewCulling");
markFlagAsAccessed(35, "enableViewCulling");
flagValue = currentProvider_->enableViewCulling();
enableViewCulling_ = flagValue;
@@ -668,7 +686,7 @@ bool ReactNativeFeatureFlagsAccessor::enableViewRecycling() {
// be accessing the provider multiple times but the end state of this
// instance and the returned flag value would be the same.
markFlagAsAccessed(35, "enableViewRecycling");
markFlagAsAccessed(36, "enableViewRecycling");
flagValue = currentProvider_->enableViewRecycling();
enableViewRecycling_ = flagValue;
@@ -686,7 +704,7 @@ bool ReactNativeFeatureFlagsAccessor::enableViewRecyclingForText() {
// be accessing the provider multiple times but the end state of this
// instance and the returned flag value would be the same.
markFlagAsAccessed(36, "enableViewRecyclingForText");
markFlagAsAccessed(37, "enableViewRecyclingForText");
flagValue = currentProvider_->enableViewRecyclingForText();
enableViewRecyclingForText_ = flagValue;
@@ -704,7 +722,7 @@ bool ReactNativeFeatureFlagsAccessor::enableViewRecyclingForView() {
// be accessing the provider multiple times but the end state of this
// instance and the returned flag value would be the same.
markFlagAsAccessed(37, "enableViewRecyclingForView");
markFlagAsAccessed(38, "enableViewRecyclingForView");
flagValue = currentProvider_->enableViewRecyclingForView();
enableViewRecyclingForView_ = flagValue;
@@ -722,7 +740,7 @@ bool ReactNativeFeatureFlagsAccessor::enableVirtualViewDebugFeatures() {
// be accessing the provider multiple times but the end state of this
// instance and the returned flag value would be the same.
markFlagAsAccessed(38, "enableVirtualViewDebugFeatures");
markFlagAsAccessed(39, "enableVirtualViewDebugFeatures");
flagValue = currentProvider_->enableVirtualViewDebugFeatures();
enableVirtualViewDebugFeatures_ = flagValue;
@@ -740,7 +758,7 @@ bool ReactNativeFeatureFlagsAccessor::enableVirtualViewRenderState() {
// be accessing the provider multiple times but the end state of this
// instance and the returned flag value would be the same.
markFlagAsAccessed(39, "enableVirtualViewRenderState");
markFlagAsAccessed(40, "enableVirtualViewRenderState");
flagValue = currentProvider_->enableVirtualViewRenderState();
enableVirtualViewRenderState_ = flagValue;
@@ -758,7 +776,7 @@ bool ReactNativeFeatureFlagsAccessor::enableVirtualViewWindowFocusDetection() {
// be accessing the provider multiple times but the end state of this
// instance and the returned flag value would be the same.
markFlagAsAccessed(40, "enableVirtualViewWindowFocusDetection");
markFlagAsAccessed(41, "enableVirtualViewWindowFocusDetection");
flagValue = currentProvider_->enableVirtualViewWindowFocusDetection();
enableVirtualViewWindowFocusDetection_ = flagValue;
@@ -776,7 +794,7 @@ bool ReactNativeFeatureFlagsAccessor::fixMappingOfEventPrioritiesBetweenFabricAn
// be accessing the provider multiple times but the end state of this
// instance and the returned flag value would be the same.
markFlagAsAccessed(41, "fixMappingOfEventPrioritiesBetweenFabricAndReact");
markFlagAsAccessed(42, "fixMappingOfEventPrioritiesBetweenFabricAndReact");
flagValue = currentProvider_->fixMappingOfEventPrioritiesBetweenFabricAndReact();
fixMappingOfEventPrioritiesBetweenFabricAndReact_ = flagValue;
@@ -794,7 +812,7 @@ bool ReactNativeFeatureFlagsAccessor::fuseboxEnabledRelease() {
// be accessing the provider multiple times but the end state of this
// instance and the returned flag value would be the same.
markFlagAsAccessed(42, "fuseboxEnabledRelease");
markFlagAsAccessed(43, "fuseboxEnabledRelease");
flagValue = currentProvider_->fuseboxEnabledRelease();
fuseboxEnabledRelease_ = flagValue;
@@ -812,7 +830,7 @@ bool ReactNativeFeatureFlagsAccessor::fuseboxNetworkInspectionEnabled() {
// be accessing the provider multiple times but the end state of this
// instance and the returned flag value would be the same.
markFlagAsAccessed(43, "fuseboxNetworkInspectionEnabled");
markFlagAsAccessed(44, "fuseboxNetworkInspectionEnabled");
flagValue = currentProvider_->fuseboxNetworkInspectionEnabled();
fuseboxNetworkInspectionEnabled_ = flagValue;
@@ -830,7 +848,7 @@ bool ReactNativeFeatureFlagsAccessor::hideOffscreenVirtualViewsOnIOS() {
// be accessing the provider multiple times but the end state of this
// instance and the returned flag value would be the same.
markFlagAsAccessed(44, "hideOffscreenVirtualViewsOnIOS");
markFlagAsAccessed(45, "hideOffscreenVirtualViewsOnIOS");
flagValue = currentProvider_->hideOffscreenVirtualViewsOnIOS();
hideOffscreenVirtualViewsOnIOS_ = flagValue;
@@ -848,7 +866,7 @@ double ReactNativeFeatureFlagsAccessor::preparedTextCacheSize() {
// be accessing the provider multiple times but the end state of this
// instance and the returned flag value would be the same.
markFlagAsAccessed(45, "preparedTextCacheSize");
markFlagAsAccessed(46, "preparedTextCacheSize");
flagValue = currentProvider_->preparedTextCacheSize();
preparedTextCacheSize_ = flagValue;
@@ -866,7 +884,7 @@ bool ReactNativeFeatureFlagsAccessor::traceTurboModulePromiseRejectionsOnAndroid
// be accessing the provider multiple times but the end state of this
// instance and the returned flag value would be the same.
markFlagAsAccessed(46, "traceTurboModulePromiseRejectionsOnAndroid");
markFlagAsAccessed(47, "traceTurboModulePromiseRejectionsOnAndroid");
flagValue = currentProvider_->traceTurboModulePromiseRejectionsOnAndroid();
traceTurboModulePromiseRejectionsOnAndroid_ = flagValue;
@@ -884,7 +902,7 @@ bool ReactNativeFeatureFlagsAccessor::updateRuntimeShadowNodeReferencesOnCommit(
// be accessing the provider multiple times but the end state of this
// instance and the returned flag value would be the same.
markFlagAsAccessed(47, "updateRuntimeShadowNodeReferencesOnCommit");
markFlagAsAccessed(48, "updateRuntimeShadowNodeReferencesOnCommit");
flagValue = currentProvider_->updateRuntimeShadowNodeReferencesOnCommit();
updateRuntimeShadowNodeReferencesOnCommit_ = flagValue;
@@ -902,7 +920,7 @@ bool ReactNativeFeatureFlagsAccessor::useAlwaysAvailableJSErrorHandling() {
// be accessing the provider multiple times but the end state of this
// instance and the returned flag value would be the same.
markFlagAsAccessed(48, "useAlwaysAvailableJSErrorHandling");
markFlagAsAccessed(49, "useAlwaysAvailableJSErrorHandling");
flagValue = currentProvider_->useAlwaysAvailableJSErrorHandling();
useAlwaysAvailableJSErrorHandling_ = flagValue;
@@ -920,7 +938,7 @@ bool ReactNativeFeatureFlagsAccessor::useFabricInterop() {
// be accessing the provider multiple times but the end state of this
// instance and the returned flag value would be the same.
markFlagAsAccessed(49, "useFabricInterop");
markFlagAsAccessed(50, "useFabricInterop");
flagValue = currentProvider_->useFabricInterop();
useFabricInterop_ = flagValue;
@@ -938,7 +956,7 @@ bool ReactNativeFeatureFlagsAccessor::useNativeViewConfigsInBridgelessMode() {
// be accessing the provider multiple times but the end state of this
// instance and the returned flag value would be the same.
markFlagAsAccessed(50, "useNativeViewConfigsInBridgelessMode");
markFlagAsAccessed(51, "useNativeViewConfigsInBridgelessMode");
flagValue = currentProvider_->useNativeViewConfigsInBridgelessMode();
useNativeViewConfigsInBridgelessMode_ = flagValue;
@@ -956,7 +974,7 @@ bool ReactNativeFeatureFlagsAccessor::useOptimizedEventBatchingOnAndroid() {
// be accessing the provider multiple times but the end state of this
// instance and the returned flag value would be the same.
markFlagAsAccessed(51, "useOptimizedEventBatchingOnAndroid");
markFlagAsAccessed(52, "useOptimizedEventBatchingOnAndroid");
flagValue = currentProvider_->useOptimizedEventBatchingOnAndroid();
useOptimizedEventBatchingOnAndroid_ = flagValue;
@@ -974,7 +992,7 @@ bool ReactNativeFeatureFlagsAccessor::useRawPropsJsiValue() {
// be accessing the provider multiple times but the end state of this
// instance and the returned flag value would be the same.
markFlagAsAccessed(52, "useRawPropsJsiValue");
markFlagAsAccessed(53, "useRawPropsJsiValue");
flagValue = currentProvider_->useRawPropsJsiValue();
useRawPropsJsiValue_ = flagValue;
@@ -992,7 +1010,7 @@ bool ReactNativeFeatureFlagsAccessor::useShadowNodeStateOnClone() {
// be accessing the provider multiple times but the end state of this
// instance and the returned flag value would be the same.
markFlagAsAccessed(53, "useShadowNodeStateOnClone");
markFlagAsAccessed(54, "useShadowNodeStateOnClone");
flagValue = currentProvider_->useShadowNodeStateOnClone();
useShadowNodeStateOnClone_ = flagValue;
@@ -1010,7 +1028,7 @@ bool ReactNativeFeatureFlagsAccessor::useTurboModuleInterop() {
// be accessing the provider multiple times but the end state of this
// instance and the returned flag value would be the same.
markFlagAsAccessed(54, "useTurboModuleInterop");
markFlagAsAccessed(55, "useTurboModuleInterop");
flagValue = currentProvider_->useTurboModuleInterop();
useTurboModuleInterop_ = flagValue;
@@ -1028,7 +1046,7 @@ bool ReactNativeFeatureFlagsAccessor::useTurboModules() {
// be accessing the provider multiple times but the end state of this
// instance and the returned flag value would be the same.
markFlagAsAccessed(55, "useTurboModules");
markFlagAsAccessed(56, "useTurboModules");
flagValue = currentProvider_->useTurboModules();
useTurboModules_ = flagValue;
@@ -1046,7 +1064,7 @@ double ReactNativeFeatureFlagsAccessor::virtualViewPrerenderRatio() {
// be accessing the provider multiple times but the end state of this
// instance and the returned flag value would be the same.
markFlagAsAccessed(56, "virtualViewPrerenderRatio");
markFlagAsAccessed(57, "virtualViewPrerenderRatio");
flagValue = currentProvider_->virtualViewPrerenderRatio();
virtualViewPrerenderRatio_ = flagValue;
@@ -4,7 +4,7 @@
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @generated SignedSource<<03ac996ff129f4ed37cad03a835008ca>>
* @generated SignedSource<<043e1a56e7a302fbca38151b5d079616>>
*/
/**
@@ -33,6 +33,7 @@ class ReactNativeFeatureFlagsAccessor {
ReactNativeFeatureFlagsAccessor();
bool commonTestFlag();
bool animatedShouldSignalBatch();
bool cxxNativeAnimatedEnabled();
bool cxxNativeAnimatedRemoveJsSync();
bool disableMainQueueSyncDispatchIOS();
@@ -100,9 +101,10 @@ class ReactNativeFeatureFlagsAccessor {
std::unique_ptr<ReactNativeFeatureFlagsProvider> currentProvider_;
bool wasOverridden_;
std::array<std::atomic<const char*>, 57> accessedFeatureFlags_;
std::array<std::atomic<const char*>, 58> accessedFeatureFlags_;
std::atomic<std::optional<bool>> commonTestFlag_;
std::atomic<std::optional<bool>> animatedShouldSignalBatch_;
std::atomic<std::optional<bool>> cxxNativeAnimatedEnabled_;
std::atomic<std::optional<bool>> cxxNativeAnimatedRemoveJsSync_;
std::atomic<std::optional<bool>> disableMainQueueSyncDispatchIOS_;
@@ -4,7 +4,7 @@
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @generated SignedSource<<447ab7d26fc92000742788c2fba6e297>>
* @generated SignedSource<<7b5caffd8f748384aa32ed6e153ee9c1>>
*/
/**
@@ -31,6 +31,10 @@ class ReactNativeFeatureFlagsDefaults : public ReactNativeFeatureFlagsProvider {
return false;
}
bool animatedShouldSignalBatch() override {
return false;
}
bool cxxNativeAnimatedEnabled() override {
return false;
}
@@ -4,7 +4,7 @@
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @generated SignedSource<<37da6a5b4c8f877f64d9cf1385d2a20f>>
* @generated SignedSource<<e78150be120e3fdf02f9420abce23bfc>>
*/
/**
@@ -54,6 +54,15 @@ class ReactNativeFeatureFlagsDynamicProvider : public ReactNativeFeatureFlagsDef
return ReactNativeFeatureFlagsDefaults::commonTestFlag();
}
bool animatedShouldSignalBatch() override {
auto value = values_["animatedShouldSignalBatch"];
if (!value.isNull()) {
return value.getBool();
}
return ReactNativeFeatureFlagsDefaults::animatedShouldSignalBatch();
}
bool cxxNativeAnimatedEnabled() override {
auto value = values_["cxxNativeAnimatedEnabled"];
if (!value.isNull()) {
@@ -4,7 +4,7 @@
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @generated SignedSource<<91c4cab3325d84025a789080a8b9a0c3>>
* @generated SignedSource<<bdd21870bf567207ad837eb33ae4ca5b>>
*/
/**
@@ -26,6 +26,7 @@ class ReactNativeFeatureFlagsProvider {
virtual ~ReactNativeFeatureFlagsProvider() = default;
virtual bool commonTestFlag() = 0;
virtual bool animatedShouldSignalBatch() = 0;
virtual bool cxxNativeAnimatedEnabled() = 0;
virtual bool cxxNativeAnimatedRemoveJsSync() = 0;
virtual bool disableMainQueueSyncDispatchIOS() = 0;
@@ -30,14 +30,15 @@ inline std::shared_ptr<const ShadowNode> getShadowNode(
return Bridging<std::shared_ptr<const ShadowNode>>::fromJs(
runtime, shadowNodeValue);
}
} // namespace
#pragma mark - Private helpers
UIManager& getUIManagerFromRuntime(facebook::jsi::Runtime& runtime) {
static UIManager& getUIManagerFromRuntime(facebook::jsi::Runtime& runtime) {
return UIManagerBinding::getBinding(runtime)->getUIManager();
}
RootShadowNode::Shared getCurrentShadowTreeRevision(
static RootShadowNode::Shared getCurrentShadowTreeRevision(
facebook::jsi::Runtime& runtime,
SurfaceId surfaceId) {
auto shadowTreeRevisionProvider =
@@ -45,7 +46,7 @@ RootShadowNode::Shared getCurrentShadowTreeRevision(
return shadowTreeRevisionProvider->getCurrentRevision(surfaceId);
}
RootShadowNode::Shared getCurrentShadowTreeRevision(
static RootShadowNode::Shared getCurrentShadowTreeRevision(
facebook::jsi::Runtime& runtime,
jsi::Value& nativeNodeReference) {
if (nativeNodeReference.isNumber()) {
@@ -57,13 +58,14 @@ RootShadowNode::Shared getCurrentShadowTreeRevision(
runtime, getShadowNode(runtime, nativeNodeReference)->getSurfaceId());
}
facebook::react::PointerEventsProcessor& getPointerEventsProcessorFromRuntime(
facebook::jsi::Runtime& runtime) {
static facebook::react::PointerEventsProcessor&
getPointerEventsProcessorFromRuntime(facebook::jsi::Runtime& runtime) {
return facebook::react::UIManagerBinding::getBinding(runtime)
->getPointerEventsProcessor();
}
std::vector<facebook::jsi::Value> getArrayOfInstanceHandlesFromShadowNodes(
static std::vector<facebook::jsi::Value>
getArrayOfInstanceHandlesFromShadowNodes(
const std::vector<std::shared_ptr<const ShadowNode>>& nodes,
facebook::jsi::Runtime& runtime) {
// JSI doesn't support adding elements to an array after creation,
@@ -81,12 +83,10 @@ std::vector<facebook::jsi::Value> getArrayOfInstanceHandlesFromShadowNodes(
return nonNullInstanceHandles;
}
bool isRootShadowNode(const ShadowNode& shadowNode) {
static bool isRootShadowNode(const ShadowNode& shadowNode) {
return shadowNode.getTraits().check(ShadowNodeTraits::Trait::RootNodeKind);
}
} // namespace
#pragma mark - NativeDOM
NativeDOM::NativeDOM(std::shared_ptr<CallInvoker> jsInvoker)
@@ -389,38 +389,44 @@ jsi::Value NativeDOM::linkRootNode(
void NativeDOM::measure(
jsi::Runtime& rt,
std::shared_ptr<const ShadowNode> shadowNode,
const MeasureOnSuccessCallback& callback) {
jsi::Function callback) {
auto currentRevision =
getCurrentShadowTreeRevision(rt, shadowNode->getSurfaceId());
if (currentRevision == nullptr) {
callback(0, 0, 0, 0, 0, 0);
callback.call(rt, {0, 0, 0, 0, 0, 0});
return;
}
auto measureRect = dom::measure(currentRevision, *shadowNode);
callback(
measureRect.x,
measureRect.y,
measureRect.width,
measureRect.height,
measureRect.pageX,
measureRect.pageY);
callback.call(
rt,
{jsi::Value{rt, measureRect.x},
jsi::Value{rt, measureRect.y},
jsi::Value{rt, measureRect.width},
jsi::Value{rt, measureRect.height},
jsi::Value{rt, measureRect.pageX},
jsi::Value{rt, measureRect.pageY}});
}
void NativeDOM::measureInWindow(
jsi::Runtime& rt,
std::shared_ptr<const ShadowNode> shadowNode,
const MeasureInWindowOnSuccessCallback& callback) {
jsi::Function callback) {
auto currentRevision =
getCurrentShadowTreeRevision(rt, shadowNode->getSurfaceId());
if (currentRevision == nullptr) {
callback(0, 0, 0, 0);
callback.call(rt, {0, 0, 0, 0});
return;
}
auto rect = dom::measureInWindow(currentRevision, *shadowNode);
callback(rect.x, rect.y, rect.width, rect.height);
callback.call(
rt,
{jsi::Value{rt, rect.x},
jsi::Value{rt, rect.y},
jsi::Value{rt, rect.width},
jsi::Value{rt, rect.height}});
}
void NativeDOM::measureLayout(
@@ -428,7 +434,7 @@ void NativeDOM::measureLayout(
std::shared_ptr<const ShadowNode> shadowNode,
std::shared_ptr<const ShadowNode> relativeToShadowNode,
jsi::Function onFail,
const MeasureLayoutOnSuccessCallback& onSuccess) {
jsi::Function onSuccess) {
auto currentRevision =
getCurrentShadowTreeRevision(rt, shadowNode->getSurfaceId());
if (currentRevision == nullptr) {
@@ -446,7 +452,12 @@ void NativeDOM::measureLayout(
auto rect = maybeRect.value();
onSuccess(rect.x, rect.y, rect.width, rect.height);
onSuccess.call(
rt,
{jsi::Value{rt, rect.x},
jsi::Value{rt, rect.y},
jsi::Value{rt, rect.width},
jsi::Value{rt, rect.height}});
}
#pragma mark - Legacy direct manipulation APIs (for `ReactNativeElement`).
@@ -21,15 +21,6 @@
namespace facebook::react {
using MeasureOnSuccessCallback =
SyncCallback<void(double, double, double, double, double, double)>;
using MeasureInWindowOnSuccessCallback =
SyncCallback<void(double, double, double, double)>;
using MeasureLayoutOnSuccessCallback =
SyncCallback<void(double, double, double, double)>;
class NativeDOM : public NativeDOMCxxSpec<NativeDOM> {
public:
NativeDOM(std::shared_ptr<CallInvoker> jsInvoker);
@@ -126,19 +117,19 @@ class NativeDOM : public NativeDOMCxxSpec<NativeDOM> {
void measure(
jsi::Runtime& rt,
std::shared_ptr<const ShadowNode> shadowNode,
const MeasureOnSuccessCallback& callback);
jsi::Function callback);
void measureInWindow(
jsi::Runtime& rt,
std::shared_ptr<const ShadowNode> shadowNode,
const MeasureInWindowOnSuccessCallback& callback);
jsi::Function callback);
void measureLayout(
jsi::Runtime& rt,
std::shared_ptr<const ShadowNode> shadowNode,
std::shared_ptr<const ShadowNode> relativeToShadowNode,
jsi::Function onFail,
const MeasureLayoutOnSuccessCallback& onSuccess);
jsi::Function onSuccess);
#pragma mark - Legacy direct manipulation APIs (for `ReactNativeElement`).
@@ -4,7 +4,7 @@
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @generated SignedSource<<52f80499ef40102683c343c11570badf>>
* @generated SignedSource<<aebe2ba2618903a0ac2df06f18df8c75>>
*/
/**
@@ -49,6 +49,11 @@ bool NativeReactNativeFeatureFlags::commonTestFlagWithoutNativeImplementation(
return false;
}
bool NativeReactNativeFeatureFlags::animatedShouldSignalBatch(
jsi::Runtime& /*runtime*/) {
return ReactNativeFeatureFlags::animatedShouldSignalBatch();
}
bool NativeReactNativeFeatureFlags::cxxNativeAnimatedEnabled(
jsi::Runtime& /*runtime*/) {
return ReactNativeFeatureFlags::cxxNativeAnimatedEnabled();
@@ -4,7 +4,7 @@
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @generated SignedSource<<f09cc734d07ec566f153e90c6d8796db>>
* @generated SignedSource<<f3336bad491a91abb3af7e8fcd7e5938>>
*/
/**
@@ -38,6 +38,8 @@ class NativeReactNativeFeatureFlags
bool commonTestFlagWithoutNativeImplementation(jsi::Runtime& runtime);
bool animatedShouldSignalBatch(jsi::Runtime& runtime);
bool cxxNativeAnimatedEnabled(jsi::Runtime& runtime);
bool cxxNativeAnimatedRemoveJsSync(jsi::Runtime& runtime);
@@ -224,11 +224,7 @@ AccessibilityProps::AccessibilityProps(
// it probably can, but this is a fairly rare edge-case that (1) is easy-ish
// to work around here, and (2) would require very careful work to address
// this case and not regress the more common cases.
if (ReactNativeFeatureFlags::enableCppPropsIteratorSetter()) {
accessibilityRole = sourceProps.accessibilityRole;
role = sourceProps.role;
accessibilityTraits = sourceProps.accessibilityTraits;
} else {
if (!ReactNativeFeatureFlags::enableCppPropsIteratorSetter()) {
auto* accessibilityRoleValue =
rawProps.at("accessibilityRole", nullptr, nullptr);
auto* roleValue = rawProps.at("role", nullptr, nullptr);
@@ -1,20 +0,0 @@
/*
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
#pragma once
#include <react/renderer/components/virtualviewexperimental/VirtualViewExperimentalShadowNode.h>
#include <react/renderer/core/ConcreteComponentDescriptor.h>
namespace facebook::react {
/*
* Descriptor for <VirtualView2> component.
*/
using VirtualViewExperimentalComponentDescriptor =
ConcreteComponentDescriptor<VirtualViewExperimentalShadowNode>;
} // namespace facebook::react
@@ -1,39 +0,0 @@
/*
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
#pragma once
#include <react/renderer/components/FBReactNativeSpec/EventEmitters.h>
#include <react/renderer/components/FBReactNativeSpec/Props.h>
#include <react/renderer/components/view/ConcreteViewShadowNode.h>
namespace facebook::react {
constexpr const char VirtualViewExperimentalComponentName[] =
"VirtualViewExperimental";
/*
* `ShadowNode` for <VirtualViewExperimental> component.
*/
class VirtualViewExperimentalShadowNode final
: public ConcreteViewShadowNode<
VirtualViewExperimentalComponentName,
VirtualViewExperimentalProps,
VirtualViewEventEmitter> {
public:
using ConcreteViewShadowNode::ConcreteViewShadowNode;
static ShadowNodeTraits BaseTraits() {
auto traits = ConcreteViewShadowNode::BaseTraits();
// <VirtualView> has a side effect: it listens to scroll events.
// It must not be culled, otherwise Fling will not work.
traits.set(ShadowNodeTraits::Trait::Unstable_uncullableView);
return traits;
}
};
} // namespace facebook::react
@@ -82,15 +82,6 @@ class ShadowNodeTraits {
// Must not be set directly. It is used by the view culling algorithm to
// efficiently determine if a node is uncullable.
Unstable_uncullableTrace = 1 << 13,
// Indicates that the `YogaLayoutableShadowNode` must set `isDirty` flag for
// Yoga node when a `ShadowNode` is being cloned. `ShadowNode`s that modify
// Yoga styles in the constructor (or later) *after* the `ShadowNode`
// is cloned must set this trait.
// Any Yoga node (not only Leaf ones) can have this trait.
// **Deprecated**: This trait is deprecated and will be removed in a future
// version of React Native.
DirtyYogaNode = 1 << 14,
};
/*
@@ -34,9 +34,9 @@ constexpr uint8_t hexToNumeric(std::string_view hex, HexColorType hexType) {
}
if (hexType == HexColorType::Short) {
return static_cast<uint8_t>(result * 16 + result);
return result * 16 + result;
} else {
return static_cast<uint8_t>(result);
return result;
}
}
@@ -28,22 +28,22 @@ ColorComponents colorComponentsFromColor(SharedColor sharedColor) {
}
// Read alpha channel in [0, 255] range
uint8_t alphaFromColor(SharedColor color) noexcept {
uint8_t alphaFromColor(SharedColor color) {
return static_cast<uint8_t>(std::round(alphaFromHostPlatformColor(*color)));
}
// Read red channel in [0, 255] range
uint8_t redFromColor(SharedColor color) noexcept {
uint8_t redFromColor(SharedColor color) {
return static_cast<uint8_t>(std::round(redFromHostPlatformColor(*color)));
}
// Read green channel in [0, 255] range
uint8_t greenFromColor(SharedColor color) noexcept {
uint8_t greenFromColor(SharedColor color) {
return static_cast<uint8_t>(std::round(greenFromHostPlatformColor(*color)));
}
// Read blue channel in [0, 255] range
uint8_t blueFromColor(SharedColor color) noexcept {
uint8_t blueFromColor(SharedColor color) {
return static_cast<uint8_t>(std::round(blueFromHostPlatformColor(*color)));
}
@@ -61,10 +61,10 @@ bool isColorMeaningful(const SharedColor& color) noexcept;
SharedColor colorFromComponents(ColorComponents components);
ColorComponents colorComponentsFromColor(SharedColor color);
uint8_t alphaFromColor(SharedColor color) noexcept;
uint8_t redFromColor(SharedColor color) noexcept;
uint8_t greenFromColor(SharedColor color) noexcept;
uint8_t blueFromColor(SharedColor color) noexcept;
uint8_t alphaFromColor(SharedColor color);
uint8_t redFromColor(SharedColor color);
uint8_t greenFromColor(SharedColor color);
uint8_t blueFromColor(SharedColor color);
SharedColor colorFromRGBA(uint8_t r, uint8_t g, uint8_t b, uint8_t a);
SharedColor clearColor();
@@ -15,19 +15,19 @@
namespace facebook::react {
/* static */ Transform Transform::Identity() noexcept {
Transform Transform::Identity() {
return {};
}
/* static */ Transform Transform::VerticalInversion() noexcept {
Transform Transform::VerticalInversion() {
return Transform::Scale(1, -1, 1);
}
/* static */ Transform Transform::HorizontalInversion() noexcept {
Transform Transform::HorizontalInversion() {
return Transform::Scale(-1, 1, 1);
}
/* static */ Transform Transform::Perspective(Float perspective) noexcept {
Transform Transform::Perspective(Float perspective) {
auto transform = Transform{};
auto Zero = ValueUnit(0, UnitType::Point);
transform.operations.push_back(TransformOperation{
@@ -39,7 +39,7 @@ namespace facebook::react {
return transform;
}
/* static */ Transform Transform::Scale(Float x, Float y, Float z) noexcept {
Transform Transform::Scale(Float x, Float y, Float z) {
auto transform = Transform{};
Float xprime = isZero(x) ? 0 : x;
Float yprime = isZero(y) ? 0 : y;
@@ -57,8 +57,7 @@ namespace facebook::react {
return transform;
}
/* static */ Transform
Transform::Translate(Float x, Float y, Float z) noexcept {
Transform Transform::Translate(Float x, Float y, Float z) {
auto transform = Transform{};
Float xprime = isZero(x) ? 0 : x;
Float yprime = isZero(y) ? 0 : y;
@@ -76,7 +75,7 @@ Transform::Translate(Float x, Float y, Float z) noexcept {
return transform;
}
/* static */ Transform Transform::Skew(Float x, Float y) noexcept {
Transform Transform::Skew(Float x, Float y) {
auto transform = Transform{};
Float xprime = isZero(x) ? 0 : x;
Float yprime = isZero(y) ? 0 : y;
@@ -90,7 +89,7 @@ Transform::Translate(Float x, Float y, Float z) noexcept {
return transform;
}
/* static */ Transform Transform::RotateX(Float radians) noexcept {
Transform Transform::RotateX(Float radians) {
auto transform = Transform{};
if (!isZero(radians)) {
auto Zero = ValueUnit(0, UnitType::Point);
@@ -107,7 +106,7 @@ Transform::Translate(Float x, Float y, Float z) noexcept {
return transform;
}
/* static */ Transform Transform::RotateY(Float radians) noexcept {
Transform Transform::RotateY(Float radians) {
auto transform = Transform{};
if (!isZero(radians)) {
auto Zero = ValueUnit(0, UnitType::Point);
@@ -124,7 +123,7 @@ Transform::Translate(Float x, Float y, Float z) noexcept {
return transform;
}
/* static */ Transform Transform::RotateZ(Float radians) noexcept {
Transform Transform::RotateZ(Float radians) {
auto transform = Transform{};
if (!isZero(radians)) {
auto Zero = ValueUnit(0, UnitType::Point);
@@ -141,7 +140,7 @@ Transform::Translate(Float x, Float y, Float z) noexcept {
return transform;
}
/* static */ Transform Transform::Rotate(Float x, Float y, Float z) noexcept {
Transform Transform::Rotate(Float x, Float y, Float z) {
auto transform = Transform{};
if (!isZero(x)) {
transform = transform * Transform::RotateX(x);
@@ -155,7 +154,7 @@ Transform::Translate(Float x, Float y, Float z) noexcept {
return transform;
}
/* static */ Transform Transform::FromTransformOperation(
Transform Transform::FromTransformOperation(
TransformOperation transformOperation,
const Size& size,
const Transform& transform) {
@@ -198,7 +197,7 @@ Transform::Translate(Float x, Float y, Float z) noexcept {
return Transform::Identity();
}
/* static */ TransformOperation Transform::DefaultTransformOperation(
TransformOperation Transform::DefaultTransformOperation(
TransformOperationType type) {
auto Zero = ValueUnit{0, UnitType::Point};
auto One = ValueUnit{1, UnitType::Point};
@@ -226,7 +225,7 @@ Transform::Translate(Float x, Float y, Float z) noexcept {
}
}
/* static */ Transform Transform::Interpolate(
Transform Transform::Interpolate(
Float animationProgress,
const Transform& lhs,
const Transform& rhs,
@@ -302,17 +301,15 @@ Transform::Translate(Float x, Float y, Float z) noexcept {
return result;
}
/* static */ bool Transform::isVerticalInversion(
const Transform& transform) noexcept {
bool Transform::isVerticalInversion(const Transform& transform) {
return floatEquality(transform.at(1, 1), static_cast<Float>(-1.0f));
}
/* static */ bool Transform::isHorizontalInversion(
const Transform& transform) noexcept {
bool Transform::isHorizontalInversion(const Transform& transform) {
return floatEquality(transform.at(0, 0), static_cast<Float>(-1.0f));
}
bool Transform::operator==(const Transform& rhs) const noexcept {
bool Transform::operator==(const Transform& rhs) const {
for (auto i = 0; i < 16; i++) {
if (matrix[i] != rhs.matrix[i]) {
return false;
@@ -329,7 +326,7 @@ bool Transform::operator==(const Transform& rhs) const noexcept {
return true;
}
bool Transform::operator!=(const Transform& rhs) const noexcept {
bool Transform::operator!=(const Transform& rhs) const {
return !(*this == rhs);
}
@@ -411,11 +408,11 @@ Transform Transform::operator*(const Transform& rhs) const {
return result;
}
Float& Transform::at(int i, int j) noexcept {
Float& Transform::at(int i, int j) {
return matrix[(i * 4) + j];
}
const Float& Transform::at(int i, int j) const noexcept {
const Float& Transform::at(int i, int j) const {
return matrix[(i * 4) + j];
}
@@ -104,47 +104,47 @@ struct Transform {
/*
* Returns the identity transform (`[1 0 0 0; 0 1 0 0; 0 0 1 0; 0 0 0 1]`).
*/
static Transform Identity() noexcept;
static Transform Identity();
/*
* Returns the vertival inversion transform (`[1 0 0 0; 0 -1 0 0; 0 0 1 0; 0 0
* 0 1]`).
*/
static Transform VerticalInversion() noexcept;
static Transform VerticalInversion();
/*
* Returns the horizontal inversion transform (`[-1 0 0 0; 0 1 0 0; 0 0 1 0; 0
* 0 0 1]`).
*/
static Transform HorizontalInversion() noexcept;
static Transform HorizontalInversion();
/*
* Returns a Perspective transform.
*/
static Transform Perspective(Float perspective) noexcept;
static Transform Perspective(Float perspective);
/*
* Returns a Scale transform.
*/
static Transform Scale(Float factorX, Float factorY, Float factorZ) noexcept;
static Transform Scale(Float factorX, Float factorY, Float factorZ);
/*
* Returns a Translate transform.
*/
static Transform Translate(Float x, Float y, Float z) noexcept;
static Transform Translate(Float x, Float y, Float z);
/*
* Returns a Skew transform.
*/
static Transform Skew(Float x, Float y) noexcept;
static Transform Skew(Float x, Float y);
/*
* Returns a transform that rotates by `angle` radians along the given axis.
*/
static Transform RotateX(Float radians) noexcept;
static Transform RotateY(Float radians) noexcept;
static Transform RotateZ(Float radians) noexcept;
static Transform Rotate(Float angleX, Float angleY, Float angleZ) noexcept;
static Transform RotateX(Float radians);
static Transform RotateY(Float radians);
static Transform RotateZ(Float radians);
static Transform Rotate(Float angleX, Float angleY, Float angleZ);
/**
* Perform an interpolation between lhs and rhs, given progress.
@@ -163,20 +163,20 @@ struct Transform {
const Transform& rhs,
const Size& size);
static bool isVerticalInversion(const Transform& transform) noexcept;
static bool isHorizontalInversion(const Transform& transform) noexcept;
static bool isVerticalInversion(const Transform& transform);
static bool isHorizontalInversion(const Transform& transform);
/*
* Equality operators.
*/
bool operator==(const Transform& rhs) const noexcept;
bool operator!=(const Transform& rhs) const noexcept;
bool operator==(const Transform& rhs) const;
bool operator!=(const Transform& rhs) const;
/*
* Matrix subscript.
*/
Float& at(int i, int j) noexcept;
const Float& at(int i, int j) const noexcept;
Float& at(int i, int j);
const Float& at(int i, int j) const;
/*
* Concatenates (multiplies) transform matrices.
@@ -7,7 +7,7 @@
#pragma once
#include "folly/json/dynamic.h"
#include "folly/dynamic.h"
#include <functional>
#include <optional>
@@ -466,33 +466,14 @@ NativeAnimatedNodesManager::ensureEventEmitterListener() noexcept {
}
void NativeAnimatedNodesManager::startRenderCallbackIfNeeded() {
// This method can be called from either the UI thread or JavaScript thread.
// It ensures `startOnRenderCallback_` is called exactly once using atomic
// operations. We use std::atomic_bool rather than std::mutex to avoid
// potential deadlocks that could occur if we called external code while
// holding a mutex.
auto isRenderCallbackStarted = isRenderCallbackStarted_.exchange(true);
if (isRenderCallbackStarted) {
// onRender callback is already started.
return;
}
if (startOnRenderCallback_) {
startOnRenderCallback_([this]() { onRender(); });
}
}
void NativeAnimatedNodesManager::stopRenderCallbackIfNeeded() noexcept {
// When multiple threads reach this point, only one thread should call
// stopOnRenderCallback_. This synchronization is primarily needed during
// destruction of NativeAnimatedNodesManager. In normal operation,
// stopRenderCallbackIfNeeded is always called from the UI thread.
auto isRenderCallbackStarted = isRenderCallbackStarted_.exchange(false);
if (isRenderCallbackStarted) {
if (stopOnRenderCallback_) {
stopOnRenderCallback_();
}
if (stopOnRenderCallback_) {
stopOnRenderCallback_();
}
}
@@ -225,11 +225,6 @@ class NativeAnimatedNodesManager {
// React context required to commit props onto Component View
DirectManipulationCallback directManipulationCallback_;
FabricCommitCallback fabricCommitCallback_;
/*
* Tracks whether the render callback loop for animations is currently active.
*/
std::atomic_bool isRenderCallbackStarted_{false};
StartOnRenderCallback startOnRenderCallback_;
StopOnRenderCallback stopOnRenderCallback_;
@@ -125,18 +125,13 @@ class ReactNativeCoreUtils
url = stable_tarball_url(@@react_native_version, :debug)
rncore_log("Using tarball from URL: #{url}")
download_stable_rncore(@@react_native_path, @@react_native_version, :debug)
download_stable_rncore(@@react_native_path, @@react_native_version, :release)
download_stable_rndeps(@@react_native_path, @@react_native_version, :debug)
download_stable_rndeps(@@react_native_path, @@react_native_version, :release)
return {:http => url}
end
def self.stable_tarball_url(version, build_type)
## You can use the `ENTERPRISE_REPOSITORY` ariable to customise the base url from which artifacts will be downloaded.
## The mirror's structure must be the same of the Maven repo the react-native core team publishes on Maven Central.
maven_repo_url =
ENV[ENTERPRISE_REPOSITORY] != nil && ENV[ENTERPRISE_REPOSITORY] != "" ?
ENV[ENTERPRISE_REPOSITORY] :
"https://repo1.maven.org/maven2"
maven_repo_url = "https://repo1.maven.org/maven2"
group = "com/facebook/react"
# Sample url from Maven:
# https://repo1.maven.org/maven2/com/facebook/react/react-native-artifacts/0.81.0/react-native-artifacts-0.81.0-reactnative-core-debug.tar.gz
@@ -162,9 +157,9 @@ class ReactNativeCoreUtils
end
end
def self.download_stable_rncore(react_native_path, version, configuration)
def self.download_stable_rndeps(react_native_path, version, configuration)
tarball_url = stable_tarball_url(version, configuration)
download_rncore_tarball(react_native_path, tarball_url, version, configuration)
download_rndeps_tarball(react_native_path, tarball_url, version, configuration)
end
def self.podspec_source_download_prebuilt_nightly_tarball(version)
@@ -173,14 +168,14 @@ class ReactNativeCoreUtils
return {:http => url}
end
def self.download_rncore_tarball(react_native_path, tarball_url, version, configuration)
def self.download_rndeps_tarball(react_native_path, tarball_url, version, configuration)
destination_path = configuration == nil ?
"#{artifacts_dir()}/reactnative-core-#{version}.tar.gz" :
"#{artifacts_dir()}/reactnative-core-#{version}-#{configuration}.tar.gz"
"#{artifacts_dir()}/reactnative-core-debug.tar.gz-#{version}.tar.gz" :
"#{artifacts_dir()}/reactnative-core-debug.tar.gz-#{version}-#{configuration}.tar.gz"
unless File.exist?(destination_path)
# Download to a temporary file first so we don't cache incomplete downloads.
tmp_file = "#{artifacts_dir()}/reactnative-core.download"
tmp_file = "#{artifacts_dir()}/reactnative-core-debug.tar.gz.download"
`mkdir -p "#{artifacts_dir()}" && curl "#{tarball_url}" -Lo "#{tmp_file}" && mv "#{tmp_file}" "#{destination_path}"`
end
@@ -166,12 +166,7 @@ class ReactNativeDependenciesUtils
end
def self.release_tarball_url(version, build_type)
## You can use the `ENTERPRISE_REPOSITORY` ariable to customise the base url from which artifacts will be downloaded.
## The mirror's structure must be the same of the Maven repo the react-native core team publishes on Maven Central.
maven_repo_url =
ENV[ENTERPRISE_REPOSITORY] != nil && ENV[ENTERPRISE_REPOSITORY] != "" ?
ENV[ENTERPRISE_REPOSITORY] :
"https://repo1.maven.org/maven2"
maven_repo_url = "https://repo1.maven.org/maven2"
group = "com/facebook/react"
# Sample url from Maven:
# https://repo1.maven.org/maven2/com/facebook/react/react-native-artifacts/0.79.0-rc.0/react-native-artifacts-0.79.0-rc.0-reactnative-dependencies-debug.tar.gz
@@ -478,7 +478,6 @@ Pod::Spec.new do |s|
depend_on_js_engine(s)
add_rn_third_party_dependencies(s)
add_rncore_dependency(s)
s.script_phases = {
'name' => 'Generate Specs',
@@ -956,7 +955,6 @@ Pod::Spec.new do |s|
depend_on_js_engine(s)
add_rn_third_party_dependencies(s)
add_rncore_dependency(s)
s.script_phases = {
'name' => 'Generate Specs',
@@ -60,6 +60,16 @@ const testDefinitions: FeatureFlagDefinitions = {
const definitions: FeatureFlagDefinitions = {
common: {
...testDefinitions.common,
animatedShouldSignalBatch: {
defaultValue: false,
metadata: {
dateAdded: '2025-03-07',
description: 'Enables start- and finishOperationBatch on any platform.',
expectedReleaseValue: true,
purpose: 'experimentation',
},
ossReleaseStage: 'none',
},
cxxNativeAnimatedEnabled: {
defaultValue: false,
metadata: {
+1 -4
View File
@@ -183,10 +183,7 @@ function getTarballUrl(
version /*: string */,
buildType /*: BuildFlavor */,
) /*: string */ {
// You can use the `ENTERPRISE_REPOSITORY` ariable to customise the base url from which artifacts will be downloaded.
// The mirror's structure must be the same of the Maven repo the react-native core team publishes on Maven Central.
const mavenRepoUrl =
process.env.ENTERPRISE_REPOSITORY ?? 'https://repo1.maven.org/maven2';
const mavenRepoUrl = 'https://repo1.maven.org/maven2';
const namespace = 'com/facebook/react';
return `${mavenRepoUrl}/${namespace}/react-native-artifacts/${version}/react-native-artifacts-${version}-hermes-ios-${buildType.toLowerCase()}.tar.gz`;
}
@@ -179,10 +179,7 @@ function getTarballUrl(
version /*: string */,
buildType /*: BuildFlavor */,
) /*: string */ {
// You can use the `ENTERPRISE_REPOSITORY` ariable to customise the base url from which artifacts will be downloaded.
// The mirror's structure must be the same of the Maven repo the react-native core team publishes on Maven Central.
const mavenRepoUrl =
process.env.ENTERPRISE_REPOSITORY ?? 'https://repo1.maven.org/maven2';
const mavenRepoUrl = 'https://repo1.maven.org/maven2';
const namespace = 'com/facebook/react';
return `${mavenRepoUrl}/${namespace}/react-native-artifacts/${version}/react-native-artifacts-${version}-reactnative-dependencies-${buildType.toLowerCase()}.tar.gz`;
}
-120
View File
@@ -1,120 +0,0 @@
/**
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @flow strict-local
* @format
*/
'use strict';
const {execSync} = require('child_process');
const fs = require('fs');
const yargs = require('yargs');
const LAST_BUILD_FILENAME = 'React-Core-prebuilt/.last_build_configuration';
function validateBuildConfiguration(configuration /*: string */) {
if (!['Debug', 'Release'].includes(configuration)) {
throw new Error(`Invalid configuration ${configuration}`);
}
}
function validateVersion(version /*: ?string */) {
if (version == null || version === '') {
throw new Error('Version cannot be empty');
}
}
function shouldReplaceRnCoreConfiguration(configuration /*: string */) {
const fileExists = fs.existsSync(LAST_BUILD_FILENAME);
if (fileExists) {
console.log(`Found ${LAST_BUILD_FILENAME} file`);
const oldConfiguration = fs.readFileSync(LAST_BUILD_FILENAME).toString();
if (oldConfiguration === configuration) {
console.log(
'Same config of the previous build. No need to replace React-Core-prebuilt',
);
return false;
}
}
// Assumption: if there is no stored last build, we assume that it was build for debug.
if (!fileExists && configuration === 'Debug') {
console.log(
'No previous build detected, but Debug Configuration. No need to replace React-Core-prebuilt',
);
return false;
}
return true;
}
function replaceRNCoreConfiguration(
configuration /*: string */,
version /*: string */,
podsRoot /*: string */,
) {
// Filename comes from rncore.rb
const tarballURLPath = `${podsRoot}/ReactNativeCore-artifacts/reactnative-core-${version.toLowerCase()}-${configuration.toLowerCase()}.tar.gz`;
const finalLocation = 'React-Core-prebuilt';
console.log('Preparing the final location', finalLocation);
fs.rmSync(finalLocation, {force: true, recursive: true});
fs.mkdirSync(finalLocation, {recursive: true});
console.log('Extracting the tarball', tarballURLPath);
execSync(`tar -xf ${tarballURLPath} -C ${finalLocation}`);
}
function updateLastBuildConfiguration(configuration /*: string */) {
console.log(`Updating ${LAST_BUILD_FILENAME} with ${configuration}`);
fs.writeFileSync(LAST_BUILD_FILENAME, configuration);
}
function main(
configuration /*: string */,
version /*: string */,
podsRoot /*: string */,
) {
validateBuildConfiguration(configuration);
validateVersion(version);
if (!shouldReplaceRnCoreConfiguration(configuration)) {
return;
}
replaceRNCoreConfiguration(configuration, version, podsRoot);
updateLastBuildConfiguration(configuration);
console.log('Done replacing React Native prebuilt');
}
// This script is executed in the Pods folder, which is usually not synched to Github, so it should be ok
const argv = yargs
.option('c', {
alias: 'configuration',
description:
'Configuration to use to download the right React-Core prebuilt version. Allowed values are "Debug" and "Release".',
})
.option('r', {
alias: 'reactNativeVersion',
description:
'The Version of React Native associated with the React-Core prebuilt tarball.',
})
.option('p', {
alias: 'podsRoot',
description: 'The path to the Pods root folder',
})
.usage('Usage: $0 -c Debug -r <version> -p <path/to/react-native>').argv;
// $FlowFixMe[prop-missing]
const configuration = argv.configuration;
// $FlowFixMe[prop-missing]
const version = argv.reactNativeVersion;
// $FlowFixMe[prop-missing]
const podsRoot = argv.podsRoot;
main(configuration, version, podsRoot);
@@ -204,12 +204,7 @@ def hermestag_file(react_native_path)
end
def release_tarball_url(version, build_type)
## You can use the `ENTERPRISE_REPOSITORY` ariable to customise the base url from which artifacts will be downloaded.
## The mirror's structure must be the same of the Maven repo the react-native core team publishes on Maven Central.
maven_repo_url =
ENV[ENTERPRISE_REPOSITORY] != nil && ENV[ENTERPRISE_REPOSITORY] != "" ?
ENV[ENTERPRISE_REPOSITORY] :
"https://repo1.maven.org/maven2"
maven_repo_url = "https://repo1.maven.org/maven2"
namespace = "com/facebook/react"
# Sample url from Maven:
# https://repo1.maven.org/maven2/com/facebook/react/react-native-artifacts/0.71.0/react-native-artifacts-0.71.0-hermes-ios-debug.tar.gz
@@ -58,6 +58,7 @@ let globalEventEmitterGetValueListener: ?EventSubscription = null;
let globalEventEmitterAnimationFinishedListener: ?EventSubscription = null;
const shouldSignalBatch: boolean =
ReactNativeFeatureFlags.animatedShouldSignalBatch() ||
ReactNativeFeatureFlags.cxxNativeAnimatedEnabled();
function createNativeOperations(): $NonMaybeType<typeof NativeAnimatedModule> {
@@ -67,7 +67,7 @@ export default function createAnimatedPropsHook(
useEffect(() => {
// Animated queue flush is handled deterministically in setImmediate for the following feature flags:
// cxxNativeAnimatedEnabled
// animatedShouldSignalBatch, cxxNativeAnimatedEnabled
if (!NativeAnimatedHelper.shouldSignalBatch) {
// If multiple components call `flushQueue`, the first one will flush the
// queue and subsequent ones will do nothing.
@@ -1,93 +0,0 @@
/**
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @flow strict-local
* @format
*/
import type {ViewProps} from '../../../../Libraries/Components/View/ViewPropTypes';
import type {
DirectEventHandler,
Double,
Int32,
} from '../../../../Libraries/Types/CodegenTypes';
import type {HostComponent} from '../../types/HostComponent';
import codegenNativeComponent from '../../../../Libraries/Utilities/codegenNativeComponent';
export type NativeModeChangeEvent = $ReadOnly<{
/**
* Virtualization mode of the target view.
*
* - `0`: Target view is visible.
* - `1`: Target view is hidden, but can be prerendered.
* - `2`: Target view is hidden.
*
* WORKAROUND: As of this writing, codegen doesn't support enums, so we need
* to convert `number` into an enum in `VirtualView`.
*/
mode: Int32,
/**
* Rect of the target view, relative to the nearest ancestor scroll container.
*/
targetRect: $ReadOnly<{
x: Double,
y: Double,
width: Double,
height: Double,
}>,
/**
* Rect of the threshold that determines the mode of the target view, relative
* to the nearest ancestor scroll container.
*
* - `Visible`: Rect in which the target view is visible.
* - `Prerender`: Rect in which the target view is prerendered.
* - `Hidden`: Unused, without any guarantees.
*
* This can be used to determine whether and how much new content to render.
*/
thresholdRect: $ReadOnly<{
x: Double,
y: Double,
width: Double,
height: Double,
}>,
}>;
type VirtualViewExperimentalNativeProps = $ReadOnly<{
...ViewProps,
/**
* Whether the initial mode should be `Hidden`.
*/
initialHidden?: boolean,
/**
* Render state of children.
*
* - `0`: Reserved to represent unknown future values.
* - `1`: Children are rendered.
* - `2`: Children are not rendered.
*
* WORKAROUND: As of this writing, codegen doesn't support enums, so we need
* to convert `number` into an enum in `VirtualView`.
*/
renderState: Int32,
/**
* See `NativeModeChangeEvent`.
*/
onModeChange?: ?DirectEventHandler<NativeModeChangeEvent>,
}>;
export default codegenNativeComponent<VirtualViewExperimentalNativeProps>(
'VirtualViewExperimental',
{
interfaceOnly: true,
},
) as HostComponent<VirtualViewExperimentalNativeProps>;
@@ -4,7 +4,7 @@
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @generated SignedSource<<1c5a52b9ffce6f221ae263e90a79a8ab>>
* @generated SignedSource<<b75fccb46a36b07c692d890f0659f9a3>>
* @flow strict
* @noformat
*/
@@ -52,6 +52,7 @@ export type ReactNativeFeatureFlags = $ReadOnly<{
...ReactNativeFeatureFlagsJsOnly,
commonTestFlag: Getter<boolean>,
commonTestFlagWithoutNativeImplementation: Getter<boolean>,
animatedShouldSignalBatch: Getter<boolean>,
cxxNativeAnimatedEnabled: Getter<boolean>,
cxxNativeAnimatedRemoveJsSync: Getter<boolean>,
disableMainQueueSyncDispatchIOS: Getter<boolean>,
@@ -198,6 +199,10 @@ export const commonTestFlag: Getter<boolean> = createNativeFlagGetter('commonTes
* Common flag for testing (without native implementation). Do NOT modify.
*/
export const commonTestFlagWithoutNativeImplementation: Getter<boolean> = createNativeFlagGetter('commonTestFlagWithoutNativeImplementation', false);
/**
* Enables start- and finishOperationBatch on any platform.
*/
export const animatedShouldSignalBatch: Getter<boolean> = createNativeFlagGetter('animatedShouldSignalBatch', false);
/**
* Use a C++ implementation of Native Animated instead of the platform implementation.
*/
@@ -4,7 +4,7 @@
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @generated SignedSource<<5935f4d8ec94954d583ad79116e8daba>>
* @generated SignedSource<<55c1f0223345b5680bbdd888a358f210>>
* @flow strict
* @noformat
*/
@@ -26,6 +26,7 @@ import * as TurboModuleRegistry from '../../../../Libraries/TurboModule/TurboMod
export interface Spec extends TurboModule {
+commonTestFlag?: () => boolean;
+commonTestFlagWithoutNativeImplementation?: () => boolean;
+animatedShouldSignalBatch?: () => boolean;
+cxxNativeAnimatedEnabled?: () => boolean;
+cxxNativeAnimatedRemoveJsSync?: () => boolean;
+disableMainQueueSyncDispatchIOS?: () => boolean;
@@ -1,123 +0,0 @@
/**
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @fantom_flags enableSynchronousStateUpdates:true
* @flow strict-local
* @format
*/
import '@react-native/fantom/src/setUpDefaultReactNativeEnvironment';
import type {HostInstance} from 'react-native';
import ensureInstance from '../../../__tests__/utilities/ensureInstance';
import * as Fantom from '@react-native/fantom';
import * as React from 'react';
import {useLayoutEffect, useState} from 'react';
import {ScrollView, View} from 'react-native';
import ReactNativeElement from 'react-native/src/private/webapis/dom/nodes/ReactNativeElement';
function TestComponent({
triggerIntermediateState,
simulateUIThreadCommit = false,
}: {
triggerIntermediateState: boolean,
simulateUIThreadCommit?: boolean,
}): React.Node {
const scrollViewRef = React.useRef<?HostInstance>();
const [intermediateStateTriggered, setIntermediateStateTriggered] =
useState(false);
useLayoutEffect(() => {
if (triggerIntermediateState) {
setIntermediateStateTriggered(true);
} else {
setIntermediateStateTriggered(false);
}
// Simulate a commit from the IU thread after the commit that triggered
// this after, but before the commit that processes the state update in
// this effect.
if (simulateUIThreadCommit) {
const node = ensureInstance(scrollViewRef.current, ReactNativeElement);
Fantom.runOnUIThread(() => {
Fantom.enqueueScrollEvent(node, {x: 0, y: 10});
});
}
}, [simulateUIThreadCommit, triggerIntermediateState]);
const isIntermediateState =
triggerIntermediateState && !intermediateStateTriggered;
return (
<ScrollView nativeID="parent" ref={scrollViewRef}>
<View
nativeID={
isIntermediateState
? 'intermediate-state-should-not-be-visible'
: 'view'
}
/>
</ScrollView>
);
}
/**
* This test describes an existing bug in Fabric where synchronous commits done
* in the UI thread can incorrectly apply mutations for intermediate commits
* from the JavaScript thread.
*/
describe('Mounting intermediate commits', () => {
it('happens when commiting from the UI thread (bug)', () => {
const root = Fantom.createRoot();
Fantom.runTask(() => {
root.render(<TestComponent triggerIntermediateState={false} />);
});
expect(root.takeMountingManagerLogs()).toEqual([
'Update {type: "RootView", nativeID: (root)}',
'Create {type: "ScrollView", nativeID: "parent"}',
'Create {type: "View", nativeID: (N/A)}',
'Create {type: "View", nativeID: "view"}',
'Insert {type: "View", parentNativeID: (N/A), index: 0, nativeID: "view"}',
'Insert {type: "View", parentNativeID: "parent", index: 0, nativeID: (N/A)}',
'Insert {type: "ScrollView", parentNativeID: (root), index: 0, nativeID: "parent"}',
]);
Fantom.runTask(() => {
root.render(<TestComponent triggerIntermediateState={true} />);
});
expect(root.takeMountingManagerLogs()).toEqual([
'Update {type: "View", nativeID: "view"}',
]);
Fantom.runTask(() => {
root.render(<TestComponent triggerIntermediateState={false} />);
});
expect(root.takeMountingManagerLogs()).toEqual([]);
Fantom.runTask(() => {
root.render(
<TestComponent
triggerIntermediateState={true}
simulateUIThreadCommit={true}
/>,
);
});
expect(root.takeMountingManagerLogs()).toEqual([
'Update {type: "ScrollView", nativeID: "parent"}',
// This should not happen and it's only visible because the update in the
// scroll view in the UI thread pulls the transactions from this
// intermediate commit.
'Update {type: "View", nativeID: "intermediate-state-should-not-be-visible"}',
'Update {type: "View", nativeID: "view"}',
]);
});
});
@@ -1,82 +0,0 @@
/**
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @flow strict-local
* @format
* @oncall react_native
*/
import '@react-native/fantom/src/setUpDefaultReactNativeEnvironment';
import * as Fantom from '@react-native/fantom';
import * as React from 'react';
import {View} from 'react-native';
import setUpIntersectionObserver from 'react-native/src/private/setup/setUpIntersectionObserver';
setUpIntersectionObserver();
describe('Fragment Refs', () => {
describe('observers', () => {
it('attaches intersection observers to children', () => {
let logs: Array<string> = [];
const root = Fantom.createRoot({
viewportHeight: 1000,
viewportWidth: 1000,
});
// $FlowFixMe[cannot-resolve-name] oss doesn't have this
const observer = new IntersectionObserver(entries => {
entries.forEach(entry => {
if (entry.isIntersecting) {
logs.push(`show:${entry.target.id}`);
} else {
logs.push(`hide:${entry.target.id}`);
}
});
});
function Test({showB}: {showB: boolean}) {
// $FlowFixMe[cannot-resolve-name] oss doesn't have this
const fragmentRef = React.useRef<null | ReactFragmentInstance>(null);
React.useEffect(() => {
fragmentRef.current?.observeUsing(observer);
const lastRefValue = fragmentRef.current;
return () => {
lastRefValue?.unobserveUsing(observer);
};
}, []);
return (
<View nativeID="parent">
{/* $FlowFixMe oss doesn't have this */}
<React.Fragment ref={fragmentRef}>
<View style={{width: 100, height: 100}} nativeID="childA" />
{showB && (
<View style={{width: 100, height: 100}} nativeID="childB" />
)}
</React.Fragment>
</View>
);
}
Fantom.runTask(() => {
root.render(<Test showB={false} />);
});
expect(logs).toEqual(['show:childA']);
// Reveal child and expect it to be observed and intersecting
logs = [];
Fantom.runTask(() => {
root.render(<Test showB={true} />);
});
expect(logs).toEqual(['show:childB']);
// Hide child and expect it to still be observed, no longer intersecting
logs = [];
Fantom.runTask(() => {
root.render(<Test showB={false} />);
});
expect(logs).toEqual(['hide:childB']);
});
});
});
@@ -7,22 +7,9 @@
#include "NativeCxxModuleExample.h"
#include <react/debug/react_native_assert.h>
#include <iomanip>
#include <ostream>
#include <sstream>
namespace facebook::react {
namespace {
std::string to_string_with_precision(double value, int precision = 2) {
std::ostringstream oss;
oss << std::setprecision(precision) << std::fixed << value;
return oss.str();
}
} // namespace
NativeCxxModuleExample::NativeCxxModuleExample(
std::shared_ptr<CallInvoker> jsInvoker)
: NativeCxxModuleExampleCxxSpec(std::move(jsInvoker)) {}
@@ -139,12 +126,10 @@ std::string NativeCxxModuleExample::getUnion(
float x,
std::string y,
jsi::Object z) {
std::string result =
"x: " + to_string_with_precision(x) + ", y: " + y + ", z: { ";
std::string result = "x: " + std::to_string(x) + ", y: " + y + ", z: { ";
if (z.hasProperty(rt, "value")) {
result += "value: ";
result +=
to_string_with_precision(z.getProperty(rt, "value").getNumber(), 0);
result += std::to_string(z.getProperty(rt, "value").getNumber());
} else if (z.hasProperty(rt, "low")) {
result += "low: ";
result += z.getProperty(rt, "low").getString(rt).utf8(rt);
@@ -216,13 +201,11 @@ void NativeCxxModuleExample::emitCustomDeviceEvent(
eventName,
[jsInvoker = jsInvoker_](
jsi::Runtime& rt, std::vector<jsi::Value>& args) {
args.emplace_back(jsi::Array::createWithElements(
rt,
jsi::Value(true),
jsi::Value(42),
jsi::String::createFromAscii(rt, "stringArg"),
bridging::toJs(
rt, CustomDeviceEvent{"one", 2, std::nullopt}, jsInvoker)));
args.emplace_back(jsi::Value(true));
args.emplace_back(jsi::Value(42));
args.emplace_back(jsi::String::createFromAscii(rt, "stringArg"));
args.emplace_back(bridging::toJs(
rt, CustomDeviceEvent{"one", 2, std::nullopt}, jsInvoker));
});
}
@@ -1,351 +0,0 @@
/**
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @flow strict-local
* @format
*/
import '@react-native/fantom/src/setUpDefaultReactNativeEnvironment';
import type {
BinaryTreeNode,
GraphNode,
ObjectStruct,
} from '../NativeCxxModuleExample';
import NativeCxxModuleExample, {
EnumInt,
EnumNone,
EnumStr,
} from '../NativeCxxModuleExample';
import RCTDeviceEventEmitter from 'react-native/Libraries/EventEmitter/RCTDeviceEventEmitter';
import NativeFantom from 'react-native/src/private/testing/fantom/specs/NativeFantom';
describe('NativeCxxModuleExample', () => {
it('verifies that the Turbo Module was loaded', () => {
expect(NativeCxxModuleExample).not.toBeNull();
});
it('verifies getArray(...) returns the correct values', () => {
expect(NativeCxxModuleExample?.getArray([])).toEqual([]);
expect(NativeCxxModuleExample?.getArray([null])).toEqual([null]);
expect(NativeCxxModuleExample?.getArray([{a: 1, b: '2'}])).toEqual([
{a: 1, b: '2'},
]);
});
it('verifies getBool(...) returns the correct values', () => {
expect(NativeCxxModuleExample?.getBool(false)).toBe(false);
expect(NativeCxxModuleExample?.getBool(true)).toBe(true);
});
it('verifies getConstants(...) returns the correct values', () => {
expect(NativeCxxModuleExample?.getConstants()).toEqual({
const1: true,
const2: 69,
const3: 'react-native',
});
});
it('verifies getCustomEnum(...) returns the correct values', () => {
expect(NativeCxxModuleExample?.getCustomEnum(EnumInt.IA)).toBe(EnumInt.IA);
});
it('verifies getCustomHostObject(...) returns the correct values', () => {
const customHostObject = NativeCxxModuleExample?.getCustomHostObject();
expect(customHostObject).not.toBe(null);
if (customHostObject != null) {
expect(
NativeCxxModuleExample?.consumeCustomHostObject(customHostObject),
).toBe('answer42');
}
});
it('verifies getBinaryTreeNode(...) returns the correct values', () => {
const binaryTreeNode: BinaryTreeNode = {
left: {value: 2},
value: 4,
right: {value: 6},
};
const result = NativeCxxModuleExample?.getBinaryTreeNode(binaryTreeNode);
expect(result).not.toBe(null);
if (result != null) {
expect(result.left?.left).toBeNull();
expect(result.left?.value).toBe(2);
expect(result.left?.right).toBeNull();
expect(result.value).toBe(4);
expect(result.right?.left).toBeNull();
expect(result.right?.value).toBe(6);
expect(result.right?.right).toBeNull();
}
});
it('verifies getGraphNode(...) returns the correct values', () => {
const graphNode: GraphNode = {
label: 'root',
neighbors: [{label: 'child1'}, {label: 'child2'}],
};
const result = NativeCxxModuleExample?.getGraphNode(graphNode);
expect(result).not.toBe(null);
if (result != null) {
expect(result.label).toBe('root');
expect(result.neighbors?.length).toBe(4);
expect(result.neighbors?.[0].label).toBe('child1');
expect(result.neighbors?.[0].neighbors).toBeNull();
expect(result.neighbors?.[1].label).toBe('child2');
expect(result.neighbors?.[1].neighbors).toBeNull();
expect(result.neighbors?.[2].label).toBe('top');
expect(result.neighbors?.[2].neighbors).toBeNull();
expect(result.neighbors?.[3].label).toBe('down');
expect(result.neighbors?.[3].neighbors).toBeNull();
}
});
it('verifies getNumEnum(...) returns the correct values', () => {
expect(NativeCxxModuleExample?.getNumEnum(EnumInt.IA)).toBe(EnumInt.IA);
expect(NativeCxxModuleExample?.getNumEnum(EnumInt.IB)).toBe(EnumInt.IB);
});
it('verifies getStrEnum(...) returns the correct values', () => {
expect(NativeCxxModuleExample?.getStrEnum(EnumNone.NA)).toBe(EnumStr.SB);
expect(NativeCxxModuleExample?.getStrEnum(EnumNone.NB)).toBe(EnumStr.SB);
});
it('verifies getMap(...) returns the correct values', () => {
expect(NativeCxxModuleExample?.getMap({a: 0, b: null, c: 3})).toEqual({
a: 0,
b: null,
c: 3,
});
});
it('verifies getNumber(...) returns the correct values', () => {
expect(NativeCxxModuleExample?.getNumber(0)).toBe(0);
expect(NativeCxxModuleExample?.getNumber(Math.pow(2, 53))).toBe(
Math.pow(2, 53),
);
});
it('verifies getObject(...) returns the correct values', () => {
expect(NativeCxxModuleExample?.getObject({a: 2, b: 'two'})).toEqual({
a: 2,
b: 'two',
});
expect(
NativeCxxModuleExample?.getObject({a: 4, b: 'four', c: 'seven'}),
).toEqual({a: 4, b: 'four', c: 'seven'});
});
it('verifies getSet(...) returns the correct values', () => {
expect(NativeCxxModuleExample?.getSet([1, 2, 3, 3, 3])).toEqual([1, 2, 3]);
});
it('verifies getString(...) returns the correct values', () => {
expect(NativeCxxModuleExample?.getString('')).toBe('');
expect(NativeCxxModuleExample?.getString('string')).toBe('string');
});
it('verifies getUnion(...) returns the correct values', () => {
expect(NativeCxxModuleExample?.getUnion(2.88, 'Two', {value: 2})).toBe(
'x: 2.88, y: Two, z: { value: 2 }',
);
expect(NativeCxxModuleExample?.getUnion(5.76, 'One', {low: 'value'})).toBe(
'x: 5.76, y: One, z: { low: value }',
);
});
it('verifies getValue(...) returns the correct values', () => {
expect(
NativeCxxModuleExample?.getValue(23, 'forty-two', {
a: 4,
b: 'four',
c: 'seven',
}),
).toEqual({x: 23, y: 'forty-two', z: {a: 4, b: 'four', c: 'seven'}});
});
it('verifies getValueWithCallback(...) returns the correct values', () => {
let result = '';
NativeCxxModuleExample?.getValueWithCallback((value: string) => {
result = value;
});
NativeFantom.flushMessageQueue(); // Flush the message queue to execute the callback
expect(result).toBe('value from callback!');
});
it('verifies setValueCallbackWithSubscription(...) returns the correct values', () => {
let result = '';
let subscription = NativeCxxModuleExample?.setValueCallbackWithSubscription(
(value: string) => {
result = value;
},
);
expect(result).toBe('');
expect(subscription).not.toBeNull();
subscription?.();
NativeFantom.flushMessageQueue(); // Flush the message queue to execute the callback
expect(result).toBe('value from callback on clean up!');
});
it('verifies getValueWithPromise(...) returns the correct values', () => {
{
let result = '';
let error = '';
NativeCxxModuleExample?.getValueWithPromise(false)
.then(value => {
result = value;
})
.catch(err => {
error = err;
});
NativeFantom.flushMessageQueue(); // Flush the message queue to execute the callbacks
expect(result).toBe('result!');
expect(error).toBe('');
}
{
let result = '';
let error = '';
NativeCxxModuleExample?.getValueWithPromise(true)
.then(value => {
result = value;
})
.catch(err => {
error = err;
});
NativeFantom.flushMessageQueue(); // Flush the message queue to execute the callbacks
expect(result).toBe('');
expect(error.toString()).toBe('Error: intentional promise rejection');
}
it('verifies getWithWithOptionalArgs(...) returns the correct values', () => {
expect(NativeCxxModuleExample?.getWithWithOptionalArgs()).toBeNull();
expect(NativeCxxModuleExample?.getWithWithOptionalArgs(true)).toBe(true);
expect(NativeCxxModuleExample?.getWithWithOptionalArgs(false)).toBe(
false,
);
});
it('verifies voidFunc(...) returns the correct for EventEmitters', () => {
let eventEmitterCalled = {
onPress: 0,
onClick: 0,
onChange: 0,
onSubmit: 0,
onEvent: 0,
};
let onClickValue: ?string = null;
let onChangeValue: ?ObjectStruct = null;
let onSubmitValue: ?(ObjectStruct[]) = null;
let onEventValue: ?EnumNone = null;
NativeCxxModuleExample?.onPress(() => {
eventEmitterCalled.onPress++;
});
NativeCxxModuleExample?.onClick((value: string) => {
eventEmitterCalled.onClick++;
onClickValue = value;
});
NativeCxxModuleExample?.onChange((value: ObjectStruct) => {
eventEmitterCalled.onChange++;
onChangeValue = value;
});
NativeCxxModuleExample?.onSubmit((value: ObjectStruct[]) => {
eventEmitterCalled.onSubmit++;
onSubmitValue = value;
});
NativeCxxModuleExample?.onEvent((value: EnumNone) => {
eventEmitterCalled.onEvent++;
onEventValue = value;
});
NativeCxxModuleExample?.voidFunc();
NativeFantom.flushMessageQueue(); // Flush the message queue to execute the callbacks
expect(eventEmitterCalled.onPress).toBe(1);
expect(eventEmitterCalled.onClick).toBe(1);
expect(eventEmitterCalled.onChange).toBe(1);
expect(eventEmitterCalled.onSubmit).toBe(1);
expect(eventEmitterCalled.onEvent).toBe(1);
expect(onClickValue).toBe('value from callback on click!');
expect(onChangeValue).toEqual({a: 1, b: 'two'});
expect(onSubmitValue).toEqual([
{a: 1, b: 'two'},
{a: 3, b: 'four'},
{a: 5, b: 'six'},
]);
expect(onEventValue).toBe(EnumNone.NA);
});
});
it('verifies voidPromise(...) returns the correct values', () => {
let promiseCalled = {
result: 0,
error: 0,
};
NativeCxxModuleExample?.voidPromise()
.then(_value => promiseCalled.result++)
.catch(_err => promiseCalled.error++);
NativeFantom.flushMessageQueue(); // Flush the message queue to execute the callbacks
expect(promiseCalled.result).toBe(1);
expect(promiseCalled.error).toBe(0);
});
it('verifies setMenu(...) returns the correct values', () => {
let result: {[key: string]: ?{value: string, flag: boolean}} = {
file: null,
new: null,
};
let menu = {
label: 'File',
onPress: (value: string, flag: boolean) => {
result.file = {value, flag};
},
items: [
{
label: 'new',
onPress: (value: string, flag: boolean) => {
result.new = {value, flag};
},
},
],
};
NativeCxxModuleExample?.setMenu(menu);
NativeFantom.flushMessageQueue(); // Flush the message queue to execute the callback
expect(result.file?.value).toBe('value');
expect(result.file?.flag).toBe(true);
expect(result.new?.value).toBe('another value');
expect(result.new?.flag).toBe(false);
});
it('verifies emitCustomDeviceEvent(...) returns the correct values', () => {
let events: {[key: string]: ?string} = {
foo: null,
bar: null,
};
RCTDeviceEventEmitter.addListener(
'foo',
(value: string) => (events.foo = value),
);
RCTDeviceEventEmitter.addListener(
'bar',
(value: string) => (events.bar = value),
);
NativeCxxModuleExample?.emitCustomDeviceEvent('foo');
NativeCxxModuleExample?.emitCustomDeviceEvent('bar');
NativeFantom.flushMessageQueue(); // Flush the message queue to execute the callbacks
expect(events.foo).toEqual([
true,
42,
'stringArg',
{type: 'one', level: 2},
]);
expect(events.foo).toEqual([
true,
42,
'stringArg',
{type: 'one', level: 2},
]);
});
});
@@ -21,7 +21,8 @@
#include REACT_NATIVE_APP_COMPONENT_DESCRIPTORS_HEADER
#endif
namespace facebook::react {
namespace facebook {
namespace react {
void registerComponents(
std::shared_ptr<const ComponentDescriptorProviderRegistry> registry) {
@@ -61,7 +62,8 @@ std::shared_ptr<TurboModule> javaModuleProvider(
return nullptr;
}
} // namespace facebook::react
} // namespace react
} // namespace facebook
JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM* vm, void*) {
return facebook::jni::initialize(vm, [] {
@@ -33,8 +33,6 @@ const DEBUG = false;
let _listeners: Array<(Info) => void> = [];
let _minSampleCount = 10;
/* $FlowFixMe[constant-condition] Error discovered during Constant Condition
* roll out. See https://fburl.com/workplace/1v97vimq. */
let _sampleRate = DEBUG ? 1 : null;
/**
@@ -84,8 +82,6 @@ class FillRateHelper {
activate() {
if (this._enabled && this._samplesStartTime == null) {
/* $FlowFixMe[constant-condition] Error discovered during Constant
* Condition roll out. See https://fburl.com/workplace/1v97vimq. */
DEBUG && console.debug('FillRateHelper: activate');
this._samplesStartTime = global.performance.now();
}
@@ -97,8 +93,6 @@ class FillRateHelper {
}
const start = this._samplesStartTime; // const for flow
if (start == null) {
/* $FlowFixMe[constant-condition] Error discovered during Constant
* Condition roll out. See https://fburl.com/workplace/1v97vimq. */
DEBUG &&
console.debug('FillRateHelper: bail on deactivate with no start time');
return;
@@ -113,8 +107,6 @@ class FillRateHelper {
...this._info,
total_time_spent,
};
/* $FlowFixMe[constant-condition] Error discovered during Constant
* Condition roll out. See https://fburl.com/workplace/1v97vimq. */
if (DEBUG) {
const derived = {
avg_blankness: this._info.pixels_blank / this._info.pixels_sampled,
@@ -279,8 +279,6 @@ class VirtualizedList extends StateSafePureComponent<
const cartOffset = this._listMetrics.cartesianOffset(
offset + this._scrollMetrics.visibleLength,
);
/* $FlowFixMe[constant-condition] Error discovered during Constant
* Condition roll out. See https://fburl.com/workplace/1v97vimq. */
return horizontal ? {x: cartOffset} : {y: cartOffset};
} else {
return horizontal ? {x: offset} : {y: offset};

Some files were not shown because too many files have changed in this diff Show More