From 663a9c1b15892198c036c85b11cb6012f9f02f9a Mon Sep 17 00:00:00 2001 From: Ramanpreet Nara Date: Mon, 5 Jan 2026 10:58:51 -0800 Subject: [PATCH 001/585] Refactor: Rename installJSIBindings (#54975) Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/54975 I think dispatchJSBindingInstall is a more apt name. This will help align ios and android. On ios, installJSBindings is a function that executes on the js thread, with a runtime pointer. Changelog: [Internal] Reviewed By: javache Differential Revision: D89709221 fbshipit-source-id: 1c4465876d9da404ebb1eba0d384d89e03ae1f10 --- .../turbomodule/core/TurboModuleManager.kt | 4 ++-- .../ReactCommon/TurboModuleManager.cpp | 19 +++++++++++++------ .../ReactCommon/TurboModuleManager.h | 3 ++- 3 files changed, 17 insertions(+), 9 deletions(-) diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/turbomodule/core/TurboModuleManager.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/turbomodule/core/TurboModuleManager.kt index 3c518d65731..5a55e7c8050 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/turbomodule/core/TurboModuleManager.kt +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/turbomodule/core/TurboModuleManager.kt @@ -59,7 +59,7 @@ public class TurboModuleManager( init { - installJSIBindings(runtimeExecutor) + dispatchJSBindingInstall(runtimeExecutor) eagerInitModuleNames = delegate?.getEagerInitModuleNames() ?: emptyList() @@ -282,7 +282,7 @@ public class TurboModuleManager( tmmDelegate: TurboModuleManagerDelegate?, ): HybridData - private external fun installJSIBindings(runtimeExecutor: RuntimeExecutor) + private external fun dispatchJSBindingInstall(runtimeExecutor: RuntimeExecutor) override fun invalidate() { /* diff --git a/packages/react-native/ReactAndroid/src/main/jni/react/turbomodule/ReactCommon/TurboModuleManager.cpp b/packages/react-native/ReactAndroid/src/main/jni/react/turbomodule/ReactCommon/TurboModuleManager.cpp index d8c7e343eb9..5d4600e6c8a 100644 --- a/packages/react-native/ReactAndroid/src/main/jni/react/turbomodule/ReactCommon/TurboModuleManager.cpp +++ b/packages/react-native/ReactAndroid/src/main/jni/react/turbomodule/ReactCommon/TurboModuleManager.cpp @@ -118,7 +118,8 @@ void TurboModuleManager::registerNatives() { registerHybrid({ makeNativeMethod("initHybrid", TurboModuleManager::initHybrid), makeNativeMethod( - "installJSIBindings", TurboModuleManager::installJSIBindings), + "dispatchJSBindingInstall", + TurboModuleManager::dispatchJSBindingInstall), }); } @@ -318,7 +319,16 @@ std::shared_ptr TurboModuleManager::getLegacyModule( return nullptr; } -void TurboModuleManager::installJSIBindings( +void TurboModuleManager::installJSBindings( + jsi::Runtime& runtime, + jni::alias_ref javaPart) { + TurboModuleBinding::install( + runtime, + createTurboModuleProvider(javaPart), + createLegacyModuleProvider(javaPart)); +} + +void TurboModuleManager::dispatchJSBindingInstall( jni::alias_ref javaPart, jni::alias_ref runtimeExecutor) { auto cxxPart = javaPart->cthis(); @@ -328,10 +338,7 @@ void TurboModuleManager::installJSIBindings( runtimeExecutor->cthis()->get()( [javaPart = jni::make_global(javaPart)](jsi::Runtime& runtime) { - TurboModuleBinding::install( - runtime, - createTurboModuleProvider(javaPart), - createLegacyModuleProvider(javaPart)); + installJSBindings(runtime, javaPart); }); } diff --git a/packages/react-native/ReactAndroid/src/main/jni/react/turbomodule/ReactCommon/TurboModuleManager.h b/packages/react-native/ReactAndroid/src/main/jni/react/turbomodule/ReactCommon/TurboModuleManager.h index f8b6e403273..c520373f689 100644 --- a/packages/react-native/ReactAndroid/src/main/jni/react/turbomodule/ReactCommon/TurboModuleManager.h +++ b/packages/react-native/ReactAndroid/src/main/jni/react/turbomodule/ReactCommon/TurboModuleManager.h @@ -55,7 +55,8 @@ class TurboModuleManager : public jni::HybridClass { std::shared_ptr nativeMethodCallInvoker, jni::alias_ref delegate); - static void installJSIBindings( + static void installJSBindings(jsi::Runtime &runtime, jni::alias_ref javaPart); + static void dispatchJSBindingInstall( jni::alias_ref javaPart, jni::alias_ref runtimeExecutor); From 749b8f6cf762bca4be306d351db0ea219d7997b7 Mon Sep 17 00:00:00 2001 From: Riccardo Cipolleschi Date: Mon, 5 Jan 2026 11:31:28 -0800 Subject: [PATCH 002/585] Update HERMES_V1_VERSION_NAME to 250829098.0.5 (#55042) Summary: We released a new version of Hermes V1 and we need `main` to point to that version ## Changelog: [Internal] - Make React Native point to the Hermes V1 .0.5 Pull Request resolved: https://github.com/facebook/react-native/pull/55042 Test Plan: GHA Reviewed By: cortinico Differential Revision: D90118293 Pulled By: cipolleschi fbshipit-source-id: 86a78febf47ddfe97e5c4750f110671f9d3bdd0f --- packages/react-native/sdks/hermes-engine/version.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/react-native/sdks/hermes-engine/version.properties b/packages/react-native/sdks/hermes-engine/version.properties index 81629a9921c..4ff14206932 100644 --- a/packages/react-native/sdks/hermes-engine/version.properties +++ b/packages/react-native/sdks/hermes-engine/version.properties @@ -1,2 +1,2 @@ HERMES_VERSION_NAME=1000.0.0 -HERMES_V1_VERSION_NAME=250829098.0.1 +HERMES_V1_VERSION_NAME=250829098.0.5 From 90e48d6031de3188a71157fe22d80b138a8d7605 Mon Sep 17 00:00:00 2001 From: Samuel Newman Date: Mon, 5 Jan 2026 11:46:16 -0800 Subject: [PATCH 003/585] Capture idle callback before running it (#54984) Summary: Fixes https://github.com/facebook/react-native/issues/54983 https://github.com/facebook/react-native/issues/54983 has more details, but in short, this code here: ```kotlin currentIdleCallbackRunnable?.cancel() currentIdleCallbackRunnable = IdleCallbackRunnable(frameTimeNanos) reactApplicationContext.runOnJSQueueThread(currentIdleCallbackRunnable) ``` If `currentIdleCallbackRunnable` change between line 2 and line 3 (which is known to happen), the wrong runnable would be sent to be run. The fix is to simply capture it in a local variable before passing it to be run ```kotlin currentIdleCallbackRunnable?.cancel() val idleCallbackRunnable = IdleCallbackRunnable(frameTimeNanos) currentIdleCallbackRunnable = idleCallbackRunnable reactApplicationContext.runOnJSQueueThread(idleCallbackRunnable) ``` ## Changelog: [ANDROID] [FIXED] - Capture idle callback before running it Pull Request resolved: https://github.com/facebook/react-native/pull/54984 Test Plan: Unfortunately this is a pretty speculative change. That said, since the change is so simple, the worst thing that can happen is nothing. I have also run it in production here with no known issues https://github.com/bluesky-social/social-app/pull/9436 Reviewed By: cortinico Differential Revision: D90120471 Pulled By: lunaleaps fbshipit-source-id: c853a976be999fa883a5835fd5e8ac75a8699681 --- .../com/facebook/react/modules/core/JavaTimerManager.kt | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/modules/core/JavaTimerManager.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/modules/core/JavaTimerManager.kt index 36116d46dda..9c3df748c47 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/modules/core/JavaTimerManager.kt +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/modules/core/JavaTimerManager.kt @@ -327,9 +327,11 @@ public open class JavaTimerManager( // If the JS thread is busy for multiple frames we cancel any other pending runnable. // We also capture the idleCallbackRunnable to tentatively fix: // https://github.com/facebook/react-native/issues/44842 + // https://github.com/facebook/react-native/issues/54983 currentIdleCallbackRunnable?.cancel() - currentIdleCallbackRunnable = IdleCallbackRunnable(frameTimeNanos) - reactApplicationContext.runOnJSQueueThread(currentIdleCallbackRunnable) + val idleCallbackRunnable = IdleCallbackRunnable(frameTimeNanos) + currentIdleCallbackRunnable = idleCallbackRunnable + reactApplicationContext.runOnJSQueueThread(idleCallbackRunnable) reactChoreographer.postFrameCallback(ReactChoreographer.CallbackType.IDLE_EVENT, this) } } From dfcb56dfea3b71a091e2b84bd27b1ca7bde7724f Mon Sep 17 00:00:00 2001 From: David Vacca Date: Mon, 5 Jan 2026 11:52:30 -0800 Subject: [PATCH 004/585] Add KDoc documentation to GuardedFrameCallback (#55022) Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/55022 Added comprehensive KDoc comments to GuardedFrameCallback.kt to document all public constructors and the doFrame method. The documentation explains the exception handling behavior, constructor parameters, and frame callback implementation. changelog: [Android][Changed] Updated documentation for GuardedFrameCallback class Reviewed By: cortinico Differential Revision: D90043453 fbshipit-source-id: 124965af92b8435feca055e59c6a2cb81064e90a --- .../react/uimanager/GuardedFrameCallback.kt | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/GuardedFrameCallback.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/GuardedFrameCallback.kt index 6d1f5e9c288..e871a7928ff 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/GuardedFrameCallback.kt +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/GuardedFrameCallback.kt @@ -14,12 +14,29 @@ import com.facebook.react.bridge.ReactContext /** * Abstract base for a Choreographer FrameCallback that should have any RuntimeExceptions it throws * handled by the [JSExceptionHandler] registered if the app is in dev mode. + * + * @property exceptionHandler The handler for RuntimeExceptions thrown during frame callbacks. + * @constructor Creates a GuardedFrameCallback with the specified exception handler. */ public abstract class GuardedFrameCallback protected constructor(private val exceptionHandler: JSExceptionHandler) : Choreographer.FrameCallback { + /** + * Creates a GuardedFrameCallback using the exception handler from the provided ReactContext. + * + * @param reactContext The React context whose exception handler will be used. + */ protected constructor(reactContext: ReactContext) : this(reactContext.exceptionHandler) + /** + * Choreographer frame callback implementation that guards [doFrameGuarded] with exception + * handling. + * + * Wraps calls to [doFrameGuarded] in a try-catch block. Any RuntimeExceptions thrown are caught + * and passed to the exception handler instead of crashing the app. + * + * @param frameTimeNanos The time in nanoseconds when the frame started being rendered. + */ public override fun doFrame(frameTimeNanos: Long) { try { doFrameGuarded(frameTimeNanos) From 36a0d9ef63b5ecb1cdf62d6d56b420f484bfa037 Mon Sep 17 00:00:00 2001 From: Peter Abbondanzo Date: Mon, 5 Jan 2026 16:55:20 -0800 Subject: [PATCH 005/585] Mark setAccessibilityFocus as deprecated (#54968) Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/54968 The `AccessibilityInfo.setAccessibilityFocus` API is unsupported in the new architecture and a perfectly valid alternative exists that *is* supported: `AccessibilityInfo.sendAccessibilityEvent`. This change marks the prior as deprecated with a code comment pointing to the new API and adds a missing type to the `AccessibilityEventTypes` type signature for `windowStateChange` Changelog: [General][Deprecated] - Deprecated `AccessibilityInfo.setAccessibilityFocus` in favor of `AccessibilityInfo.sendAccessibilityEvent` Reviewed By: mdvacca Differential Revision: D89729103 fbshipit-source-id: 4e55adb9a7ae7ba773e1e258359e67106488bee3 --- .../Components/AccessibilityInfo/AccessibilityInfo.js | 8 +++++++- packages/react-native/ReactNativeApi.d.ts | 10 +++++++--- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/packages/react-native/Libraries/Components/AccessibilityInfo/AccessibilityInfo.js b/packages/react-native/Libraries/Components/AccessibilityInfo/AccessibilityInfo.js index 69473b4f767..9e1d236c928 100644 --- a/packages/react-native/Libraries/Components/AccessibilityInfo/AccessibilityInfo.js +++ b/packages/react-native/Libraries/Components/AccessibilityInfo/AccessibilityInfo.js @@ -42,7 +42,11 @@ type AccessibilityEventDefinitions = { screenReaderChanged: [boolean], }; -type AccessibilityEventTypes = 'click' | 'focus' | 'viewHoverEnter'; +type AccessibilityEventTypes = + | 'click' + | 'focus' + | 'viewHoverEnter' + | 'windowStateChange'; // Mapping of public event names to platform-specific event names. const EventNames: Map< @@ -438,6 +442,8 @@ const AccessibilityInfo = { * Set accessibility focus to a React component. * * See https://reactnative.dev/docs/accessibilityinfo#setaccessibilityfocus + * + * @deprecated Use `sendAccessibilityEvent` with eventType `focus` instead. */ setAccessibilityFocus(reactTag: number): void { legacySendAccessibilityEvent(reactTag, 'focus'); diff --git a/packages/react-native/ReactNativeApi.d.ts b/packages/react-native/ReactNativeApi.d.ts index 1663252c3ed..be0534addca 100644 --- a/packages/react-native/ReactNativeApi.d.ts +++ b/packages/react-native/ReactNativeApi.d.ts @@ -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<> + * @generated SignedSource<<9504863966549f8efbbe4e13d7f74eaf>> * * This file was generated by scripts/js-api/build-types/index.js. */ @@ -1076,7 +1076,11 @@ declare type AccessibilityEventDefinitionsIOS = { invertColorsChanged: [boolean] reduceTransparencyChanged: [boolean] } -declare type AccessibilityEventTypes = "click" | "focus" | "viewHoverEnter" +declare type AccessibilityEventTypes = + | "click" + | "focus" + | "viewHoverEnter" + | "windowStateChange" declare type AccessibilityInfo = typeof AccessibilityInfo declare type AccessibilityProps = Readonly< AccessibilityPropsAndroid & @@ -5954,7 +5958,7 @@ declare type WrapperComponentProvider = ( ) => React.ComponentType export { AccessibilityActionEvent, // f6181a2c - AccessibilityInfo, // ce4850e1 + AccessibilityInfo, // 3e373fdc AccessibilityProps, // 5a2836fc AccessibilityRole, // f2f2e066 AccessibilityState, // b0c2b3f7 From 6587beab88120c8f8d3563e1bb4740e8359391e9 Mon Sep 17 00:00:00 2001 From: Pierre Moulon Date: Tue, 6 Jan 2026 03:23:09 -0800 Subject: [PATCH 006/585] Fixing typos (#55047) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/55047 Changelog: [Internal] Fixed typos found through comprehensive recursive scan of the react-native-github directory. **Fixed typos:** 1. "accomodate" → "accommodate" in CHANGELOG-0.6x.md 2. "occured" → "occurred" in LaunchUtils.js 3. "compatability" → "compatibility" in 7 Renderer files 4. "recieved" → "received" in PointerEvent test files (6 instances) 5. "seperated" → "separated" in ImageExample.js **Total: 16 typo instances fixed across 10 files** All typos were found by scanning ~3000 text files (excluding dist/third-party/node_modules) using pattern matching for common misspellings. Reviewed By: javache Differential Revision: D89799362 fbshipit-source-id: 73e9123dc0bae3c1ce8e374f4752404ab7345347 --- .github/workflow-scripts/generateChangelog.js | 4 ++-- CHANGELOG-0.6x.md | 2 +- .../__tests__/__snapshots__/dotslash-test.js.snap | 2 +- .../debugger-shell/src/node/private/LaunchUtils.js | 2 +- .../Libraries/Animated/__tests__/Animated-itest.js | 6 +++--- .../Libraries/Animated/__tests__/Animated-test.js | 2 +- .../Animated/__tests__/AnimatedBackend-itest.js | 12 ++++++------ .../implementations/ReactNativeRenderer-dev.js | 5 +++-- .../implementations/ReactNativeRenderer-prod.js | 5 +++-- .../implementations/ReactNativeRenderer-profiling.js | 5 +++-- .../Libraries/Renderer/shims/ReactNative.js | 5 +++-- .../renderer/components/view/tests/LayoutTest.cpp | 2 +- .../runtimescheduler/tests/RuntimeSchedulerTest.cpp | 2 +- .../PointerEventPointerCancelTouch.js | 8 ++++---- .../PointerEventPointerOverOut.js | 8 ++++---- packages/rn-tester/js/examples/Image/ImageExample.js | 2 +- 16 files changed, 38 insertions(+), 34 deletions(-) diff --git a/.github/workflow-scripts/generateChangelog.js b/.github/workflow-scripts/generateChangelog.js index fc7a9c1794d..2b01a5f8ccb 100644 --- a/.github/workflow-scripts/generateChangelog.js +++ b/.github/workflow-scripts/generateChangelog.js @@ -45,8 +45,8 @@ function _generateChangelog(previousVersion, version, token) { run('git checkout main'); run('git fetch'); run('git pull origin main'); - const generateChangelogComand = `npx @rnx-kit/rn-changelog-generator --base v${previousVersion} --compare v${version} --repo . --changelog ./CHANGELOG.md --token ${token}`; - run(generateChangelogComand); + const generateChangelogCommand = `npx @rnx-kit/rn-changelog-generator --base v${previousVersion} --compare v${version} --repo . --changelog ./CHANGELOG.md --token ${token}`; + run(generateChangelogCommand); } function _pushCommit(version) { diff --git a/CHANGELOG-0.6x.md b/CHANGELOG-0.6x.md index 8e4e433af8e..9cf3b2b4018 100644 --- a/CHANGELOG-0.6x.md +++ b/CHANGELOG-0.6x.md @@ -606,7 +606,7 @@ This file contains all changelogs for releases in the 0.60-0.69 range. Please ch - Fix crash on ReactEditText with AppCompat 1.4.0 ([e21f8ec349](https://github.com/facebook/react-native/commit/e21f8ec34984551f87a306672160cc88e67e4793) by [@cortinico](https://github.com/cortinico)) - Do not .lowerCase the library name when codegenerating TurboModule Specs ([28aeb7b865](https://github.com/facebook/react-native/commit/28aeb7b8659b38ee3a27fae213c4d0800f4d7e31) by [@cortinico](https://github.com/cortinico)) - Enable hitSlop to be set using a single number. ([a96bdb7154](https://github.com/facebook/react-native/commit/a96bdb7154b0d8c7f43977d8a583e8d2cbdcb795) by [@javache](https://github.com/javache)) -- Updated TextInput prop types to accomodate for new autoComplete values ([9eb0881c8f](https://github.com/facebook/react-native/commit/9eb0881c8fecd0e974b1cb9f479bad3075854340) by [@TheWirv](https://github.com/TheWirv)) +- Updated TextInput prop types to accommodate for new autoComplete values ([9eb0881c8f](https://github.com/facebook/react-native/commit/9eb0881c8fecd0e974b1cb9f479bad3075854340) by [@TheWirv](https://github.com/TheWirv)) - Don't reconstruct app components https://github.com/facebook/react-native/issues/25040 ([fc962c9b6c](https://github.com/facebook/react-native/commit/fc962c9b6c4bf9f88decbe014ab9a9d5c1cf51bc) by [@Somena1](https://github.com/Somena1)) - Do NOT skip the first child view in the scroll view group when measuring the lower and upper bounds for snapping. ([61e1b6f86c](https://github.com/facebook/react-native/commit/61e1b6f86cf98d8a74eeb9353143fe0c624fe6e6) by [@ryancat](https://github.com/ryancat)) - Fix crash when a Switch is initialised with both backgroundColor and thumbColor. ([456cf3db14](https://github.com/facebook/react-native/commit/456cf3db14c443c483d63aa97c88b45ffd25799b) by [@smarki](https://github.com/smarki)) diff --git a/packages/debugger-shell/__tests__/__snapshots__/dotslash-test.js.snap b/packages/debugger-shell/__tests__/__snapshots__/dotslash-test.js.snap index cda13942506..d8d8f165e0a 100644 --- a/packages/debugger-shell/__tests__/__snapshots__/dotslash-test.js.snap +++ b/packages/debugger-shell/__tests__/__snapshots__/dotslash-test.js.snap @@ -3,7 +3,7 @@ exports[`prepareDebuggerShellFromDotSlashFile fails with the expected error message for a missing dotslash file 1`] = ` Object { "code": "unexpected_error", - "humanReadableMessage": "An unexpected error occured while installing the latest version of React Native DevTools. Using a fallback version instead.", + "humanReadableMessage": "An unexpected error occurred while installing the latest version of React Native DevTools. Using a fallback version instead.", "verboseInfo": Any, } `; diff --git a/packages/debugger-shell/src/node/private/LaunchUtils.js b/packages/debugger-shell/src/node/private/LaunchUtils.js index a0692f64ee0..5972f2841b6 100644 --- a/packages/debugger-shell/src/node/private/LaunchUtils.js +++ b/packages/debugger-shell/src/node/private/LaunchUtils.js @@ -89,7 +89,7 @@ async function prepareDebuggerShellFromDotSlashFile( return { code: 'unexpected_error', humanReadableMessage: - 'An unexpected error occured while installing the latest version of React Native DevTools. ' + + 'An unexpected error occurred while installing the latest version of React Native DevTools. ' + 'Using a fallback version instead.', verboseInfo: stderr, }; diff --git a/packages/react-native/Libraries/Animated/__tests__/Animated-itest.js b/packages/react-native/Libraries/Animated/__tests__/Animated-itest.js index 7886bd8ca06..6a4c856dcda 100644 --- a/packages/react-native/Libraries/Animated/__tests__/Animated-itest.js +++ b/packages/react-native/Libraries/Animated/__tests__/Animated-itest.js @@ -74,7 +74,7 @@ test('moving box by 100 points', () => { Fantom.unstable_produceFramesForDuration(500); // Animation is completed now. C++ Animated will commit the final position to the shadow tree. - // TODO(T232605345): this shouldn't be neccessary once we fix Android's race condition. + // TODO(T232605345): this shouldn't be necessary once we fix Android's race condition. Fantom.runWorkLoop(); expect(viewElement.getBoundingClientRect().x).toBe(100); }); @@ -251,7 +251,7 @@ test('animated opacity', () => { 0, ); - // TODO: this shouldn't be neccessary since animation should be stopped after duration + // TODO: this shouldn't be necessary since animation should be stopped after duration Fantom.runTask(() => { _opacityAnimation?.stop(); }); @@ -559,7 +559,7 @@ test('animate layout props', () => { Fantom.unstable_produceFramesForDuration(10); - // TODO: this shouldn't be neccessary since animation should be stopped after duration + // TODO: this shouldn't be necessary since animation should be stopped after duration Fantom.runTask(() => { _heightAnimation?.stop(); }); diff --git a/packages/react-native/Libraries/Animated/__tests__/Animated-test.js b/packages/react-native/Libraries/Animated/__tests__/Animated-test.js index 3e3f3f4cdcb..6ef62d4af32 100644 --- a/packages/react-native/Libraries/Animated/__tests__/Animated-test.js +++ b/packages/react-native/Libraries/Animated/__tests__/Animated-test.js @@ -701,7 +701,7 @@ describe('Animated', () => { expect(cb).toBeCalledWith({finished: true}); }); - it('parellelizes well', () => { + it('parallelizes well', () => { const anim1 = {start: jest.fn()}; const anim2 = {start: jest.fn()}; const cb = jest.fn(); diff --git a/packages/react-native/Libraries/Animated/__tests__/AnimatedBackend-itest.js b/packages/react-native/Libraries/Animated/__tests__/AnimatedBackend-itest.js index e36beafdfe3..36c29ace08b 100644 --- a/packages/react-native/Libraries/Animated/__tests__/AnimatedBackend-itest.js +++ b/packages/react-native/Libraries/Animated/__tests__/AnimatedBackend-itest.js @@ -65,7 +65,7 @@ test('animated opacity', () => { 0, ); - // TODO: this shouldn't be neccessary since animation should be stopped after duration + // TODO: this shouldn't be necessary since animation should be stopped after duration Fantom.runTask(() => { _opacityAnimation?.stop(); }); @@ -132,7 +132,7 @@ test('animate layout props', () => { Fantom.unstable_produceFramesForDuration(100); - // TODO: this shouldn't be neccessary since animation should be stopped after duration + // TODO: this shouldn't be necessary since animation should be stopped after duration Fantom.runTask(() => { _heightAnimation?.stop(); }); @@ -199,7 +199,7 @@ test('animate layout props and rerender', () => { Fantom.unstable_produceFramesForDuration(500); - // TODO: this shouldn't be neccessary since animation should be stopped after duration + // TODO: this shouldn't be necessary since animation should be stopped after duration Fantom.runTask(() => { _heightAnimation?.stop(); }); @@ -290,7 +290,7 @@ test('animate non-layout props and rerender', () => { Fantom.unstable_produceFramesForDuration(500); - // TODO: this shouldn't be neccessary since animation should be stopped after duration + // TODO: this shouldn't be necessary since animation should be stopped after duration Fantom.runTask(() => { _opacityAnimation?.stop(); }); @@ -394,7 +394,7 @@ test('animate layout props and rerender in many components', () => { _setWidth(200); }); - // TODO: this shouldn't be neccessary since animation should be stopped after duration + // TODO: this shouldn't be necessary since animation should be stopped after duration Fantom.runTask(() => { _heightAnimation?.stop(); }); @@ -469,7 +469,7 @@ test('animate width, height and opacity at once', () => { Fantom.unstable_produceFramesForDuration(100); - // TODO: this shouldn't be neccessary since animation should be stopped after duration + // TODO: this shouldn't be necessary since animation should be stopped after duration Fantom.runTask(() => { _parallelAnimation?.stop(); }); diff --git a/packages/react-native/Libraries/Renderer/implementations/ReactNativeRenderer-dev.js b/packages/react-native/Libraries/Renderer/implementations/ReactNativeRenderer-dev.js index 800f2aa14e8..62b3f4a3b63 100644 --- a/packages/react-native/Libraries/Renderer/implementations/ReactNativeRenderer-dev.js +++ b/packages/react-native/Libraries/Renderer/implementations/ReactNativeRenderer-dev.js @@ -7,9 +7,10 @@ * @noflow * @nolint * @preventMunge - * @generated SignedSource<<22737380b5e4280ce3563ac009164f56>> + * @generated SignedSource<> * - * This file was sync'd from the facebook/react repository. + * This file is no longer sync'd from the facebook/react repository. + * The version compatibility check is removed. Use at your own risk. */ "use strict"; diff --git a/packages/react-native/Libraries/Renderer/implementations/ReactNativeRenderer-prod.js b/packages/react-native/Libraries/Renderer/implementations/ReactNativeRenderer-prod.js index f63c8160c86..c16743495c2 100644 --- a/packages/react-native/Libraries/Renderer/implementations/ReactNativeRenderer-prod.js +++ b/packages/react-native/Libraries/Renderer/implementations/ReactNativeRenderer-prod.js @@ -7,9 +7,10 @@ * @noflow * @nolint * @preventMunge - * @generated SignedSource<<232209f5a157745637191195f25907c7>> + * @generated SignedSource<<7e40a1e09e8b18f5fde8d400a830ed9a>> * - * This file was sync'd from the facebook/react repository. + * This file is no longer sync'd from the facebook/react repository. + * The version compatibility check is removed. Use at your own risk. */ "use strict"; diff --git a/packages/react-native/Libraries/Renderer/implementations/ReactNativeRenderer-profiling.js b/packages/react-native/Libraries/Renderer/implementations/ReactNativeRenderer-profiling.js index ad2b39569a6..1c6dbcb8cb4 100644 --- a/packages/react-native/Libraries/Renderer/implementations/ReactNativeRenderer-profiling.js +++ b/packages/react-native/Libraries/Renderer/implementations/ReactNativeRenderer-profiling.js @@ -7,9 +7,10 @@ * @noflow * @nolint * @preventMunge - * @generated SignedSource<<9b111e8265a6b1d86607277dbe91d200>> + * @generated SignedSource<<3db8390cde71bdefbc682552931ec739>> * - * This file was sync'd from the facebook/react repository. + * This file is no longer sync'd from the facebook/react repository. + * The version compatibility check is removed. Use at your own risk. */ "use strict"; diff --git a/packages/react-native/Libraries/Renderer/shims/ReactNative.js b/packages/react-native/Libraries/Renderer/shims/ReactNative.js index 797bdebcaf7..8a1e9e722f1 100644 --- a/packages/react-native/Libraries/Renderer/shims/ReactNative.js +++ b/packages/react-native/Libraries/Renderer/shims/ReactNative.js @@ -7,9 +7,10 @@ * @noformat * @nolint * @flow - * @generated SignedSource<> + * @generated SignedSource<<7a063365bcf9d96b1cd8714d309e5b92>> * - * This file was sync'd from the facebook/react repository. + * This file is no longer sync'd from the facebook/react repository. + * The version compatibility check is removed. Use at your own risk. */ 'use strict'; diff --git a/packages/react-native/ReactCommon/react/renderer/components/view/tests/LayoutTest.cpp b/packages/react-native/ReactCommon/react/renderer/components/view/tests/LayoutTest.cpp index 22cf5d7c602..a5a24224d08 100644 --- a/packages/react-native/ReactCommon/react/renderer/components/view/tests/LayoutTest.cpp +++ b/packages/react-native/ReactCommon/react/renderer/components/view/tests/LayoutTest.cpp @@ -356,7 +356,7 @@ TEST_F(LayoutTest, overflowInsetTransformScaleTest) { auto layoutMetricsABC = viewShadowNodeABC_->getLayoutMetrics(); // The frame of box ABC won't actually scale up. The transform matrix is - // purely cosmatic and should apply later in mounting phase. + // purely cosmetic and should apply later in mounting phase. EXPECT_EQ(layoutMetricsABC.frame.size.width, 110); EXPECT_EQ(layoutMetricsABC.frame.size.height, 20); diff --git a/packages/react-native/ReactCommon/react/renderer/runtimescheduler/tests/RuntimeSchedulerTest.cpp b/packages/react-native/ReactCommon/react/renderer/runtimescheduler/tests/RuntimeSchedulerTest.cpp index 3cbb84532e6..f04ad51bffc 100644 --- a/packages/react-native/ReactCommon/react/renderer/runtimescheduler/tests/RuntimeSchedulerTest.cpp +++ b/packages/react-native/ReactCommon/react/renderer/runtimescheduler/tests/RuntimeSchedulerTest.cpp @@ -728,7 +728,7 @@ TEST_P(RuntimeSchedulerTest, normalTaskYieldsToSynchronousAccessAndResumes) { // the test would be flaky in a multithreaded environment. stubQueue_->waitForTasks(2); - // Normal priority task immediatelly yield in favour of the sync task. + // Normal priority task immediately yield in favour of the sync task. stubQueue_->tick(); EXPECT_EQ(stubQueue_->size(), 1); diff --git a/packages/rn-tester/js/examples/Experimental/W3CPointerEventPlatformTests/PointerEventPointerCancelTouch.js b/packages/rn-tester/js/examples/Experimental/W3CPointerEventPlatformTests/PointerEventPointerCancelTouch.js index a195230bf77..4d97b81e871 100644 --- a/packages/rn-tester/js/examples/Experimental/W3CPointerEventPlatformTests/PointerEventPointerCancelTouch.js +++ b/packages/rn-tester/js/examples/Experimental/W3CPointerEventPlatformTests/PointerEventPointerCancelTouch.js @@ -23,7 +23,7 @@ function PointerEventPointerCancelTouchTestCase( ) { const {harness} = props; - const testPointerEvent = harness.useAsyncTest('pointercancel event recieved'); + const testPointerEvent = harness.useAsyncTest('pointercancel event received'); const pointerDownEventRef = useRef(null); const pointerCancelEventRef = useRef(null); @@ -40,7 +40,7 @@ function PointerEventPointerCancelTouchTestCase( testPointerEvent.step(({assert_equals, assert_not_equals}) => { const pointerDownEvent = pointerDownEventRef.current; - assert_not_equals(pointerDownEvent, null, 'pointerdown was recieved: '); + assert_not_equals(pointerDownEvent, null, 'pointerdown was received: '); if (pointerDownEvent != null) { assert_equals( event.nativeEvent.pointerId, @@ -87,7 +87,7 @@ function PointerEventPointerCancelTouchTestCase( assert_not_equals( pointerCancelEvent, null, - 'pointercancel was recieved: ', + 'pointercancel was received: ', ); if (pointerCancelEvent != null) { assert_equals( @@ -118,7 +118,7 @@ function PointerEventPointerCancelTouchTestCase( assert_not_equals( pointerCancelEvent, null, - 'pointercancel was recieved: ', + 'pointercancel was received: ', ); if (pointerCancelEvent != null) { assert_equals( diff --git a/packages/rn-tester/js/examples/Experimental/W3CPointerEventPlatformTests/PointerEventPointerOverOut.js b/packages/rn-tester/js/examples/Experimental/W3CPointerEventPlatformTests/PointerEventPointerOverOut.js index 77152706d7a..07cde4b5992 100644 --- a/packages/rn-tester/js/examples/Experimental/W3CPointerEventPlatformTests/PointerEventPointerOverOut.js +++ b/packages/rn-tester/js/examples/Experimental/W3CPointerEventPlatformTests/PointerEventPointerOverOut.js @@ -78,7 +78,7 @@ function PointerEventPointerOverOutTestCase( assert_equals( innerOverRef.current, innerOutRef.current, - 'pointerover is recieved before pointerout', + 'pointerover is received before pointerout', ); switch (innerOverRef.current) { case 0: { @@ -144,7 +144,7 @@ function PointerEventPointerOverOutTestCase( assert_equals( outerOwnOverRef.current, outerOwnOutRef.current, - 'outer: pointerover is recieved before pointerout', + 'outer: pointerover is received before pointerout', ); outerOwnOverRef.current++; } else { @@ -167,7 +167,7 @@ function PointerEventPointerOverOutTestCase( assert_equals( outerOwnOverRef.current, outerOwnOutRef.current + 1, - 'outer: pointerout is recieved after pointerover', + 'outer: pointerout is received after pointerover', ); if (outerOwnOutRef.current === 1) { assert_equals(innerOutRef.current, 2, 'inner should be done now'); @@ -178,7 +178,7 @@ function PointerEventPointerOverOutTestCase( assert_equals( outerOutRef.current - outerOwnOutRef.current, innerOutRef.current - 1, - 'pointerout: should only recieve this via bubbling', + 'pointerout: should only receive this via bubbling', ); } }); diff --git a/packages/rn-tester/js/examples/Image/ImageExample.js b/packages/rn-tester/js/examples/Image/ImageExample.js index 357e714ef8b..d598c4ae3f0 100644 --- a/packages/rn-tester/js/examples/Image/ImageExample.js +++ b/packages/rn-tester/js/examples/Image/ImageExample.js @@ -936,7 +936,7 @@ exports.examples = [ { title: 'Multiple Image Source using the `srcSet` prop.', description: - ('A list of comma seperated uris along with scale are provided in `srcSet`.' + + ('A list of comma separated uris along with scale are provided in `srcSet`.' + 'An appropriate value will be used based on the scale of the device.': string), render: function (): React.Node { return ( From a425f4feac574a10b2be98f4d35ac8481a4e71d7 Mon Sep 17 00:00:00 2001 From: Riccardo Cipolleschi Date: Tue, 6 Jan 2026 05:21:28 -0800 Subject: [PATCH 007/585] Fix validate-dotslash-artifacts jobs (#55049) Summary: In my prs, Im seeing the validate-dotslash-artifacts job fail with the error: ``` error react-native@1000.0.0: The engine "node" is incompatible with this module. Expected version ">= 22.11.0". Got "20.19.6" error Found incompatible module. ``` This change should fix the job by setting up a compatible version of Node ## Changelog: [Internal] - Pull Request resolved: https://github.com/facebook/react-native/pull/55049 Test Plan: GHA Reviewed By: cortinico Differential Revision: D90168396 Pulled By: cipolleschi fbshipit-source-id: 8d81f37a62ca13d5e868869b488eec4ea36d17c7 --- .github/workflows/validate-dotslash-artifacts.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/validate-dotslash-artifacts.yml b/.github/workflows/validate-dotslash-artifacts.yml index 1526ee0e9cf..c1baac14097 100644 --- a/.github/workflows/validate-dotslash-artifacts.yml +++ b/.github/workflows/validate-dotslash-artifacts.yml @@ -34,6 +34,8 @@ jobs: with: fetch-depth: 0 fetch-tags: true + - name: Setup node.js + uses: ./.github/actions/setup-node - name: Install dependencies uses: ./.github/actions/yarn-install - name: Configure Git From 26da0fa50995d6ba33fbfafeb74d31e5115869c5 Mon Sep 17 00:00:00 2001 From: Intl Scheduler Date: Tue, 6 Jan 2026 05:54:26 -0800 Subject: [PATCH 008/585] translation auto-update for batch 0/61 on master Summary: Chronos Job Instance ID: 1125908215169071 Sandcastle Job Instance ID: 40532396775611237 Processed xml files: apps/fblite/xMob-android/scripts/strings/values/strings.xml apps/fblite/xMob-android/res/values/strings.xml libraries/bloks/res/values/strings.xml android_res/rendercore/res/values/strings.xml android_res/com/facebook/common/util/res/values/strings.xml android_res/com/facebook/content/res/values/strings.xml ../xplat/js/react-native-github/packages/react-native/ReactAndroid/src/main/res/views/uimanager/values/strings.xml ../xplat/js/react-native-github/packages/react-native/ReactAndroid/src/main/res/systeminfo/values/strings.xml ../xplat/js/react-native-github/packages/react-native/ReactAndroid/src/main/res/devsupport/values/strings.xml android_res/com/facebook/common/i18n/res/values/strings.xml android_res/com/facebook/common/timeformat/res/values/strings.xml android_res/com/facebook/common/strings/external/res/values/strings.xml android_res/com/facebook/common/strings/res/values/strings.xml android_res/com/facebook/fbui/widget/pagerindicator/res/values/strings.xml android_res/com/facebook/fbui/widget/contentview/strings/res/values/strings.xml android_res/com/facebookpay/widget/strings/res/values/strings.xml android_res/com/facebookpay/ecpexception/strings/res/values/strings.xml android_res/com/facebookpay/expresscheckout/strings/res/values/strings.xml android_res/com/fbpay/auth/res/values/strings.xml android_res/com/facebook/resources/res/values/strings.xml android_res/com/facebook/widget/res/values/strings.xml android_res/com/facebook/config/appspecific/res/values/strings.xml android_res/com/facebook/ui/emoji/res/values/strings.xml android_res/com/facebook/ui/emoji/common/res/values/strings.xml android_res/com/facebook/nativetemplates/res/values/strings.xml android_res/com/facebook/iorg/common/upsell/res/values/strings.xml android_res/com/facebook/iorg/common/res/values/strings.xml android_res/com/facebook/dialtone/res/values/strings.xml android_res/com/facebook/zero/messenger/semi/res/values/strings.xml android_res/com/facebook/zero/res/values/strings.xml android_res/com/facebook/zero/common/res/values/strings.xml android_res/com/facebook/widget/facepile/res/values/strings.xml android_res/com/facebook/tabbar/res/values/strings.xml android_res/com/facebook/ui/toolbar/res/values/strings.xml android_res/com/facebook/dialtone/messenger/res/values/strings.xml android_res/com/facebook/feedback/reactions/res/values/strings.xml android_res/com/facebook/ufiservices/res/values/strings.xml android_res/com/facebook/ui/edithistory/res/values/strings.xml android_res/com/facebook/pages/common/userinviter/res/values/strings.xml android_res/com/facebook/pages/common/bannedusers/res/values/strings.xml android_res/com/facebook/friending/common/res/values/strings.xml android_res/com/facebook/messaging/ui/stickerstore/res/values/strings.xml android_res/com/facebook/stickers/res/values/strings.xml android_res/com/facebook/messaging/shared/res/values/strings.xml android_res/com/facebook/caspian/res/values/strings.xml android_res/com/facebook/timeline/widget/actionbar/res/values/strings.xml android_res/com/facebook/showpages/res/values/strings.xml android_res/com/facebook/nux/res/values/strings.xml android_res/com/facebook/facecast/common/badge/res/values/strings.xml android_res/com/facebook/feedbase/res/values/strings.xml android_res/com/facebook/feedback/ui/res/values/strings.xml android_res/com/facebook/video/player/res/values/strings.xml android_res/com/facebook/spherical/res/values/strings.xml android_res/com/facebook/saved/common/res/values/strings.xml android_res/com/facebook/video/comments/res/values/strings.xml android_res/com/facebook/messaging/media/picker/res/values/strings.xml android_res/com/facebook/messaging/media/res/values/strings.xml android_res/com/facebook/messaging/res/values/strings.xml android_res/com/facebook/ui/media/contentsearch/res/values/strings.xml android_res/com/facebook/transliteration/res/values/strings.xml android_res/com/facebook/bookmark/res/values/strings.xml android_res/com/facebook/orca/res/values/strings.xml android_res/com/facebook/workshared/userstatus/donotdisturb/res/values/strings.xml android_res/com/facebook/widget/tokenizedtypeahead/res/values/strings.xml android_res/com/facebook/widget/refreshableview/res/values/strings.xml android_res/com/facebook/rtc/common/res/values/strings.xml android_res/com/facebook/payments/ui/res/values/strings.xml android_res/com/facebook/fig/mediagrid/res/values/strings.xml android_res/com/facebook/pages/app/clicktomessengerads/messagesuggestion/ui/res/values/strings.xml android_res/com/facebook/messagingneue/res/values/strings.xml android_res/com/facebook/messaging/widget/toolbar/res/values/strings.xml android_res/com/facebook/messaging/users/username/res/values/strings.xml android_res/com/facebook/messaging/tincan/messenger/res/values/strings.xml android_res/com/facebook/messaging/threadview/quickpromotion/res/values/strings.xml android_res/com/facebook/messaging/threadview/message/res/values/strings.xml android_res/com/facebook/messaging/threadview/games/res/values/strings.xml android_res/com/facebook/messaging/xma/res/values/strings.xml android_res/com/facebook/messaging/threadview/admin/res/values/strings.xml android_res/com/facebook/messaging/reactions/res/values/strings.xml android_res/com/facebook/messaging/threadview/attachment/video/res/values/strings.xml android_res/com/facebook/messaging/settings/res/values/strings.xml android_res/com/facebook/messaging/searchnullstate/res/values/strings.xml android_res/com/facebook/messenger/login/res/values/strings.xml android_res/com/facebook/messaging/promotion/res/values/strings.xml android_res/com/facebook/messaging/presence/res/values/strings.xml android_res/com/facebook/messaging/polling/adminmessage/res/values/strings.xml android_res/com/facebook/messaging/photos/view/res/values/strings.xml android_res/com/facebook/messaging/omnipicker/res/values/strings.xml android_res/com/facebook/messaging/livelocation/shared/res/values/strings.xml android_res/com/facebook/messaging/permissions/res/values/strings.xml android_res/com/facebook/messaging/invites/res/values/strings.xml android_res/com/facebook/messaging/groups/threadactions/res/values/strings.xml android_res/com/facebook/messaging/groups/admin/res/values/strings.xml android_res/com/facebook/messaging/extensions/res/values/strings.xml android_res/com/facebook/messaging/ephemeral/res/values/strings.xml android_res/com/facebook/messaging/emoji/res/values/strings.xml android_res/com/facebook/messaging/customthreads/res/values/strings.xml android_res/com/facebook/messaging/contacts/picker/res/values/strings.xml android_res/com/facebook/messaging/search/picker/res/values/strings.xml android_res/com/facebook/contacts/res/values/strings.xml allow-large-files ignore-conflict-markers opt-out-review drop-conflicts Differential Revision: D90177312 fbshipit-source-id: c30ff51626f40103a98b31ee2ca26a0ea5f6dca5 --- .../src/main/res/views/uimanager/values-ne/strings.xml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/packages/react-native/ReactAndroid/src/main/res/views/uimanager/values-ne/strings.xml b/packages/react-native/ReactAndroid/src/main/res/views/uimanager/values-ne/strings.xml index f6429f63b2c..ce619fd1fe3 100644 --- a/packages/react-native/ReactAndroid/src/main/res/views/uimanager/values-ne/strings.xml +++ b/packages/react-native/ReactAndroid/src/main/res/views/uimanager/values-ne/strings.xml @@ -7,6 +7,7 @@ फोटो बटन, फोटो शीर्षक + अलर्ट कम्बो बक्स मेनु मेनु बार @@ -16,6 +17,7 @@ स्क्रोल बार स्पिन बटन टयाब + ट्याबको सूची टाइमर टुल बार सारांश From e1d2de82a8147e11023512e3a834d3b5a380d970 Mon Sep 17 00:00:00 2001 From: Pieter De Baets Date: Tue, 6 Jan 2026 05:55:41 -0800 Subject: [PATCH 009/585] Cleanup useRawPropsJsiValue flag (#55032) Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/55032 This has been fully rolled out now, the feature flag can be removed. Changelog: [Internal] Reviewed By: zeyap Differential Revision: D90106434 fbshipit-source-id: 9bdc53f7d34828c662d7304397bfc8f1c7bb1f81 --- .../AppDelegate/RCTReactNativeFactory.mm | 1 + .../featureflags/ReactNativeFeatureFlags.kt | 8 +---- .../ReactNativeFeatureFlagsCxxAccessor.kt | 12 +------ .../ReactNativeFeatureFlagsCxxInterop.kt | 4 +-- .../ReactNativeFeatureFlagsDefaults.kt | 4 +-- .../ReactNativeFeatureFlagsLocalAccessor.kt | 13 +------ .../ReactNativeFeatureFlagsProvider.kt | 4 +-- .../JReactNativeFeatureFlagsCxxInterop.cpp | 16 +-------- .../JReactNativeFeatureFlagsCxxInterop.h | 5 +-- .../RCTAnimatedModuleProvider.mm | 2 ++ .../featureflags/ReactNativeFeatureFlags.cpp | 6 +--- .../featureflags/ReactNativeFeatureFlags.h | 7 +--- .../ReactNativeFeatureFlagsAccessor.cpp | 36 +++++-------------- .../ReactNativeFeatureFlagsAccessor.h | 6 ++-- .../ReactNativeFeatureFlagsDefaults.h | 6 +--- .../ReactNativeFeatureFlagsDynamicProvider.h | 11 +----- .../ReactNativeFeatureFlagsProvider.h | 3 +- .../NativeReactNativeFeatureFlags.cpp | 7 +--- .../NativeReactNativeFeatureFlags.h | 4 +-- .../react/renderer/core/RawPropsParser.cpp | 8 +---- .../react/renderer/core/RawPropsParser.h | 8 ++--- .../react/renderer/core/RawValue.h | 3 +- .../ReactNativeFeatureFlags.config.js | 10 ------ .../featureflags/ReactNativeFeatureFlags.js | 7 +--- .../specs/NativeReactNativeFeatureFlags.js | 3 +- 25 files changed, 35 insertions(+), 159 deletions(-) diff --git a/packages/react-native/Libraries/AppDelegate/RCTReactNativeFactory.mm b/packages/react-native/Libraries/AppDelegate/RCTReactNativeFactory.mm index 9de23e72cb8..c1cc9d7d22f 100644 --- a/packages/react-native/Libraries/AppDelegate/RCTReactNativeFactory.mm +++ b/packages/react-native/Libraries/AppDelegate/RCTReactNativeFactory.mm @@ -15,6 +15,7 @@ #import #import #import +#import #import #import #import diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlags.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlags.kt index 7d36eef1511..0143fbb9a93 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlags.kt +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlags.kt @@ -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<<9406085adbc0685b473c868a27085cf8>> + * @generated SignedSource<<6f0aac1f6451f4dcd6290116c925f7c4>> */ /** @@ -504,12 +504,6 @@ public object ReactNativeFeatureFlags { @JvmStatic public fun useNativeViewConfigsInBridgelessMode(): Boolean = accessor.useNativeViewConfigsInBridgelessMode() - /** - * Instead of using folly::dynamic as internal representation in RawProps and RawValue, use jsi::Value - */ - @JvmStatic - public fun useRawPropsJsiValue(): Boolean = accessor.useRawPropsJsiValue() - /** * Use the state stored on the source shadow node when cloning it instead of reading in the most recent state on the shadow node family. */ diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsCxxAccessor.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsCxxAccessor.kt index 90e5cb3f024..c56e80d350c 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsCxxAccessor.kt +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsCxxAccessor.kt @@ -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<> + * @generated SignedSource<> */ /** @@ -99,7 +99,6 @@ internal class ReactNativeFeatureFlagsCxxAccessor : ReactNativeFeatureFlagsAcces private var useAlwaysAvailableJSErrorHandlingCache: Boolean? = null private var useFabricInteropCache: Boolean? = null private var useNativeViewConfigsInBridgelessModeCache: Boolean? = null - private var useRawPropsJsiValueCache: Boolean? = null private var useShadowNodeStateOnCloneCache: Boolean? = null private var useSharedAnimatedBackendCache: Boolean? = null private var useTraitHiddenOnAndroidCache: Boolean? = null @@ -820,15 +819,6 @@ internal class ReactNativeFeatureFlagsCxxAccessor : ReactNativeFeatureFlagsAcces return cached } - override fun useRawPropsJsiValue(): Boolean { - var cached = useRawPropsJsiValueCache - if (cached == null) { - cached = ReactNativeFeatureFlagsCxxInterop.useRawPropsJsiValue() - useRawPropsJsiValueCache = cached - } - return cached - } - override fun useShadowNodeStateOnClone(): Boolean { var cached = useShadowNodeStateOnCloneCache if (cached == null) { diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsCxxInterop.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsCxxInterop.kt index f73c0a52d7b..1579785999e 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsCxxInterop.kt +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsCxxInterop.kt @@ -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<> + * @generated SignedSource<<285349293c92ae2588664ae854fa250a>> */ /** @@ -186,8 +186,6 @@ public object ReactNativeFeatureFlagsCxxInterop { @DoNotStrip @JvmStatic public external fun useNativeViewConfigsInBridgelessMode(): Boolean - @DoNotStrip @JvmStatic public external fun useRawPropsJsiValue(): Boolean - @DoNotStrip @JvmStatic public external fun useShadowNodeStateOnClone(): Boolean @DoNotStrip @JvmStatic public external fun useSharedAnimatedBackend(): Boolean diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsDefaults.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsDefaults.kt index d1174d7c70c..387e3581cc0 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsDefaults.kt +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsDefaults.kt @@ -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<<6bdc23594dd175a0bf4409c0e2f10552>> + * @generated SignedSource<<24678f43c0deb08304bc86bbef617eb8>> */ /** @@ -181,8 +181,6 @@ public open class ReactNativeFeatureFlagsDefaults : ReactNativeFeatureFlagsProvi override fun useNativeViewConfigsInBridgelessMode(): Boolean = false - override fun useRawPropsJsiValue(): Boolean = true - override fun useShadowNodeStateOnClone(): Boolean = true override fun useSharedAnimatedBackend(): Boolean = false diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsLocalAccessor.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsLocalAccessor.kt index e32df1946ea..b502c959569 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsLocalAccessor.kt +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsLocalAccessor.kt @@ -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<<3b0c2dec02a603afec82993302ecb6ff>> + * @generated SignedSource<> */ /** @@ -103,7 +103,6 @@ internal class ReactNativeFeatureFlagsLocalAccessor : ReactNativeFeatureFlagsAcc private var useAlwaysAvailableJSErrorHandlingCache: Boolean? = null private var useFabricInteropCache: Boolean? = null private var useNativeViewConfigsInBridgelessModeCache: Boolean? = null - private var useRawPropsJsiValueCache: Boolean? = null private var useShadowNodeStateOnCloneCache: Boolean? = null private var useSharedAnimatedBackendCache: Boolean? = null private var useTraitHiddenOnAndroidCache: Boolean? = null @@ -903,16 +902,6 @@ internal class ReactNativeFeatureFlagsLocalAccessor : ReactNativeFeatureFlagsAcc return cached } - override fun useRawPropsJsiValue(): Boolean { - var cached = useRawPropsJsiValueCache - if (cached == null) { - cached = currentProvider.useRawPropsJsiValue() - accessedFeatureFlags.add("useRawPropsJsiValue") - useRawPropsJsiValueCache = cached - } - return cached - } - override fun useShadowNodeStateOnClone(): Boolean { var cached = useShadowNodeStateOnCloneCache if (cached == null) { diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsProvider.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsProvider.kt index cf35ff452ee..b96ef23f60b 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsProvider.kt +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsProvider.kt @@ -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<<995c1c3035757935dc7a4c4d6778e43e>> + * @generated SignedSource<<26c5b5fc23fdce860c39d37c6edfeb4d>> */ /** @@ -181,8 +181,6 @@ public interface ReactNativeFeatureFlagsProvider { @DoNotStrip public fun useNativeViewConfigsInBridgelessMode(): Boolean - @DoNotStrip public fun useRawPropsJsiValue(): Boolean - @DoNotStrip public fun useShadowNodeStateOnClone(): Boolean @DoNotStrip public fun useSharedAnimatedBackend(): Boolean diff --git a/packages/react-native/ReactAndroid/src/main/jni/react/featureflags/JReactNativeFeatureFlagsCxxInterop.cpp b/packages/react-native/ReactAndroid/src/main/jni/react/featureflags/JReactNativeFeatureFlagsCxxInterop.cpp index cb542fe05cd..8b1da518e3d 100644 --- a/packages/react-native/ReactAndroid/src/main/jni/react/featureflags/JReactNativeFeatureFlagsCxxInterop.cpp +++ b/packages/react-native/ReactAndroid/src/main/jni/react/featureflags/JReactNativeFeatureFlagsCxxInterop.cpp @@ -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<<1ea556a16d18a54b7087742b986a93a7>> + * @generated SignedSource<<832afeff38c393fde762b0e33fcd802e>> */ /** @@ -513,12 +513,6 @@ class ReactNativeFeatureFlagsJavaProvider return method(javaProvider_); } - bool useRawPropsJsiValue() override { - static const auto method = - getReactNativeFeatureFlagsProviderJavaClass()->getMethod("useRawPropsJsiValue"); - return method(javaProvider_); - } - bool useShadowNodeStateOnClone() override { static const auto method = getReactNativeFeatureFlagsProviderJavaClass()->getMethod("useShadowNodeStateOnClone"); @@ -966,11 +960,6 @@ bool JReactNativeFeatureFlagsCxxInterop::useNativeViewConfigsInBridgelessMode( return ReactNativeFeatureFlags::useNativeViewConfigsInBridgelessMode(); } -bool JReactNativeFeatureFlagsCxxInterop::useRawPropsJsiValue( - facebook::jni::alias_ref /*unused*/) { - return ReactNativeFeatureFlags::useRawPropsJsiValue(); -} - bool JReactNativeFeatureFlagsCxxInterop::useShadowNodeStateOnClone( facebook::jni::alias_ref /*unused*/) { return ReactNativeFeatureFlags::useShadowNodeStateOnClone(); @@ -1279,9 +1268,6 @@ void JReactNativeFeatureFlagsCxxInterop::registerNatives() { makeNativeMethod( "useNativeViewConfigsInBridgelessMode", JReactNativeFeatureFlagsCxxInterop::useNativeViewConfigsInBridgelessMode), - makeNativeMethod( - "useRawPropsJsiValue", - JReactNativeFeatureFlagsCxxInterop::useRawPropsJsiValue), makeNativeMethod( "useShadowNodeStateOnClone", JReactNativeFeatureFlagsCxxInterop::useShadowNodeStateOnClone), diff --git a/packages/react-native/ReactAndroid/src/main/jni/react/featureflags/JReactNativeFeatureFlagsCxxInterop.h b/packages/react-native/ReactAndroid/src/main/jni/react/featureflags/JReactNativeFeatureFlagsCxxInterop.h index 9d9178985b5..55c631a87e9 100644 --- a/packages/react-native/ReactAndroid/src/main/jni/react/featureflags/JReactNativeFeatureFlagsCxxInterop.h +++ b/packages/react-native/ReactAndroid/src/main/jni/react/featureflags/JReactNativeFeatureFlagsCxxInterop.h @@ -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<<67b23d4209c5fa6b721921953d76a829>> + * @generated SignedSource<<78530405942f4d922c6442e0c274e26f>> */ /** @@ -267,9 +267,6 @@ class JReactNativeFeatureFlagsCxxInterop static bool useNativeViewConfigsInBridgelessMode( facebook::jni::alias_ref); - static bool useRawPropsJsiValue( - facebook::jni::alias_ref); - static bool useShadowNodeStateOnClone( facebook::jni::alias_ref); diff --git a/packages/react-native/ReactApple/RCTAnimatedModuleProvider/RCTAnimatedModuleProvider.mm b/packages/react-native/ReactApple/RCTAnimatedModuleProvider/RCTAnimatedModuleProvider.mm index 61b63226e3e..14627a2865e 100644 --- a/packages/react-native/ReactApple/RCTAnimatedModuleProvider/RCTAnimatedModuleProvider.mm +++ b/packages/react-native/ReactApple/RCTAnimatedModuleProvider/RCTAnimatedModuleProvider.mm @@ -14,6 +14,8 @@ #else #import #endif + +#import #import #import diff --git a/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlags.cpp b/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlags.cpp index 5a382dd0a39..bb4c43b55fd 100644 --- a/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlags.cpp +++ b/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlags.cpp @@ -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<<3d71ee2b906dcc1313428185cbe853f8>> + * @generated SignedSource<<5ad716b4ded11ac4131aa52b378615d9>> */ /** @@ -342,10 +342,6 @@ bool ReactNativeFeatureFlags::useNativeViewConfigsInBridgelessMode() { return getAccessor().useNativeViewConfigsInBridgelessMode(); } -bool ReactNativeFeatureFlags::useRawPropsJsiValue() { - return getAccessor().useRawPropsJsiValue(); -} - bool ReactNativeFeatureFlags::useShadowNodeStateOnClone() { return getAccessor().useShadowNodeStateOnClone(); } diff --git a/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlags.h b/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlags.h index 8ac677efac6..6f2b0c60d88 100644 --- a/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlags.h +++ b/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlags.h @@ -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<> + * @generated SignedSource<<6bc7cf8676a7ff3db3e3fc0669875996>> */ /** @@ -434,11 +434,6 @@ class ReactNativeFeatureFlags { */ RN_EXPORT static bool useNativeViewConfigsInBridgelessMode(); - /** - * Instead of using folly::dynamic as internal representation in RawProps and RawValue, use jsi::Value - */ - RN_EXPORT static bool useRawPropsJsiValue(); - /** * Use the state stored on the source shadow node when cloning it instead of reading in the most recent state on the shadow node family. */ diff --git a/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlagsAccessor.cpp b/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlagsAccessor.cpp index 8f421b1cded..30006229036 100644 --- a/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlagsAccessor.cpp +++ b/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlagsAccessor.cpp @@ -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<<8bda4a084596c5512b8ebf5eaa44268e>> + * @generated SignedSource<<6b06f174bde31429a04437c34fb38453>> */ /** @@ -1451,24 +1451,6 @@ bool ReactNativeFeatureFlagsAccessor::useNativeViewConfigsInBridgelessMode() { return flagValue.value(); } -bool ReactNativeFeatureFlagsAccessor::useRawPropsJsiValue() { - auto flagValue = useRawPropsJsiValue_.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(79, "useRawPropsJsiValue"); - - flagValue = currentProvider_->useRawPropsJsiValue(); - useRawPropsJsiValue_ = flagValue; - } - - return flagValue.value(); -} - bool ReactNativeFeatureFlagsAccessor::useShadowNodeStateOnClone() { auto flagValue = useShadowNodeStateOnClone_.load(); @@ -1478,7 +1460,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(80, "useShadowNodeStateOnClone"); + markFlagAsAccessed(79, "useShadowNodeStateOnClone"); flagValue = currentProvider_->useShadowNodeStateOnClone(); useShadowNodeStateOnClone_ = flagValue; @@ -1496,7 +1478,7 @@ bool ReactNativeFeatureFlagsAccessor::useSharedAnimatedBackend() { // be accessing the provider multiple times but the end state of this // instance and the returned flag value would be the same. - markFlagAsAccessed(81, "useSharedAnimatedBackend"); + markFlagAsAccessed(80, "useSharedAnimatedBackend"); flagValue = currentProvider_->useSharedAnimatedBackend(); useSharedAnimatedBackend_ = flagValue; @@ -1514,7 +1496,7 @@ bool ReactNativeFeatureFlagsAccessor::useTraitHiddenOnAndroid() { // be accessing the provider multiple times but the end state of this // instance and the returned flag value would be the same. - markFlagAsAccessed(82, "useTraitHiddenOnAndroid"); + markFlagAsAccessed(81, "useTraitHiddenOnAndroid"); flagValue = currentProvider_->useTraitHiddenOnAndroid(); useTraitHiddenOnAndroid_ = flagValue; @@ -1532,7 +1514,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(83, "useTurboModuleInterop"); + markFlagAsAccessed(82, "useTurboModuleInterop"); flagValue = currentProvider_->useTurboModuleInterop(); useTurboModuleInterop_ = flagValue; @@ -1550,7 +1532,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(84, "useTurboModules"); + markFlagAsAccessed(83, "useTurboModules"); flagValue = currentProvider_->useTurboModules(); useTurboModules_ = flagValue; @@ -1568,7 +1550,7 @@ double ReactNativeFeatureFlagsAccessor::viewCullingOutsetRatio() { // be accessing the provider multiple times but the end state of this // instance and the returned flag value would be the same. - markFlagAsAccessed(85, "viewCullingOutsetRatio"); + markFlagAsAccessed(84, "viewCullingOutsetRatio"); flagValue = currentProvider_->viewCullingOutsetRatio(); viewCullingOutsetRatio_ = flagValue; @@ -1586,7 +1568,7 @@ double ReactNativeFeatureFlagsAccessor::virtualViewHysteresisRatio() { // be accessing the provider multiple times but the end state of this // instance and the returned flag value would be the same. - markFlagAsAccessed(86, "virtualViewHysteresisRatio"); + markFlagAsAccessed(85, "virtualViewHysteresisRatio"); flagValue = currentProvider_->virtualViewHysteresisRatio(); virtualViewHysteresisRatio_ = flagValue; @@ -1604,7 +1586,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(87, "virtualViewPrerenderRatio"); + markFlagAsAccessed(86, "virtualViewPrerenderRatio"); flagValue = currentProvider_->virtualViewPrerenderRatio(); virtualViewPrerenderRatio_ = flagValue; diff --git a/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlagsAccessor.h b/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlagsAccessor.h index cd725587710..38422ce21ae 100644 --- a/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlagsAccessor.h +++ b/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlagsAccessor.h @@ -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<> + * @generated SignedSource<> */ /** @@ -111,7 +111,6 @@ class ReactNativeFeatureFlagsAccessor { bool useAlwaysAvailableJSErrorHandling(); bool useFabricInterop(); bool useNativeViewConfigsInBridgelessMode(); - bool useRawPropsJsiValue(); bool useShadowNodeStateOnClone(); bool useSharedAnimatedBackend(); bool useTraitHiddenOnAndroid(); @@ -131,7 +130,7 @@ class ReactNativeFeatureFlagsAccessor { std::unique_ptr currentProvider_; bool wasOverridden_; - std::array, 88> accessedFeatureFlags_; + std::array, 87> accessedFeatureFlags_; std::atomic> commonTestFlag_; std::atomic> cdpInteractionMetricsEnabled_; @@ -212,7 +211,6 @@ class ReactNativeFeatureFlagsAccessor { std::atomic> useAlwaysAvailableJSErrorHandling_; std::atomic> useFabricInterop_; std::atomic> useNativeViewConfigsInBridgelessMode_; - std::atomic> useRawPropsJsiValue_; std::atomic> useShadowNodeStateOnClone_; std::atomic> useSharedAnimatedBackend_; std::atomic> useTraitHiddenOnAndroid_; diff --git a/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlagsDefaults.h b/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlagsDefaults.h index cfd77e1be5d..0bf831e5422 100644 --- a/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlagsDefaults.h +++ b/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlagsDefaults.h @@ -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<> + * @generated SignedSource<<5fb5b0f15594c9f65de484c77c7e4215>> */ /** @@ -343,10 +343,6 @@ class ReactNativeFeatureFlagsDefaults : public ReactNativeFeatureFlagsProvider { return false; } - bool useRawPropsJsiValue() override { - return true; - } - bool useShadowNodeStateOnClone() override { return true; } diff --git a/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlagsDynamicProvider.h b/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlagsDynamicProvider.h index 77b9c94ad16..46f15c01838 100644 --- a/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlagsDynamicProvider.h +++ b/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlagsDynamicProvider.h @@ -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<> + * @generated SignedSource<<2f22164639286343590c3ec3ec5ab176>> */ /** @@ -756,15 +756,6 @@ class ReactNativeFeatureFlagsDynamicProvider : public ReactNativeFeatureFlagsDef return ReactNativeFeatureFlagsDefaults::useNativeViewConfigsInBridgelessMode(); } - bool useRawPropsJsiValue() override { - auto value = values_["useRawPropsJsiValue"]; - if (!value.isNull()) { - return value.getBool(); - } - - return ReactNativeFeatureFlagsDefaults::useRawPropsJsiValue(); - } - bool useShadowNodeStateOnClone() override { auto value = values_["useShadowNodeStateOnClone"]; if (!value.isNull()) { diff --git a/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlagsProvider.h b/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlagsProvider.h index 309a9640023..799c202faee 100644 --- a/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlagsProvider.h +++ b/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlagsProvider.h @@ -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<<8e68f8be2e5f35422ae866390c76f670>> + * @generated SignedSource<> */ /** @@ -104,7 +104,6 @@ class ReactNativeFeatureFlagsProvider { virtual bool useAlwaysAvailableJSErrorHandling() = 0; virtual bool useFabricInterop() = 0; virtual bool useNativeViewConfigsInBridgelessMode() = 0; - virtual bool useRawPropsJsiValue() = 0; virtual bool useShadowNodeStateOnClone() = 0; virtual bool useSharedAnimatedBackend() = 0; virtual bool useTraitHiddenOnAndroid() = 0; diff --git a/packages/react-native/ReactCommon/react/nativemodule/featureflags/NativeReactNativeFeatureFlags.cpp b/packages/react-native/ReactCommon/react/nativemodule/featureflags/NativeReactNativeFeatureFlags.cpp index 7575785af07..e4a67d1a043 100644 --- a/packages/react-native/ReactCommon/react/nativemodule/featureflags/NativeReactNativeFeatureFlags.cpp +++ b/packages/react-native/ReactCommon/react/nativemodule/featureflags/NativeReactNativeFeatureFlags.cpp @@ -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<<3923fa1256c4cc2656201f9d83338606>> + * @generated SignedSource<> */ /** @@ -439,11 +439,6 @@ bool NativeReactNativeFeatureFlags::useNativeViewConfigsInBridgelessMode( return ReactNativeFeatureFlags::useNativeViewConfigsInBridgelessMode(); } -bool NativeReactNativeFeatureFlags::useRawPropsJsiValue( - jsi::Runtime& /*runtime*/) { - return ReactNativeFeatureFlags::useRawPropsJsiValue(); -} - bool NativeReactNativeFeatureFlags::useShadowNodeStateOnClone( jsi::Runtime& /*runtime*/) { return ReactNativeFeatureFlags::useShadowNodeStateOnClone(); diff --git a/packages/react-native/ReactCommon/react/nativemodule/featureflags/NativeReactNativeFeatureFlags.h b/packages/react-native/ReactCommon/react/nativemodule/featureflags/NativeReactNativeFeatureFlags.h index 4c58c5c0305..a3f1f16bad5 100644 --- a/packages/react-native/ReactCommon/react/nativemodule/featureflags/NativeReactNativeFeatureFlags.h +++ b/packages/react-native/ReactCommon/react/nativemodule/featureflags/NativeReactNativeFeatureFlags.h @@ -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<<560b5619790e0d17e76bc3d600ca10d1>> + * @generated SignedSource<> */ /** @@ -194,8 +194,6 @@ class NativeReactNativeFeatureFlags bool useNativeViewConfigsInBridgelessMode(jsi::Runtime& runtime); - bool useRawPropsJsiValue(jsi::Runtime& runtime); - bool useShadowNodeStateOnClone(jsi::Runtime& runtime); bool useSharedAnimatedBackend(jsi::Runtime& runtime); diff --git a/packages/react-native/ReactCommon/react/renderer/core/RawPropsParser.cpp b/packages/react-native/ReactCommon/react/renderer/core/RawPropsParser.cpp index aaf9519897f..71a3fb93fbe 100644 --- a/packages/react-native/ReactCommon/react/renderer/core/RawPropsParser.cpp +++ b/packages/react-native/ReactCommon/react/renderer/core/RawPropsParser.cpp @@ -136,13 +136,7 @@ void RawPropsParser::preparse(const RawProps& rawProps) const noexcept { rawProps.keyIndexToValueIndex_[keyIndex] = valueIndex; auto value = object.getProperty(runtime, nameValue); - RawValue rawValue; - if (useRawPropsJsiValue_) { - rawValue = RawValue(runtime, std::move(value)); - } else { - rawValue = RawValue(jsi::dynamicFromValue(runtime, value)); - } - rawProps.values_.push_back(std::move(rawValue)); + rawProps.values_.emplace_back(runtime, std::move(value)); valueIndex++; } diff --git a/packages/react-native/ReactCommon/react/renderer/core/RawPropsParser.h b/packages/react-native/ReactCommon/react/renderer/core/RawPropsParser.h index c5ff52c7260..ad28ae7b211 100644 --- a/packages/react-native/ReactCommon/react/renderer/core/RawPropsParser.h +++ b/packages/react-native/ReactCommon/react/renderer/core/RawPropsParser.h @@ -7,7 +7,6 @@ #pragma once -#include #include #include #include @@ -27,11 +26,9 @@ class RawPropsParser final { /* * Default constructor. * To be used by `ConcreteComponentDescriptor` only. - * If `useRawPropsJsiValue` is `true`, the parser will use `jsi::Value` - * directly for RawValues instead of converting them to `folly::dynamic`. */ - RawPropsParser(bool useRawPropsJsiValue = ReactNativeFeatureFlags::useRawPropsJsiValue()) - : useRawPropsJsiValue_(useRawPropsJsiValue) {}; + RawPropsParser() = default; + [[deprecated]] explicit RawPropsParser(bool /* ignored */) : RawPropsParser() {} /* * To be used by `ConcreteComponentDescriptor` only. @@ -59,7 +56,6 @@ class RawPropsParser final { template friend class ConcreteComponentDescriptor; friend class RawProps; - bool useRawPropsJsiValue_{false}; /* * To be used by `RawProps` only. diff --git a/packages/react-native/ReactCommon/react/renderer/core/RawValue.h b/packages/react-native/ReactCommon/react/renderer/core/RawValue.h index fd67679acd2..560b54a67a4 100644 --- a/packages/react-native/ReactCommon/react/renderer/core/RawValue.h +++ b/packages/react-native/ReactCommon/react/renderer/core/RawValue.h @@ -405,8 +405,7 @@ class RawValue { static JsiValuePair castValue(const folly::dynamic & /*dynamic*/, JsiValuePair * /*type*/) { react_native_assert(false); - throw std::runtime_error( - "Cannot cast dynamic to a jsi::Value type. Please use the 'useRawPropsJsiValue' feature flag to enable jsi::Value support for RawValues."); + throw std::runtime_error("Cannot cast dynamic to a jsi::Value type"); } static JsiValuePair castValue(jsi::Runtime *runtime, const jsi::Value &value, JsiValuePair * /*type*/) diff --git a/packages/react-native/scripts/featureflags/ReactNativeFeatureFlags.config.js b/packages/react-native/scripts/featureflags/ReactNativeFeatureFlags.config.js index 3d122c24882..89f772baa9a 100644 --- a/packages/react-native/scripts/featureflags/ReactNativeFeatureFlags.config.js +++ b/packages/react-native/scripts/featureflags/ReactNativeFeatureFlags.config.js @@ -889,16 +889,6 @@ const definitions: FeatureFlagDefinitions = { }, ossReleaseStage: 'canary', }, - useRawPropsJsiValue: { - defaultValue: true, - metadata: { - description: - 'Instead of using folly::dynamic as internal representation in RawProps and RawValue, use jsi::Value', - expectedReleaseValue: true, - purpose: 'release', - }, - ossReleaseStage: 'none', - }, useShadowNodeStateOnClone: { defaultValue: true, metadata: { diff --git a/packages/react-native/src/private/featureflags/ReactNativeFeatureFlags.js b/packages/react-native/src/private/featureflags/ReactNativeFeatureFlags.js index 25b8c620583..b8e1ab47ca0 100644 --- a/packages/react-native/src/private/featureflags/ReactNativeFeatureFlags.js +++ b/packages/react-native/src/private/featureflags/ReactNativeFeatureFlags.js @@ -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<> + * @generated SignedSource<<02b24e5c75fb8d34646670771ac3b2ed>> * @flow strict * @noformat */ @@ -130,7 +130,6 @@ export type ReactNativeFeatureFlags = $ReadOnly<{ useAlwaysAvailableJSErrorHandling: Getter, useFabricInterop: Getter, useNativeViewConfigsInBridgelessMode: Getter, - useRawPropsJsiValue: Getter, useShadowNodeStateOnClone: Getter, useSharedAnimatedBackend: Getter, useTraitHiddenOnAndroid: Getter, @@ -541,10 +540,6 @@ export const useFabricInterop: Getter = createNativeFlagGetter('useFabr * When enabled, the native view configs are used in bridgeless mode. */ export const useNativeViewConfigsInBridgelessMode: Getter = createNativeFlagGetter('useNativeViewConfigsInBridgelessMode', false); -/** - * Instead of using folly::dynamic as internal representation in RawProps and RawValue, use jsi::Value - */ -export const useRawPropsJsiValue: Getter = createNativeFlagGetter('useRawPropsJsiValue', true); /** * Use the state stored on the source shadow node when cloning it instead of reading in the most recent state on the shadow node family. */ diff --git a/packages/react-native/src/private/featureflags/specs/NativeReactNativeFeatureFlags.js b/packages/react-native/src/private/featureflags/specs/NativeReactNativeFeatureFlags.js index c5ea2bbfab9..27ddaf93678 100644 --- a/packages/react-native/src/private/featureflags/specs/NativeReactNativeFeatureFlags.js +++ b/packages/react-native/src/private/featureflags/specs/NativeReactNativeFeatureFlags.js @@ -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<<14b4f8916fccd1d255b4a260556d11da>> + * @generated SignedSource<> * @flow strict * @noformat */ @@ -104,7 +104,6 @@ export interface Spec extends TurboModule { +useAlwaysAvailableJSErrorHandling?: () => boolean; +useFabricInterop?: () => boolean; +useNativeViewConfigsInBridgelessMode?: () => boolean; - +useRawPropsJsiValue?: () => boolean; +useShadowNodeStateOnClone?: () => boolean; +useSharedAnimatedBackend?: () => boolean; +useTraitHiddenOnAndroid?: () => boolean; From 87939fcba07787c9632cac753451ed8580ba94b5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rub=C3=A9n=20Norte?= Date: Tue, 6 Jan 2026 06:07:13 -0800 Subject: [PATCH 010/585] Cleanup enableWebPerformanceAPIsByDefault flag (#55052) Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/55052 Changelog: [internal] This flag has been fully rolled out and can be removed. The Web Performance APIs (Performance Timeline, User Timings, etc.) are now always enabled by default. Reviewed By: cipolleschi Differential Revision: D90116775 fbshipit-source-id: 3ee3eabfac08c06d8dc4fd516c8d32479de815d7 --- .../featureflags/ReactNativeFeatureFlags.kt | 8 +- .../ReactNativeFeatureFlagsCxxAccessor.kt | 12 +-- .../ReactNativeFeatureFlagsCxxInterop.kt | 4 +- .../ReactNativeFeatureFlagsDefaults.kt | 4 +- .../ReactNativeFeatureFlagsLocalAccessor.kt | 13 +-- .../ReactNativeFeatureFlagsProvider.kt | 4 +- .../JReactNativeFeatureFlagsCxxInterop.cpp | 16 +--- .../JReactNativeFeatureFlagsCxxInterop.h | 5 +- .../featureflags/ReactNativeFeatureFlags.cpp | 6 +- .../featureflags/ReactNativeFeatureFlags.h | 7 +- .../ReactNativeFeatureFlagsAccessor.cpp | 82 ++++++++----------- .../ReactNativeFeatureFlagsAccessor.h | 6 +- .../ReactNativeFeatureFlagsDefaults.h | 6 +- .../ReactNativeFeatureFlagsDynamicProvider.h | 11 +-- .../ReactNativeFeatureFlagsProvider.h | 3 +- .../defaults/DefaultTurboModules.cpp | 6 +- .../NativeReactNativeFeatureFlags.cpp | 7 +- .../NativeReactNativeFeatureFlags.h | 4 +- .../ReactNativeFeatureFlags.config.js | 10 --- .../featureflags/ReactNativeFeatureFlags.js | 7 +- .../specs/NativeReactNativeFeatureFlags.js | 3 +- 21 files changed, 53 insertions(+), 171 deletions(-) diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlags.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlags.kt index 0143fbb9a93..9fb1085b20e 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlags.kt +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlags.kt @@ -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<<6f0aac1f6451f4dcd6290116c925f7c4>> + * @generated SignedSource<<1ee723a105e7d14a01f92469bad94888>> */ /** @@ -360,12 +360,6 @@ public object ReactNativeFeatureFlags { @JvmStatic public fun enableVirtualViewWindowFocusDetection(): Boolean = accessor.enableVirtualViewWindowFocusDetection() - /** - * Enable Web Performance APIs (Performance Timeline, User Timings, etc.) by default. - */ - @JvmStatic - public fun enableWebPerformanceAPIsByDefault(): Boolean = accessor.enableWebPerformanceAPIsByDefault() - /** * Uses the default event priority instead of the discreet event priority by default when dispatching events from Fabric to React. */ diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsCxxAccessor.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsCxxAccessor.kt index c56e80d350c..fdf3e5e88c0 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsCxxAccessor.kt +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsCxxAccessor.kt @@ -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<> + * @generated SignedSource<<934d187fb9928a20d4a442977c7f90b2>> */ /** @@ -75,7 +75,6 @@ internal class ReactNativeFeatureFlagsCxxAccessor : ReactNativeFeatureFlagsAcces private var enableVirtualViewDebugFeaturesCache: Boolean? = null private var enableVirtualViewRenderStateCache: Boolean? = null private var enableVirtualViewWindowFocusDetectionCache: Boolean? = null - private var enableWebPerformanceAPIsByDefaultCache: Boolean? = null private var fixMappingOfEventPrioritiesBetweenFabricAndReactCache: Boolean? = null private var fixTextClippingAndroid15useBoundsForWidthCache: Boolean? = null private var fuseboxAssertSingleHostStateCache: Boolean? = null @@ -603,15 +602,6 @@ internal class ReactNativeFeatureFlagsCxxAccessor : ReactNativeFeatureFlagsAcces return cached } - override fun enableWebPerformanceAPIsByDefault(): Boolean { - var cached = enableWebPerformanceAPIsByDefaultCache - if (cached == null) { - cached = ReactNativeFeatureFlagsCxxInterop.enableWebPerformanceAPIsByDefault() - enableWebPerformanceAPIsByDefaultCache = cached - } - return cached - } - override fun fixMappingOfEventPrioritiesBetweenFabricAndReact(): Boolean { var cached = fixMappingOfEventPrioritiesBetweenFabricAndReactCache if (cached == null) { diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsCxxInterop.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsCxxInterop.kt index 1579785999e..6020d152e8c 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsCxxInterop.kt +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsCxxInterop.kt @@ -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<<285349293c92ae2588664ae854fa250a>> + * @generated SignedSource<<9eaa1bfee243767cc98b9477fc391c37>> */ /** @@ -138,8 +138,6 @@ public object ReactNativeFeatureFlagsCxxInterop { @DoNotStrip @JvmStatic public external fun enableVirtualViewWindowFocusDetection(): Boolean - @DoNotStrip @JvmStatic public external fun enableWebPerformanceAPIsByDefault(): Boolean - @DoNotStrip @JvmStatic public external fun fixMappingOfEventPrioritiesBetweenFabricAndReact(): Boolean @DoNotStrip @JvmStatic public external fun fixTextClippingAndroid15useBoundsForWidth(): Boolean diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsDefaults.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsDefaults.kt index 387e3581cc0..120977530ce 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsDefaults.kt +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsDefaults.kt @@ -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<<24678f43c0deb08304bc86bbef617eb8>> + * @generated SignedSource<<51a5be93dbaf0000664d6ff482bdc18c>> */ /** @@ -133,8 +133,6 @@ public open class ReactNativeFeatureFlagsDefaults : ReactNativeFeatureFlagsProvi override fun enableVirtualViewWindowFocusDetection(): Boolean = false - override fun enableWebPerformanceAPIsByDefault(): Boolean = true - override fun fixMappingOfEventPrioritiesBetweenFabricAndReact(): Boolean = false override fun fixTextClippingAndroid15useBoundsForWidth(): Boolean = false diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsLocalAccessor.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsLocalAccessor.kt index b502c959569..7e5ca9db5ec 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsLocalAccessor.kt +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsLocalAccessor.kt @@ -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<> + * @generated SignedSource<<503f34acc5cf8a0755cef1ca8b72e7e5>> */ /** @@ -79,7 +79,6 @@ internal class ReactNativeFeatureFlagsLocalAccessor : ReactNativeFeatureFlagsAcc private var enableVirtualViewDebugFeaturesCache: Boolean? = null private var enableVirtualViewRenderStateCache: Boolean? = null private var enableVirtualViewWindowFocusDetectionCache: Boolean? = null - private var enableWebPerformanceAPIsByDefaultCache: Boolean? = null private var fixMappingOfEventPrioritiesBetweenFabricAndReactCache: Boolean? = null private var fixTextClippingAndroid15useBoundsForWidthCache: Boolean? = null private var fuseboxAssertSingleHostStateCache: Boolean? = null @@ -662,16 +661,6 @@ internal class ReactNativeFeatureFlagsLocalAccessor : ReactNativeFeatureFlagsAcc return cached } - override fun enableWebPerformanceAPIsByDefault(): Boolean { - var cached = enableWebPerformanceAPIsByDefaultCache - if (cached == null) { - cached = currentProvider.enableWebPerformanceAPIsByDefault() - accessedFeatureFlags.add("enableWebPerformanceAPIsByDefault") - enableWebPerformanceAPIsByDefaultCache = cached - } - return cached - } - override fun fixMappingOfEventPrioritiesBetweenFabricAndReact(): Boolean { var cached = fixMappingOfEventPrioritiesBetweenFabricAndReactCache if (cached == null) { diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsProvider.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsProvider.kt index b96ef23f60b..1ed03955e4e 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsProvider.kt +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsProvider.kt @@ -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<<26c5b5fc23fdce860c39d37c6edfeb4d>> + * @generated SignedSource<> */ /** @@ -133,8 +133,6 @@ public interface ReactNativeFeatureFlagsProvider { @DoNotStrip public fun enableVirtualViewWindowFocusDetection(): Boolean - @DoNotStrip public fun enableWebPerformanceAPIsByDefault(): Boolean - @DoNotStrip public fun fixMappingOfEventPrioritiesBetweenFabricAndReact(): Boolean @DoNotStrip public fun fixTextClippingAndroid15useBoundsForWidth(): Boolean diff --git a/packages/react-native/ReactAndroid/src/main/jni/react/featureflags/JReactNativeFeatureFlagsCxxInterop.cpp b/packages/react-native/ReactAndroid/src/main/jni/react/featureflags/JReactNativeFeatureFlagsCxxInterop.cpp index 8b1da518e3d..ac4802ab6e9 100644 --- a/packages/react-native/ReactAndroid/src/main/jni/react/featureflags/JReactNativeFeatureFlagsCxxInterop.cpp +++ b/packages/react-native/ReactAndroid/src/main/jni/react/featureflags/JReactNativeFeatureFlagsCxxInterop.cpp @@ -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<<832afeff38c393fde762b0e33fcd802e>> + * @generated SignedSource<> */ /** @@ -369,12 +369,6 @@ class ReactNativeFeatureFlagsJavaProvider return method(javaProvider_); } - bool enableWebPerformanceAPIsByDefault() override { - static const auto method = - getReactNativeFeatureFlagsProviderJavaClass()->getMethod("enableWebPerformanceAPIsByDefault"); - return method(javaProvider_); - } - bool fixMappingOfEventPrioritiesBetweenFabricAndReact() override { static const auto method = getReactNativeFeatureFlagsProviderJavaClass()->getMethod("fixMappingOfEventPrioritiesBetweenFabricAndReact"); @@ -840,11 +834,6 @@ bool JReactNativeFeatureFlagsCxxInterop::enableVirtualViewWindowFocusDetection( return ReactNativeFeatureFlags::enableVirtualViewWindowFocusDetection(); } -bool JReactNativeFeatureFlagsCxxInterop::enableWebPerformanceAPIsByDefault( - facebook::jni::alias_ref /*unused*/) { - return ReactNativeFeatureFlags::enableWebPerformanceAPIsByDefault(); -} - bool JReactNativeFeatureFlagsCxxInterop::fixMappingOfEventPrioritiesBetweenFabricAndReact( facebook::jni::alias_ref /*unused*/) { return ReactNativeFeatureFlags::fixMappingOfEventPrioritiesBetweenFabricAndReact(); @@ -1196,9 +1185,6 @@ void JReactNativeFeatureFlagsCxxInterop::registerNatives() { makeNativeMethod( "enableVirtualViewWindowFocusDetection", JReactNativeFeatureFlagsCxxInterop::enableVirtualViewWindowFocusDetection), - makeNativeMethod( - "enableWebPerformanceAPIsByDefault", - JReactNativeFeatureFlagsCxxInterop::enableWebPerformanceAPIsByDefault), makeNativeMethod( "fixMappingOfEventPrioritiesBetweenFabricAndReact", JReactNativeFeatureFlagsCxxInterop::fixMappingOfEventPrioritiesBetweenFabricAndReact), diff --git a/packages/react-native/ReactAndroid/src/main/jni/react/featureflags/JReactNativeFeatureFlagsCxxInterop.h b/packages/react-native/ReactAndroid/src/main/jni/react/featureflags/JReactNativeFeatureFlagsCxxInterop.h index 55c631a87e9..22f9adcaef9 100644 --- a/packages/react-native/ReactAndroid/src/main/jni/react/featureflags/JReactNativeFeatureFlagsCxxInterop.h +++ b/packages/react-native/ReactAndroid/src/main/jni/react/featureflags/JReactNativeFeatureFlagsCxxInterop.h @@ -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<<78530405942f4d922c6442e0c274e26f>> + * @generated SignedSource<> */ /** @@ -195,9 +195,6 @@ class JReactNativeFeatureFlagsCxxInterop static bool enableVirtualViewWindowFocusDetection( facebook::jni::alias_ref); - static bool enableWebPerformanceAPIsByDefault( - facebook::jni::alias_ref); - static bool fixMappingOfEventPrioritiesBetweenFabricAndReact( facebook::jni::alias_ref); diff --git a/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlags.cpp b/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlags.cpp index bb4c43b55fd..aad3e2dc18e 100644 --- a/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlags.cpp +++ b/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlags.cpp @@ -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<<5ad716b4ded11ac4131aa52b378615d9>> + * @generated SignedSource<<9e57bf3807cda945c78dd6d3229908a0>> */ /** @@ -246,10 +246,6 @@ bool ReactNativeFeatureFlags::enableVirtualViewWindowFocusDetection() { return getAccessor().enableVirtualViewWindowFocusDetection(); } -bool ReactNativeFeatureFlags::enableWebPerformanceAPIsByDefault() { - return getAccessor().enableWebPerformanceAPIsByDefault(); -} - bool ReactNativeFeatureFlags::fixMappingOfEventPrioritiesBetweenFabricAndReact() { return getAccessor().fixMappingOfEventPrioritiesBetweenFabricAndReact(); } diff --git a/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlags.h b/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlags.h index 6f2b0c60d88..ed64268b731 100644 --- a/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlags.h +++ b/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlags.h @@ -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<<6bc7cf8676a7ff3db3e3fc0669875996>> + * @generated SignedSource<<7583b49b28e083ae22b538fdce205d43>> */ /** @@ -314,11 +314,6 @@ class ReactNativeFeatureFlags { */ RN_EXPORT static bool enableVirtualViewWindowFocusDetection(); - /** - * Enable Web Performance APIs (Performance Timeline, User Timings, etc.) by default. - */ - RN_EXPORT static bool enableWebPerformanceAPIsByDefault(); - /** * Uses the default event priority instead of the discreet event priority by default when dispatching events from Fabric to React. */ diff --git a/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlagsAccessor.cpp b/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlagsAccessor.cpp index 30006229036..66fbceefbae 100644 --- a/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlagsAccessor.cpp +++ b/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlagsAccessor.cpp @@ -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<<6b06f174bde31429a04437c34fb38453>> + * @generated SignedSource<<0f1be431e0396dc00069c100631d7c64>> */ /** @@ -1019,24 +1019,6 @@ bool ReactNativeFeatureFlagsAccessor::enableVirtualViewWindowFocusDetection() { return flagValue.value(); } -bool ReactNativeFeatureFlagsAccessor::enableWebPerformanceAPIsByDefault() { - auto flagValue = enableWebPerformanceAPIsByDefault_.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(55, "enableWebPerformanceAPIsByDefault"); - - flagValue = currentProvider_->enableWebPerformanceAPIsByDefault(); - enableWebPerformanceAPIsByDefault_ = flagValue; - } - - return flagValue.value(); -} - bool ReactNativeFeatureFlagsAccessor::fixMappingOfEventPrioritiesBetweenFabricAndReact() { auto flagValue = fixMappingOfEventPrioritiesBetweenFabricAndReact_.load(); @@ -1046,7 +1028,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(56, "fixMappingOfEventPrioritiesBetweenFabricAndReact"); + markFlagAsAccessed(55, "fixMappingOfEventPrioritiesBetweenFabricAndReact"); flagValue = currentProvider_->fixMappingOfEventPrioritiesBetweenFabricAndReact(); fixMappingOfEventPrioritiesBetweenFabricAndReact_ = flagValue; @@ -1064,7 +1046,7 @@ bool ReactNativeFeatureFlagsAccessor::fixTextClippingAndroid15useBoundsForWidth( // be accessing the provider multiple times but the end state of this // instance and the returned flag value would be the same. - markFlagAsAccessed(57, "fixTextClippingAndroid15useBoundsForWidth"); + markFlagAsAccessed(56, "fixTextClippingAndroid15useBoundsForWidth"); flagValue = currentProvider_->fixTextClippingAndroid15useBoundsForWidth(); fixTextClippingAndroid15useBoundsForWidth_ = flagValue; @@ -1082,7 +1064,7 @@ bool ReactNativeFeatureFlagsAccessor::fuseboxAssertSingleHostState() { // be accessing the provider multiple times but the end state of this // instance and the returned flag value would be the same. - markFlagAsAccessed(58, "fuseboxAssertSingleHostState"); + markFlagAsAccessed(57, "fuseboxAssertSingleHostState"); flagValue = currentProvider_->fuseboxAssertSingleHostState(); fuseboxAssertSingleHostState_ = flagValue; @@ -1100,7 +1082,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(59, "fuseboxEnabledRelease"); + markFlagAsAccessed(58, "fuseboxEnabledRelease"); flagValue = currentProvider_->fuseboxEnabledRelease(); fuseboxEnabledRelease_ = flagValue; @@ -1118,7 +1100,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(60, "fuseboxNetworkInspectionEnabled"); + markFlagAsAccessed(59, "fuseboxNetworkInspectionEnabled"); flagValue = currentProvider_->fuseboxNetworkInspectionEnabled(); fuseboxNetworkInspectionEnabled_ = flagValue; @@ -1136,7 +1118,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(61, "hideOffscreenVirtualViewsOnIOS"); + markFlagAsAccessed(60, "hideOffscreenVirtualViewsOnIOS"); flagValue = currentProvider_->hideOffscreenVirtualViewsOnIOS(); hideOffscreenVirtualViewsOnIOS_ = flagValue; @@ -1154,7 +1136,7 @@ bool ReactNativeFeatureFlagsAccessor::overrideBySynchronousMountPropsAtMountingA // be accessing the provider multiple times but the end state of this // instance and the returned flag value would be the same. - markFlagAsAccessed(62, "overrideBySynchronousMountPropsAtMountingAndroid"); + markFlagAsAccessed(61, "overrideBySynchronousMountPropsAtMountingAndroid"); flagValue = currentProvider_->overrideBySynchronousMountPropsAtMountingAndroid(); overrideBySynchronousMountPropsAtMountingAndroid_ = flagValue; @@ -1172,7 +1154,7 @@ bool ReactNativeFeatureFlagsAccessor::perfIssuesEnabled() { // be accessing the provider multiple times but the end state of this // instance and the returned flag value would be the same. - markFlagAsAccessed(63, "perfIssuesEnabled"); + markFlagAsAccessed(62, "perfIssuesEnabled"); flagValue = currentProvider_->perfIssuesEnabled(); perfIssuesEnabled_ = flagValue; @@ -1190,7 +1172,7 @@ bool ReactNativeFeatureFlagsAccessor::perfMonitorV2Enabled() { // be accessing the provider multiple times but the end state of this // instance and the returned flag value would be the same. - markFlagAsAccessed(64, "perfMonitorV2Enabled"); + markFlagAsAccessed(63, "perfMonitorV2Enabled"); flagValue = currentProvider_->perfMonitorV2Enabled(); perfMonitorV2Enabled_ = flagValue; @@ -1208,7 +1190,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(65, "preparedTextCacheSize"); + markFlagAsAccessed(64, "preparedTextCacheSize"); flagValue = currentProvider_->preparedTextCacheSize(); preparedTextCacheSize_ = flagValue; @@ -1226,7 +1208,7 @@ bool ReactNativeFeatureFlagsAccessor::preventShadowTreeCommitExhaustion() { // be accessing the provider multiple times but the end state of this // instance and the returned flag value would be the same. - markFlagAsAccessed(66, "preventShadowTreeCommitExhaustion"); + markFlagAsAccessed(65, "preventShadowTreeCommitExhaustion"); flagValue = currentProvider_->preventShadowTreeCommitExhaustion(); preventShadowTreeCommitExhaustion_ = flagValue; @@ -1244,7 +1226,7 @@ bool ReactNativeFeatureFlagsAccessor::shouldPressibilityUseW3CPointerEventsForHo // be accessing the provider multiple times but the end state of this // instance and the returned flag value would be the same. - markFlagAsAccessed(67, "shouldPressibilityUseW3CPointerEventsForHover"); + markFlagAsAccessed(66, "shouldPressibilityUseW3CPointerEventsForHover"); flagValue = currentProvider_->shouldPressibilityUseW3CPointerEventsForHover(); shouldPressibilityUseW3CPointerEventsForHover_ = flagValue; @@ -1262,7 +1244,7 @@ bool ReactNativeFeatureFlagsAccessor::shouldResetClickableWhenRecyclingView() { // be accessing the provider multiple times but the end state of this // instance and the returned flag value would be the same. - markFlagAsAccessed(68, "shouldResetClickableWhenRecyclingView"); + markFlagAsAccessed(67, "shouldResetClickableWhenRecyclingView"); flagValue = currentProvider_->shouldResetClickableWhenRecyclingView(); shouldResetClickableWhenRecyclingView_ = flagValue; @@ -1280,7 +1262,7 @@ bool ReactNativeFeatureFlagsAccessor::shouldResetOnClickListenerWhenRecyclingVie // be accessing the provider multiple times but the end state of this // instance and the returned flag value would be the same. - markFlagAsAccessed(69, "shouldResetOnClickListenerWhenRecyclingView"); + markFlagAsAccessed(68, "shouldResetOnClickListenerWhenRecyclingView"); flagValue = currentProvider_->shouldResetOnClickListenerWhenRecyclingView(); shouldResetOnClickListenerWhenRecyclingView_ = flagValue; @@ -1298,7 +1280,7 @@ bool ReactNativeFeatureFlagsAccessor::shouldSetEnabledBasedOnAccessibilityState( // be accessing the provider multiple times but the end state of this // instance and the returned flag value would be the same. - markFlagAsAccessed(70, "shouldSetEnabledBasedOnAccessibilityState"); + markFlagAsAccessed(69, "shouldSetEnabledBasedOnAccessibilityState"); flagValue = currentProvider_->shouldSetEnabledBasedOnAccessibilityState(); shouldSetEnabledBasedOnAccessibilityState_ = flagValue; @@ -1316,7 +1298,7 @@ bool ReactNativeFeatureFlagsAccessor::shouldSetIsClickableByDefault() { // be accessing the provider multiple times but the end state of this // instance and the returned flag value would be the same. - markFlagAsAccessed(71, "shouldSetIsClickableByDefault"); + markFlagAsAccessed(70, "shouldSetIsClickableByDefault"); flagValue = currentProvider_->shouldSetIsClickableByDefault(); shouldSetIsClickableByDefault_ = flagValue; @@ -1334,7 +1316,7 @@ bool ReactNativeFeatureFlagsAccessor::shouldTriggerResponderTransferOnScrollAndr // be accessing the provider multiple times but the end state of this // instance and the returned flag value would be the same. - markFlagAsAccessed(72, "shouldTriggerResponderTransferOnScrollAndroid"); + markFlagAsAccessed(71, "shouldTriggerResponderTransferOnScrollAndroid"); flagValue = currentProvider_->shouldTriggerResponderTransferOnScrollAndroid(); shouldTriggerResponderTransferOnScrollAndroid_ = flagValue; @@ -1352,7 +1334,7 @@ bool ReactNativeFeatureFlagsAccessor::skipActivityIdentityAssertionOnHostPause() // be accessing the provider multiple times but the end state of this // instance and the returned flag value would be the same. - markFlagAsAccessed(73, "skipActivityIdentityAssertionOnHostPause"); + markFlagAsAccessed(72, "skipActivityIdentityAssertionOnHostPause"); flagValue = currentProvider_->skipActivityIdentityAssertionOnHostPause(); skipActivityIdentityAssertionOnHostPause_ = flagValue; @@ -1370,7 +1352,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(74, "traceTurboModulePromiseRejectionsOnAndroid"); + markFlagAsAccessed(73, "traceTurboModulePromiseRejectionsOnAndroid"); flagValue = currentProvider_->traceTurboModulePromiseRejectionsOnAndroid(); traceTurboModulePromiseRejectionsOnAndroid_ = flagValue; @@ -1388,7 +1370,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(75, "updateRuntimeShadowNodeReferencesOnCommit"); + markFlagAsAccessed(74, "updateRuntimeShadowNodeReferencesOnCommit"); flagValue = currentProvider_->updateRuntimeShadowNodeReferencesOnCommit(); updateRuntimeShadowNodeReferencesOnCommit_ = flagValue; @@ -1406,7 +1388,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(76, "useAlwaysAvailableJSErrorHandling"); + markFlagAsAccessed(75, "useAlwaysAvailableJSErrorHandling"); flagValue = currentProvider_->useAlwaysAvailableJSErrorHandling(); useAlwaysAvailableJSErrorHandling_ = flagValue; @@ -1424,7 +1406,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(77, "useFabricInterop"); + markFlagAsAccessed(76, "useFabricInterop"); flagValue = currentProvider_->useFabricInterop(); useFabricInterop_ = flagValue; @@ -1442,7 +1424,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(78, "useNativeViewConfigsInBridgelessMode"); + markFlagAsAccessed(77, "useNativeViewConfigsInBridgelessMode"); flagValue = currentProvider_->useNativeViewConfigsInBridgelessMode(); useNativeViewConfigsInBridgelessMode_ = flagValue; @@ -1460,7 +1442,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(79, "useShadowNodeStateOnClone"); + markFlagAsAccessed(78, "useShadowNodeStateOnClone"); flagValue = currentProvider_->useShadowNodeStateOnClone(); useShadowNodeStateOnClone_ = flagValue; @@ -1478,7 +1460,7 @@ bool ReactNativeFeatureFlagsAccessor::useSharedAnimatedBackend() { // be accessing the provider multiple times but the end state of this // instance and the returned flag value would be the same. - markFlagAsAccessed(80, "useSharedAnimatedBackend"); + markFlagAsAccessed(79, "useSharedAnimatedBackend"); flagValue = currentProvider_->useSharedAnimatedBackend(); useSharedAnimatedBackend_ = flagValue; @@ -1496,7 +1478,7 @@ bool ReactNativeFeatureFlagsAccessor::useTraitHiddenOnAndroid() { // be accessing the provider multiple times but the end state of this // instance and the returned flag value would be the same. - markFlagAsAccessed(81, "useTraitHiddenOnAndroid"); + markFlagAsAccessed(80, "useTraitHiddenOnAndroid"); flagValue = currentProvider_->useTraitHiddenOnAndroid(); useTraitHiddenOnAndroid_ = flagValue; @@ -1514,7 +1496,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(82, "useTurboModuleInterop"); + markFlagAsAccessed(81, "useTurboModuleInterop"); flagValue = currentProvider_->useTurboModuleInterop(); useTurboModuleInterop_ = flagValue; @@ -1532,7 +1514,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(83, "useTurboModules"); + markFlagAsAccessed(82, "useTurboModules"); flagValue = currentProvider_->useTurboModules(); useTurboModules_ = flagValue; @@ -1550,7 +1532,7 @@ double ReactNativeFeatureFlagsAccessor::viewCullingOutsetRatio() { // be accessing the provider multiple times but the end state of this // instance and the returned flag value would be the same. - markFlagAsAccessed(84, "viewCullingOutsetRatio"); + markFlagAsAccessed(83, "viewCullingOutsetRatio"); flagValue = currentProvider_->viewCullingOutsetRatio(); viewCullingOutsetRatio_ = flagValue; @@ -1568,7 +1550,7 @@ double ReactNativeFeatureFlagsAccessor::virtualViewHysteresisRatio() { // be accessing the provider multiple times but the end state of this // instance and the returned flag value would be the same. - markFlagAsAccessed(85, "virtualViewHysteresisRatio"); + markFlagAsAccessed(84, "virtualViewHysteresisRatio"); flagValue = currentProvider_->virtualViewHysteresisRatio(); virtualViewHysteresisRatio_ = flagValue; @@ -1586,7 +1568,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(86, "virtualViewPrerenderRatio"); + markFlagAsAccessed(85, "virtualViewPrerenderRatio"); flagValue = currentProvider_->virtualViewPrerenderRatio(); virtualViewPrerenderRatio_ = flagValue; diff --git a/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlagsAccessor.h b/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlagsAccessor.h index 38422ce21ae..e09fc0d625f 100644 --- a/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlagsAccessor.h +++ b/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlagsAccessor.h @@ -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<> + * @generated SignedSource<<52f05ab59b596ddf941b48fd4193e6cc>> */ /** @@ -87,7 +87,6 @@ class ReactNativeFeatureFlagsAccessor { bool enableVirtualViewDebugFeatures(); bool enableVirtualViewRenderState(); bool enableVirtualViewWindowFocusDetection(); - bool enableWebPerformanceAPIsByDefault(); bool fixMappingOfEventPrioritiesBetweenFabricAndReact(); bool fixTextClippingAndroid15useBoundsForWidth(); bool fuseboxAssertSingleHostState(); @@ -130,7 +129,7 @@ class ReactNativeFeatureFlagsAccessor { std::unique_ptr currentProvider_; bool wasOverridden_; - std::array, 87> accessedFeatureFlags_; + std::array, 86> accessedFeatureFlags_; std::atomic> commonTestFlag_; std::atomic> cdpInteractionMetricsEnabled_; @@ -187,7 +186,6 @@ class ReactNativeFeatureFlagsAccessor { std::atomic> enableVirtualViewDebugFeatures_; std::atomic> enableVirtualViewRenderState_; std::atomic> enableVirtualViewWindowFocusDetection_; - std::atomic> enableWebPerformanceAPIsByDefault_; std::atomic> fixMappingOfEventPrioritiesBetweenFabricAndReact_; std::atomic> fixTextClippingAndroid15useBoundsForWidth_; std::atomic> fuseboxAssertSingleHostState_; diff --git a/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlagsDefaults.h b/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlagsDefaults.h index 0bf831e5422..002c6fa79cd 100644 --- a/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlagsDefaults.h +++ b/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlagsDefaults.h @@ -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<<5fb5b0f15594c9f65de484c77c7e4215>> + * @generated SignedSource<> */ /** @@ -247,10 +247,6 @@ class ReactNativeFeatureFlagsDefaults : public ReactNativeFeatureFlagsProvider { return false; } - bool enableWebPerformanceAPIsByDefault() override { - return true; - } - bool fixMappingOfEventPrioritiesBetweenFabricAndReact() override { return false; } diff --git a/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlagsDynamicProvider.h b/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlagsDynamicProvider.h index 46f15c01838..f420c9c410b 100644 --- a/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlagsDynamicProvider.h +++ b/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlagsDynamicProvider.h @@ -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<<2f22164639286343590c3ec3ec5ab176>> + * @generated SignedSource<> */ /** @@ -540,15 +540,6 @@ class ReactNativeFeatureFlagsDynamicProvider : public ReactNativeFeatureFlagsDef return ReactNativeFeatureFlagsDefaults::enableVirtualViewWindowFocusDetection(); } - bool enableWebPerformanceAPIsByDefault() override { - auto value = values_["enableWebPerformanceAPIsByDefault"]; - if (!value.isNull()) { - return value.getBool(); - } - - return ReactNativeFeatureFlagsDefaults::enableWebPerformanceAPIsByDefault(); - } - bool fixMappingOfEventPrioritiesBetweenFabricAndReact() override { auto value = values_["fixMappingOfEventPrioritiesBetweenFabricAndReact"]; if (!value.isNull()) { diff --git a/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlagsProvider.h b/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlagsProvider.h index 799c202faee..8b5ac58e9b0 100644 --- a/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlagsProvider.h +++ b/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlagsProvider.h @@ -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<> + * @generated SignedSource<<5f72ef123c1f70ef6b922c7d74b00ba3>> */ /** @@ -80,7 +80,6 @@ class ReactNativeFeatureFlagsProvider { virtual bool enableVirtualViewDebugFeatures() = 0; virtual bool enableVirtualViewRenderState() = 0; virtual bool enableVirtualViewWindowFocusDetection() = 0; - virtual bool enableWebPerformanceAPIsByDefault() = 0; virtual bool fixMappingOfEventPrioritiesBetweenFabricAndReact() = 0; virtual bool fixTextClippingAndroid15useBoundsForWidth() = 0; virtual bool fuseboxAssertSingleHostState() = 0; diff --git a/packages/react-native/ReactCommon/react/nativemodule/defaults/DefaultTurboModules.cpp b/packages/react-native/ReactCommon/react/nativemodule/defaults/DefaultTurboModules.cpp index 99b37a1398d..3c50a17e2ff 100644 --- a/packages/react-native/ReactCommon/react/nativemodule/defaults/DefaultTurboModules.cpp +++ b/packages/react-native/ReactCommon/react/nativemodule/defaults/DefaultTurboModules.cpp @@ -39,10 +39,8 @@ namespace facebook::react { return std::make_shared(jsInvoker); } - if (ReactNativeFeatureFlags::enableWebPerformanceAPIsByDefault()) { - if (name == NativePerformance::kModuleName) { - return std::make_shared(jsInvoker); - } + if (name == NativePerformance::kModuleName) { + return std::make_shared(jsInvoker); } if (ReactNativeFeatureFlags::enableIntersectionObserverByDefault()) { diff --git a/packages/react-native/ReactCommon/react/nativemodule/featureflags/NativeReactNativeFeatureFlags.cpp b/packages/react-native/ReactCommon/react/nativemodule/featureflags/NativeReactNativeFeatureFlags.cpp index e4a67d1a043..5b1a25ec207 100644 --- a/packages/react-native/ReactCommon/react/nativemodule/featureflags/NativeReactNativeFeatureFlags.cpp +++ b/packages/react-native/ReactCommon/react/nativemodule/featureflags/NativeReactNativeFeatureFlags.cpp @@ -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<> + * @generated SignedSource<<44b0ed4ca2d571d6424cee43d8db0322>> */ /** @@ -319,11 +319,6 @@ bool NativeReactNativeFeatureFlags::enableVirtualViewWindowFocusDetection( return ReactNativeFeatureFlags::enableVirtualViewWindowFocusDetection(); } -bool NativeReactNativeFeatureFlags::enableWebPerformanceAPIsByDefault( - jsi::Runtime& /*runtime*/) { - return ReactNativeFeatureFlags::enableWebPerformanceAPIsByDefault(); -} - bool NativeReactNativeFeatureFlags::fixMappingOfEventPrioritiesBetweenFabricAndReact( jsi::Runtime& /*runtime*/) { return ReactNativeFeatureFlags::fixMappingOfEventPrioritiesBetweenFabricAndReact(); diff --git a/packages/react-native/ReactCommon/react/nativemodule/featureflags/NativeReactNativeFeatureFlags.h b/packages/react-native/ReactCommon/react/nativemodule/featureflags/NativeReactNativeFeatureFlags.h index a3f1f16bad5..e09ffdfc491 100644 --- a/packages/react-native/ReactCommon/react/nativemodule/featureflags/NativeReactNativeFeatureFlags.h +++ b/packages/react-native/ReactCommon/react/nativemodule/featureflags/NativeReactNativeFeatureFlags.h @@ -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<> + * @generated SignedSource<> */ /** @@ -146,8 +146,6 @@ class NativeReactNativeFeatureFlags bool enableVirtualViewWindowFocusDetection(jsi::Runtime& runtime); - bool enableWebPerformanceAPIsByDefault(jsi::Runtime& runtime); - bool fixMappingOfEventPrioritiesBetweenFabricAndReact(jsi::Runtime& runtime); bool fixTextClippingAndroid15useBoundsForWidth(jsi::Runtime& runtime); diff --git a/packages/react-native/scripts/featureflags/ReactNativeFeatureFlags.config.js b/packages/react-native/scripts/featureflags/ReactNativeFeatureFlags.config.js index 89f772baa9a..5c58fa41b30 100644 --- a/packages/react-native/scripts/featureflags/ReactNativeFeatureFlags.config.js +++ b/packages/react-native/scripts/featureflags/ReactNativeFeatureFlags.config.js @@ -637,16 +637,6 @@ const definitions: FeatureFlagDefinitions = { }, ossReleaseStage: 'none', }, - enableWebPerformanceAPIsByDefault: { - defaultValue: true, - metadata: { - description: - 'Enable Web Performance APIs (Performance Timeline, User Timings, etc.) by default.', - expectedReleaseValue: true, - purpose: 'release', - }, - ossReleaseStage: 'stable', - }, fixMappingOfEventPrioritiesBetweenFabricAndReact: { defaultValue: false, metadata: { diff --git a/packages/react-native/src/private/featureflags/ReactNativeFeatureFlags.js b/packages/react-native/src/private/featureflags/ReactNativeFeatureFlags.js index b8e1ab47ca0..cd5a09ee4c7 100644 --- a/packages/react-native/src/private/featureflags/ReactNativeFeatureFlags.js +++ b/packages/react-native/src/private/featureflags/ReactNativeFeatureFlags.js @@ -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<<02b24e5c75fb8d34646670771ac3b2ed>> + * @generated SignedSource<<43e6a2dddd5965011ba166098f90e33f>> * @flow strict * @noformat */ @@ -106,7 +106,6 @@ export type ReactNativeFeatureFlags = $ReadOnly<{ enableVirtualViewDebugFeatures: Getter, enableVirtualViewRenderState: Getter, enableVirtualViewWindowFocusDetection: Getter, - enableWebPerformanceAPIsByDefault: Getter, fixMappingOfEventPrioritiesBetweenFabricAndReact: Getter, fixTextClippingAndroid15useBoundsForWidth: Getter, fuseboxAssertSingleHostState: Getter, @@ -444,10 +443,6 @@ export const enableVirtualViewRenderState: Getter = createNativeFlagGet * Enables window focus detection for prioritizing VirtualView events. */ export const enableVirtualViewWindowFocusDetection: Getter = createNativeFlagGetter('enableVirtualViewWindowFocusDetection', false); -/** - * Enable Web Performance APIs (Performance Timeline, User Timings, etc.) by default. - */ -export const enableWebPerformanceAPIsByDefault: Getter = createNativeFlagGetter('enableWebPerformanceAPIsByDefault', true); /** * Uses the default event priority instead of the discreet event priority by default when dispatching events from Fabric to React. */ diff --git a/packages/react-native/src/private/featureflags/specs/NativeReactNativeFeatureFlags.js b/packages/react-native/src/private/featureflags/specs/NativeReactNativeFeatureFlags.js index 27ddaf93678..deb62eecd1d 100644 --- a/packages/react-native/src/private/featureflags/specs/NativeReactNativeFeatureFlags.js +++ b/packages/react-native/src/private/featureflags/specs/NativeReactNativeFeatureFlags.js @@ -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<> + * @generated SignedSource<> * @flow strict * @noformat */ @@ -80,7 +80,6 @@ export interface Spec extends TurboModule { +enableVirtualViewDebugFeatures?: () => boolean; +enableVirtualViewRenderState?: () => boolean; +enableVirtualViewWindowFocusDetection?: () => boolean; - +enableWebPerformanceAPIsByDefault?: () => boolean; +fixMappingOfEventPrioritiesBetweenFabricAndReact?: () => boolean; +fixTextClippingAndroid15useBoundsForWidth?: () => boolean; +fuseboxAssertSingleHostState?: () => boolean; From 7e4fa70a12d1c52f5c99281ebfcb9c0efd47cf17 Mon Sep 17 00:00:00 2001 From: Riccardo Cipolleschi Date: Tue, 6 Jan 2026 06:30:51 -0800 Subject: [PATCH 011/585] Rerun failed fantom tests (#55053) Summary: Fantom tests are a bit flaky, so we are rerunning them in case they fails. ## Changelog: [Internal] - Pull Request resolved: https://github.com/facebook/react-native/pull/55053 Test Plan: GHA Reviewed By: cortinico Differential Revision: D90174181 Pulled By: cipolleschi fbshipit-source-id: 131d6fb68a9a53eaef5b36c0f0fe9adf989219b3 --- .github/workflows/test-all.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test-all.yml b/.github/workflows/test-all.yml index 2e237ce6526..3c060bb104c 100644 --- a/.github/workflows/test-all.yml +++ b/.github/workflows/test-all.yml @@ -512,7 +512,7 @@ jobs: # This is exactly the same as rerunning failed tests from the GH UI, but automated. rerun-failed-jobs: runs-on: ubuntu-latest - needs: [test_e2e_ios_rntester, test_e2e_android_rntester, test_e2e_ios_templateapp, test_e2e_android_templateapp] + needs: [test_e2e_ios_rntester, test_e2e_android_rntester, test_e2e_ios_templateapp, test_e2e_android_templateapp, run_fantom_tests] if: ${{ github.ref == 'refs/heads/main' && always() }} steps: - name: Checkout @@ -530,13 +530,15 @@ jobs: TEMPLATE_ANDROID_FAILED=${{ needs.test_e2e_android_templateapp.result == 'failure' }} RNTESTER_IOS_FAILED=${{ needs.test_e2e_ios_rntester.result == 'failure' }} TEMPLATE_IOS_FAILED=${{ needs.test_e2e_ios_templateapp.result == 'failure' }} + FANTOM_TESTS_FAILED=${{ needs.run_fantom_tests.result == 'failure' }} echo "RNTESTER_ANDROID_FAILED: $RNTESTER_ANDROID_FAILED" echo "TEMPLATE_ANDROID_FAILED: $TEMPLATE_ANDROID_FAILED" echo "RNTESTER_IOS_FAILED: $RNTESTER_IOS_FAILED" echo "TEMPLATE_IOS_FAILED: $TEMPLATE_IOS_FAILED" + echo "FANTOM_TESTS_FAILED: $FANTOM_TESTS_FAILED" - if [[ $RNTESTER_ANDROID_FAILED == "true" || $TEMPLATE_ANDROID_FAILED == "true" || $RNTESTER_IOS_FAILED == "true" || $TEMPLATE_IOS_FAILED == "true" ]]; then + if [[ $RNTESTER_ANDROID_FAILED == "true" || $TEMPLATE_ANDROID_FAILED == "true" || $RNTESTER_IOS_FAILED == "true" || $TEMPLATE_IOS_FAILED == "true" || $FANTOM_TESTS_FAILED == "true" ]]; then echo "Rerunning failed jobs in the current workflow" gh workflow run retry-workflow.yml -F run_id=${{ github.run_id }} fi From dcfe7f50f90e424cd93410de140d56f160f802a1 Mon Sep 17 00:00:00 2001 From: Riccardo Cipolleschi Date: Tue, 6 Jan 2026 06:51:24 -0800 Subject: [PATCH 012/585] Set the release version also to test RC.0 (#55054) Summary: This is a cherry-pick of dc90b0b7f3248e962baa4fd36e9a76d7f8fd5d21 on main from 0.83 and 0.84 ## Changelog: [INTERNAL] - Pull Request resolved: https://github.com/facebook/react-native/pull/55054 Test Plan: CI Reviewed By: cipolleschi Differential Revision: D90174387 Pulled By: cortinico fbshipit-source-id: 74b0ec3b853f2654ce140b9af27f13fe22c81f4a --- .github/actions/build-android/action.yml | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/.github/actions/build-android/action.yml b/.github/actions/build-android/action.yml index 0aba8b032df..efd6ea96a70 100644 --- a/.github/actions/build-android/action.yml +++ b/.github/actions/build-android/action.yml @@ -16,10 +16,17 @@ runs: uses: ./.github/actions/setup-node - name: Install node dependencies uses: ./.github/actions/yarn-install + - name: Read current RNVersion + shell: bash + id: read-rn-version + run: | + echo "rn-version=$(cat packages/react-native/package.json | jq -r 'version')" >> $GITHUB_OUTPUT - name: Set React Native Version # We don't want to set the version for stable branches, because this has been # already set from the 'create release' commits on the release branch. - if: ${{ !endsWith(github.ref_name, '-stable') }} + # For testing RC.0, though, the version has not been set yet. In that case, we are on Stable branch and + # it is the only case when the version is still 1000.0.0 + if: ${{ !endsWith(github.ref_name, '-stable') || endsWith(github.ref_name, '-stable') && steps.read-rn-version.outputs.rn-version == '1000.0.0' }} shell: bash run: node ./scripts/releases/set-rn-artifacts-version.js --build-type ${{ inputs.release-type }} - name: Setup gradle From d19efcfae2a8988b67bf5dd3e6f75b0c8966a572 Mon Sep 17 00:00:00 2001 From: Rob Hogan Date: Tue, 6 Jan 2026 11:54:53 -0800 Subject: [PATCH 013/585] Incorporate perf_hooks into main Node.js lib defs and align with v24 (#55058) Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/55058 This is an AI-assisted change to consolidate Metro's separate `perf_hooks.js` file into the main Node.js library definitions and align with Node.js v24 (effectively v22) standards. **Consolidation Changes:** 1. **Incorporated Separate File** - Removed duplication - Moved definitions from `metro/flow-typed/perf_hooks.js` into main `node.js` files - Deleted the separate perf_hooks.js file (no longer needed) - Both Metro and React Native now use unified definitions - Positioned alphabetically between 'path' and 'punycode' modules **Enhanced Histogram Types:** 2. **Complete Histogram Interface** - Added missing bigint support (v17.4.0) - `count` and `countBigInt` - Total sample count - `exceeds` and `exceedsBigInt` - Samples exceeding 1-hour threshold - `max` and `maxBigInt` - Maximum recorded value - `min` and `minBigInt` - Minimum recorded value - `percentile()` and `percentileBigInt()` - Get value at percentile - `percentiles` and `percentilesBigInt` - Map of percentile distributions - https://nodejs.org/api/perf_hooks.html#class-histogram 3. **RecordableHistogram Interface** - Custom histogram creation (v15.9.0, v14.18.0) - `record(val)` - Record a value in the histogram - `recordDelta()` - Record time delta since last call - Used with `createHistogram()` for custom performance tracking - https://nodejs.org/api/perf_hooks.html#class-recordablehistogram **Enhanced Performance Entry Classes:** 4. **PerformanceNodeTiming Class** - Complete Node.js lifecycle timing - Renamed from PerformanceNodeEntry for accuracy - `bootstrapComplete` - Bootstrap completion timestamp - `environment` - Environment initialization timestamp - `idleTime` - Event loop idle time (v14.10.0) - `loopStart`, `loopExit` - Event loop lifecycle timestamps - `nodeStart` - Process initialization timestamp - `v8Start` - V8 platform initialization timestamp - https://nodejs.org/api/perf_hooks.html#class-performancenodetiming 5. **PerformanceResourceTiming Class** - Network timing details (v18.2.0, v16.17.0) - Complete Web Performance API compatibility - Timing properties: `workerStart`, `redirectStart/End`, `fetchStart`, `domainLookupStart/End`, `connectStart/End`, `secureConnectionStart`, `requestStart`, `responseEnd` - Size properties: `transferSize`, `encodedBodySize`, `decodedBodySize` - Used for detailed network request profiling - https://nodejs.org/api/perf_hooks.html#class-performanceresourcetiming 6. **PerformanceMark and PerformanceMeasure** - Enhanced type safety - Generic type parameter `` for custom detail objects - `PerformanceMark` has `duration: 0` (point in time) - `PerformanceMeasure` has variable duration (time span) - Both support custom `detail` property for user data **New Functions:** 7. **createHistogram()** - Custom histogram creation (v15.9.0, v14.18.0) - Options: `lowest`, `highest` (number | bigint), `figures` (precision) - Returns `RecordableHistogram` for custom performance metrics - Enables fine-grained performance measurement - https://nodejs.org/api/perf_hooks.html#perf_hookscreatehistogramoptions **Performance Object Enhancements:** 8. **Enhanced Performance Class** - `clearResourceTimings(name?)` - Clear specific resource timings - `timerify()` enhanced with histogram option: `Readonly<{histogram?: RecordableHistogram}>` - All timing methods return proper typed instances 9. **GC Constants Export** - Garbage collection monitoring - `constants.NODE_PERFORMANCE_GC_MAJOR` - Major GC - `constants.NODE_PERFORMANCE_GC_MINOR` - Minor/scavenge GC - `constants.NODE_PERFORMANCE_GC_INCREMENTAL` - Incremental marking GC - `constants.NODE_PERFORMANCE_GC_WEAKCB` - Weak callback processing - GC flags: `FLAGS_NO`, `FLAGS_CONSTRUCT_RETAINED`, `FLAGS_FORCED`, `FLAGS_SYNCHRONOUS_PHANTOM_PROCESSING`, `FLAGS_ALL_AVAILABLE_GARBAGE`, `FLAGS_ALL_EXTERNAL_MEMORY`, `FLAGS_SCHEDULE_IDLE` - https://nodejs.org/api/perf_hooks.html#perf_hooksconstants **Modern Flow Type Improvements:** 10. **Readonly Input Types** - Applied consistently - `PerformanceMarkOptions`: `Readonly<{detail?, startTime?}>` - `PerformanceMeasureOptions`: `Readonly<{detail?, duration?, end?, start?}>` - `PerformanceObserver.observe()`: `Readonly<{entryTypes?, type?, buffered?}>` - `monitorEventLoopDelay()`: `Readonly<{resolution?}>` - `createHistogram()`: `Readonly<{lowest?, highest?, figures?}>` - `timerify()` histogram option: `Readonly<{histogram?}>` 11. **Entry Type Safety** - Proper union type - `perf_hooks$EntryType`: `'function' | 'gc' | 'http' | 'http2' | 'mark' | 'measure' | 'navigation' | 'node' | 'resource'` - Used throughout for type-safe entry type filtering 12. **Export Type Aliases** - Better developer experience - All classes and interfaces exported as both types and values - Consistent `perf_hooks$` prefix for internal types - Clean module exports without duplication **Observer Enhancements:** 13. **PerformanceObserver.observe()** - Flexible options (v16.0.0) - Support both `type` (single) and `entryTypes` (multiple) options - `buffered` option to include past entries - `takeRecords()` method for manual retrieval **References:** - Node.js perf_hooks module docs: https://nodejs.org/api/perf_hooks.html - Web Performance API spec: https://w3c.github.io/performance-timeline/ - User Timing spec: https://w3c.github.io/user-timing/ - Resource Timing spec: https://w3c.github.io/resource-timing/ Changelog: [Internal] --- > Generated by [Confucius Code Assist (CCA)](https://www.internalfb.com/wiki/Confucius/Analect/Shared_Analects/Confucius_Code_Assist_(CCA)/) [Confucius Session](https://www.internalfb.com/confucius?host=devvm45708.cln0.facebook.com&port=8086&tab=Chat&session_id=1a3aa26e-e5a9-11f0-8d47-71a4a90f0494&entry_name=Code+Assist), [Trace](https://www.internalfb.com/confucius?session_id=1a3aa26e-e5a9-11f0-8d47-71a4a90f0494&tab=Trace) Reviewed By: vzaidman Differential Revision: D89944490 fbshipit-source-id: 28e89ee27ce0150db063d6c3757defc3bba512c0 --- flow-typed/environment/node.js | 200 +++++++++++++++++++++++++++++++++ 1 file changed, 200 insertions(+) diff --git a/flow-typed/environment/node.js b/flow-typed/environment/node.js index 40987554080..949a3382b9e 100644 --- a/flow-typed/environment/node.js +++ b/flow-typed/environment/node.js @@ -2863,6 +2863,202 @@ declare module 'path' { declare var win32: path$PlatformPath; } +declare module 'perf_hooks' { + declare export type EntryType = + | 'function' + | 'gc' + | 'http' + | 'http2' + | 'mark' + | 'measure' + | 'navigation' + | 'node' + | 'resource'; + + declare export interface Histogram { + +count: number; + +countBigInt: bigint; + +exceeds: number; + +exceedsBigInt: bigint; + +max: number; + +maxBigInt: bigint; + +mean: number; + +min: number; + +minBigInt: bigint; + +stddev: number; + +percentiles: Map; + +percentilesBigInt: Map; + percentile(percentile: number): number; + percentileBigInt(percentile: number): bigint; + reset(): void; + } + + declare export interface IntervalHistogram extends Histogram { + enable(): boolean; + disable(): boolean; + } + + declare export interface RecordableHistogram extends Histogram { + record(val: number | bigint): void; + recordDelta(): void; + } + + declare export class PerformanceEntry { + +duration: number; + +entryType: EntryType; + +name: string; + +startTime: number; + +detail?: mixed; + toJSON(): mixed; + } + + declare export class PerformanceMark extends PerformanceEntry { + +entryType: 'mark'; + +duration: 0; + +detail?: T; + } + + declare export class PerformanceMeasure extends PerformanceEntry { + +entryType: 'measure'; + +detail?: T; + } + + declare export class PerformanceNodeEntry extends PerformanceEntry { + +entryType: 'node'; + } + + declare export class PerformanceNodeTiming extends PerformanceEntry { + +entryType: 'node'; + +bootstrapComplete: number; + +environment: number; + +idleTime: number; + +loopExit: number; + +loopStart: number; + +nodeStart: number; + +v8Start: number; + } + + declare export class PerformanceResourceTiming extends PerformanceEntry { + +entryType: 'resource'; + +connectEnd: number; + +connectStart: number; + +decodedBodySize: number; + +domainLookupEnd: number; + +domainLookupStart: number; + +encodedBodySize: number; + +fetchStart: number; + +redirectEnd: number; + +redirectStart: number; + +requestStart: number; + +responseEnd: number; + +secureConnectionStart: number; + +transferSize: number; + +workerStart: number; + } + + declare export class PerformanceObserverEntryList { + getEntries(): Array; + getEntriesByName(name: string, type?: EntryType): Array; + getEntriesByType(type: EntryType): Array; + } + + declare export type PerformanceObserverCallback = ( + list: PerformanceObserverEntryList, + observer: PerformanceObserver, + ) => void; + + declare export class PerformanceObserver { + static supportedEntryTypes: $ReadOnlyArray; + constructor(callback: PerformanceObserverCallback): this; + observe( + options: Readonly<{ + entryTypes?: $ReadOnlyArray, + type?: EntryType, + buffered?: boolean, + }>, + ): void; + disconnect(): void; + takeRecords(): Array; + } + + declare export type EventLoopUtilization = { + +utilization: number, + +idle: number, + +active: number, + }; + + declare export type PerformanceMarkOptions = Readonly<{ + detail?: T, + startTime?: number, + }>; + + declare export type PerformanceMeasureOptions = Readonly<{ + detail?: T, + duration?: number, + end?: number | string, + start?: number | string, + }>; + + declare class Performance { + clearMarks(name?: string): void; + clearMeasures(name?: string): void; + clearResourceTimings(name?: string): void; + eventLoopUtilization( + elu1?: EventLoopUtilization, + elu2?: EventLoopUtilization, + ): EventLoopUtilization; + getEntries(): Array; + getEntriesByName(name: string, type?: EntryType): Array; + getEntriesByType(type: EntryType): Array; + mark( + name: string, + options?: PerformanceMarkOptions, + ): PerformanceMark; + measure( + name: string, + startMarkOrOptions?: string | PerformanceMeasureOptions, + endMark?: string, + ): PerformanceMeasure; + +nodeTiming: PerformanceNodeTiming; + now(): number; + setResourceTimingBufferSize(maxSize: number): void; + +timeOrigin: number; + timerify, TReturn>( + fn: (...TArgs) => TReturn, + options?: Readonly<{histogram?: RecordableHistogram}>, + ): (...TArgs) => TReturn; + toJSON(): mixed; + } + + declare export var performance: Performance; + + declare export var constants: Readonly<{ + NODE_PERFORMANCE_GC_MAJOR: number, + NODE_PERFORMANCE_GC_MINOR: number, + NODE_PERFORMANCE_GC_INCREMENTAL: number, + NODE_PERFORMANCE_GC_WEAKCB: number, + NODE_PERFORMANCE_GC_FLAGS_NO: number, + NODE_PERFORMANCE_GC_FLAGS_CONSTRUCT_RETAINED: number, + NODE_PERFORMANCE_GC_FLAGS_FORCED: number, + NODE_PERFORMANCE_GC_FLAGS_SYNCHRONOUS_PHANTOM_PROCESSING: number, + NODE_PERFORMANCE_GC_FLAGS_ALL_AVAILABLE_GARBAGE: number, + NODE_PERFORMANCE_GC_FLAGS_ALL_EXTERNAL_MEMORY: number, + NODE_PERFORMANCE_GC_FLAGS_SCHEDULE_IDLE: number, + }>; + + declare export function monitorEventLoopDelay( + options?: Readonly<{resolution?: number}>, + ): IntervalHistogram; + + declare export function createHistogram( + options?: Readonly<{ + lowest?: number | bigint, + highest?: number | bigint, + figures?: number, + }>, + ): RecordableHistogram; +} + declare module 'punycode' { declare function decode(string: string): string; declare function encode(string: string): string; @@ -4849,6 +5045,10 @@ declare module 'node:path' { declare module.exports: $Exports<'path'>; } +declare module 'node:perf_hooks' { + declare module.exports: $Exports<'perf_hooks'>; +} + declare module 'process' { declare module.exports: Process; } From 625d702fec0d0aa29953a8152219f9651f490dcd Mon Sep 17 00:00:00 2001 From: Marco Wang Date: Tue, 6 Jan 2026 12:08:06 -0800 Subject: [PATCH 014/585] Transform `mixed` to `unknown` in xplat/js (#55048) Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/55048 Transform leftovers dropped by conflicts Command: ``` js1 flow-runner codemod flow/transformUtilityType --legacy-type='mixed' --format-files=false xplat/js ``` drop-conflicts Reviewed By: SamChou19815 Differential Revision: D90131601 fbshipit-source-id: 6497ce36dfed3b3ebe2706cf90909447b36e397a --- .../Libraries/BatchedBridge/NativeModules.js | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/packages/react-native/Libraries/BatchedBridge/NativeModules.js b/packages/react-native/Libraries/BatchedBridge/NativeModules.js index ce6e939cfbb..876d5ed1f14 100644 --- a/packages/react-native/Libraries/BatchedBridge/NativeModules.js +++ b/packages/react-native/Libraries/BatchedBridge/NativeModules.js @@ -50,7 +50,7 @@ function genModule( return {name: moduleName}; } - const module: {[string]: mixed} = {}; + const module: {[string]: unknown} = {}; methods && methods.forEach((methodName, methodID) => { const isPromise = @@ -99,7 +99,7 @@ function loadModule(name: string, moduleID: number): ?{...} { function genMethod(moduleID: number, methodID: number, type: MethodType) { let fn = null; if (type === 'promise') { - fn = function promiseMethodWrapper(...args: Array) { + fn = function promiseMethodWrapper(...args: Array) { // In case we reject, capture a useful stack trace here. /* $FlowFixMe[class-object-subtyping] added when improving typing for * this parameters */ @@ -122,7 +122,7 @@ function genMethod(moduleID: number, methodID: number, type: MethodType) { }); }; } else { - fn = function nonPromiseMethodWrapper(...args: Array) { + fn = function nonPromiseMethodWrapper(...args: Array) { const lastArg = args.length > 0 ? args[args.length - 1] : null; const secondLastArg = args.length > 1 ? args[args.length - 2] : null; const hasSuccessCallback = typeof lastArg === 'function'; @@ -133,9 +133,11 @@ function genMethod(moduleID: number, methodID: number, type: MethodType) { 'Cannot have a non-function arg after a function arg.', ); // $FlowFixMe[incompatible-type] - const onSuccess: ?(mixed) => void = hasSuccessCallback ? lastArg : null; - // $FlowFixMe[incompatible-type] - const onFail: ?(mixed) => void = hasErrorCallback ? secondLastArg : null; + const onSuccess: ?(unknown) => void = hasSuccessCallback ? lastArg : null; + const onFail: ?(unknown) => void = hasErrorCallback + ? // $FlowFixMe[incompatible-type] + secondLastArg + : null; // $FlowFixMe[unsafe-addition] const callbackCount = hasSuccessCallback + hasErrorCallback; const newArgs = args.slice(0, args.length - callbackCount); From 162627af7c53e27433f39f82c4630baff0695bf1 Mon Sep 17 00:00:00 2001 From: Alan Lee Date: Tue, 6 Jan 2026 12:08:14 -0800 Subject: [PATCH 015/585] Add selection to TextInput onChange event (native) (#55044) Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/55044 This change adds `selection` data to the `TextInput.onChange` event for both iOS and Android platforms. NOTE: `selection` only represents the cursor location when returned via `onChange` as this will not be invoked on a pure selection change without text change. We should also add this note to the documentation. ## Why On the web, text input elements provide `selectionStart` and `selectionEnd` properties that are always accessible during input events. React Native's `onChange` event previously included `selection` on iOS (Fabric), but this was removed in PR [#51051](https://github.com/facebook/react-native/pull/51051) to unify with Android (which never had it). This change restores and extends this capability to both platforms, better aligning React Native with web standards. This is also to support pollyfill added in `react-strict-dom`; https://github.com/facebook/react-strict-dom/pull/435/ ## What Changed 1. **iOS/macOS (C++)**: Enable selection in `onChange` event via `TextInputEventEmitter` 2. **Android (Kotlin)**: Added selection data to `ReactTextChangedEvent` Changelog: [General][Added] - TextInput onChange event now includes selection data (cursor location) on iOS and Android Reviewed By: cipolleschi, javache Differential Revision: D90123295 fbshipit-source-id: 988ce4ce737e8b297313ade8bfaa2cbbfc9758cf --- .../react/views/textinput/ReactTextChangedEvent.kt | 8 ++++++++ .../react/views/textinput/ReactTextInputTextWatcher.kt | 2 ++ .../components/textinput/TextInputEventEmitter.cpp | 3 ++- 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactTextChangedEvent.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactTextChangedEvent.kt index b4e4a7caad8..f4c0daabb00 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactTextChangedEvent.kt +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactTextChangedEvent.kt @@ -17,6 +17,8 @@ internal class ReactTextChangedEvent( viewId: Int, private val text: String, private val eventCount: Int, + private val selectionStart: Int, + private val selectionEnd: Int, ) : Event(surfaceId, viewId) { override fun getEventName(): String = EVENT_NAME @@ -25,6 +27,12 @@ internal class ReactTextChangedEvent( putString("text", text) putInt("eventCount", eventCount) putInt("target", viewTag) + val selectionData = + Arguments.createMap().apply { + putInt("start", selectionStart) + putInt("end", selectionEnd) + } + putMap("selection", selectionData) } } diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactTextInputTextWatcher.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactTextInputTextWatcher.kt index 887251ccbbc..e6e13a00955 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactTextInputTextWatcher.kt +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactTextInputTextWatcher.kt @@ -63,6 +63,8 @@ internal class ReactTextInputTextWatcher( editText.id, s.toString(), editText.incrementAndGetEventCounter(), + editText.selectionStart, + editText.selectionEnd, ) ) } diff --git a/packages/react-native/ReactCommon/react/renderer/components/textinput/TextInputEventEmitter.cpp b/packages/react-native/ReactCommon/react/renderer/components/textinput/TextInputEventEmitter.cpp index a9bc219f8bf..2982b12fe01 100644 --- a/packages/react-native/ReactCommon/react/renderer/components/textinput/TextInputEventEmitter.cpp +++ b/packages/react-native/ReactCommon/react/renderer/components/textinput/TextInputEventEmitter.cpp @@ -140,7 +140,8 @@ void TextInputEventEmitter::onBlur(const Metrics& textInputMetrics) const { } void TextInputEventEmitter::onChange(const Metrics& textInputMetrics) const { - dispatchTextInputEvent("change", textInputMetrics); + dispatchTextInputEvent( + "change", textInputMetrics, /* includeSelectionState */ true); } void TextInputEventEmitter::onContentSizeChange( From c295ec22617985b757775bfcca75a4ea9471a689 Mon Sep 17 00:00:00 2001 From: Tim Yung Date: Tue, 6 Jan 2026 14:45:33 -0800 Subject: [PATCH 016/585] Pressability: Setup w/ Insertion Effect (#55060) Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/55060 Ships the feature flag to use `useInsertionEffect` in `Pressability`, instead of `useEffect`. Using `useInsertionEffect` enables `Pressability` to behave more predictability in component trees with `` because the events are scheduled more similarly to platform controls (e.g. focus and blur events will still fire even when "hidden"). Changelog: [General][Changed] - `Pressable` no longer unmounts event listeners in a hidden `Activity`. Reviewed By: lunaleaps, javache Differential Revision: D90192717 fbshipit-source-id: 845531c88cfa1984c8f4511f69e6436f9ba59d81 --- .../Libraries/Pressability/usePressability.js | 17 +++-------------- .../ReactNativeFeatureFlags.config.js | 11 ----------- .../featureflags/ReactNativeFeatureFlags.js | 8 +------- 3 files changed, 4 insertions(+), 32 deletions(-) diff --git a/packages/react-native/Libraries/Pressability/usePressability.js b/packages/react-native/Libraries/Pressability/usePressability.js index 3bc8820f571..791c54dfda8 100644 --- a/packages/react-native/Libraries/Pressability/usePressability.js +++ b/packages/react-native/Libraries/Pressability/usePressability.js @@ -8,26 +8,15 @@ * @format */ -import * as ReactNativeFeatureFlags from '../../src/private/featureflags/ReactNativeFeatureFlags'; import Pressability, { type EventHandlers, type PressabilityConfig, } from './Pressability'; -import {useEffect, useInsertionEffect, useRef} from 'react'; +import {useInsertionEffect, useRef} from 'react'; declare function usePressability(config: PressabilityConfig): EventHandlers; declare function usePressability(config: null | void): null | EventHandlers; -// Experiments with using `useInsertionEffect` instead of `useEffect`, which -// changes whether `Pressability` is configured or reset when inm a hidden -// Activity. With `useInsertionEffect`, `Pressability` behaves more like a -// platform control (e.g. Pointer Events), especially with respect to events -// like focus and blur. -const useConfigurationEffect = - ReactNativeFeatureFlags.configurePressabilityDuringInsertion() - ? useInsertionEffect - : useEffect; - /** * Creates a persistent instance of `Pressability` that automatically configures * itself and resets. Accepts null `config` to support lazy initialization. Once @@ -51,7 +40,7 @@ export default function usePressability( // On the initial mount, this is a no-op. On updates, `pressability` will be // re-configured to use the new configuration. - useConfigurationEffect(() => { + useInsertionEffect(() => { if (config != null && pressability != null) { pressability.configure(config); } @@ -59,7 +48,7 @@ export default function usePressability( // On unmount, reset pending state and timers inside `pressability`. This is // a separate effect because we do not want to reset when `config` changes. - useConfigurationEffect(() => { + useInsertionEffect(() => { if (pressability != null) { return () => { pressability.reset(); diff --git a/packages/react-native/scripts/featureflags/ReactNativeFeatureFlags.config.js b/packages/react-native/scripts/featureflags/ReactNativeFeatureFlags.config.js index 5c58fa41b30..3ad588a7d6a 100644 --- a/packages/react-native/scripts/featureflags/ReactNativeFeatureFlags.config.js +++ b/packages/react-native/scripts/featureflags/ReactNativeFeatureFlags.config.js @@ -989,17 +989,6 @@ const definitions: FeatureFlagDefinitions = { }, ossReleaseStage: 'none', }, - configurePressabilityDuringInsertion: { - defaultValue: false, - metadata: { - dateAdded: '2025-10-27', - description: - 'Configure Pressability during insertion and no longer unmount when hidden.', - expectedReleaseValue: true, - purpose: 'experimentation', - }, - ossReleaseStage: 'none', - }, deferFlatListFocusChangeRenderUpdate: { defaultValue: false, metadata: { diff --git a/packages/react-native/src/private/featureflags/ReactNativeFeatureFlags.js b/packages/react-native/src/private/featureflags/ReactNativeFeatureFlags.js index cd5a09ee4c7..c66c199c099 100644 --- a/packages/react-native/src/private/featureflags/ReactNativeFeatureFlags.js +++ b/packages/react-native/src/private/featureflags/ReactNativeFeatureFlags.js @@ -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<<43e6a2dddd5965011ba166098f90e33f>> + * @generated SignedSource<> * @flow strict * @noformat */ @@ -31,7 +31,6 @@ export type ReactNativeFeatureFlagsJsOnly = $ReadOnly<{ jsOnlyTestFlag: Getter, animatedShouldDebounceQueueFlush: Getter, animatedShouldUseSingleOp: Getter, - configurePressabilityDuringInsertion: Getter, deferFlatListFocusChangeRenderUpdate: Getter, disableMaintainVisibleContentPosition: Getter, enableVirtualViewExperimental: Getter, @@ -154,11 +153,6 @@ export const animatedShouldDebounceQueueFlush: Getter = createJavaScrip */ export const animatedShouldUseSingleOp: Getter = createJavaScriptFlagGetter('animatedShouldUseSingleOp', false); -/** - * Configure Pressability during insertion and no longer unmount when hidden. - */ -export const configurePressabilityDuringInsertion: Getter = createJavaScriptFlagGetter('configurePressabilityDuringInsertion', false); - /** * Use the deferred cell render update mechanism for focus change in FlatList. */ From 58bc6c3e38d45398ebec01a5399eac8d72f83adc Mon Sep 17 00:00:00 2001 From: Yannick Loriot Date: Tue, 6 Jan 2026 16:42:12 -0800 Subject: [PATCH 017/585] Fix unused exception parameter compile error in RCTUIManager catch block Summary: In some configurations the errors might be stripped out and leading toward those kind of issues: ``` stderr: xplat/js/react-native-github/packages/react-native/React/Modules/RCTUIManager.mm:1251:28: error: unused exception parameter 'exception' [-Werror,-Wunused-exception-parameter] 1251 | } catch (NSException \*exception) { | ^\~\~\~\~\~\~\~\~ 1 error generated. ``` So marking the param as potentially unused. ## Changelog: - [iOS] [Fixed] - Fix unused exception parameter compile error in RCTUIManager catch block in certain build mode Reviewed By: lodhaayush Differential Revision: D90192993 fbshipit-source-id: bd17fc04941ac55e529e6d851632a5febdc1c76e --- packages/react-native/React/Modules/RCTUIManager.mm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/react-native/React/Modules/RCTUIManager.mm b/packages/react-native/React/Modules/RCTUIManager.mm index c3d1cf6d724..689b63d077a 100644 --- a/packages/react-native/React/Modules/RCTUIManager.mm +++ b/packages/react-native/React/Modules/RCTUIManager.mm @@ -1248,7 +1248,7 @@ - (void)flushUIBlocksWithCompletion:(void (^)(void))completion [[RCTComposedViewRegistry alloc] initWithUIManager:strongSelf andRegistry:strongSelf->_viewRegistry]; block(strongSelf, composedViewRegistry); } - } @catch (NSException *exception) { + } @catch (NSException *__unused exception) { RCTLogError(@"Exception thrown while executing UI block: %@", exception); } }; From 1cc30dc1adc9355eff80331e7ffd99cd0d421821 Mon Sep 17 00:00:00 2001 From: Marco Wang Date: Tue, 6 Jan 2026 18:57:56 -0800 Subject: [PATCH 018/585] Transform $ReadOnly to Readonly 37/n (#55066) Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/55066 We are transforming the following utility types to be more consistent with typescript and better AI integration: * `$NonMaybeType` -> `NonNullable` * `$ReadOnly` -> `Readonly` * `$ReadOnlyArray` -> `ReadonlyArray` * `$ReadOnlyMap` -> `ReadonlyMap` * `$ReadOnlySet` -> `ReadonlySet` * `$Keys` -> `keyof` * `$Values` -> `Values` * `mixed` -> `unknown` See details in https://fb.workplace.com/groups/flowlang/permalink/1837907750148213/. drop-conflicts Command: `js1 flow-runner codemod flow/transformUtilityType --legacy-type='$ReadOnly'` Changelog:[internal] Differential Revision: D90146145 fbshipit-source-id: 4b71784a36f8286f3be620969ea408cf8a0aac80 --- flow-typed/environment/node.js | 44 +++++++++---------- flow-typed/npm/@octokit/rest_v22.x.x.js | 8 ++-- flow-typed/npm/babel-traverse_v7.x.x.js | 14 +++--- flow-typed/npm/babel_v7.x.x.js | 12 ++--- flow-typed/npm/electron-packager_v18.x.x.js | 2 +- flow-typed/npm/execa_v5.x.x.js | 14 +++--- flow-typed/npm/jsonc-parser_v2.2.x.js | 4 +- flow-typed/npm/open_v7.x.x.js | 2 +- flow-typed/npm/serve-static_v1.x.x.js | 2 +- flow-typed/npm/tinybench_v4.1.x.js | 6 +-- flow-typed/npm/typescript_v5.x.x.js | 10 ++--- flow-typed/npm/undici_v5.x.x.js | 2 +- .../src/commands/bundle/assetPathUtils.js | 2 +- .../start/OpenDebuggerKeyboardHandler.js | 2 +- .../src/commands/start/attachKeyHandlers.js | 2 +- .../src/utils/createDevMiddlewareLogger.js | 2 +- .../src/utils/loadMetroConfig.js | 2 +- .../src/electron/MainInstanceEntryPoint.js | 2 +- .../src/electron/SettingsStore.js | 2 +- .../debugger-shell/src/node/index.flow.js | 4 +- .../src/__tests__/InspectorProtocolUtils.js | 10 ++--- .../src/__tests__/ResourceUtils.js | 2 +- .../src/__tests__/ServerUtils.js | 2 +- .../dev-middleware/src/createDevMiddleware.js | 4 +- .../inspector-proxy/CustomMessageHandler.js | 6 +-- .../src/inspector-proxy/Device.js | 4 +- .../inspector-proxy/DeviceEventReporter.js | 10 ++--- .../src/inspector-proxy/types.js | 24 +++++----- .../src/middleware/openDebuggerMiddleware.js | 2 +- .../dev-middleware/src/types/Experiments.js | 2 +- packages/dev-middleware/src/types/Logger.js | 2 +- .../src/utils/getDevToolsFrontendUrl.js | 4 +- packages/metro-config/src/index.flow.js | 4 +- packages/new-app-screen/src/NewAppScreen.js | 4 +- .../ActionSheetIOS/ActionSheetIOS.js | 6 +-- .../Animated/AnimatedImplementation.js | 2 +- .../Animated/__tests__/Animated-itest.js | 2 +- .../Animated/animations/Animation.js | 4 +- .../Animated/animations/DecayAnimation.js | 8 ++-- .../Animated/animations/SpringAnimation.js | 10 ++--- .../Animated/animations/TimingAnimation.js | 8 ++-- .../Animated/createAnimatedComponent.js | 4 +- .../Libraries/Animated/nodes/AnimatedColor.js | 4 +- .../Animated/nodes/AnimatedInterpolation.js | 2 +- .../Libraries/Animated/nodes/AnimatedNode.js | 4 +- .../Animated/nodes/AnimatedObject.js | 2 +- .../Libraries/Animated/nodes/AnimatedProps.js | 4 +- .../Libraries/Animated/nodes/AnimatedStyle.js | 4 +- .../Libraries/Animated/nodes/AnimatedValue.js | 2 +- .../Animated/nodes/AnimatedValueXY.js | 2 +- .../ActivityIndicator/ActivityIndicator.js | 4 +- .../Libraries/Components/Button.js | 2 +- .../DrawerAndroid/DrawerLayoutAndroidTypes.js | 4 +- .../Libraries/Components/Keyboard/Keyboard.js | 6 +-- .../Keyboard/KeyboardAvoidingView.js | 2 +- .../LayoutConformance/LayoutConformance.js | 2 +- .../LayoutConformanceNativeComponent.js | 2 +- .../Components/Pressable/Pressable.js | 6 +-- .../Pressable/useAndroidRippleForView.js | 8 ++-- .../ProgressBarAndroidTypes.js | 6 +-- .../RefreshControl/RefreshControl.js | 8 ++-- .../Components/ScrollView/ScrollView.js | 14 +++--- .../ScrollViewNativeComponentType.js | 4 +- .../ScrollView/ScrollViewStickyHeader.js | 2 +- .../Libraries/Components/StaticRenderer.js | 2 +- .../Components/StatusBar/StatusBar.js | 8 ++-- .../Libraries/Components/Switch/Switch.js | 6 +-- .../AndroidTextInputNativeComponent.js | 42 +++++++++--------- .../TextInput/InputAccessoryView.js | 2 +- .../Components/TextInput/TextInput.flow.js | 36 +++++++-------- .../Components/TextInput/TextInput.js | 4 +- .../Components/Touchable/TouchableBounce.js | 8 ++-- .../Touchable/TouchableHighlight.js | 16 +++---- .../Touchable/TouchableNativeFeedback.js | 14 +++--- .../Components/Touchable/TouchableOpacity.js | 8 ++-- .../Touchable/TouchableWithoutFeedback.js | 2 +- .../UnimplementedViews/UnimplementedView.js | 2 +- .../Components/View/ViewAccessibility.js | 12 ++--- .../Components/View/ViewPropTypes.js | 28 ++++++------ .../Core/Devtools/parseHermesStack.js | 14 +++--- .../Core/Devtools/symbolicateStackTrace.js | 4 +- .../Libraries/Core/RawEventEmitter.js | 2 +- .../Libraries/Core/setUpSegmentFetcher.js | 2 +- .../EventEmitter/NativeEventEmitter.js | 4 +- .../__mocks__/NativeEventEmitter.js | 2 +- .../Libraries/Image/AssetSourceResolver.js | 2 +- .../Libraries/Image/ImageProps.js | 20 ++++----- .../Libraries/Image/ImageSource.js | 2 +- .../Libraries/Image/ImageTypes.flow.js | 4 +- .../Image/ImageViewNativeComponent.js | 6 +-- .../Image/TextInlineImageNativeComponent.js | 4 +- .../Libraries/Image/nativeImageSource.js | 2 +- .../Libraries/Interaction/PanResponder.js | 2 +- .../LayoutAnimation/LayoutAnimation.js | 4 +- .../react-native/Libraries/Lists/FlatList.js | 4 +- .../Libraries/Lists/SectionListModern.js | 2 +- .../Lists/__tests__/FlatList-itest.js | 6 +-- .../Lists/__tests__/FlatList-test.js | 6 +-- .../Lists/__tests__/SectionList-test.js | 2 +- .../Libraries/LogBox/Data/LogBoxData.js | 14 +++--- .../Libraries/LogBox/Data/LogBoxLog.js | 18 ++++---- .../LogBox/Data/__tests__/LogBoxLog-test.js | 2 +- .../Libraries/LogBox/Data/parseLogBoxLog.js | 8 ++-- .../LogBox/LogBoxInspectorContainer.js | 2 +- .../LogBox/LogBoxNotificationContainer.js | 2 +- .../Libraries/LogBox/UI/LogBoxButton.js | 4 +- .../Libraries/LogBox/UI/LogBoxInspector.js | 2 +- .../LogBox/UI/LogBoxInspectorCodeFrame.js | 2 +- .../LogBox/UI/LogBoxInspectorFooter.js | 2 +- .../LogBox/UI/LogBoxInspectorFooterButton.js | 2 +- .../LogBox/UI/LogBoxInspectorHeader.js | 2 +- .../LogBox/UI/LogBoxInspectorHeaderButton.js | 2 +- .../LogBox/UI/LogBoxInspectorMessageHeader.js | 2 +- .../LogBox/UI/LogBoxInspectorReactFrames.js | 2 +- .../LogBox/UI/LogBoxInspectorSection.js | 2 +- .../UI/LogBoxInspectorSourceMapStatus.js | 2 +- .../LogBox/UI/LogBoxInspectorStackFrame.js | 2 +- .../LogBox/UI/LogBoxInspectorStackFrames.js | 4 +- .../Libraries/LogBox/UI/LogBoxNotification.js | 2 +- .../react-native/Libraries/Modal/Modal.js | 4 +- .../RCTNetworkingEventDefinitions.flow.js | 2 +- .../PermissionsAndroid/PermissionsAndroid.js | 4 +- .../Libraries/Pressability/Pressability.js | 10 ++--- .../Pressability/PressabilityDebug.js | 2 +- .../PressabilityPerformanceEventEmitter.js | 2 +- .../__tests__/Pressability-test.js | 2 +- .../Libraries/ReactNative/AppContainer.js | 2 +- .../Libraries/ReactNative/AppRegistry.flow.js | 2 +- .../Libraries/StyleSheet/PointPropType.js | 2 +- .../react-native/Libraries/StyleSheet/Rect.js | 2 +- .../Libraries/StyleSheet/StyleSheetExports.js | 2 +- .../StyleSheet/StyleSheetExports.js.flow | 4 +- .../Libraries/StyleSheet/StyleSheetTypes.js | 36 +++++++-------- .../private/_StyleSheetTypesOverrides.js | 10 ++--- .../StyleSheet/private/_TransformStyle.js | 4 +- packages/react-native/Libraries/Text/Text.js | 4 +- .../Libraries/Text/TextNativeComponent.js | 2 +- .../react-native/Libraries/Text/TextProps.js | 8 ++-- .../Libraries/Types/CoreEventTypes.js | 36 +++++++-------- .../Libraries/Utilities/Dimensions.js | 2 +- .../Libraries/Utilities/IPerformanceLogger.js | 8 ++-- .../Utilities/__tests__/useMergeRefs-test.js | 2 +- .../Utilities/codegenNativeCommands.js | 2 +- .../Utilities/codegenNativeComponent.js | 2 +- .../Libraries/vendor/emitter/EventEmitter.js | 10 ++--- packages/react-native/flow/bom.js.flow | 4 +- packages/react-native/jest/mockComponent.js | 7 ++- .../scripts/featureflags/print.js | 4 +- .../scripts/featureflags/types.js | 20 ++++----- .../private/animated/NativeAnimatedHelper.js | 2 +- .../animated/createAnimatedPropsMemoHook.js | 26 +++++------ .../components/virtualview/VirtualView.js | 4 +- .../VirtualViewExperimentalNativeComponent.js | 8 ++-- .../virtualview/VirtualViewNativeComponent.js | 8 ++-- .../__tests__/VirtualView-itest.js | 2 +- .../devmenu/elementinspector/BorderBox.js | 4 +- .../devmenu/elementinspector/BoxInspector.js | 6 +-- .../devmenu/elementinspector/ElementBox.js | 8 ++-- .../elementinspector/ElementProperties.js | 2 +- .../devmenu/elementinspector/Inspector.js | 2 +- .../elementinspector/InspectorOverlay.js | 2 +- .../elementinspector/InspectorPanel.js | 4 +- .../elementinspector/StyleInspector.js | 2 +- .../elementinspector/resolveBoxStyle.js | 2 +- .../ActivityIndicatorViewNativeComponent.js | 2 +- .../AndroidDrawerLayoutNativeComponent.js | 6 +-- ...izontalScrollContentViewNativeComponent.js | 2 +- ...ndroidSwipeRefreshLayoutNativeComponent.js | 2 +- .../AndroidSwitchNativeComponent.js | 4 +- .../DebuggingOverlayNativeComponent.js | 2 +- .../ProgressBarAndroidNativeComponent.js | 2 +- .../PullToRefreshViewNativeComponent.js | 2 +- .../RCTInputAccessoryViewNativeComponent.js | 2 +- .../RCTModalHostViewNativeComponent.js | 4 +- .../RCTSafeAreaViewNativeComponent.js | 2 +- 175 files changed, 512 insertions(+), 519 deletions(-) diff --git a/flow-typed/environment/node.js b/flow-typed/environment/node.js index 949a3382b9e..74f30ba7bd1 100644 --- a/flow-typed/environment/node.js +++ b/flow-typed/environment/node.js @@ -199,7 +199,7 @@ declare module 'buffer' { declare var kMaxLength: number; declare var INSPECT_MAX_BYTES: number; - declare var constants: $ReadOnly<{ + declare var constants: Readonly<{ MAX_LENGTH: number, MAX_STRING_LENGTH: number, }>; @@ -1467,7 +1467,7 @@ declare module 'fs' { path: string, options: | string - | $ReadOnly<{ + | Readonly<{ encoding?: string, recursive?: boolean, withFileTypes?: false, @@ -1477,7 +1477,7 @@ declare module 'fs' { ): void; declare function readdir( path: string, - options: $ReadOnly<{ + options: Readonly<{ encoding?: string, recursive?: boolean, withFileTypes: true, @@ -1493,7 +1493,7 @@ declare module 'fs' { path: string, options?: | string - | $ReadOnly<{ + | Readonly<{ encoding?: string, recursive?: boolean, withFileTypes?: false, @@ -1503,7 +1503,7 @@ declare module 'fs' { path: string, options?: | string - | $ReadOnly<{ + | Readonly<{ encoding?: string, recursive?: boolean, withFileTypes: true, @@ -1527,13 +1527,13 @@ declare module 'fs' { ): void; declare function openAsBlob( path: string | Buffer | URL, - options?: $ReadOnly<{ + options?: Readonly<{ type?: string, // Optional MIME type hint }>, ): Promise; declare function opendir( path: string, - options?: $ReadOnly<{ + options?: Readonly<{ encoding?: string, bufferSize?: number, recursive?: boolean, @@ -1542,7 +1542,7 @@ declare module 'fs' { ): void; declare function opendirSync( path: string, - options?: $ReadOnly<{ + options?: Readonly<{ encoding?: string, bufferSize?: number, recursive?: boolean, @@ -1770,7 +1770,7 @@ declare module 'fs' { ): void; declare function watchFile( filename: string, - options?: $ReadOnly<{ + options?: Readonly<{ bigint?: boolean, persistent?: boolean, interval?: number, @@ -1787,7 +1787,7 @@ declare module 'fs' { ): FSWatcher; declare function watch( filename: string, - options?: $ReadOnly<{ + options?: Readonly<{ persistent?: boolean, recursive?: boolean, encoding?: string, @@ -1835,7 +1835,7 @@ declare module 'fs' { declare function cp( src: string | URL, dest: string | URL, - options: $ReadOnly<{ + options: Readonly<{ dereference?: boolean, errorOnExist?: boolean, filter?: (src: string, dest: string) => boolean | Promise, @@ -1855,7 +1855,7 @@ declare module 'fs' { declare function cpSync( src: string | URL, dest: string | URL, - options?: $ReadOnly<{ + options?: Readonly<{ dereference?: boolean, errorOnExist?: boolean, filter?: (src: string, dest: string) => boolean, @@ -2022,7 +2022,7 @@ declare module 'fs' { chown(uid: number, guid: number): Promise; close(): Promise; createReadStream( - options?: $ReadOnly<{ + options?: Readonly<{ encoding?: string, autoClose?: boolean, emitClose?: boolean, @@ -2033,7 +2033,7 @@ declare module 'fs' { }>, ): ReadStream; createWriteStream( - options?: $ReadOnly<{ + options?: Readonly<{ encoding?: string, autoClose?: boolean, emitClose?: boolean, @@ -2055,12 +2055,12 @@ declare module 'fs' { ... }>; readableWebStream( - options?: $ReadOnly<{autoClose?: boolean}>, + options?: Readonly<{autoClose?: boolean}>, ): ReadableStream; readFile(options: EncodingFlag): Promise; readFile(options: string): Promise; readLines( - options?: $ReadOnly<{ + options?: Readonly<{ encoding?: string, autoClose?: boolean, emitClose?: boolean, @@ -2088,7 +2088,7 @@ declare module 'fs' { ): Promise; write( buffer: Buffer | Uint8Array | DataView, - options?: $ReadOnly<{ + options?: Readonly<{ offset?: number, length?: number, position?: number, @@ -2119,7 +2119,7 @@ declare module 'fs' { cp( src: string | URL, dest: string | URL, - options?: $ReadOnly<{ + options?: Readonly<{ dereference?: boolean, errorOnExist?: boolean, filter?: (src: string, dest: string) => boolean | Promise, @@ -2171,7 +2171,7 @@ declare module 'fs' { ): Promise, opendir( path: string, - options?: $ReadOnly<{ + options?: Readonly<{ encoding?: string, bufferSize?: number, recursive?: boolean, @@ -2192,7 +2192,7 @@ declare module 'fs' { path: FSPromisePath, options: | string - | $ReadOnly<{ + | Readonly<{ encoding?: string, recursive?: boolean, withFileTypes?: false, @@ -2200,7 +2200,7 @@ declare module 'fs' { ) => Promise>) & (( path: FSPromisePath, - options: $ReadOnly<{ + options: Readonly<{ encoding?: string, recursive?: boolean, withFileTypes: true, @@ -2249,7 +2249,7 @@ declare module 'fs' { ): Promise, watch( filename: FSPromisePath, - options?: $ReadOnly<{ + options?: Readonly<{ persistent?: boolean, recursive?: boolean, encoding?: string, diff --git a/flow-typed/npm/@octokit/rest_v22.x.x.js b/flow-typed/npm/@octokit/rest_v22.x.x.js index fafa59f524c..4d3fbfccb4d 100644 --- a/flow-typed/npm/@octokit/rest_v22.x.x.js +++ b/flow-typed/npm/@octokit/rest_v22.x.x.js @@ -13,9 +13,9 @@ declare module '@octokit/rest' { declare class Octokit { constructor(options?: {auth?: string, ...}): this; - repos: $ReadOnly<{ + repos: Readonly<{ listReleaseAssets: ( - params: $ReadOnly<{ + params: Readonly<{ owner: string, repo: string, release_id: string, @@ -29,13 +29,13 @@ declare module '@octokit/rest' { ... }>, uploadReleaseAsset: ( - params: $ReadOnly<{ + params: Readonly<{ owner: string, repo: string, release_id: string, name: string, data: Buffer, - headers: $ReadOnly<{ + headers: Readonly<{ 'content-type': string, ... }>, diff --git a/flow-typed/npm/babel-traverse_v7.x.x.js b/flow-typed/npm/babel-traverse_v7.x.x.js index 1caf444f529..344099df669 100644 --- a/flow-typed/npm/babel-traverse_v7.x.x.js +++ b/flow-typed/npm/babel-traverse_v7.x.x.js @@ -97,7 +97,7 @@ declare module '@babel/traverse' { /** Traverse node with current scope and path. */ traverse( node: BabelNode | Array, - opts: $ReadOnly>, + opts: Readonly>, state: S, ): void; @@ -303,7 +303,7 @@ declare module '@babel/traverse' { shouldStop: boolean; removed: boolean; state: unknown; - +opts: $ReadOnly> | null; + +opts: Readonly> | null; skipKeys: null | {[key: string]: boolean}; parentPath: ?NodePath<>; context: TraversalContext; @@ -346,7 +346,7 @@ declare module '@babel/traverse' { ): TError; traverse( - visitor: $ReadOnly>, + visitor: Readonly>, state: TState, ): void; @@ -1444,7 +1444,7 @@ declare module '@babel/traverse' { | VisitNodeFunction | VisitNodeObject; - declare export type Visitor = $ReadOnly<{ + declare export type Visitor = Readonly<{ enter?: VisitNodeFunction, exit?: VisitNodeFunction, @@ -1872,7 +1872,7 @@ declare module '@babel/traverse' { explode(visitor: Visitor): Visitor, verify(visitor: Visitor): void, merge( - visitors: Array<$ReadOnly>>, + visitors: Array>>, states: Array, wrapper?: ?Function, ): Array>, @@ -1891,7 +1891,7 @@ declare module '@babel/traverse' { declare export type Traverse = { ( parent?: BabelNode | Array, - opts?: $ReadOnly>, + opts?: Readonly>, scope?: ?Scope, state: TState, parentPath?: ?NodePath, @@ -1909,7 +1909,7 @@ declare module '@babel/traverse' { node( node: BabelNode, - opts: $ReadOnly>, + opts: Readonly>, scope: Scope, state: TState, parentPath: NodePath<>, diff --git a/flow-typed/npm/babel_v7.x.x.js b/flow-typed/npm/babel_v7.x.x.js index 3e574ffb473..a1f665cd5bc 100644 --- a/flow-typed/npm/babel_v7.x.x.js +++ b/flow-typed/npm/babel_v7.x.x.js @@ -10,7 +10,7 @@ 'use strict'; -type _BabelSourceMap = $ReadOnly<{ +type _BabelSourceMap = Readonly<{ file?: string, mappings: string, names: Array, @@ -28,9 +28,9 @@ type _BabelSourceMapSegment = { ... }; -export type BabelSourceLocation = $ReadOnly<{ - start: $ReadOnly<{line: number, column: number}>, - end: $ReadOnly<{line: number, column: number}>, +export type BabelSourceLocation = Readonly<{ + start: Readonly<{line: number, column: number}>, + end: Readonly<{line: number, column: number}>, }>; declare module '@babel/parser' { @@ -330,7 +330,7 @@ declare module '@babel/core' { constructor( options: BabelCoreOptions, - input: $ReadOnly<{ast: BabelNode, code: string, inputMap: any}>, + input: Readonly<{ast: BabelNode, code: string, inputMap: any}>, ): File; getMetadata(): void; @@ -1079,7 +1079,7 @@ declare module '@babel/core' { declare type ValidatedOptions = BabelCoreOptions; declare class PartialConfig { - +options: $ReadOnly; + +options: Readonly; +babelrc: string | void; +babelignore: string | void; +config: string | void; diff --git a/flow-typed/npm/electron-packager_v18.x.x.js b/flow-typed/npm/electron-packager_v18.x.x.js index f77d694e7ac..4ac8b158eb5 100644 --- a/flow-typed/npm/electron-packager_v18.x.x.js +++ b/flow-typed/npm/electron-packager_v18.x.x.js @@ -46,7 +46,7 @@ declare module '@electron/packager' { declare export type OsxUniversalOptions = $FlowFixMe; - declare export type Win32MetadataOptions = $ReadOnly<{ + declare export type Win32MetadataOptions = Readonly<{ CompanyName?: string, FileDescription?: string, OriginalFilename?: string, diff --git a/flow-typed/npm/execa_v5.x.x.js b/flow-typed/npm/execa_v5.x.x.js index 65e2ef8c9d3..db3f61779d1 100644 --- a/flow-typed/npm/execa_v5.x.x.js +++ b/flow-typed/npm/execa_v5.x.x.js @@ -91,25 +91,25 @@ declare module 'execa' { ( file: string, args?: $ReadOnlyArray, - options?: $ReadOnly, + options?: Readonly, ): ExecaPromise; - (file: string, options?: $ReadOnly): ExecaPromise; + (file: string, options?: Readonly): ExecaPromise; - command(command: string, options?: $ReadOnly): ExecaPromise; - commandSync(command: string, options?: $ReadOnly): ExecaPromise; + command(command: string, options?: Readonly): ExecaPromise; + commandSync(command: string, options?: Readonly): ExecaPromise; node( path: string, args?: $ReadOnlyArray, - options?: $ReadOnly, + options?: Readonly, ): void; sync( file: string, args?: $ReadOnlyArray, - options?: $ReadOnly, + options?: Readonly, ): SyncResult; - sync(file: string, options?: $ReadOnly): SyncResult; + sync(file: string, options?: Readonly): SyncResult; } declare module.exports: Execa; diff --git a/flow-typed/npm/jsonc-parser_v2.2.x.js b/flow-typed/npm/jsonc-parser_v2.2.x.js index 50316cb13e9..51eadf91b48 100644 --- a/flow-typed/npm/jsonc-parser_v2.2.x.js +++ b/flow-typed/npm/jsonc-parser_v2.2.x.js @@ -22,7 +22,7 @@ declare module 'jsonc-parser' { /** * The scanner object, representing a JSON scanner at a position in the input string. */ - export type JSONScanner = $ReadOnly<{ + export type JSONScanner = Readonly<{ /** * Sets the scan position to a new offset. A call to 'scan' is needed to get the first token. */ @@ -351,7 +351,7 @@ declare module 'jsonc-parser' { /** * Options used by {@linkcode format} when computing the formatting edit operations */ - export type FormattingOptions = $ReadOnly<{ + export type FormattingOptions = Readonly<{ /** * If indentation is based on spaces (`insertSpaces` = true), the number of spaces that make an indent. */ diff --git a/flow-typed/npm/open_v7.x.x.js b/flow-typed/npm/open_v7.x.x.js index 19629e3c4f3..25f62fae217 100644 --- a/flow-typed/npm/open_v7.x.x.js +++ b/flow-typed/npm/open_v7.x.x.js @@ -11,7 +11,7 @@ declare module 'open' { import type {ChildProcess} from 'child_process'; - declare export type Options = $ReadOnly<{ + declare export type Options = Readonly<{ wait?: boolean, background?: boolean, newInstance?: boolean, diff --git a/flow-typed/npm/serve-static_v1.x.x.js b/flow-typed/npm/serve-static_v1.x.x.js index 5ea71ddda7e..d04a56fe4a8 100644 --- a/flow-typed/npm/serve-static_v1.x.x.js +++ b/flow-typed/npm/serve-static_v1.x.x.js @@ -12,7 +12,7 @@ declare module 'serve-static' { import type {NextHandleFunction} from 'connect'; import type http from 'http'; - declare export type Options = $ReadOnly<{ + declare export type Options = Readonly<{ /** * Enable or disable accepting ranged requests, defaults to true. Disabling * this will not send `Accept-Ranges` and ignore the contents of the diff --git a/flow-typed/npm/tinybench_v4.1.x.js b/flow-typed/npm/tinybench_v4.1.x.js index 56412034a9d..2b6bbba9baf 100644 --- a/flow-typed/npm/tinybench_v4.1.x.js +++ b/flow-typed/npm/tinybench_v4.1.x.js @@ -11,7 +11,7 @@ declare module 'tinybench' { declare export class Task extends EventTarget { name: string; - result: void | $ReadOnly; + result: void | Readonly; runs: number; reset(): void; @@ -108,13 +108,13 @@ declare module 'tinybench' { declare export class Bench extends EventTarget { concurrency: null | 'task' | 'bench'; name?: string; - opts: $ReadOnly; + opts: Readonly; threshold: number; constructor(options?: BenchOptions): this; // $FlowExpectedError[unsafe-getters-setters] - get results(): Array<$ReadOnly>; + get results(): Array>; // $FlowExpectedError[unsafe-getters-setters] get tasks(): Array; diff --git a/flow-typed/npm/typescript_v5.x.x.js b/flow-typed/npm/typescript_v5.x.x.js index 3e5efa0afc6..c89c7a5141e 100644 --- a/flow-typed/npm/typescript_v5.x.x.js +++ b/flow-typed/npm/typescript_v5.x.x.js @@ -18,25 +18,25 @@ declare module 'typescript' { Bundler = 'Bundler', } - declare type SourceFile = $ReadOnly<{ + declare type SourceFile = Readonly<{ fileName: string, text: string, ... }>; - declare type Diagnostic = $ReadOnly<{ + declare type Diagnostic = Readonly<{ file?: SourceFile, start?: number, messageText: string, ... }>; - declare type EmitResult = $ReadOnly<{ + declare type EmitResult = Readonly<{ diagnostics: Array, ... }>; - declare type Program = $ReadOnly<{ + declare type Program = Readonly<{ emit: () => EmitResult, ... }>; @@ -47,7 +47,7 @@ declare module 'typescript' { getLineAndCharacterOfPosition( file: SourceFile, start?: number, - ): $ReadOnly<{line: number, character: number}>, + ): Readonly<{line: number, character: number}>, convertCompilerOptionsFromJson( jsonOptions: any, basePath: string, diff --git a/flow-typed/npm/undici_v5.x.x.js b/flow-typed/npm/undici_v5.x.x.js index 89a4a42fb5d..9076fb91bee 100644 --- a/flow-typed/npm/undici_v5.x.x.js +++ b/flow-typed/npm/undici_v5.x.x.js @@ -15,7 +15,7 @@ declare interface undici$Agent$Options { } declare module 'undici' { - declare export type RequestOptions = $ReadOnly<{ + declare export type RequestOptions = Readonly<{ dispatcher?: Dispatcher, method?: string, headers?: HeadersInit, diff --git a/packages/community-cli-plugin/src/commands/bundle/assetPathUtils.js b/packages/community-cli-plugin/src/commands/bundle/assetPathUtils.js index ced3d4b92a8..51c0a66e4e3 100644 --- a/packages/community-cli-plugin/src/commands/bundle/assetPathUtils.js +++ b/packages/community-cli-plugin/src/commands/bundle/assetPathUtils.js @@ -8,7 +8,7 @@ * @format */ -export type PackagerAsset = $ReadOnly<{ +export type PackagerAsset = Readonly<{ httpServerLocation: string, name: string, type: string, diff --git a/packages/community-cli-plugin/src/commands/start/OpenDebuggerKeyboardHandler.js b/packages/community-cli-plugin/src/commands/start/OpenDebuggerKeyboardHandler.js index 4baaaf942fe..14affb2664a 100644 --- a/packages/community-cli-plugin/src/commands/start/OpenDebuggerKeyboardHandler.js +++ b/packages/community-cli-plugin/src/commands/start/OpenDebuggerKeyboardHandler.js @@ -12,7 +12,7 @@ import type {TerminalReporter} from 'metro'; import {styleText} from 'util'; -type PageDescription = $ReadOnly<{ +type PageDescription = Readonly<{ id: string, title: string, description: string, diff --git a/packages/community-cli-plugin/src/commands/start/attachKeyHandlers.js b/packages/community-cli-plugin/src/commands/start/attachKeyHandlers.js index 24cf6f9a56e..fd43a0e8e01 100644 --- a/packages/community-cli-plugin/src/commands/start/attachKeyHandlers.js +++ b/packages/community-cli-plugin/src/commands/start/attachKeyHandlers.js @@ -45,7 +45,7 @@ export default function attachKeyHandlers({ reporter, }: { devServerUrl: string, - messageSocket: $ReadOnly<{ + messageSocket: Readonly<{ broadcast: (type: string, params?: Record | null) => void, ... }>, diff --git a/packages/community-cli-plugin/src/utils/createDevMiddlewareLogger.js b/packages/community-cli-plugin/src/utils/createDevMiddlewareLogger.js index 6a8e5e22272..869052a047a 100644 --- a/packages/community-cli-plugin/src/utils/createDevMiddlewareLogger.js +++ b/packages/community-cli-plugin/src/utils/createDevMiddlewareLogger.js @@ -18,7 +18,7 @@ type LoggerFn = (...message: $ReadOnlyArray) => void; */ export default function createDevMiddlewareLogger( reporter: TerminalReporter, -): $ReadOnly<{ +): Readonly<{ info: LoggerFn, error: LoggerFn, warn: LoggerFn, diff --git a/packages/community-cli-plugin/src/utils/loadMetroConfig.js b/packages/community-cli-plugin/src/utils/loadMetroConfig.js index 36d11175f63..8b5883a3148 100644 --- a/packages/community-cli-plugin/src/utils/loadMetroConfig.js +++ b/packages/community-cli-plugin/src/utils/loadMetroConfig.js @@ -20,7 +20,7 @@ const debug = require('debug')('ReactNative:CommunityCliPlugin'); export type {Config}; -export type ConfigLoadingContext = $ReadOnly<{ +export type ConfigLoadingContext = Readonly<{ root: Config['root'], reactNativePath: Config['reactNativePath'], platforms: Config['platforms'], diff --git a/packages/debugger-shell/src/electron/MainInstanceEntryPoint.js b/packages/debugger-shell/src/electron/MainInstanceEntryPoint.js index bf68f735c05..41693cc14bc 100644 --- a/packages/debugger-shell/src/electron/MainInstanceEntryPoint.js +++ b/packages/debugger-shell/src/electron/MainInstanceEntryPoint.js @@ -19,7 +19,7 @@ const {BrowserWindow, Menu, app, shell, ipcMain} = require('electron') as any; const appSettings = new SettingsStore(); const windowMetadata = new WeakMap< typeof BrowserWindow, - $ReadOnly<{ + Readonly<{ windowKey: string, }>, >(); diff --git a/packages/debugger-shell/src/electron/SettingsStore.js b/packages/debugger-shell/src/electron/SettingsStore.js index d85363b3e40..b79b262e314 100644 --- a/packages/debugger-shell/src/electron/SettingsStore.js +++ b/packages/debugger-shell/src/electron/SettingsStore.js @@ -14,7 +14,7 @@ const {app} = require('electron') as any; const fs = require('fs'); const path = require('path'); -type Options = $ReadOnly<{ +type Options = Readonly<{ name?: string, defaults?: Object, }>; diff --git a/packages/debugger-shell/src/node/index.flow.js b/packages/debugger-shell/src/node/index.flow.js index 7824db67a56..5b23b9fa401 100644 --- a/packages/debugger-shell/src/node/index.flow.js +++ b/packages/debugger-shell/src/node/index.flow.js @@ -31,7 +31,7 @@ async function unstable_spawnDebuggerShellWithArgs( mode = 'detached', flavor = process.env.RNDT_DEV === '1' ? 'dev' : 'prebuilt', prebuiltBinaryPath, - }: $ReadOnly<{ + }: Readonly<{ // In 'syncAndExit' mode, the current process will block until the spawned process exits, and then it will exit // with the same exit code as the spawned process. // In 'detached' mode, the spawned process will be detached from the current process and the current process will @@ -97,7 +97,7 @@ async function unstable_spawnDebuggerShellWithArgs( }); } -export type DebuggerShellPreparationResult = $ReadOnly<{ +export type DebuggerShellPreparationResult = Readonly<{ code: | 'success' | 'not_implemented' diff --git a/packages/dev-middleware/src/__tests__/InspectorProtocolUtils.js b/packages/dev-middleware/src/__tests__/InspectorProtocolUtils.js index 4b5c6844531..3d12d534541 100644 --- a/packages/dev-middleware/src/__tests__/InspectorProtocolUtils.js +++ b/packages/dev-middleware/src/__tests__/InspectorProtocolUtils.js @@ -21,18 +21,18 @@ import {createDebuggerMock} from './InspectorDebuggerUtils'; import {createDeviceMock} from './InspectorDeviceUtils'; import until from 'wait-for-expect'; -export type CdpMessageFromTarget = $ReadOnly<{ +export type CdpMessageFromTarget = Readonly<{ method: string, id?: number, params?: JSONSerializable, }>; -export type CdpResponseFromTarget = $ReadOnly<{ +export type CdpResponseFromTarget = Readonly<{ id: number, result: JSONSerializable, }>; -export type CdpMessageToTarget = $ReadOnly<{ +export type CdpMessageToTarget = Readonly<{ method: string, id: number, params?: JSONSerializable, @@ -108,7 +108,7 @@ export async function sendFromDebuggerToTarget( } export async function createAndConnectTarget( - serverRef: $ReadOnly<{ + serverRef: Readonly<{ serverBaseUrl: string, serverBaseWsUrl: string, ... @@ -119,7 +119,7 @@ export async function createAndConnectTarget( debuggerHostHeader = null, deviceId = null, deviceHostHeader = null, - }: $ReadOnly<{ + }: Readonly<{ debuggerHostHeader?: ?string, deviceId?: ?string, deviceHostHeader?: ?string, diff --git a/packages/dev-middleware/src/__tests__/ResourceUtils.js b/packages/dev-middleware/src/__tests__/ResourceUtils.js index 3c36166a4e3..780f7f06bb1 100644 --- a/packages/dev-middleware/src/__tests__/ResourceUtils.js +++ b/packages/dev-middleware/src/__tests__/ResourceUtils.js @@ -8,7 +8,7 @@ * @format */ -export function withAbortSignalForEachTest(): $ReadOnly<{signal: AbortSignal}> { +export function withAbortSignalForEachTest(): Readonly<{signal: AbortSignal}> { const ref: {signal: AbortSignal} = { // $FlowFixMe[unsafe-getters-setters] get signal() { diff --git a/packages/dev-middleware/src/__tests__/ServerUtils.js b/packages/dev-middleware/src/__tests__/ServerUtils.js index 71de93c4875..8c9c190158f 100644 --- a/packages/dev-middleware/src/__tests__/ServerUtils.js +++ b/packages/dev-middleware/src/__tests__/ServerUtils.js @@ -25,7 +25,7 @@ type CreateServerOptions = { }; type ConnectApp = ReturnType; -export function withServerForEachTest(options: CreateServerOptions): $ReadOnly<{ +export function withServerForEachTest(options: CreateServerOptions): Readonly<{ serverBaseUrl: string, serverBaseWsUrl: string, app: ConnectApp, diff --git a/packages/dev-middleware/src/createDevMiddleware.js b/packages/dev-middleware/src/createDevMiddleware.js index 72d1bdd52de..fd1e93109b1 100644 --- a/packages/dev-middleware/src/createDevMiddleware.js +++ b/packages/dev-middleware/src/createDevMiddleware.js @@ -23,7 +23,7 @@ import connect from 'connect'; import path from 'path'; import serveStaticMiddleware from 'serve-static'; -type Options = $ReadOnly<{ +type Options = Readonly<{ /** * The base URL to the dev server, as reachable from the machine on which * dev-middleware is hosted. Typically `http://localhost:${metroPort}`. @@ -70,7 +70,7 @@ type Options = $ReadOnly<{ unstable_trackInspectorProxyEventLoopPerf?: boolean, }>; -type DevMiddlewareAPI = $ReadOnly<{ +type DevMiddlewareAPI = Readonly<{ middleware: NextHandleFunction, websocketEndpoints: {[path: string]: ws$WebSocketServer}, }>; diff --git a/packages/dev-middleware/src/inspector-proxy/CustomMessageHandler.js b/packages/dev-middleware/src/inspector-proxy/CustomMessageHandler.js index 1c3dd473b7c..52a9f549fe0 100644 --- a/packages/dev-middleware/src/inspector-proxy/CustomMessageHandler.js +++ b/packages/dev-middleware/src/inspector-proxy/CustomMessageHandler.js @@ -10,19 +10,19 @@ import type {JSONSerializable, Page} from './types'; -type ExposedDevice = $ReadOnly<{ +type ExposedDevice = Readonly<{ appId: string, id: string, name: string, sendMessage: (message: JSONSerializable) => void, }>; -type ExposedDebugger = $ReadOnly<{ +type ExposedDebugger = Readonly<{ userAgent: string | null, sendMessage: (message: JSONSerializable) => void, }>; -export type CustomMessageHandlerConnection = $ReadOnly<{ +export type CustomMessageHandlerConnection = Readonly<{ page: Page, device: ExposedDevice, debugger: ExposedDebugger, diff --git a/packages/dev-middleware/src/inspector-proxy/Device.js b/packages/dev-middleware/src/inspector-proxy/Device.js index 20d6ede32fc..4af39f070ee 100644 --- a/packages/dev-middleware/src/inspector-proxy/Device.js +++ b/packages/dev-middleware/src/inspector-proxy/Device.js @@ -68,7 +68,7 @@ type DebuggerConnection = { const REACT_NATIVE_RELOADABLE_PAGE_ID = '-1'; -export type DeviceOptions = $ReadOnly<{ +export type DeviceOptions = Readonly<{ id: string, name: string, app: string, @@ -302,7 +302,7 @@ export default class Device { { debuggerRelativeBaseUrl, userAgent, - }: $ReadOnly<{ + }: Readonly<{ debuggerRelativeBaseUrl: URL, userAgent: string | null, }>, diff --git a/packages/dev-middleware/src/inspector-proxy/DeviceEventReporter.js b/packages/dev-middleware/src/inspector-proxy/DeviceEventReporter.js index a86877b07c9..8ad4b68f1d3 100644 --- a/packages/dev-middleware/src/inspector-proxy/DeviceEventReporter.js +++ b/packages/dev-middleware/src/inspector-proxy/DeviceEventReporter.js @@ -21,19 +21,19 @@ type PendingCommand = { metadata: RequestMetadata, }; -type DeviceMetadata = $ReadOnly<{ +type DeviceMetadata = Readonly<{ appId: string, deviceId: string, deviceName: string, }>; -type RequestMetadata = $ReadOnly<{ +type RequestMetadata = Readonly<{ pageId: string | null, frontendUserAgent: string | null, prefersFuseboxFrontend: boolean | null, }>; -type ResponseMetadata = $ReadOnly<{ +type ResponseMetadata = Readonly<{ pageId: string | null, frontendUserAgent: string | null, prefersFuseboxFrontend: boolean | null, @@ -68,7 +68,7 @@ class DeviceEventReporter { } logRequest( - req: $ReadOnly<{id: number, method: string, ...}>, + req: Readonly<{id: number, method: string, ...}>, origin: 'debugger' | 'proxy', metadata: RequestMetadata, ): void { @@ -164,7 +164,7 @@ class DeviceEventReporter { logConnection( connectedEntity: 'debugger', - metadata: $ReadOnly<{ + metadata: Readonly<{ pageId: string, frontendUserAgent: string | null, }>, diff --git a/packages/dev-middleware/src/inspector-proxy/types.js b/packages/dev-middleware/src/inspector-proxy/types.js index d60dd37a17c..d30125ffdf6 100644 --- a/packages/dev-middleware/src/inspector-proxy/types.js +++ b/packages/dev-middleware/src/inspector-proxy/types.js @@ -12,7 +12,7 @@ * A capability flag disables a specific feature/hack in the InspectorProxy * layer by indicating that the target supports one or more modern CDP features. */ -export type TargetCapabilityFlags = $ReadOnly<{ +export type TargetCapabilityFlags = Readonly<{ /** * The target supports a stable page representation across reloads. * @@ -43,7 +43,7 @@ export type TargetCapabilityFlags = $ReadOnly<{ // each new instance of VM and can appear when user reloads React Native // application. -export type PageFromDevice = $ReadOnly<{ +export type PageFromDevice = Readonly<{ id: string, title: string, /** Sent from modern targets only */ @@ -54,15 +54,15 @@ export type PageFromDevice = $ReadOnly<{ capabilities?: TargetCapabilityFlags, }>; -export type Page = $ReadOnly<{ +export type Page = Readonly<{ ...PageFromDevice, capabilities: NonNullable, }>; // Chrome Debugger Protocol message/event passed between device and debugger. -export type WrappedEvent = $ReadOnly<{ +export type WrappedEvent = Readonly<{ event: 'wrappedEvent', - payload: $ReadOnly<{ + payload: Readonly<{ pageId: string, wrappedEvent: string, }>, @@ -70,16 +70,16 @@ export type WrappedEvent = $ReadOnly<{ // Request sent from Inspector Proxy to Device when new debugger is connected // to particular page. -export type ConnectRequest = $ReadOnly<{ +export type ConnectRequest = Readonly<{ event: 'connect', - payload: $ReadOnly<{pageId: string}>, + payload: Readonly<{pageId: string}>, }>; // Request sent from Inspector Proxy to Device to notify that debugger is // disconnected. -export type DisconnectRequest = $ReadOnly<{ +export type DisconnectRequest = Readonly<{ event: 'disconnect', - payload: $ReadOnly<{pageId: string}>, + payload: Readonly<{pageId: string}>, }>; // Request sent from Inspector Proxy to Device to get a list of pages. @@ -105,7 +105,7 @@ export type MessageToDevice = | DisconnectRequest; // Page description object that is sent in response to /json HTTP request from debugger. -export type PageDescription = $ReadOnly<{ +export type PageDescription = Readonly<{ id: string, title: string, appId: string, @@ -121,7 +121,7 @@ export type PageDescription = $ReadOnly<{ vm?: string, // React Native specific metadata - reactNative: $ReadOnly<{ + reactNative: Readonly<{ logicalDeviceId: string, capabilities: Page['capabilities'], }>, @@ -131,7 +131,7 @@ export type JsonPagesListResponse = Array; // Response to /json/version HTTP request from the debugger specifying browser type and // Chrome protocol version. -export type JsonVersionResponse = $ReadOnly<{ +export type JsonVersionResponse = Readonly<{ Browser: string, 'Protocol-Version': string, }>; diff --git a/packages/dev-middleware/src/middleware/openDebuggerMiddleware.js b/packages/dev-middleware/src/middleware/openDebuggerMiddleware.js index 5de43b399b5..f274449c7b2 100644 --- a/packages/dev-middleware/src/middleware/openDebuggerMiddleware.js +++ b/packages/dev-middleware/src/middleware/openDebuggerMiddleware.js @@ -27,7 +27,7 @@ import url from 'url'; const LEGACY_SYNTHETIC_PAGE_TITLE = 'React Native Experimental (Improved Chrome Reloads)'; -type Options = $ReadOnly<{ +type Options = Readonly<{ serverBaseUrl: string, logger?: Logger, browserLauncher: BrowserLauncher, diff --git a/packages/dev-middleware/src/types/Experiments.js b/packages/dev-middleware/src/types/Experiments.js index 582e44120ca..5219f3e7bfc 100644 --- a/packages/dev-middleware/src/types/Experiments.js +++ b/packages/dev-middleware/src/types/Experiments.js @@ -8,7 +8,7 @@ * @format */ -export type Experiments = $ReadOnly<{ +export type Experiments = Readonly<{ /** * Enables the handling of GET requests in the /open-debugger endpoint, * in addition to POST requests. GET requests respond by redirecting to diff --git a/packages/dev-middleware/src/types/Logger.js b/packages/dev-middleware/src/types/Logger.js index 48720dea290..09f6205ee2b 100644 --- a/packages/dev-middleware/src/types/Logger.js +++ b/packages/dev-middleware/src/types/Logger.js @@ -8,7 +8,7 @@ * @format */ -export type Logger = $ReadOnly<{ +export type Logger = Readonly<{ error: (...message: Array) => void, info: (...message: Array) => void, warn: (...message: Array) => void, diff --git a/packages/dev-middleware/src/utils/getDevToolsFrontendUrl.js b/packages/dev-middleware/src/utils/getDevToolsFrontendUrl.js index a00f54bf544..a46e12254c9 100644 --- a/packages/dev-middleware/src/utils/getDevToolsFrontendUrl.js +++ b/packages/dev-middleware/src/utils/getDevToolsFrontendUrl.js @@ -17,7 +17,7 @@ export default function getDevToolsFrontendUrl( experiments: Experiments, webSocketDebuggerUrl: string, devServerUrl: string, - options?: $ReadOnly<{ + options?: Readonly<{ relative?: boolean, launchId?: string, telemetryInfo?: string, @@ -65,7 +65,7 @@ export default function getDevToolsFrontendUrl( function getWsParam({ webSocketDebuggerUrl, devServerUrl, -}: $ReadOnly<{ +}: Readonly<{ webSocketDebuggerUrl: string, devServerUrl: string, }>): { diff --git a/packages/metro-config/src/index.flow.js b/packages/metro-config/src/index.flow.js index 4deebfa891d..6bba33bd975 100644 --- a/packages/metro-config/src/index.flow.js +++ b/packages/metro-config/src/index.flow.js @@ -64,7 +64,7 @@ export function getDefaultConfig(projectRoot: string): ConfigT { require.resolve('react-native/Libraries/Core/InitializeCore'), ], getPolyfills: () => require('@react-native/js-polyfills')(), - isThirdPartyModule({path: modulePath}: $ReadOnly<{path: string, ...}>) { + isThirdPartyModule({path: modulePath}: Readonly<{path: string, ...}>) { return ( INTERNAL_CALLSITES_REGEX.test(modulePath) || /(?:^|[/\\])node_modules[/\\]/.test(modulePath) @@ -75,7 +75,7 @@ export function getDefaultConfig(projectRoot: string): ConfigT { port: Number(process.env.RCT_METRO_PORT) || 8081, }, symbolicator: { - customizeFrame: (frame: $ReadOnly<{file: ?string, ...}>) => { + customizeFrame: (frame: Readonly<{file: ?string, ...}>) => { const collapse = Boolean( frame.file != null && INTERNAL_CALLSITES_REGEX.test(frame.file), ); diff --git a/packages/new-app-screen/src/NewAppScreen.js b/packages/new-app-screen/src/NewAppScreen.js index 69c265508ed..379bfe8d62f 100644 --- a/packages/new-app-screen/src/NewAppScreen.js +++ b/packages/new-app-screen/src/NewAppScreen.js @@ -24,9 +24,9 @@ import { } from 'react-native'; import openURLInBrowser from 'react-native/Libraries/Core/Devtools/openURLInBrowser'; -export type NewAppScreenProps = $ReadOnly<{ +export type NewAppScreenProps = Readonly<{ templateFileName?: string, - safeAreaInsets?: $ReadOnly<{ + safeAreaInsets?: Readonly<{ top: number, bottom: number, left: number, diff --git a/packages/react-native/Libraries/ActionSheetIOS/ActionSheetIOS.js b/packages/react-native/Libraries/ActionSheetIOS/ActionSheetIOS.js index 84e274c1834..78b6cda1bf1 100644 --- a/packages/react-native/Libraries/ActionSheetIOS/ActionSheetIOS.js +++ b/packages/react-native/Libraries/ActionSheetIOS/ActionSheetIOS.js @@ -16,7 +16,7 @@ import RCTActionSheetManager from './NativeActionSheetManager'; const processColor = require('../StyleSheet/processColor').default; const invariant = require('invariant'); -export type ActionSheetIOSOptions = $ReadOnly<{ +export type ActionSheetIOSOptions = Readonly<{ title?: ?string, message?: ?string, options: Array, @@ -30,7 +30,7 @@ export type ActionSheetIOSOptions = $ReadOnly<{ disabledButtonIndices?: Array, }>; -export type ShareActionSheetIOSOptions = $ReadOnly<{ +export type ShareActionSheetIOSOptions = Readonly<{ message?: ?string, url?: ?string, subject?: ?string, @@ -42,7 +42,7 @@ export type ShareActionSheetIOSOptions = $ReadOnly<{ userInterfaceStyle?: ?string, }>; -export type ShareActionSheetError = $ReadOnly<{ +export type ShareActionSheetError = Readonly<{ domain: string, code: string, userInfo?: ?Object, diff --git a/packages/react-native/Libraries/Animated/AnimatedImplementation.js b/packages/react-native/Libraries/Animated/AnimatedImplementation.js index 610e68ef8bb..fa51e5ea1fd 100644 --- a/packages/react-native/Libraries/Animated/AnimatedImplementation.js +++ b/packages/react-native/Libraries/Animated/AnimatedImplementation.js @@ -89,7 +89,7 @@ const diffClampImpl = function ( const _combineCallbacks = function ( callback: ?EndCallback, - config: $ReadOnly<{...AnimationConfig, ...}>, + config: Readonly<{...AnimationConfig, ...}>, ) { if (callback && config.onComplete) { return (...args: Array) => { diff --git a/packages/react-native/Libraries/Animated/__tests__/Animated-itest.js b/packages/react-native/Libraries/Animated/__tests__/Animated-itest.js index 6a4c856dcda..53982c18134 100644 --- a/packages/react-native/Libraries/Animated/__tests__/Animated-itest.js +++ b/packages/react-native/Libraries/Animated/__tests__/Animated-itest.js @@ -581,7 +581,7 @@ test('AnimatedValue.interpolate', () => { let _interpolatedValueX; const viewRef = createRef(); - function MyApp({outputRangeX}: $ReadOnly<{outputRangeX: number}>) { + function MyApp({outputRangeX}: Readonly<{outputRangeX: number}>) { const valueX = useAnimatedValue(0.5, {useNativeDriver: true}); _valueX = valueX; const offset = outputRangeX - 1; diff --git a/packages/react-native/Libraries/Animated/animations/Animation.js b/packages/react-native/Libraries/Animated/animations/Animation.js index 3dd0b14a84d..b071a89661b 100644 --- a/packages/react-native/Libraries/Animated/animations/Animation.js +++ b/packages/react-native/Libraries/Animated/animations/Animation.js @@ -24,7 +24,7 @@ export type EndResult = { }; export type EndCallback = (result: EndResult) => void; -export type AnimationConfig = $ReadOnly<{ +export type AnimationConfig = Readonly<{ isInteraction?: boolean, useNativeDriver: boolean, platformConfig?: PlatformConfig, @@ -98,7 +98,7 @@ export default class Animation { this.__active = false; } - __getNativeAnimationConfig(): $ReadOnly<{ + __getNativeAnimationConfig(): Readonly<{ platformConfig: ?PlatformConfig, ... }> { diff --git a/packages/react-native/Libraries/Animated/animations/DecayAnimation.js b/packages/react-native/Libraries/Animated/animations/DecayAnimation.js index 30c532ee4c1..35eb106f5a2 100644 --- a/packages/react-native/Libraries/Animated/animations/DecayAnimation.js +++ b/packages/react-native/Libraries/Animated/animations/DecayAnimation.js @@ -14,11 +14,11 @@ import type {AnimationConfig, EndCallback} from './Animation'; import Animation from './Animation'; -export type DecayAnimationConfig = $ReadOnly<{ +export type DecayAnimationConfig = Readonly<{ ...AnimationConfig, velocity: | number - | $ReadOnly<{ + | Readonly<{ x: number, y: number, ... @@ -27,7 +27,7 @@ export type DecayAnimationConfig = $ReadOnly<{ ... }>; -export type DecayAnimationConfigSingle = $ReadOnly<{ +export type DecayAnimationConfigSingle = Readonly<{ ...AnimationConfig, velocity: number, deceleration?: number, @@ -52,7 +52,7 @@ export default class DecayAnimation extends Animation { this._platformConfig = config.platformConfig; } - __getNativeAnimationConfig(): $ReadOnly<{ + __getNativeAnimationConfig(): Readonly<{ deceleration: number, iterations: number, platformConfig: ?PlatformConfig, diff --git a/packages/react-native/Libraries/Animated/animations/SpringAnimation.js b/packages/react-native/Libraries/Animated/animations/SpringAnimation.js index 1a28de90748..cb70e445411 100644 --- a/packages/react-native/Libraries/Animated/animations/SpringAnimation.js +++ b/packages/react-native/Libraries/Animated/animations/SpringAnimation.js @@ -19,7 +19,7 @@ import * as SpringConfig from '../SpringConfig'; import Animation from './Animation'; import invariant from 'invariant'; -export type SpringAnimationConfig = $ReadOnly<{ +export type SpringAnimationConfig = Readonly<{ ...AnimationConfig, toValue: | number @@ -44,7 +44,7 @@ export type SpringAnimationConfig = $ReadOnly<{ restSpeedThreshold?: number, velocity?: | number - | $ReadOnly<{ + | Readonly<{ x: number, y: number, ... @@ -60,7 +60,7 @@ export type SpringAnimationConfig = $ReadOnly<{ ... }>; -export type SpringAnimationConfigSingle = $ReadOnly<{ +export type SpringAnimationConfigSingle = Readonly<{ ...AnimationConfig, toValue: number, overshootClamping?: boolean, @@ -78,7 +78,7 @@ export type SpringAnimationConfigSingle = $ReadOnly<{ ... }>; -opaque type SpringAnimationInternalState = $ReadOnly<{ +opaque type SpringAnimationInternalState = Readonly<{ lastPosition: number, lastVelocity: number, lastTime: number, @@ -168,7 +168,7 @@ export default class SpringAnimation extends Animation { invariant(this._mass > 0, 'Mass value must be greater than 0'); } - __getNativeAnimationConfig(): $ReadOnly<{ + __getNativeAnimationConfig(): Readonly<{ damping: number, initialVelocity: number, iterations: number, diff --git a/packages/react-native/Libraries/Animated/animations/TimingAnimation.js b/packages/react-native/Libraries/Animated/animations/TimingAnimation.js index 0589855753f..96946862b21 100644 --- a/packages/react-native/Libraries/Animated/animations/TimingAnimation.js +++ b/packages/react-native/Libraries/Animated/animations/TimingAnimation.js @@ -18,12 +18,12 @@ import type {AnimationConfig, EndCallback} from './Animation'; import AnimatedColor from '../nodes/AnimatedColor'; import Animation from './Animation'; -export type TimingAnimationConfig = $ReadOnly<{ +export type TimingAnimationConfig = Readonly<{ ...AnimationConfig, toValue: | number | AnimatedValue - | $ReadOnly<{ + | Readonly<{ x: number, y: number, ... @@ -38,7 +38,7 @@ export type TimingAnimationConfig = $ReadOnly<{ ... }>; -export type TimingAnimationConfigSingle = $ReadOnly<{ +export type TimingAnimationConfigSingle = Readonly<{ ...AnimationConfig, toValue: number, easing?: (value: number) => number, @@ -80,7 +80,7 @@ export default class TimingAnimation extends Animation { this._platformConfig = config.platformConfig; } - __getNativeAnimationConfig(): $ReadOnly<{ + __getNativeAnimationConfig(): Readonly<{ type: 'frames', frames: $ReadOnlyArray, toValue: number, diff --git a/packages/react-native/Libraries/Animated/createAnimatedComponent.js b/packages/react-native/Libraries/Animated/createAnimatedComponent.js index 58743588007..470e745d5af 100644 --- a/packages/react-native/Libraries/Animated/createAnimatedComponent.js +++ b/packages/react-native/Libraries/Animated/createAnimatedComponent.js @@ -61,7 +61,7 @@ type NonAnimatedProps = | 'testID' | 'disabled' | 'accessibilityLabel'; -type PassThroughProps = $ReadOnly<{ +type PassThroughProps = Readonly<{ passthroughAnimatedPropExplicitValues?: ViewProps | null, }>; @@ -99,7 +99,7 @@ export default function createAnimatedComponent< >( Component: TInstance, ): AnimatedComponentType< - $ReadOnly>, + Readonly>, React.ElementRef, > { return unstable_createAnimatedComponentWithAllowlist(Component, null); diff --git a/packages/react-native/Libraries/Animated/nodes/AnimatedColor.js b/packages/react-native/Libraries/Animated/nodes/AnimatedColor.js index fa3c4df59c1..b0de039b402 100644 --- a/packages/react-native/Libraries/Animated/nodes/AnimatedColor.js +++ b/packages/react-native/Libraries/Animated/nodes/AnimatedColor.js @@ -22,7 +22,7 @@ import {processColorObject} from '../../StyleSheet/PlatformColorValueTypes'; import AnimatedValue, {flushValue} from './AnimatedValue'; import AnimatedWithChildren from './AnimatedWithChildren'; -export type AnimatedColorConfig = $ReadOnly<{ +export type AnimatedColorConfig = Readonly<{ ...AnimatedNodeConfig, useNativeDriver: boolean, }>; @@ -112,7 +112,7 @@ function isRgbaAnimatedValue(value: any): boolean { export function getRgbaValueAndNativeColor( value: RgbaValue | ColorValue, -): $ReadOnly<{ +): Readonly<{ rgbaValue: RgbaValue, nativeColor?: NativeColorValue, }> { diff --git a/packages/react-native/Libraries/Animated/nodes/AnimatedInterpolation.js b/packages/react-native/Libraries/Animated/nodes/AnimatedInterpolation.js index 0372262d11d..aa3d9c3edca 100644 --- a/packages/react-native/Libraries/Animated/nodes/AnimatedInterpolation.js +++ b/packages/react-native/Libraries/Animated/nodes/AnimatedInterpolation.js @@ -34,7 +34,7 @@ export type InterpolationConfigSupportedOutputType = export type InterpolationConfigType< OutputT: InterpolationConfigSupportedOutputType, -> = $ReadOnly<{ +> = Readonly<{ ...AnimatedNodeConfig, inputRange: $ReadOnlyArray, outputRange: $ReadOnlyArray, diff --git a/packages/react-native/Libraries/Animated/nodes/AnimatedNode.js b/packages/react-native/Libraries/Animated/nodes/AnimatedNode.js index 9cf3b990d18..fa1d59b3b7a 100644 --- a/packages/react-native/Libraries/Animated/nodes/AnimatedNode.js +++ b/packages/react-native/Libraries/Animated/nodes/AnimatedNode.js @@ -15,7 +15,7 @@ import invariant from 'invariant'; type ValueListenerCallback = (state: {value: number, ...}) => unknown; -export type AnimatedNodeConfig = $ReadOnly<{ +export type AnimatedNodeConfig = Readonly<{ debugID?: string, unstable_disableBatchingForNativeCreate?: boolean, }>; @@ -34,7 +34,7 @@ export default class AnimatedNode { _platformConfig: ?PlatformConfig = undefined; constructor( - config?: ?$ReadOnly<{ + config?: ?Readonly<{ ...AnimatedNodeConfig, ... }>, diff --git a/packages/react-native/Libraries/Animated/nodes/AnimatedObject.js b/packages/react-native/Libraries/Animated/nodes/AnimatedObject.js index 95bb12f18d8..0064816bf36 100644 --- a/packages/react-native/Libraries/Animated/nodes/AnimatedObject.js +++ b/packages/react-native/Libraries/Animated/nodes/AnimatedObject.js @@ -23,7 +23,7 @@ export function isPlainObject( value: unknown, /* $FlowFixMe[incompatible-type-guard] - Flow does not know that the prototype and ReactElement checks preserve the type refinement of `value`. */ -): value is $ReadOnly<{[string]: unknown}> { +): value is Readonly<{[string]: unknown}> { const proto = value !== null && typeof value === 'object' ? Object.getPrototypeOf(value) diff --git a/packages/react-native/Libraries/Animated/nodes/AnimatedProps.js b/packages/react-native/Libraries/Animated/nodes/AnimatedProps.js index 308de24556a..6c63964b7c6 100644 --- a/packages/react-native/Libraries/Animated/nodes/AnimatedProps.js +++ b/packages/react-native/Libraries/Animated/nodes/AnimatedProps.js @@ -24,7 +24,7 @@ import AnimatedObject from './AnimatedObject'; import AnimatedStyle from './AnimatedStyle'; import invariant from 'invariant'; -export type AnimatedPropsAllowlist = $ReadOnly<{ +export type AnimatedPropsAllowlist = Readonly<{ style?: ?AnimatedStyleAllowlist, [key: string]: true | AnimatedStyleAllowlist, }>; @@ -358,6 +358,6 @@ export default class AnimatedProps extends AnimatedNode { // this shim when they do. // $FlowFixMe[method-unbinding] const _hasOwnProp = Object.prototype.hasOwnProperty; -const hasOwn: (obj: $ReadOnly<{...}>, prop: string) => boolean = +const hasOwn: (obj: Readonly<{...}>, prop: string) => boolean = // $FlowFixMe[method-unbinding] Object.hasOwn ?? ((obj, prop) => _hasOwnProp.call(obj, prop)); diff --git a/packages/react-native/Libraries/Animated/nodes/AnimatedStyle.js b/packages/react-native/Libraries/Animated/nodes/AnimatedStyle.js index 1e9c1837703..a5a9c3887a7 100644 --- a/packages/react-native/Libraries/Animated/nodes/AnimatedStyle.js +++ b/packages/react-native/Libraries/Animated/nodes/AnimatedStyle.js @@ -19,7 +19,7 @@ import AnimatedObject from './AnimatedObject'; import AnimatedTransform from './AnimatedTransform'; import AnimatedWithChildren from './AnimatedWithChildren'; -export type AnimatedStyleAllowlist = $ReadOnly<{[string]: true}>; +export type AnimatedStyleAllowlist = Readonly<{[string]: true}>; type FlatStyle = {[string]: unknown}; type FlatStyleForWeb = [unknown, TStyle]; @@ -253,6 +253,6 @@ export default class AnimatedStyle extends AnimatedWithChildren { // this shim when they do. // $FlowFixMe[method-unbinding] const _hasOwnProp = Object.prototype.hasOwnProperty; -const hasOwn: (obj: $ReadOnly<{...}>, prop: string) => boolean = +const hasOwn: (obj: Readonly<{...}>, prop: string) => boolean = // $FlowFixMe[method-unbinding] Object.hasOwn ?? ((obj, prop) => _hasOwnProp.call(obj, prop)); diff --git a/packages/react-native/Libraries/Animated/nodes/AnimatedValue.js b/packages/react-native/Libraries/Animated/nodes/AnimatedValue.js index 7d28e936f90..1d8ec17bdbb 100644 --- a/packages/react-native/Libraries/Animated/nodes/AnimatedValue.js +++ b/packages/react-native/Libraries/Animated/nodes/AnimatedValue.js @@ -24,7 +24,7 @@ import NativeAnimatedHelper from '../../../src/private/animated/NativeAnimatedHe import AnimatedInterpolation from './AnimatedInterpolation'; import AnimatedWithChildren from './AnimatedWithChildren'; -export type AnimatedValueConfig = $ReadOnly<{ +export type AnimatedValueConfig = Readonly<{ ...AnimatedNodeConfig, useNativeDriver: boolean, }>; diff --git a/packages/react-native/Libraries/Animated/nodes/AnimatedValueXY.js b/packages/react-native/Libraries/Animated/nodes/AnimatedValueXY.js index 304d65a733d..acc969ad2d2 100644 --- a/packages/react-native/Libraries/Animated/nodes/AnimatedValueXY.js +++ b/packages/react-native/Libraries/Animated/nodes/AnimatedValueXY.js @@ -17,7 +17,7 @@ import AnimatedValue from './AnimatedValue'; import AnimatedWithChildren from './AnimatedWithChildren'; import invariant from 'invariant'; -export type AnimatedValueXYConfig = $ReadOnly<{ +export type AnimatedValueXYConfig = Readonly<{ ...AnimatedNodeConfig, useNativeDriver: boolean, }>; diff --git a/packages/react-native/Libraries/Components/ActivityIndicator/ActivityIndicator.js b/packages/react-native/Libraries/Components/ActivityIndicator/ActivityIndicator.js index 0e9fd477a74..de86dba6551 100644 --- a/packages/react-native/Libraries/Components/ActivityIndicator/ActivityIndicator.js +++ b/packages/react-native/Libraries/Components/ActivityIndicator/ActivityIndicator.js @@ -26,7 +26,7 @@ const GRAY = '#999999'; type IndicatorSize = number | 'small' | 'large'; -type ActivityIndicatorIOSProps = $ReadOnly<{ +type ActivityIndicatorIOSProps = Readonly<{ /** Whether the indicator should hide when not animating. @@ -34,7 +34,7 @@ type ActivityIndicatorIOSProps = $ReadOnly<{ */ hidesWhenStopped?: ?boolean, }>; -export type ActivityIndicatorProps = $ReadOnly<{ +export type ActivityIndicatorProps = Readonly<{ ...ViewProps, ...ActivityIndicatorIOSProps, diff --git a/packages/react-native/Libraries/Components/Button.js b/packages/react-native/Libraries/Components/Button.js index 84eedcf168c..71c947adf4d 100644 --- a/packages/react-native/Libraries/Components/Button.js +++ b/packages/react-native/Libraries/Components/Button.js @@ -27,7 +27,7 @@ import View from './View/View'; import invariant from 'invariant'; import * as React from 'react'; -export type ButtonProps = $ReadOnly<{ +export type ButtonProps = Readonly<{ /** Text to display inside the button. On Android the given title will be converted to the uppercased form. diff --git a/packages/react-native/Libraries/Components/DrawerAndroid/DrawerLayoutAndroidTypes.js b/packages/react-native/Libraries/Components/DrawerAndroid/DrawerLayoutAndroidTypes.js index c6ef94eca4f..e100c6006ee 100644 --- a/packages/react-native/Libraries/Components/DrawerAndroid/DrawerLayoutAndroidTypes.js +++ b/packages/react-native/Libraries/Components/DrawerAndroid/DrawerLayoutAndroidTypes.js @@ -22,12 +22,12 @@ import * as React from 'react'; export type DrawerStates = 'Idle' | 'Dragging' | 'Settling'; export type DrawerSlideEvent = NativeSyntheticEvent< - $ReadOnly<{ + Readonly<{ offset: number, }>, >; -export type DrawerLayoutAndroidProps = $ReadOnly<{ +export type DrawerLayoutAndroidProps = Readonly<{ ...ViewProps, /** diff --git a/packages/react-native/Libraries/Components/Keyboard/Keyboard.js b/packages/react-native/Libraries/Components/Keyboard/Keyboard.js index 58379250a49..a17be856521 100644 --- a/packages/react-native/Libraries/Components/Keyboard/Keyboard.js +++ b/packages/react-native/Libraries/Components/Keyboard/Keyboard.js @@ -25,7 +25,7 @@ export type KeyboardEventEasing = | 'linear' | 'keyboard'; -export type KeyboardMetrics = $ReadOnly<{ +export type KeyboardMetrics = Readonly<{ screenX: number, screenY: number, width: number, @@ -40,13 +40,13 @@ type BaseKeyboardEvent = { endCoordinates: KeyboardMetrics, }; -export type AndroidKeyboardEvent = $ReadOnly<{ +export type AndroidKeyboardEvent = Readonly<{ ...BaseKeyboardEvent, duration: 0, easing: 'keyboard', }>; -export type IOSKeyboardEvent = $ReadOnly<{ +export type IOSKeyboardEvent = Readonly<{ ...BaseKeyboardEvent, startCoordinates: KeyboardMetrics, isEventFromThisApp: boolean, diff --git a/packages/react-native/Libraries/Components/Keyboard/KeyboardAvoidingView.js b/packages/react-native/Libraries/Components/Keyboard/KeyboardAvoidingView.js index 6eca1569f30..4f1cd85848f 100644 --- a/packages/react-native/Libraries/Components/Keyboard/KeyboardAvoidingView.js +++ b/packages/react-native/Libraries/Components/Keyboard/KeyboardAvoidingView.js @@ -26,7 +26,7 @@ import Keyboard from './Keyboard'; import * as React from 'react'; import {createRef} from 'react'; -export type KeyboardAvoidingViewProps = $ReadOnly<{ +export type KeyboardAvoidingViewProps = Readonly<{ ...ViewProps, /** diff --git a/packages/react-native/Libraries/Components/LayoutConformance/LayoutConformance.js b/packages/react-native/Libraries/Components/LayoutConformance/LayoutConformance.js index ab3afcfc27f..027428146a0 100644 --- a/packages/react-native/Libraries/Components/LayoutConformance/LayoutConformance.js +++ b/packages/react-native/Libraries/Components/LayoutConformance/LayoutConformance.js @@ -12,7 +12,7 @@ import StyleSheet from '../../StyleSheet/StyleSheet'; import LayoutConformanceNativeComponent from './LayoutConformanceNativeComponent'; import * as React from 'react'; -export type LayoutConformanceProps = $ReadOnly<{ +export type LayoutConformanceProps = Readonly<{ /** * strict: Layout in accordance with W3C spec, even when breaking * compatibility: Layout with the same behavior as previous versions of React Native diff --git a/packages/react-native/Libraries/Components/LayoutConformance/LayoutConformanceNativeComponent.js b/packages/react-native/Libraries/Components/LayoutConformance/LayoutConformanceNativeComponent.js index 698bee76995..226bc5c0e39 100644 --- a/packages/react-native/Libraries/Components/LayoutConformance/LayoutConformanceNativeComponent.js +++ b/packages/react-native/Libraries/Components/LayoutConformance/LayoutConformanceNativeComponent.js @@ -13,7 +13,7 @@ import type {ViewProps} from '../View/ViewPropTypes'; import * as NativeComponentRegistry from '../../NativeComponent/NativeComponentRegistry'; -type Props = $ReadOnly<{ +type Props = Readonly<{ mode: 'strict' | 'compatibility', ...ViewProps, }>; diff --git a/packages/react-native/Libraries/Components/Pressable/Pressable.js b/packages/react-native/Libraries/Components/Pressable/Pressable.js index 687baf982d5..c1a71a9a3fa 100644 --- a/packages/react-native/Libraries/Components/Pressable/Pressable.js +++ b/packages/react-native/Libraries/Components/Pressable/Pressable.js @@ -29,11 +29,11 @@ import {memo, useMemo, useRef, useState} from 'react'; export type {PressableAndroidRippleConfig}; -export type PressableStateCallbackType = $ReadOnly<{ +export type PressableStateCallbackType = Readonly<{ pressed: boolean, }>; -type PressableBaseProps = $ReadOnly<{ +type PressableBaseProps = Readonly<{ /** * Whether a press gesture can be interrupted by a parent gesture such as a * scroll event. Defaults to true. @@ -156,7 +156,7 @@ type PressableBaseProps = $ReadOnly<{ unstable_pressDelay?: ?number, }>; -export type PressableProps = $ReadOnly<{ +export type PressableProps = Readonly<{ // Pressability may override `onMouseEnter` and `onMouseLeave` to // implement `onHoverIn` and `onHoverOut` in a platform-agnostic way. // Hover events should be used instead of mouse events. diff --git a/packages/react-native/Libraries/Components/Pressable/useAndroidRippleForView.js b/packages/react-native/Libraries/Components/Pressable/useAndroidRippleForView.js index c8851fe94fc..dc64193200c 100644 --- a/packages/react-native/Libraries/Components/Pressable/useAndroidRippleForView.js +++ b/packages/react-native/Libraries/Components/Pressable/useAndroidRippleForView.js @@ -19,7 +19,7 @@ import invariant from 'invariant'; import * as React from 'react'; import {useMemo} from 'react'; -type NativeBackgroundProp = $ReadOnly<{ +type NativeBackgroundProp = Readonly<{ type: 'RippleAndroid', color: ?number, borderless: boolean, @@ -40,13 +40,13 @@ export type PressableAndroidRippleConfig = { export default function useAndroidRippleForView( rippleConfig: ?PressableAndroidRippleConfig, viewRef: {current: null | React.ElementRef}, -): ?$ReadOnly<{ +): ?Readonly<{ onPressIn: (event: GestureResponderEvent) => void, onPressMove: (event: GestureResponderEvent) => void, onPressOut: (event: GestureResponderEvent) => void, viewProps: - | $ReadOnly<{nativeBackgroundAndroid: NativeBackgroundProp}> - | $ReadOnly<{nativeForegroundAndroid: NativeBackgroundProp}>, + | Readonly<{nativeBackgroundAndroid: NativeBackgroundProp}> + | Readonly<{nativeForegroundAndroid: NativeBackgroundProp}>, }> { const {color, borderless, radius, foreground} = rippleConfig ?? {}; diff --git a/packages/react-native/Libraries/Components/ProgressBarAndroid/ProgressBarAndroidTypes.js b/packages/react-native/Libraries/Components/ProgressBarAndroid/ProgressBarAndroidTypes.js index 8f20e23a52c..e565e0bf728 100644 --- a/packages/react-native/Libraries/Components/ProgressBarAndroid/ProgressBarAndroidTypes.js +++ b/packages/react-native/Libraries/Components/ProgressBarAndroid/ProgressBarAndroidTypes.js @@ -35,7 +35,7 @@ type IndeterminateProgressBarAndroidStyleAttrProp = { indeterminate: true, }; -type ProgressBarAndroidBaseProps = $ReadOnly<{ +type ProgressBarAndroidBaseProps = Readonly<{ /** * Whether to show the ProgressBar (true, the default) or hide it (false). */ @@ -51,12 +51,12 @@ type ProgressBarAndroidBaseProps = $ReadOnly<{ }>; export type ProgressBarAndroidProps = - | $ReadOnly<{ + | Readonly<{ ...ViewProps, ...ProgressBarAndroidBaseProps, ...DeterminateProgressBarAndroidStyleAttrProp, }> - | $ReadOnly<{ + | Readonly<{ ...ViewProps, ...ProgressBarAndroidBaseProps, ...IndeterminateProgressBarAndroidStyleAttrProp, diff --git a/packages/react-native/Libraries/Components/RefreshControl/RefreshControl.js b/packages/react-native/Libraries/Components/RefreshControl/RefreshControl.js index 4c6947a1fbc..53b5231bc7f 100644 --- a/packages/react-native/Libraries/Components/RefreshControl/RefreshControl.js +++ b/packages/react-native/Libraries/Components/RefreshControl/RefreshControl.js @@ -21,7 +21,7 @@ import * as React from 'react'; const Platform = require('../../Utilities/Platform').default; -export type RefreshControlPropsIOS = $ReadOnly<{ +export type RefreshControlPropsIOS = Readonly<{ /** * The color of the refresh indicator. */ @@ -36,7 +36,7 @@ export type RefreshControlPropsIOS = $ReadOnly<{ title?: ?string, }>; -export type RefreshControlPropsAndroid = $ReadOnly<{ +export type RefreshControlPropsAndroid = Readonly<{ /** * Whether the pull to refresh functionality is enabled. */ @@ -55,7 +55,7 @@ export type RefreshControlPropsAndroid = $ReadOnly<{ size?: ?('default' | 'large'), }>; -type RefreshControlBaseProps = $ReadOnly<{ +type RefreshControlBaseProps = Readonly<{ /** * Called when the view starts refreshing. */ @@ -72,7 +72,7 @@ type RefreshControlBaseProps = $ReadOnly<{ progressViewOffset?: ?number, }>; -export type RefreshControlProps = $ReadOnly<{ +export type RefreshControlProps = Readonly<{ ...ViewProps, ...RefreshControlPropsIOS, ...RefreshControlPropsAndroid, diff --git a/packages/react-native/Libraries/Components/ScrollView/ScrollView.js b/packages/react-native/Libraries/Components/ScrollView/ScrollView.js index fdb830dc6e6..d247ac706d2 100644 --- a/packages/react-native/Libraries/Components/ScrollView/ScrollView.js +++ b/packages/react-native/Libraries/Components/ScrollView/ScrollView.js @@ -174,7 +174,7 @@ export interface PublicScrollViewInstance type InnerViewInstance = React.ElementRef; -export type ScrollViewPropsIOS = $ReadOnly<{ +export type ScrollViewPropsIOS = Readonly<{ /** * Controls whether iOS should automatically adjust the content inset * for scroll views that are placed behind a navigation bar or @@ -330,7 +330,7 @@ export type ScrollViewPropsIOS = $ReadOnly<{ ), }>; -export type ScrollViewPropsAndroid = $ReadOnly<{ +export type ScrollViewPropsAndroid = Readonly<{ /** * Enables nested scrolling for Android API level 21+. * Nested scrolling is supported by default on iOS @@ -391,11 +391,11 @@ export type ScrollViewPropsAndroid = $ReadOnly<{ }>; type StickyHeaderComponentType = component( - ref?: React.RefSetter<$ReadOnly void}>>, + ref?: React.RefSetter void}>>, ...ScrollViewStickyHeaderProps ); -type ScrollViewBaseProps = $ReadOnly<{ +type ScrollViewBaseProps = Readonly<{ /** * These styles will be applied to the scroll view content container which * wraps all of the child views. Example: @@ -514,7 +514,7 @@ type ScrollViewBaseProps = $ReadOnly<{ * whether content is "visible" or not. * */ - maintainVisibleContentPosition?: ?$ReadOnly<{ + maintainVisibleContentPosition?: ?Readonly<{ minIndexForVisible: number, autoscrollToTopThreshold?: ?number, }>, @@ -673,7 +673,7 @@ type ScrollViewBaseProps = $ReadOnly<{ scrollViewRef?: React.RefSetter, }>; -export type ScrollViewProps = $ReadOnly<{ +export type ScrollViewProps = Readonly<{ ...Omit, ...ScrollViewPropsIOS, ...ScrollViewPropsAndroid, @@ -686,7 +686,7 @@ type ScrollViewState = { const IS_ANIMATING_TOUCH_START_THRESHOLD_MS = 16; -export type ScrollViewComponentStatics = $ReadOnly<{ +export type ScrollViewComponentStatics = Readonly<{ Context: typeof ScrollViewContext, }>; diff --git a/packages/react-native/Libraries/Components/ScrollView/ScrollViewNativeComponentType.js b/packages/react-native/Libraries/Components/ScrollView/ScrollViewNativeComponentType.js index 1feee699954..05a2eb18690 100644 --- a/packages/react-native/Libraries/Components/ScrollView/ScrollViewNativeComponentType.js +++ b/packages/react-native/Libraries/Components/ScrollView/ScrollViewNativeComponentType.js @@ -19,7 +19,7 @@ import type { } from '../../Types/CoreEventTypes'; import type {ViewProps} from '../View/ViewPropTypes'; -export type ScrollViewNativeProps = $ReadOnly<{ +export type ScrollViewNativeProps = Readonly<{ ...ViewProps, alwaysBounceHorizontal?: ?boolean, alwaysBounceVertical?: ?boolean, @@ -46,7 +46,7 @@ export type ScrollViewNativeProps = $ReadOnly<{ indicatorStyle?: ?('default' | 'black' | 'white'), isInvertedVirtualizedList?: ?boolean, keyboardDismissMode?: ?('none' | 'on-drag' | 'interactive'), - maintainVisibleContentPosition?: ?$ReadOnly<{ + maintainVisibleContentPosition?: ?Readonly<{ minIndexForVisible: number, autoscrollToTopThreshold?: ?number, }>, diff --git a/packages/react-native/Libraries/Components/ScrollView/ScrollViewStickyHeader.js b/packages/react-native/Libraries/Components/ScrollView/ScrollViewStickyHeader.js index af9b9866464..72a249831a6 100644 --- a/packages/react-native/Libraries/Components/ScrollView/ScrollViewStickyHeader.js +++ b/packages/react-native/Libraries/Components/ScrollView/ScrollViewStickyHeader.js @@ -25,7 +25,7 @@ import { useState, } from 'react'; -export type ScrollViewStickyHeaderProps = $ReadOnly<{ +export type ScrollViewStickyHeaderProps = Readonly<{ children?: React.Node, nextHeaderLayoutY: ?number, onLayout: (event: LayoutChangeEvent) => void, diff --git a/packages/react-native/Libraries/Components/StaticRenderer.js b/packages/react-native/Libraries/Components/StaticRenderer.js index a7ae823ef71..da36f130533 100644 --- a/packages/react-native/Libraries/Components/StaticRenderer.js +++ b/packages/react-native/Libraries/Components/StaticRenderer.js @@ -12,7 +12,7 @@ import * as React from 'react'; -type Props = $ReadOnly<{ +type Props = Readonly<{ /** * Indicates whether the render function needs to be called again */ diff --git a/packages/react-native/Libraries/Components/StatusBar/StatusBar.js b/packages/react-native/Libraries/Components/StatusBar/StatusBar.js index 5cbc674ecf3..396ed4047e2 100644 --- a/packages/react-native/Libraries/Components/StatusBar/StatusBar.js +++ b/packages/react-native/Libraries/Components/StatusBar/StatusBar.js @@ -55,7 +55,7 @@ export type StatusBarAnimation = $Keys<{ ... }>; -export type StatusBarPropsAndroid = $ReadOnly<{ +export type StatusBarPropsAndroid = Readonly<{ /** * The background color of the status bar. * @@ -76,7 +76,7 @@ export type StatusBarPropsAndroid = $ReadOnly<{ translucent?: ?boolean, }>; -export type StatusBarPropsIOS = $ReadOnly<{ +export type StatusBarPropsIOS = Readonly<{ /** * If the network activity indicator should be visible. * @@ -92,7 +92,7 @@ export type StatusBarPropsIOS = $ReadOnly<{ showHideTransition?: ?('fade' | 'slide' | 'none'), }>; -type StatusBarBaseProps = $ReadOnly<{ +type StatusBarBaseProps = Readonly<{ /** * If the status bar is hidden. */ @@ -108,7 +108,7 @@ type StatusBarBaseProps = $ReadOnly<{ barStyle?: ?('default' | 'light-content' | 'dark-content'), }>; -export type StatusBarProps = $ReadOnly<{ +export type StatusBarProps = Readonly<{ ...StatusBarPropsAndroid, ...StatusBarPropsIOS, ...StatusBarBaseProps, diff --git a/packages/react-native/Libraries/Components/Switch/Switch.js b/packages/react-native/Libraries/Components/Switch/Switch.js index 1047396d6b5..8d3c5530cf5 100644 --- a/packages/react-native/Libraries/Components/Switch/Switch.js +++ b/packages/react-native/Libraries/Components/Switch/Switch.js @@ -48,7 +48,7 @@ export type SwitchPropsIOS = { tintColor?: ?ColorValue, }; -type SwitchChangeEventData = $ReadOnly<{ +type SwitchChangeEventData = Readonly<{ target: number, value: boolean, }>; @@ -82,7 +82,7 @@ type SwitchPropsBase = { color of the background exposed by the shrunken track, use [`ios_backgroundColor`](https://reactnative.dev/docs/switch#ios_backgroundColor). */ - trackColor?: ?$ReadOnly<{ + trackColor?: ?Readonly<{ false?: ?ColorValue, true?: ?ColorValue, }>, @@ -109,7 +109,7 @@ type SwitchPropsBase = { onValueChange?: ?(value: boolean) => Promise | void, }; -export type SwitchProps = $ReadOnly<{ +export type SwitchProps = Readonly<{ ...ViewProps, ...SwitchPropsIOS, ...SwitchPropsBase, diff --git a/packages/react-native/Libraries/Components/TextInput/AndroidTextInputNativeComponent.js b/packages/react-native/Libraries/Components/TextInput/AndroidTextInputNativeComponent.js index 8cc136961bc..c3016749841 100644 --- a/packages/react-native/Libraries/Components/TextInput/AndroidTextInputNativeComponent.js +++ b/packages/react-native/Libraries/Components/TextInput/AndroidTextInputNativeComponent.js @@ -63,7 +63,7 @@ export type ReturnKeyType = export type SubmitBehavior = 'submit' | 'blurAndSubmit' | 'newline'; -export type AndroidTextInputNativeProps = $ReadOnly<{ +export type AndroidTextInputNativeProps = Readonly<{ // This allows us to inherit everything from ViewProps except for style (see below) // This must be commented for Fabric codegen to work. ...Omit, @@ -339,13 +339,13 @@ export type AndroidTextInputNativeProps = $ReadOnly<{ * Callback that is called when the text input is blurred. * `target` is the reactTag of the element */ - onBlur?: ?BubblingEventHandler<$ReadOnly<{target: Int32}>>, + onBlur?: ?BubblingEventHandler>, /** * Callback that is called when the text input is focused. * `target` is the reactTag of the element */ - onFocus?: ?BubblingEventHandler<$ReadOnly<{target: Int32}>>, + onFocus?: ?BubblingEventHandler>, /** * Callback that is called when the text input's text changes. @@ -353,7 +353,7 @@ export type AndroidTextInputNativeProps = $ReadOnly<{ * TODO: differentiate between onChange and onChangeText */ onChange?: ?BubblingEventHandler< - $ReadOnly<{target: Int32, eventCount: Int32, text: string}>, + Readonly<{target: Int32, eventCount: Int32, text: string}>, >, /** @@ -362,7 +362,7 @@ export type AndroidTextInputNativeProps = $ReadOnly<{ * TODO: differentiate between onChange and onChangeText */ onChangeText?: ?BubblingEventHandler< - $ReadOnly<{target: Int32, eventCount: Int32, text: string}>, + Readonly<{target: Int32, eventCount: Int32, text: string}>, >, /** @@ -373,18 +373,16 @@ export type AndroidTextInputNativeProps = $ReadOnly<{ * Only called for multiline text inputs. */ onContentSizeChange?: ?DirectEventHandler< - $ReadOnly<{ + Readonly<{ target: Int32, - contentSize: $ReadOnly<{width: Double, height: Double}>, + contentSize: Readonly<{width: Double, height: Double}>, }>, >, /** * Callback that is called when text input ends. */ - onEndEditing?: ?BubblingEventHandler< - $ReadOnly<{target: Int32, text: string}>, - >, + onEndEditing?: ?BubblingEventHandler>, /** * Callback that is called when the text input selection is changed. @@ -392,9 +390,9 @@ export type AndroidTextInputNativeProps = $ReadOnly<{ * `{ nativeEvent: { selection: { start, end } } }`. */ onSelectionChange?: ?DirectEventHandler< - $ReadOnly<{ + Readonly<{ target: Int32, - selection: $ReadOnly<{start: Double, end: Double}>, + selection: Readonly<{start: Double, end: Double}>, }>, >, @@ -403,7 +401,7 @@ export type AndroidTextInputNativeProps = $ReadOnly<{ * Invalid if `multiline={true}` is specified. */ onSubmitEditing?: ?BubblingEventHandler< - $ReadOnly<{target: Int32, text: string}>, + Readonly<{target: Int32, text: string}>, >, /** @@ -413,7 +411,7 @@ export type AndroidTextInputNativeProps = $ReadOnly<{ * the typed-in character otherwise including `' '` for space. * Fires before `onChange` callbacks. */ - onKeyPress?: ?BubblingEventHandler<$ReadOnly<{target: Int32, key: string}>>, + onKeyPress?: ?BubblingEventHandler>, /** * Invoked on content scroll with `{ nativeEvent: { contentOffset: { x, y } } }`. @@ -421,28 +419,28 @@ export type AndroidTextInputNativeProps = $ReadOnly<{ * is not provided for performance reasons. */ onScroll?: ?DirectEventHandler< - $ReadOnly<{ + Readonly<{ target: Int32, responderIgnoreScroll: boolean, - contentInset: $ReadOnly<{ + contentInset: Readonly<{ top: Double, // always 0 on Android bottom: Double, // always 0 on Android left: Double, // always 0 on Android right: Double, // always 0 on Android }>, - contentOffset: $ReadOnly<{ + contentOffset: Readonly<{ x: Double, y: Double, }>, - contentSize: $ReadOnly<{ + contentSize: Readonly<{ width: Double, // always 0 on Android height: Double, // always 0 on Android }>, - layoutMeasurement: $ReadOnly<{ + layoutMeasurement: Readonly<{ width: Double, height: Double, }>, - velocity: $ReadOnly<{ + velocity: Readonly<{ x: Double, // always 0 on Android y: Double, // always 0 on Android }>, @@ -479,7 +477,7 @@ export type AndroidTextInputNativeProps = $ReadOnly<{ * The start and end of the text input's selection. Set start and end to * the same value to position the cursor. */ - selection?: ?$ReadOnly<{ + selection?: ?Readonly<{ start: Int32, end?: ?Int32, }>, @@ -582,7 +580,7 @@ export type AndroidTextInputNativeProps = $ReadOnly<{ textShadowRadius?: ?Float, textDecorationLine?: ?string, fontStyle?: ?string, - textShadowOffset?: ?$ReadOnly<{width?: ?Double, height?: ?Double}>, + textShadowOffset?: ?Readonly<{width?: ?Double, height?: ?Double}>, lineHeight?: ?Float, textTransform?: ?string, color?: ?Int32, diff --git a/packages/react-native/Libraries/Components/TextInput/InputAccessoryView.js b/packages/react-native/Libraries/Components/TextInput/InputAccessoryView.js index d80716cbf31..20ec3003d5c 100644 --- a/packages/react-native/Libraries/Components/TextInput/InputAccessoryView.js +++ b/packages/react-native/Libraries/Components/TextInput/InputAccessoryView.js @@ -76,7 +76,7 @@ import * as React from 'react'; * For an example, look at InputAccessoryViewExample.js in RNTester. */ -export type InputAccessoryViewProps = $ReadOnly<{ +export type InputAccessoryViewProps = Readonly<{ +children: React.Node, /** * An ID which is used to associate this `InputAccessoryView` to diff --git a/packages/react-native/Libraries/Components/TextInput/TextInput.flow.js b/packages/react-native/Libraries/Components/TextInput/TextInput.flow.js index 8438a0eac10..27063a5dd9d 100644 --- a/packages/react-native/Libraries/Components/TextInput/TextInput.flow.js +++ b/packages/react-native/Libraries/Components/TextInput/TextInput.flow.js @@ -25,7 +25,7 @@ import * as React from 'react'; /** * @see TextInputProps.onChange */ -type TextInputChangeEventData = $ReadOnly<{ +type TextInputChangeEventData = Readonly<{ eventCount: number, target: number, text: string, @@ -35,10 +35,10 @@ export type TextInputChangeEvent = NativeSyntheticEvent; export type TextInputEvent = NativeSyntheticEvent< - $ReadOnly<{ + Readonly<{ eventCount: number, previousText: string, - range: $ReadOnly<{ + range: Readonly<{ start: number, end: number, }>, @@ -47,9 +47,9 @@ export type TextInputEvent = NativeSyntheticEvent< }>, >; -type TextInputContentSizeChangeEventData = $ReadOnly<{ +type TextInputContentSizeChangeEventData = Readonly<{ target: number, - contentSize: $ReadOnly<{ + contentSize: Readonly<{ width: number, height: number, }>, @@ -73,17 +73,17 @@ export type TextInputBlurEvent = BlurEvent; */ export type TextInputFocusEvent = FocusEvent; -type TargetEvent = $ReadOnly<{ +type TargetEvent = Readonly<{ target: number, ... }>; -export type Selection = $ReadOnly<{ +export type Selection = Readonly<{ start: number, end: number, }>; -type TextInputSelectionChangeEventData = $ReadOnly<{ +type TextInputSelectionChangeEventData = Readonly<{ ...TargetEvent, selection: Selection, ... @@ -95,7 +95,7 @@ type TextInputSelectionChangeEventData = $ReadOnly<{ export type TextInputSelectionChangeEvent = NativeSyntheticEvent; -type TextInputKeyPressEventData = $ReadOnly<{ +type TextInputKeyPressEventData = Readonly<{ ...TargetEvent, key: string, target?: ?number, @@ -109,7 +109,7 @@ type TextInputKeyPressEventData = $ReadOnly<{ export type TextInputKeyPressEvent = NativeSyntheticEvent; -type TextInputEndEditingEventData = $ReadOnly<{ +type TextInputEndEditingEventData = Readonly<{ ...TargetEvent, eventCount: number, text: string, @@ -122,7 +122,7 @@ type TextInputEndEditingEventData = $ReadOnly<{ export type TextInputEndEditingEvent = NativeSyntheticEvent; -type TextInputSubmitEditingEventData = $ReadOnly<{ +type TextInputSubmitEditingEventData = Readonly<{ ...TargetEvent, eventCount: number, text: string, @@ -266,7 +266,7 @@ export type EnterKeyHintTypeOptions = type PasswordRules = string; -export type TextInputIOSProps = $ReadOnly<{ +export type TextInputIOSProps = Readonly<{ /** * If true, the keyboard shortcuts (undo/redo and copy buttons) are disabled. The default value is false. * @platform ios @@ -403,7 +403,7 @@ export type TextInputIOSProps = $ReadOnly<{ smartInsertDelete?: ?boolean, }>; -export type TextInputAndroidProps = $ReadOnly<{ +export type TextInputAndroidProps = Readonly<{ /** * When provided it will set the color of the cursor (or "caret") in the component. * Unlike the behavior of `selectionColor` the cursor color will be set independently @@ -512,7 +512,7 @@ export type TextInputAndroidProps = $ReadOnly<{ underlineColorAndroid?: ?ColorValue, }>; -type TextInputBaseProps = $ReadOnly<{ +type TextInputBaseProps = Readonly<{ /** * When provided, the text input will only accept drag and drop events for the specified * types. If null or not provided, the text input will accept all types of drag and drop events. @@ -946,7 +946,7 @@ type TextInputBaseProps = $ReadOnly<{ * The start and end of the text input's selection. Set start and end to * the same value to position the cursor. */ - selection?: ?$ReadOnly<{ + selection?: ?Readonly<{ start: number, end?: ?number, }>, @@ -1031,7 +1031,7 @@ type TextInputBaseProps = $ReadOnly<{ textAlign?: ?('left' | 'center' | 'right'), }>; -export type TextInputProps = $ReadOnly<{ +export type TextInputProps = Readonly<{ ...Omit, ...TextInputIOSProps, ...TextInputAndroidProps, @@ -1167,8 +1167,8 @@ type InternalTextInput = component( ...TextInputProps ); -export type TextInputComponentStatics = $ReadOnly<{ - State: $ReadOnly<{ +export type TextInputComponentStatics = Readonly<{ + State: Readonly<{ currentlyFocusedInput: () => ?HostInstance, currentlyFocusedField: () => ?number, focusTextInput: (textField: ?HostInstance) => void, diff --git a/packages/react-native/Libraries/Components/TextInput/TextInput.js b/packages/react-native/Libraries/Components/TextInput/TextInput.js index f42f8ed0464..a7d9beb1756 100644 --- a/packages/react-native/Libraries/Components/TextInput/TextInput.js +++ b/packages/react-native/Libraries/Components/TextInput/TextInput.js @@ -120,7 +120,7 @@ export type { TextInputSubmitEditingEvent, }; -type TextInputStateType = $ReadOnly<{ +type TextInputStateType = Readonly<{ /** * @deprecated Use currentlyFocusedInput * Returns the ID of the currently focused text field, if one exists @@ -965,7 +965,7 @@ TextInput.State = { focusTextInput: TextInputState.focusTextInput, }; -export type TextInputComponentStatics = $ReadOnly<{ +export type TextInputComponentStatics = Readonly<{ State: TextInputStateType, }>; diff --git a/packages/react-native/Libraries/Components/Touchable/TouchableBounce.js b/packages/react-native/Libraries/Components/Touchable/TouchableBounce.js index 7974a77cb9f..3370b442d15 100644 --- a/packages/react-native/Libraries/Components/Touchable/TouchableBounce.js +++ b/packages/react-native/Libraries/Components/Touchable/TouchableBounce.js @@ -19,7 +19,7 @@ import {PressabilityDebugView} from '../../Pressability/PressabilityDebug'; import Platform from '../../Utilities/Platform'; import * as React from 'react'; -type TouchableBounceProps = $ReadOnly<{ +type TouchableBounceProps = Readonly<{ ...React.ElementConfig, onPressAnimationComplete?: ?() => void, @@ -31,7 +31,7 @@ type TouchableBounceProps = $ReadOnly<{ hostRef: React.RefSetter>, }>; -type TouchableBounceState = $ReadOnly<{ +type TouchableBounceState = Readonly<{ pressability: Pressability, scale: Animated.Value, }>; @@ -226,10 +226,10 @@ export default (function TouchableBounceWrapper({ ...props }: { ref: React.RefSetter, - ...$ReadOnly>, + ...Readonly>, }) { return ; } as component( ref?: React.RefSetter, - ...props: $ReadOnly> + ...props: Readonly> )); diff --git a/packages/react-native/Libraries/Components/Touchable/TouchableHighlight.js b/packages/react-native/Libraries/Components/Touchable/TouchableHighlight.js index ba1518a85e8..0064e996238 100644 --- a/packages/react-native/Libraries/Components/Touchable/TouchableHighlight.js +++ b/packages/react-native/Libraries/Components/Touchable/TouchableHighlight.js @@ -22,7 +22,7 @@ import Platform from '../../Utilities/Platform'; import * as React from 'react'; import {cloneElement} from 'react'; -type AndroidProps = $ReadOnly<{ +type AndroidProps = Readonly<{ nextFocusDown?: ?number, nextFocusForward?: ?number, nextFocusLeft?: ?number, @@ -30,14 +30,14 @@ type AndroidProps = $ReadOnly<{ nextFocusUp?: ?number, }>; -type IOSProps = $ReadOnly<{ +type IOSProps = Readonly<{ /** * @deprecated Use `focusable` instead */ hasTVPreferredFocus?: ?boolean, }>; -type TouchableHighlightBaseProps = $ReadOnly<{ +type TouchableHighlightBaseProps = Readonly<{ /** * Determines what the opacity of the wrapped view should be when touch is active. */ @@ -63,19 +63,19 @@ type TouchableHighlightBaseProps = $ReadOnly<{ hostRef?: React.RefSetter>, }>; -export type TouchableHighlightProps = $ReadOnly<{ +export type TouchableHighlightProps = Readonly<{ ...TouchableWithoutFeedbackProps, ...AndroidProps, ...IOSProps, ...TouchableHighlightBaseProps, }>; -type ExtraStyles = $ReadOnly<{ +type ExtraStyles = Readonly<{ child: ViewStyleProp, underlay: ViewStyleProp, }>; -type TouchableHighlightState = $ReadOnly<{ +type TouchableHighlightState = Readonly<{ pressability: Pressability, extraStyles: ?ExtraStyles, }>; @@ -412,13 +412,13 @@ class TouchableHighlightImpl extends React.Component< const TouchableHighlight: component( ref?: React.RefSetter>, - ...props: $ReadOnly> + ...props: Readonly> ) = ({ ref: hostRef, ...props }: { ref?: React.RefSetter>, - ...$ReadOnly>, + ...Readonly>, }) => ; TouchableHighlight.displayName = 'TouchableHighlight'; diff --git a/packages/react-native/Libraries/Components/Touchable/TouchableNativeFeedback.js b/packages/react-native/Libraries/Components/Touchable/TouchableNativeFeedback.js index a929ba2f23a..6a0b5e12ee6 100644 --- a/packages/react-native/Libraries/Components/Touchable/TouchableNativeFeedback.js +++ b/packages/react-native/Libraries/Components/Touchable/TouchableNativeFeedback.js @@ -69,7 +69,7 @@ type TouchableNativeFeedbackTVProps = { nextFocusUp?: ?number, }; -export type TouchableNativeFeedbackProps = $ReadOnly<{ +export type TouchableNativeFeedbackProps = Readonly<{ ...TouchableWithoutFeedbackProps, ...TouchableNativeFeedbackTVProps, /** @@ -87,14 +87,14 @@ export type TouchableNativeFeedbackProps = $ReadOnly<{ * type is available on Android API level 21+ */ background?: ?( - | $ReadOnly<{ + | Readonly<{ type: 'ThemeAttrAndroid', attribute: | 'selectableItemBackground' | 'selectableItemBackgroundBorderless', rippleRadius: ?number, }> - | $ReadOnly<{ + | Readonly<{ type: 'RippleAndroid', color: ?number, borderless: boolean, @@ -114,7 +114,7 @@ export type TouchableNativeFeedbackProps = $ReadOnly<{ useForeground?: ?boolean, }>; -type TouchableNativeFeedbackState = $ReadOnly<{ +type TouchableNativeFeedbackState = Readonly<{ pressability: Pressability, }>; @@ -138,7 +138,7 @@ class TouchableNativeFeedback extends React.Component< * * @param rippleRadius The radius of ripple effect */ - static SelectableBackground: (rippleRadius?: ?number) => $ReadOnly<{ + static SelectableBackground: (rippleRadius?: ?number) => Readonly<{ attribute: 'selectableItemBackground', type: 'ThemeAttrAndroid', rippleRadius: ?number, @@ -155,7 +155,7 @@ class TouchableNativeFeedback extends React.Component< * * @param rippleRadius The radius of ripple effect */ - static SelectableBackgroundBorderless: (rippleRadius?: ?number) => $ReadOnly<{ + static SelectableBackgroundBorderless: (rippleRadius?: ?number) => Readonly<{ attribute: 'selectableItemBackgroundBorderless', type: 'ThemeAttrAndroid', rippleRadius: ?number, @@ -180,7 +180,7 @@ class TouchableNativeFeedback extends React.Component< color: string, borderless: boolean, rippleRadius?: ?number, - ) => $ReadOnly<{ + ) => Readonly<{ borderless: boolean, color: ?number, rippleRadius: ?number, diff --git a/packages/react-native/Libraries/Components/Touchable/TouchableOpacity.js b/packages/react-native/Libraries/Components/Touchable/TouchableOpacity.js index 9733b42c7aa..72d7ad49f2f 100644 --- a/packages/react-native/Libraries/Components/Touchable/TouchableOpacity.js +++ b/packages/react-native/Libraries/Components/Touchable/TouchableOpacity.js @@ -21,7 +21,7 @@ import flattenStyle from '../../StyleSheet/flattenStyle'; import Platform from '../../Utilities/Platform'; import * as React from 'react'; -export type TouchableOpacityTVProps = $ReadOnly<{ +export type TouchableOpacityTVProps = Readonly<{ /** * *(Apple TV only)* TV preferred focus (see documentation for the View component). * @@ -66,7 +66,7 @@ export type TouchableOpacityTVProps = $ReadOnly<{ nextFocusUp?: ?number, }>; -type TouchableOpacityBaseProps = $ReadOnly<{ +type TouchableOpacityBaseProps = Readonly<{ /** * Determines what the opacity of the wrapped view should be when touch is active. * Defaults to 0.2 @@ -77,13 +77,13 @@ type TouchableOpacityBaseProps = $ReadOnly<{ hostRef?: ?React.RefSetter>, }>; -export type TouchableOpacityProps = $ReadOnly<{ +export type TouchableOpacityProps = Readonly<{ ...TouchableWithoutFeedbackProps, ...TouchableOpacityTVProps, ...TouchableOpacityBaseProps, }>; -type TouchableOpacityState = $ReadOnly<{ +type TouchableOpacityState = Readonly<{ anim: Animated.Value, pressability: Pressability, }>; diff --git a/packages/react-native/Libraries/Components/Touchable/TouchableWithoutFeedback.js b/packages/react-native/Libraries/Components/Touchable/TouchableWithoutFeedback.js index 159e39e5b1c..adb099c2721 100755 --- a/packages/react-native/Libraries/Components/Touchable/TouchableWithoutFeedback.js +++ b/packages/react-native/Libraries/Components/Touchable/TouchableWithoutFeedback.js @@ -36,7 +36,7 @@ export type TouchableWithoutFeedbackPropsAndroid = { touchSoundDisabled?: ?boolean, }; -export type TouchableWithoutFeedbackProps = $ReadOnly< +export type TouchableWithoutFeedbackProps = Readonly< { children?: ?React.Node, /** diff --git a/packages/react-native/Libraries/Components/UnimplementedViews/UnimplementedView.js b/packages/react-native/Libraries/Components/UnimplementedViews/UnimplementedView.js index f7b32329e44..d07fff980a1 100644 --- a/packages/react-native/Libraries/Components/UnimplementedViews/UnimplementedView.js +++ b/packages/react-native/Libraries/Components/UnimplementedViews/UnimplementedView.js @@ -14,7 +14,7 @@ import type {ViewStyleProp} from '../../StyleSheet/StyleSheet'; import StyleSheet from '../../StyleSheet/StyleSheet'; import * as React from 'react'; -type Props = $ReadOnly<{ +type Props = Readonly<{ style?: ?ViewStyleProp, children?: React.Node, ... diff --git a/packages/react-native/Libraries/Components/View/ViewAccessibility.js b/packages/react-native/Libraries/Components/View/ViewAccessibility.js index 09d0b4c1977..3c99c03925e 100644 --- a/packages/react-native/Libraries/Components/View/ViewAccessibility.js +++ b/packages/react-native/Libraries/Components/View/ViewAccessibility.js @@ -154,7 +154,7 @@ export type AccessibilityActionName = | 'escape'; // the info associated with an accessibility action -export type AccessibilityActionInfo = $ReadOnly<{ +export type AccessibilityActionInfo = Readonly<{ name: AccessibilityActionName | string, label?: string, ... @@ -162,7 +162,7 @@ export type AccessibilityActionInfo = $ReadOnly<{ // The info included in the event sent to onAccessibilityAction export type AccessibilityActionEvent = NativeSyntheticEvent< - $ReadOnly<{actionName: string, ...}>, + Readonly<{actionName: string, ...}>, >; export type AccessibilityState = { @@ -189,7 +189,7 @@ export type AccessibilityState = { ... }; -export type AccessibilityValue = $ReadOnly<{ +export type AccessibilityValue = Readonly<{ /** * The minimum value of this component's range. (should be an integer) */ @@ -211,7 +211,7 @@ export type AccessibilityValue = $ReadOnly<{ text?: Stringish, }>; -export type AccessibilityPropsAndroid = $ReadOnly<{ +export type AccessibilityPropsAndroid = Readonly<{ /** * Identifies the element that labels the element it is applied to. When the assistive technology focuses on the component with this props, * the text is read aloud. The value should should match the nativeID of the related element. @@ -268,7 +268,7 @@ export type AccessibilityPropsAndroid = $ReadOnly<{ screenReaderFocusable?: boolean, }>; -export type AccessibilityPropsIOS = $ReadOnly<{ +export type AccessibilityPropsIOS = Readonly<{ /** * Prevents view from being inverted if set to true and color inversion is turned on. * @@ -338,7 +338,7 @@ export type AccessibilityPropsIOS = $ReadOnly<{ accessibilityRespondsToUserInteraction?: ?boolean, }>; -export type AccessibilityProps = $ReadOnly<{ +export type AccessibilityProps = Readonly<{ ...AccessibilityPropsAndroid, ...AccessibilityPropsIOS, /** diff --git a/packages/react-native/Libraries/Components/View/ViewPropTypes.js b/packages/react-native/Libraries/Components/View/ViewPropTypes.js index 8046e9d13e3..a20d8f246ea 100644 --- a/packages/react-native/Libraries/Components/View/ViewPropTypes.js +++ b/packages/react-native/Libraries/Components/View/ViewPropTypes.js @@ -33,7 +33,7 @@ import * as React from 'react'; export type ViewLayout = LayoutRectangle; export type ViewLayoutEvent = LayoutChangeEvent; -type DirectEventProps = $ReadOnly<{ +type DirectEventProps = Readonly<{ /** * When `accessible` is true, the system will try to invoke this function * when the user performs an accessibility custom action. @@ -79,13 +79,13 @@ type DirectEventProps = $ReadOnly<{ onAccessibilityEscape?: ?() => unknown, }>; -type MouseEventProps = $ReadOnly<{ +type MouseEventProps = Readonly<{ onMouseEnter?: ?(event: MouseEvent) => void, onMouseLeave?: ?(event: MouseEvent) => void, }>; // Experimental/Work in Progress Pointer Event Callbacks (not yet ready for use) -type PointerEventProps = $ReadOnly<{ +type PointerEventProps = Readonly<{ onClick?: ?(event: PointerEvent) => void, onClickCapture?: ?(event: PointerEvent) => void, onPointerEnter?: ?(event: PointerEvent) => void, @@ -110,21 +110,21 @@ type PointerEventProps = $ReadOnly<{ onLostPointerCaptureCapture?: ?(e: PointerEvent) => void, }>; -type FocusEventProps = $ReadOnly<{ +type FocusEventProps = Readonly<{ onBlur?: ?(event: BlurEvent) => void, onBlurCapture?: ?(event: BlurEvent) => void, onFocus?: ?(event: FocusEvent) => void, onFocusCapture?: ?(event: FocusEvent) => void, }>; -type KeyEventProps = $ReadOnly<{ +type KeyEventProps = Readonly<{ onKeyDown?: ?(event: KeyDownEvent) => void, onKeyDownCapture?: ?(event: KeyDownEvent) => void, onKeyUp?: ?(event: KeyUpEvent) => void, onKeyUpCapture?: ?(event: KeyUpEvent) => void, }>; -type TouchEventProps = $ReadOnly<{ +type TouchEventProps = Readonly<{ onTouchCancel?: ?(e: GestureResponderEvent) => void, onTouchCancelCapture?: ?(e: GestureResponderEvent) => void, onTouchEnd?: ?(e: GestureResponderEvent) => void, @@ -140,7 +140,7 @@ type TouchEventProps = $ReadOnly<{ * `TouchableHighlight` or `TouchableOpacity`. Check out `Touchable.js`, * `ScrollResponder.js` and `ResponderEventPlugin.js` for more discussion. */ -export type GestureResponderHandlers = $ReadOnly<{ +export type GestureResponderHandlers = Readonly<{ /** * Does this view want to "claim" touch responsiveness? This is called for * every touch move on the `View` when it is not the responder. @@ -257,12 +257,12 @@ export type GestureResponderHandlers = $ReadOnly<{ onStartShouldSetResponderCapture?: ?(e: GestureResponderEvent) => boolean, }>; -type AndroidDrawableThemeAttr = $ReadOnly<{ +type AndroidDrawableThemeAttr = Readonly<{ type: 'ThemeAttrAndroid', attribute: string, }>; -type AndroidDrawableRipple = $ReadOnly<{ +type AndroidDrawableRipple = Readonly<{ type: 'RippleAndroid', color?: ?number, borderless?: ?boolean, @@ -271,7 +271,7 @@ type AndroidDrawableRipple = $ReadOnly<{ type AndroidDrawable = AndroidDrawableThemeAttr | AndroidDrawableRipple; -export type ViewPropsAndroid = $ReadOnly<{ +export type ViewPropsAndroid = Readonly<{ nativeBackgroundAndroid?: ?AndroidDrawable, nativeForegroundAndroid?: ?AndroidDrawable, @@ -356,7 +356,7 @@ export type ViewPropsAndroid = $ReadOnly<{ onClick?: ?(event: GestureResponderEvent) => unknown, }>; -export type TVViewPropsIOS = $ReadOnly<{ +export type TVViewPropsIOS = Readonly<{ /** * *(Apple TV only)* When set to true, this view will be focusable * and navigable using the Apple TV remote. @@ -401,7 +401,7 @@ export type TVViewPropsIOS = $ReadOnly<{ tvParallaxMagnification?: number, }>; -export type ViewPropsIOS = $ReadOnly<{ +export type ViewPropsIOS = Readonly<{ /** * Whether this `View` should be rendered as a bitmap before compositing. * @@ -412,7 +412,7 @@ export type ViewPropsIOS = $ReadOnly<{ shouldRasterizeIOS?: ?boolean, }>; -type ViewBaseProps = $ReadOnly<{ +type ViewBaseProps = Readonly<{ children?: React.Node, style?: ?ViewStyleProp, @@ -508,7 +508,7 @@ type ViewBaseProps = $ReadOnly<{ experimental_accessibilityOrder?: ?Array, }>; -export type ViewProps = $ReadOnly<{ +export type ViewProps = Readonly<{ ...DirectEventProps, ...GestureResponderHandlers, ...MouseEventProps, diff --git a/packages/react-native/Libraries/Core/Devtools/parseHermesStack.js b/packages/react-native/Libraries/Core/Devtools/parseHermesStack.js index e8911cebdd2..b89ba3102d5 100644 --- a/packages/react-native/Libraries/Core/Devtools/parseHermesStack.js +++ b/packages/react-native/Libraries/Core/Devtools/parseHermesStack.js @@ -10,25 +10,25 @@ 'use strict'; -type HermesStackLocationNative = $ReadOnly<{ +type HermesStackLocationNative = Readonly<{ type: 'NATIVE', }>; -type HermesStackLocationSource = $ReadOnly<{ +type HermesStackLocationSource = Readonly<{ type: 'SOURCE', sourceUrl: string, line1Based: number, column1Based: number, }>; -type HermesStackLocationInternalBytecode = $ReadOnly<{ +type HermesStackLocationInternalBytecode = Readonly<{ type: 'INTERNAL_BYTECODE', sourceUrl: string, line1Based: number, virtualOffset0Based: number, }>; -type HermesStackLocationBytecode = $ReadOnly<{ +type HermesStackLocationBytecode = Readonly<{ type: 'BYTECODE', sourceUrl: string, line1Based: number, @@ -41,20 +41,20 @@ type HermesStackLocation = | HermesStackLocationInternalBytecode | HermesStackLocationBytecode; -type HermesStackEntryFrame = $ReadOnly<{ +type HermesStackEntryFrame = Readonly<{ type: 'FRAME', location: HermesStackLocation, functionName: string, }>; -type HermesStackEntrySkipped = $ReadOnly<{ +type HermesStackEntrySkipped = Readonly<{ type: 'SKIPPED', count: number, }>; type HermesStackEntry = HermesStackEntryFrame | HermesStackEntrySkipped; -export type HermesParsedStack = $ReadOnly<{ +export type HermesParsedStack = Readonly<{ message: string, entries: $ReadOnlyArray, }>; diff --git a/packages/react-native/Libraries/Core/Devtools/symbolicateStackTrace.js b/packages/react-native/Libraries/Core/Devtools/symbolicateStackTrace.js index 52fa4fe2256..0ec71a33b7b 100644 --- a/packages/react-native/Libraries/Core/Devtools/symbolicateStackTrace.js +++ b/packages/react-native/Libraries/Core/Devtools/symbolicateStackTrace.js @@ -14,7 +14,7 @@ import type {StackFrame} from '../NativeExceptionsManager'; const getDevServer = require('./getDevServer').default; -export type CodeFrame = $ReadOnly<{ +export type CodeFrame = Readonly<{ content: string, location: ?{ row: number, @@ -24,7 +24,7 @@ export type CodeFrame = $ReadOnly<{ fileName: string, }>; -export type SymbolicatedStackTrace = $ReadOnly<{ +export type SymbolicatedStackTrace = Readonly<{ stack: Array, codeFrame: ?CodeFrame, }>; diff --git a/packages/react-native/Libraries/Core/RawEventEmitter.js b/packages/react-native/Libraries/Core/RawEventEmitter.js index eb71bffb019..fd7d726a114 100644 --- a/packages/react-native/Libraries/Core/RawEventEmitter.js +++ b/packages/react-native/Libraries/Core/RawEventEmitter.js @@ -12,7 +12,7 @@ import type {IEventEmitter} from '../vendor/emitter/EventEmitter'; import EventEmitter from '../vendor/emitter/EventEmitter'; -export type RawEventEmitterEvent = $ReadOnly<{ +export type RawEventEmitterEvent = Readonly<{ eventName: string, // We expect, but do not/cannot require, that nativeEvent is an object // with the properties: key, elementType (string), type (string), tag (numeric), diff --git a/packages/react-native/Libraries/Core/setUpSegmentFetcher.js b/packages/react-native/Libraries/Core/setUpSegmentFetcher.js index 54d9e37a6a0..f56430ac5a0 100644 --- a/packages/react-native/Libraries/Core/setUpSegmentFetcher.js +++ b/packages/react-native/Libraries/Core/setUpSegmentFetcher.js @@ -19,7 +19,7 @@ export type FetchSegmentFunction = typeof __fetchSegment; function __fetchSegment( segmentId: number, - options: $ReadOnly<{ + options: Readonly<{ otaBuildNumber: ?string, requestedModuleName: string, segmentHash: string, diff --git a/packages/react-native/Libraries/EventEmitter/NativeEventEmitter.js b/packages/react-native/Libraries/EventEmitter/NativeEventEmitter.js index ff353ed6031..5a996da4f31 100644 --- a/packages/react-native/Libraries/EventEmitter/NativeEventEmitter.js +++ b/packages/react-native/Libraries/EventEmitter/NativeEventEmitter.js @@ -45,9 +45,9 @@ type UnsafeNativeEventObject = Object; * can theoretically listen to `RCTDeviceEventEmitter` (although discouraged). */ export default class NativeEventEmitter< - TEventToArgsMap: $ReadOnly< + TEventToArgsMap: Readonly< Record>, - > = $ReadOnly>>, + > = Readonly>>, > implements IEventEmitter { _nativeModule: ?NativeModule; diff --git a/packages/react-native/Libraries/EventEmitter/__mocks__/NativeEventEmitter.js b/packages/react-native/Libraries/EventEmitter/__mocks__/NativeEventEmitter.js index 36d44553775..9bfe9ee44e7 100644 --- a/packages/react-native/Libraries/EventEmitter/__mocks__/NativeEventEmitter.js +++ b/packages/react-native/Libraries/EventEmitter/__mocks__/NativeEventEmitter.js @@ -19,7 +19,7 @@ import RCTDeviceEventEmitter from '../RCTDeviceEventEmitter'; * Mock `NativeEventEmitter` to ignore Native Modules. */ export default class NativeEventEmitter< - TEventToArgsMap: $ReadOnly>>, + TEventToArgsMap: Readonly>>, > implements IEventEmitter { addListener>( diff --git a/packages/react-native/Libraries/Image/AssetSourceResolver.js b/packages/react-native/Libraries/Image/AssetSourceResolver.js index 29950f1535e..cb665428333 100644 --- a/packages/react-native/Libraries/Image/AssetSourceResolver.js +++ b/packages/react-native/Libraries/Image/AssetSourceResolver.js @@ -22,7 +22,7 @@ export type ResolvedAssetSource = { type AssetDestPathResolver = 'android' | 'generic'; // From @react-native/assets-registry -type PackagerAsset = $ReadOnly<{ +type PackagerAsset = Readonly<{ __packager_asset: boolean, fileSystemLocation: string, httpServerLocation: string, diff --git a/packages/react-native/Libraries/Image/ImageProps.js b/packages/react-native/Libraries/Image/ImageProps.js index 697084e3f11..2acab590b8d 100644 --- a/packages/react-native/Libraries/Image/ImageProps.js +++ b/packages/react-native/Libraries/Image/ImageProps.js @@ -38,7 +38,7 @@ type ImageProgressEventDataIOS = { * @see ImagePropsIOS.onProgress */ export type ImageProgressEventIOS = NativeSyntheticEvent< - $ReadOnly, + Readonly, >; type ImageErrorEventData = { @@ -46,7 +46,7 @@ type ImageErrorEventData = { }; export type ImageErrorEvent = NativeSyntheticEvent< - $ReadOnly, + Readonly, >; type ImageLoadEventData = { @@ -57,11 +57,9 @@ type ImageLoadEventData = { }, }; -export type ImageLoadEvent = NativeSyntheticEvent< - $ReadOnly, ->; +export type ImageLoadEvent = NativeSyntheticEvent>; -export type ImagePropsIOS = $ReadOnly<{ +export type ImagePropsIOS = Readonly<{ /** * A static image to display while loading the image source. * @@ -82,13 +80,13 @@ export type ImagePropsIOS = $ReadOnly<{ onProgress?: ?(event: ImageProgressEventIOS) => void, }>; -export type ImagePropsAndroid = $ReadOnly<{ +export type ImagePropsAndroid = Readonly<{ /** * similarly to `source`, this property represents the resource used to render * the loading indicator for the image, displayed until image is ready to be * displayed, typically after when it got downloaded from network. */ - loadingIndicatorSource?: ?(number | $ReadOnly), + loadingIndicatorSource?: ?(number | Readonly), progressiveRenderingEnabled?: ?boolean, fadeDuration?: ?number, @@ -127,7 +125,7 @@ export type ImagePropsAndroid = $ReadOnly<{ resizeMultiplier?: ?number, }>; -export type ImagePropsBase = $ReadOnly<{ +export type ImagePropsBase = Readonly<{ ...Omit, /** * When true, indicates the image is an accessibility element. @@ -333,7 +331,7 @@ export type ImagePropsBase = $ReadOnly<{ children?: empty, }>; -export type ImageProps = $ReadOnly<{ +export type ImageProps = Readonly<{ ...ImagePropsIOS, ...ImagePropsAndroid, ...ImagePropsBase, @@ -344,7 +342,7 @@ export type ImageProps = $ReadOnly<{ style?: ?ImageStyleProp, }>; -export type ImageBackgroundProps = $ReadOnly<{ +export type ImageBackgroundProps = Readonly<{ ...ImageProps, children?: React.Node, diff --git a/packages/react-native/Libraries/Image/ImageSource.js b/packages/react-native/Libraries/Image/ImageSource.js index 4418051ee76..12df755a0dc 100644 --- a/packages/react-native/Libraries/Image/ImageSource.js +++ b/packages/react-native/Libraries/Image/ImageSource.js @@ -104,7 +104,7 @@ type ImageSourceProperties = { export function getImageSourceProperties( imageSource: ImageURISource, -): $ReadOnly { +): Readonly { const object: ImageSourceProperties = {}; if (imageSource.body != null) { object.body = imageSource.body; diff --git a/packages/react-native/Libraries/Image/ImageTypes.flow.js b/packages/react-native/Libraries/Image/ImageTypes.flow.js index 265f4a9baf9..6058d6367bd 100644 --- a/packages/react-native/Libraries/Image/ImageTypes.flow.js +++ b/packages/react-native/Libraries/Image/ImageTypes.flow.js @@ -23,7 +23,7 @@ export type ImageSize = { export type ImageResolvedAssetSource = ResolvedAssetSource; -type ImageComponentStaticsIOS = $ReadOnly<{ +type ImageComponentStaticsIOS = Readonly<{ getSize(uri: string): Promise, getSize( uri: string, @@ -60,7 +60,7 @@ type ImageComponentStaticsIOS = $ReadOnly<{ resolveAssetSource(source: ImageSource): ?ImageResolvedAssetSource, }>; -type ImageComponentStaticsAndroid = $ReadOnly<{ +type ImageComponentStaticsAndroid = Readonly<{ ...ImageComponentStaticsIOS, abortPrefetch(requestId: number): void, }>; diff --git a/packages/react-native/Libraries/Image/ImageViewNativeComponent.js b/packages/react-native/Libraries/Image/ImageViewNativeComponent.js index 6ad7da9a8db..f5236d2101c 100644 --- a/packages/react-native/Libraries/Image/ImageViewNativeComponent.js +++ b/packages/react-native/Libraries/Image/ImageViewNativeComponent.js @@ -26,7 +26,7 @@ import {ConditionallyIgnoredEventHandlers} from '../NativeComponent/ViewConfigIg import codegenNativeCommands from '../Utilities/codegenNativeCommands'; import Platform from '../Utilities/Platform'; -type ImageHostComponentProps = $ReadOnly<{ +type ImageHostComponentProps = Readonly<{ ...ImageProps, ...ViewProps, @@ -37,9 +37,7 @@ type ImageHostComponentProps = $ReadOnly<{ // Android native props shouldNotifyLoadEvents?: boolean, - src?: - | ?ResolvedAssetSource - | ?$ReadOnlyArray>, + src?: ?ResolvedAssetSource | ?$ReadOnlyArray>, headers?: ?{[string]: string}, defaultSource?: ?ImageSource | ?string, loadingIndicatorSrc?: ?string, diff --git a/packages/react-native/Libraries/Image/TextInlineImageNativeComponent.js b/packages/react-native/Libraries/Image/TextInlineImageNativeComponent.js index 3bcdb390522..9f4f62beb0b 100644 --- a/packages/react-native/Libraries/Image/TextInlineImageNativeComponent.js +++ b/packages/react-native/Libraries/Image/TextInlineImageNativeComponent.js @@ -18,10 +18,10 @@ import type {ImageResizeMode} from './ImageResizeMode'; import * as NativeComponentRegistry from '../NativeComponent/NativeComponentRegistry'; -type RCTTextInlineImageNativeProps = $ReadOnly<{ +type RCTTextInlineImageNativeProps = Readonly<{ ...ViewProps, resizeMode?: ?ImageResizeMode, - src?: ?$ReadOnlyArray>, + src?: ?$ReadOnlyArray>, tintColor?: ?ColorValue, headers?: ?{[string]: string}, }>; diff --git a/packages/react-native/Libraries/Image/nativeImageSource.js b/packages/react-native/Libraries/Image/nativeImageSource.js index 04835eea300..a7bf9396e05 100644 --- a/packages/react-native/Libraries/Image/nativeImageSource.js +++ b/packages/react-native/Libraries/Image/nativeImageSource.js @@ -12,7 +12,7 @@ import type {ImageURISource} from './ImageSource'; import Platform from '../Utilities/Platform'; -type NativeImageSourceSpec = $ReadOnly<{ +type NativeImageSourceSpec = Readonly<{ android?: string, ios?: string, default?: string, diff --git a/packages/react-native/Libraries/Interaction/PanResponder.js b/packages/react-native/Libraries/Interaction/PanResponder.js index 49f604598cb..dc6ea6f46da 100644 --- a/packages/react-native/Libraries/Interaction/PanResponder.js +++ b/packages/react-native/Libraries/Interaction/PanResponder.js @@ -204,7 +204,7 @@ export type GestureResponderHandlerMethods = { onStartShouldSetResponderCapture: (event: GestureResponderEvent) => boolean, }; -export type PanResponderCallbacks = $ReadOnly<{ +export type PanResponderCallbacks = Readonly<{ onMoveShouldSetPanResponder?: ?ActiveCallback, onMoveShouldSetPanResponderCapture?: ?ActiveCallback, onStartShouldSetPanResponder?: ?ActiveCallback, diff --git a/packages/react-native/Libraries/LayoutAnimation/LayoutAnimation.js b/packages/react-native/Libraries/LayoutAnimation/LayoutAnimation.js index 3b79cf4f2b0..28fc16055df 100644 --- a/packages/react-native/Libraries/LayoutAnimation/LayoutAnimation.js +++ b/packages/react-native/Libraries/LayoutAnimation/LayoutAnimation.js @@ -31,11 +31,11 @@ export type { // Reexport type export type {LayoutAnimationConfig} from '../Renderer/shims/ReactNativeTypes'; -export type LayoutAnimationTypes = $ReadOnly<{ +export type LayoutAnimationTypes = Readonly<{ [type in LayoutAnimationType]: type, }>; -export type LayoutAnimationProperties = $ReadOnly<{ +export type LayoutAnimationProperties = Readonly<{ [prop in LayoutAnimationProperty]: prop, }>; diff --git a/packages/react-native/Libraries/Lists/FlatList.js b/packages/react-native/Libraries/Lists/FlatList.js index 2f2851bf67c..44257b7c91b 100644 --- a/packages/react-native/Libraries/Lists/FlatList.js +++ b/packages/react-native/Libraries/Lists/FlatList.js @@ -38,7 +38,7 @@ type RequiredFlatListProps = { * An array (or array-like list) of items to render. Other data types can be * used by targeting VirtualizedList directly. */ - data: ?$ReadOnly<$ArrayLike>, + data: ?Readonly<$ArrayLike>, }; type OptionalFlatListProps = { /** @@ -93,7 +93,7 @@ type OptionalFlatListProps = { * specify `ItemSeparatorComponent`. */ getItemLayout?: ( - data: ?$ReadOnly<$ArrayLike>, + data: ?Readonly<$ArrayLike>, index: number, ) => { length: number, diff --git a/packages/react-native/Libraries/Lists/SectionListModern.js b/packages/react-native/Libraries/Lists/SectionListModern.js index 2d89633c868..01de31a98f5 100644 --- a/packages/react-native/Libraries/Lists/SectionListModern.js +++ b/packages/react-native/Libraries/Lists/SectionListModern.js @@ -101,7 +101,7 @@ type OptionalProps = { removeClippedSubviews?: boolean, }; -export type Props = $ReadOnly<{ +export type Props = Readonly<{ ...Omit< VirtualizedSectionListProps, 'getItem' | 'getItemCount' | 'renderItem' | 'keyExtractor', diff --git a/packages/react-native/Libraries/Lists/__tests__/FlatList-itest.js b/packages/react-native/Libraries/Lists/__tests__/FlatList-itest.js index a730c73faa3..9a54004221f 100644 --- a/packages/react-native/Libraries/Lists/__tests__/FlatList-itest.js +++ b/packages/react-native/Libraries/Lists/__tests__/FlatList-itest.js @@ -20,7 +20,7 @@ function testPropPropagatedToMountingLayer({ value, defaultValue, renderChildrenForValue, -}: $ReadOnly<{ +}: Readonly<{ propName: string, value: TValue, defaultValue: TValue, @@ -29,7 +29,7 @@ function testPropPropagatedToMountingLayer({ describe(propName, () => { it('is propagated to the mounting layer', () => { const root = Fantom.createRoot(); - const props: FlatListProps<$ReadOnly<{}>> = { + const props: FlatListProps> = { // $FlowFixMe[incompatible-type] [propName]: value, }; @@ -53,7 +53,7 @@ function testPropPropagatedToMountingLayer({ it(`default value is ${JSON.stringify(defaultValue) ?? 'null'}`, () => { const root = Fantom.createRoot(); - const props: FlatListProps<$ReadOnly<{}>> = { + const props: FlatListProps> = { // $FlowFixMe[incompatible-type] [propName]: defaultValue, }; diff --git a/packages/react-native/Libraries/Lists/__tests__/FlatList-test.js b/packages/react-native/Libraries/Lists/__tests__/FlatList-test.js index 157e2fa3d17..065d6ddf038 100644 --- a/packages/react-native/Libraries/Lists/__tests__/FlatList-test.js +++ b/packages/react-native/Libraries/Lists/__tests__/FlatList-test.js @@ -36,7 +36,7 @@ describe('FlatList', () => { expect(component).toMatchSnapshot(); }); it('renders simple list using ListItemComponent', async () => { - function ListItemComponent({item}: $ReadOnly<{item: {key: string}}>) { + function ListItemComponent({item}: Readonly<{item: {key: string}}>) { return ; } const component = await create( @@ -48,7 +48,7 @@ describe('FlatList', () => { expect(component).toMatchSnapshot(); }); it('renders simple list using ListItemComponent (multiple columns)', async () => { - function ListItemComponent({item}: $ReadOnly<{item: {key: string}}>) { + function ListItemComponent({item}: Readonly<{item: {key: string}}>) { return ; } const component = await create( @@ -137,7 +137,7 @@ describe('FlatList', () => { jest.resetModules(); jest.unmock('../../Components/ScrollView/ScrollView'); - function ListItemComponent({item}: $ReadOnly<{item: {key: string}}>) { + function ListItemComponent({item}: Readonly<{item: {key: string}}>) { return ; } const listRef = createRef>(); diff --git a/packages/react-native/Libraries/Lists/__tests__/SectionList-test.js b/packages/react-native/Libraries/Lists/__tests__/SectionList-test.js index 4aa7fc48a3e..fb4bdb3f7d8 100644 --- a/packages/react-native/Libraries/Lists/__tests__/SectionList-test.js +++ b/packages/react-native/Libraries/Lists/__tests__/SectionList-test.js @@ -99,7 +99,7 @@ describe('SectionList', () => { }); }); -function propStr(props: $ReadOnly<{[string]: $FlowFixMe}>) { +function propStr(props: Readonly<{[string]: $FlowFixMe}>) { return Object.keys(props) .map(k => { const propObj = props[k] || {}; diff --git a/packages/react-native/Libraries/LogBox/Data/LogBoxData.js b/packages/react-native/Libraries/LogBox/Data/LogBoxData.js index 639e97af40d..a874864a746 100644 --- a/packages/react-native/Libraries/LogBox/Data/LogBoxData.js +++ b/packages/react-native/Libraries/LogBox/Data/LogBoxData.js @@ -26,7 +26,7 @@ import {parseLogBoxException} from './parseLogBoxLog'; import * as React from 'react'; export type LogBoxLogs = Set; -export type LogData = $ReadOnly<{ +export type LogData = Readonly<{ level: LogLevel, message: Message, category: Category, @@ -36,7 +36,7 @@ export type LogData = $ReadOnly<{ }>; export type Observer = ( - $ReadOnly<{ + Readonly<{ logs: LogBoxLogs, isDisabled: boolean, selectedLogIndex: number, @@ -45,7 +45,7 @@ export type Observer = ( export type IgnorePattern = string | RegExp; -export type Subscription = $ReadOnly<{ +export type Subscription = Readonly<{ unsubscribe: () => void, }>; @@ -61,7 +61,7 @@ export type WarningInfo = { export type WarningFilter = (format: string) => WarningInfo; -type AppInfo = $ReadOnly<{ +type AppInfo = Readonly<{ appVersion: string, engine: string, onPress?: ?() => void, @@ -427,8 +427,8 @@ function observeNext(observer: Observer): Subscription { }; } -type LogBoxStateSubscriptionProps = $ReadOnly<{}>; -type LogBoxStateSubscriptionState = $ReadOnly<{ +type LogBoxStateSubscriptionProps = Readonly<{}>; +type LogBoxStateSubscriptionState = Readonly<{ logs: LogBoxLogs, isDisabled: boolean, hasError: boolean, @@ -436,7 +436,7 @@ type LogBoxStateSubscriptionState = $ReadOnly<{ }>; type SubscribedComponent = React.ComponentType< - $ReadOnly<{ + Readonly<{ logs: $ReadOnlyArray, isDisabled: boolean, selectedLogIndex: number, diff --git a/packages/react-native/Libraries/LogBox/Data/LogBoxLog.js b/packages/react-native/Libraries/LogBox/Data/LogBoxLog.js index 81390e059d9..e68004677fe 100644 --- a/packages/react-native/Libraries/LogBox/Data/LogBoxLog.js +++ b/packages/react-native/Libraries/LogBox/Data/LogBoxLog.js @@ -55,7 +55,7 @@ function convertStackToComponentStack(stack: Stack): ComponentStack { return componentStack; } -export type LogBoxLogData = $ReadOnly<{ +export type LogBoxLogData = Readonly<{ level: LogLevel, type?: ?string, message: Message, @@ -83,23 +83,23 @@ class LogBoxLog { isComponentError: boolean; extraData: unknown | void; symbolicated: - | $ReadOnly<{error: null, stack: null, status: 'NONE'}> - | $ReadOnly<{error: null, stack: null, status: 'PENDING'}> - | $ReadOnly<{error: null, stack: Stack, status: 'COMPLETE'}> - | $ReadOnly<{error: Error, stack: null, status: 'FAILED'}> = { + | Readonly<{error: null, stack: null, status: 'NONE'}> + | Readonly<{error: null, stack: null, status: 'PENDING'}> + | Readonly<{error: null, stack: Stack, status: 'COMPLETE'}> + | Readonly<{error: Error, stack: null, status: 'FAILED'}> = { error: null, stack: null, status: 'NONE', }; symbolicatedComponentStack: - | $ReadOnly<{error: null, componentStack: null, status: 'NONE'}> - | $ReadOnly<{error: null, componentStack: null, status: 'PENDING'}> - | $ReadOnly<{ + | Readonly<{error: null, componentStack: null, status: 'NONE'}> + | Readonly<{error: null, componentStack: null, status: 'PENDING'}> + | Readonly<{ error: null, componentStack: ComponentStack, status: 'COMPLETE', }> - | $ReadOnly<{error: Error, componentStack: null, status: 'FAILED'}> = { + | Readonly<{error: Error, componentStack: null, status: 'FAILED'}> = { error: null, componentStack: null, status: 'NONE', diff --git a/packages/react-native/Libraries/LogBox/Data/__tests__/LogBoxLog-test.js b/packages/react-native/Libraries/LogBox/Data/__tests__/LogBoxLog-test.js index a3b265b0468..42a3a3a67ec 100644 --- a/packages/react-native/Libraries/LogBox/Data/__tests__/LogBoxLog-test.js +++ b/packages/react-native/Libraries/LogBox/Data/__tests__/LogBoxLog-test.js @@ -18,7 +18,7 @@ jest.mock('../LogBoxSymbolication', () => { return {__esModule: true, symbolicate: jest.fn(), deleteStack: jest.fn()}; }); -type CodeCodeFrame = $ReadOnly<{ +type CodeCodeFrame = Readonly<{ content: string, location: ?{ row: number, diff --git a/packages/react-native/Libraries/LogBox/Data/parseLogBoxLog.js b/packages/react-native/Libraries/LogBox/Data/parseLogBoxLog.js index cde538517b0..2d8e7f54627 100644 --- a/packages/react-native/Libraries/LogBox/Data/parseLogBoxLog.js +++ b/packages/react-native/Libraries/LogBox/Data/parseLogBoxLog.js @@ -107,7 +107,7 @@ export type ExtendedExceptionData = ExceptionData & { ... }; export type Category = string; -export type CodeFrame = $ReadOnly<{ +export type CodeFrame = Readonly<{ content: string, location: ?{ row: number, @@ -121,10 +121,10 @@ export type CodeFrame = $ReadOnly<{ // it is not integrated into the LogBox UI. collapse?: boolean, }>; -export type Message = $ReadOnly<{ +export type Message = Readonly<{ content: string, substitutions: $ReadOnlyArray< - $ReadOnly<{ + Readonly<{ length: number, offset: number, }>, @@ -136,7 +136,7 @@ export type ComponentStackType = 'legacy' | 'stack'; const SUBSTITUTION = UTFSequence.BOM + '%s'; -export function parseInterpolation(args: $ReadOnlyArray): $ReadOnly<{ +export function parseInterpolation(args: $ReadOnlyArray): Readonly<{ category: Category, message: Message, }> { diff --git a/packages/react-native/Libraries/LogBox/LogBoxInspectorContainer.js b/packages/react-native/Libraries/LogBox/LogBoxInspectorContainer.js index 3ccf93a68bd..0e496ec9536 100644 --- a/packages/react-native/Libraries/LogBox/LogBoxInspectorContainer.js +++ b/packages/react-native/Libraries/LogBox/LogBoxInspectorContainer.js @@ -16,7 +16,7 @@ import * as LogBoxData from './Data/LogBoxData'; import LogBoxInspector from './UI/LogBoxInspector'; import * as React from 'react'; -type Props = $ReadOnly<{ +type Props = Readonly<{ logs: $ReadOnlyArray, selectedLogIndex: number, isDisabled?: ?boolean, diff --git a/packages/react-native/Libraries/LogBox/LogBoxNotificationContainer.js b/packages/react-native/Libraries/LogBox/LogBoxNotificationContainer.js index a3fa687c4c6..3eaae63de9d 100644 --- a/packages/react-native/Libraries/LogBox/LogBoxNotificationContainer.js +++ b/packages/react-native/Libraries/LogBox/LogBoxNotificationContainer.js @@ -16,7 +16,7 @@ import LogBoxLog from './Data/LogBoxLog'; import LogBoxLogNotification from './UI/LogBoxNotification'; import * as React from 'react'; -type Props = $ReadOnly<{ +type Props = Readonly<{ logs: $ReadOnlyArray, selectedLogIndex: number, isDisabled?: ?boolean, diff --git a/packages/react-native/Libraries/LogBox/UI/LogBoxButton.js b/packages/react-native/Libraries/LogBox/UI/LogBoxButton.js index 8534d14ca4f..6e4da80afbf 100644 --- a/packages/react-native/Libraries/LogBox/UI/LogBoxButton.js +++ b/packages/react-native/Libraries/LogBox/UI/LogBoxButton.js @@ -19,9 +19,9 @@ import * as LogBoxStyle from './LogBoxStyle'; import * as React from 'react'; import {useState} from 'react'; -type Props = $ReadOnly<{ +type Props = Readonly<{ id?: string, - backgroundColor: $ReadOnly<{ + backgroundColor: Readonly<{ default: string, pressed: string, }>, diff --git a/packages/react-native/Libraries/LogBox/UI/LogBoxInspector.js b/packages/react-native/Libraries/LogBox/UI/LogBoxInspector.js index be889b06fd5..ac6a5816176 100644 --- a/packages/react-native/Libraries/LogBox/UI/LogBoxInspector.js +++ b/packages/react-native/Libraries/LogBox/UI/LogBoxInspector.js @@ -20,7 +20,7 @@ import * as LogBoxStyle from './LogBoxStyle'; import * as React from 'react'; import {useEffect} from 'react'; -type Props = $ReadOnly<{ +type Props = Readonly<{ onDismiss: () => void, onChangeSelectedIndex: (index: number) => void, onMinimize: () => void, diff --git a/packages/react-native/Libraries/LogBox/UI/LogBoxInspectorCodeFrame.js b/packages/react-native/Libraries/LogBox/UI/LogBoxInspectorCodeFrame.js index 0b4606cfd19..7703d4483e1 100644 --- a/packages/react-native/Libraries/LogBox/UI/LogBoxInspectorCodeFrame.js +++ b/packages/react-native/Libraries/LogBox/UI/LogBoxInspectorCodeFrame.js @@ -23,7 +23,7 @@ import LogBoxInspectorSection from './LogBoxInspectorSection'; import * as LogBoxStyle from './LogBoxStyle'; import * as React from 'react'; -type Props = $ReadOnly<{ +type Props = Readonly<{ componentCodeFrame: ?CodeFrame, codeFrame: ?CodeFrame, }>; diff --git a/packages/react-native/Libraries/LogBox/UI/LogBoxInspectorFooter.js b/packages/react-native/Libraries/LogBox/UI/LogBoxInspectorFooter.js index c3a7b692106..9f599c07e7d 100644 --- a/packages/react-native/Libraries/LogBox/UI/LogBoxInspectorFooter.js +++ b/packages/react-native/Libraries/LogBox/UI/LogBoxInspectorFooter.js @@ -17,7 +17,7 @@ import LogBoxInspectorFooterButton from './LogBoxInspectorFooterButton'; import * as LogBoxStyle from './LogBoxStyle'; import * as React from 'react'; -type Props = $ReadOnly<{ +type Props = Readonly<{ onDismiss: () => void, onMinimize: () => void, level?: ?LogLevel, diff --git a/packages/react-native/Libraries/LogBox/UI/LogBoxInspectorFooterButton.js b/packages/react-native/Libraries/LogBox/UI/LogBoxInspectorFooterButton.js index e75d7a23e83..c1ecc8fb6d5 100644 --- a/packages/react-native/Libraries/LogBox/UI/LogBoxInspectorFooterButton.js +++ b/packages/react-native/Libraries/LogBox/UI/LogBoxInspectorFooterButton.js @@ -16,7 +16,7 @@ import LogBoxButton from './LogBoxButton'; import * as LogBoxStyle from './LogBoxStyle'; import * as React from 'react'; -type ButtonProps = $ReadOnly<{ +type ButtonProps = Readonly<{ id: string, onPress: () => void, text: string, diff --git a/packages/react-native/Libraries/LogBox/UI/LogBoxInspectorHeader.js b/packages/react-native/Libraries/LogBox/UI/LogBoxInspectorHeader.js index c6aa7937e29..653a67a5a34 100644 --- a/packages/react-native/Libraries/LogBox/UI/LogBoxInspectorHeader.js +++ b/packages/react-native/Libraries/LogBox/UI/LogBoxInspectorHeader.js @@ -20,7 +20,7 @@ import LogBoxInspectorHeaderButton from './LogBoxInspectorHeaderButton'; import * as LogBoxStyle from './LogBoxStyle'; import * as React from 'react'; -type Props = $ReadOnly<{ +type Props = Readonly<{ onSelectIndex: (selectedIndex: number) => void, selectedIndex: number, total: number, diff --git a/packages/react-native/Libraries/LogBox/UI/LogBoxInspectorHeaderButton.js b/packages/react-native/Libraries/LogBox/UI/LogBoxInspectorHeaderButton.js index 75c801868c8..95db580e6af 100644 --- a/packages/react-native/Libraries/LogBox/UI/LogBoxInspectorHeaderButton.js +++ b/packages/react-native/Libraries/LogBox/UI/LogBoxInspectorHeaderButton.js @@ -38,7 +38,7 @@ const backgroundForLevel = (level: LogLevel) => })[level]; export default function LogBoxInspectorHeaderButton( - props: $ReadOnly<{ + props: Readonly<{ id: string, disabled: boolean, image: ImageSource, diff --git a/packages/react-native/Libraries/LogBox/UI/LogBoxInspectorMessageHeader.js b/packages/react-native/Libraries/LogBox/UI/LogBoxInspectorMessageHeader.js index 65259c1edba..fd50a1375b6 100644 --- a/packages/react-native/Libraries/LogBox/UI/LogBoxInspectorMessageHeader.js +++ b/packages/react-native/Libraries/LogBox/UI/LogBoxInspectorMessageHeader.js @@ -18,7 +18,7 @@ import LogBoxMessage from './LogBoxMessage'; import * as LogBoxStyle from './LogBoxStyle'; import * as React from 'react'; -type Props = $ReadOnly<{ +type Props = Readonly<{ collapsed: boolean, message: Message, level: LogLevel, diff --git a/packages/react-native/Libraries/LogBox/UI/LogBoxInspectorReactFrames.js b/packages/react-native/Libraries/LogBox/UI/LogBoxInspectorReactFrames.js index d9e0b1a59d5..5ab475c1256 100644 --- a/packages/react-native/Libraries/LogBox/UI/LogBoxInspectorReactFrames.js +++ b/packages/react-native/Libraries/LogBox/UI/LogBoxInspectorReactFrames.js @@ -21,7 +21,7 @@ import * as LogBoxStyle from './LogBoxStyle'; import * as React from 'react'; import {useState} from 'react'; -type Props = $ReadOnly<{ +type Props = Readonly<{ log: LogBoxLog, }>; diff --git a/packages/react-native/Libraries/LogBox/UI/LogBoxInspectorSection.js b/packages/react-native/Libraries/LogBox/UI/LogBoxInspectorSection.js index 2b3d7bcedd9..93db5d98790 100644 --- a/packages/react-native/Libraries/LogBox/UI/LogBoxInspectorSection.js +++ b/packages/react-native/Libraries/LogBox/UI/LogBoxInspectorSection.js @@ -14,7 +14,7 @@ import Text from '../../Text/Text'; import * as LogBoxStyle from './LogBoxStyle'; import * as React from 'react'; -type Props = $ReadOnly<{ +type Props = Readonly<{ heading: string, children: React.Node, action?: ?React.Node, diff --git a/packages/react-native/Libraries/LogBox/UI/LogBoxInspectorSourceMapStatus.js b/packages/react-native/Libraries/LogBox/UI/LogBoxInspectorSourceMapStatus.js index 9826f1c9471..96e93c500e2 100644 --- a/packages/react-native/Libraries/LogBox/UI/LogBoxInspectorSourceMapStatus.js +++ b/packages/react-native/Libraries/LogBox/UI/LogBoxInspectorSourceMapStatus.js @@ -19,7 +19,7 @@ import * as LogBoxStyle from './LogBoxStyle'; import * as React from 'react'; import {useEffect, useState} from 'react'; -type Props = $ReadOnly<{ +type Props = Readonly<{ onPress?: ?(event: GestureResponderEvent) => void, status: 'COMPLETE' | 'FAILED' | 'NONE' | 'PENDING', }>; diff --git a/packages/react-native/Libraries/LogBox/UI/LogBoxInspectorStackFrame.js b/packages/react-native/Libraries/LogBox/UI/LogBoxInspectorStackFrame.js index b3aa786f55c..afced59c029 100644 --- a/packages/react-native/Libraries/LogBox/UI/LogBoxInspectorStackFrame.js +++ b/packages/react-native/Libraries/LogBox/UI/LogBoxInspectorStackFrame.js @@ -19,7 +19,7 @@ import LogBoxButton from './LogBoxButton'; import * as LogBoxStyle from './LogBoxStyle'; import * as React from 'react'; -type Props = $ReadOnly<{ +type Props = Readonly<{ frame: StackFrame, onPress?: ?(event: GestureResponderEvent) => void, }>; diff --git a/packages/react-native/Libraries/LogBox/UI/LogBoxInspectorStackFrames.js b/packages/react-native/Libraries/LogBox/UI/LogBoxInspectorStackFrames.js index 48c1b849332..249658f2468 100644 --- a/packages/react-native/Libraries/LogBox/UI/LogBoxInspectorStackFrames.js +++ b/packages/react-native/Libraries/LogBox/UI/LogBoxInspectorStackFrames.js @@ -24,7 +24,7 @@ import * as LogBoxStyle from './LogBoxStyle'; import * as React from 'react'; import {useState} from 'react'; -type Props = $ReadOnly<{ +type Props = Readonly<{ log: LogBoxLog, onRetry: () => void, }>; @@ -139,7 +139,7 @@ function StackFrameList(props: { } function StackFrameFooter( - props: $ReadOnly<{message: string, onPress: () => void}>, + props: Readonly<{message: string, onPress: () => void}>, ) { return ( diff --git a/packages/react-native/Libraries/LogBox/UI/LogBoxNotification.js b/packages/react-native/Libraries/LogBox/UI/LogBoxNotification.js index c3149438e54..8d646c37052 100644 --- a/packages/react-native/Libraries/LogBox/UI/LogBoxNotification.js +++ b/packages/react-native/Libraries/LogBox/UI/LogBoxNotification.js @@ -20,7 +20,7 @@ import * as LogBoxStyle from './LogBoxStyle'; import * as React from 'react'; import {useEffect} from 'react'; -type Props = $ReadOnly<{ +type Props = Readonly<{ log: LogBoxLog, totalLogCount: number, level: 'warn' | 'error', diff --git a/packages/react-native/Libraries/Modal/Modal.js b/packages/react-native/Libraries/Modal/Modal.js index eb0e1a92541..6900fffe7bc 100644 --- a/packages/react-native/Libraries/Modal/Modal.js +++ b/packages/react-native/Libraries/Modal/Modal.js @@ -59,7 +59,7 @@ const ModalEventEmitter = // destroyed before the callback is fired. let uniqueModalIdentifier = 0; -type OrientationChangeEvent = $ReadOnly<{ +type OrientationChangeEvent = Readonly<{ orientation: 'portrait' | 'landscape', }>; @@ -383,7 +383,7 @@ const styles = StyleSheet.create({ }, }); -type ModalRefProps = $ReadOnly<{ +type ModalRefProps = Readonly<{ ref?: React.RefSetter, }>; diff --git a/packages/react-native/Libraries/Network/RCTNetworkingEventDefinitions.flow.js b/packages/react-native/Libraries/Network/RCTNetworkingEventDefinitions.flow.js index f2e621660b2..65f2012cd4b 100644 --- a/packages/react-native/Libraries/Network/RCTNetworkingEventDefinitions.flow.js +++ b/packages/react-native/Libraries/Network/RCTNetworkingEventDefinitions.flow.js @@ -10,7 +10,7 @@ 'use strict'; -export type RCTNetworkingEventDefinitions = $ReadOnly<{ +export type RCTNetworkingEventDefinitions = Readonly<{ didSendNetworkData: [ [ number, // requestId diff --git a/packages/react-native/Libraries/PermissionsAndroid/PermissionsAndroid.js b/packages/react-native/Libraries/PermissionsAndroid/PermissionsAndroid.js index 8fe33fb73e4..f59845e9e34 100644 --- a/packages/react-native/Libraries/PermissionsAndroid/PermissionsAndroid.js +++ b/packages/react-native/Libraries/PermissionsAndroid/PermissionsAndroid.js @@ -31,7 +31,7 @@ const PERMISSION_REQUEST_RESULT = Object.freeze({ NEVER_ASK_AGAIN: 'never_ask_again', }); -type PermissionsType = $ReadOnly<{ +type PermissionsType = Readonly<{ READ_CALENDAR: 'android.permission.READ_CALENDAR', WRITE_CALENDAR: 'android.permission.WRITE_CALENDAR', CAMERA: 'android.permission.CAMERA', @@ -134,7 +134,7 @@ const PERMISSIONS = Object.freeze({ */ class PermissionsAndroidImpl { PERMISSIONS: PermissionsType = PERMISSIONS; - RESULTS: $ReadOnly<{ + RESULTS: Readonly<{ DENIED: 'denied', GRANTED: 'granted', NEVER_ASK_AGAIN: 'never_ask_again', diff --git a/packages/react-native/Libraries/Pressability/Pressability.js b/packages/react-native/Libraries/Pressability/Pressability.js index 7c43691bde5..e2a06655eb7 100644 --- a/packages/react-native/Libraries/Pressability/Pressability.js +++ b/packages/react-native/Libraries/Pressability/Pressability.js @@ -27,7 +27,7 @@ import PressabilityPerformanceEventEmitter from './PressabilityPerformanceEventE import {type PressabilityTouchSignal as TouchSignal} from './PressabilityTypes.js'; import invariant from 'invariant'; -export type PressabilityConfig = $ReadOnly<{ +export type PressabilityConfig = Readonly<{ /** * Whether a press gesture can be interrupted by a parent gesture such as a * scroll event. Defaults to true. @@ -137,7 +137,7 @@ export type PressabilityConfig = $ReadOnly<{ blockNativeResponder?: ?boolean, }>; -export type EventHandlers = $ReadOnly<{ +export type EventHandlers = Readonly<{ onBlur: (event: BlurEvent) => void, onClick: (event: GestureResponderEvent) => void, onFocus: (event: FocusEvent) => void, @@ -378,13 +378,13 @@ export default class Pressability { _pressDelayTimeout: ?TimeoutID = null; _pressOutDelayTimeout: ?TimeoutID = null; _responderID: ?number | HostInstance = null; - _responderRegion: ?$ReadOnly<{ + _responderRegion: ?Readonly<{ bottom: number, left: number, right: number, top: number, }> = null; - _touchActivatePosition: ?$ReadOnly<{ + _touchActivatePosition: ?Readonly<{ pageX: number, pageY: number, }>; @@ -830,7 +830,7 @@ export default class Pressability { _isTouchWithinResponderRegion( touch: GestureResponderEvent['nativeEvent'], - responderRegion: $ReadOnly<{ + responderRegion: Readonly<{ bottom: number, left: number, right: number, diff --git a/packages/react-native/Libraries/Pressability/PressabilityDebug.js b/packages/react-native/Libraries/Pressability/PressabilityDebug.js index 87bf772d641..90b83e49e51 100644 --- a/packages/react-native/Libraries/Pressability/PressabilityDebug.js +++ b/packages/react-native/Libraries/Pressability/PressabilityDebug.js @@ -15,7 +15,7 @@ import normalizeColor from '../StyleSheet/normalizeColor'; import {type RectOrSize, normalizeRect} from '../StyleSheet/Rect'; import * as React from 'react'; -type Props = $ReadOnly<{ +type Props = Readonly<{ color: ColorValue, hitSlop: ?RectOrSize, }>; diff --git a/packages/react-native/Libraries/Pressability/PressabilityPerformanceEventEmitter.js b/packages/react-native/Libraries/Pressability/PressabilityPerformanceEventEmitter.js index 9270b01c53e..1d9070e9968 100644 --- a/packages/react-native/Libraries/Pressability/PressabilityPerformanceEventEmitter.js +++ b/packages/react-native/Libraries/Pressability/PressabilityPerformanceEventEmitter.js @@ -10,7 +10,7 @@ import {type PressabilityTouchSignal as TouchSignal} from './PressabilityTypes.js'; -export type PressabilityPerformanceEvent = $ReadOnly<{ +export type PressabilityPerformanceEvent = Readonly<{ signal: TouchSignal, nativeTimestamp: number, }>; diff --git a/packages/react-native/Libraries/Pressability/__tests__/Pressability-test.js b/packages/react-native/Libraries/Pressability/__tests__/Pressability-test.js index be84bbdac94..431429183d7 100644 --- a/packages/react-native/Libraries/Pressability/__tests__/Pressability-test.js +++ b/packages/react-native/Libraries/Pressability/__tests__/Pressability-test.js @@ -170,7 +170,7 @@ const createMockMouseEvent = (registrationName: string) => { const createMockPressEvent = ( nameOrOverrides: | string - | $ReadOnly<{ + | Readonly<{ registrationName: string, pageX: number, pageY: number, diff --git a/packages/react-native/Libraries/ReactNative/AppContainer.js b/packages/react-native/Libraries/ReactNative/AppContainer.js index 697be80873f..58bc7319e44 100644 --- a/packages/react-native/Libraries/ReactNative/AppContainer.js +++ b/packages/react-native/Libraries/ReactNative/AppContainer.js @@ -13,7 +13,7 @@ import type {RootTag} from './RootTag'; import * as React from 'react'; -export type Props = $ReadOnly<{ +export type Props = Readonly<{ children?: React.Node, fabric?: boolean, rootTag: number | RootTag, diff --git a/packages/react-native/Libraries/ReactNative/AppRegistry.flow.js b/packages/react-native/Libraries/ReactNative/AppRegistry.flow.js index 419424df2cd..a2db296f50b 100644 --- a/packages/react-native/Libraries/ReactNative/AppRegistry.flow.js +++ b/packages/react-native/Libraries/ReactNative/AppRegistry.flow.js @@ -29,7 +29,7 @@ export type AppConfig = { ... }; export type AppParameters = { - initialProps: $ReadOnly<{[string]: unknown, ...}>, + initialProps: Readonly<{[string]: unknown, ...}>, rootTag: RootTag, fabric?: boolean, }; diff --git a/packages/react-native/Libraries/StyleSheet/PointPropType.js b/packages/react-native/Libraries/StyleSheet/PointPropType.js index 2dd4a7158a5..1baba417fd5 100644 --- a/packages/react-native/Libraries/StyleSheet/PointPropType.js +++ b/packages/react-native/Libraries/StyleSheet/PointPropType.js @@ -10,7 +10,7 @@ 'use strict'; -export type PointProp = $ReadOnly<{ +export type PointProp = Readonly<{ x: number, y: number, ... diff --git a/packages/react-native/Libraries/StyleSheet/Rect.js b/packages/react-native/Libraries/StyleSheet/Rect.js index 6345337bd38..343a39e2938 100644 --- a/packages/react-native/Libraries/StyleSheet/Rect.js +++ b/packages/react-native/Libraries/StyleSheet/Rect.js @@ -8,7 +8,7 @@ * @format */ -export type Rect = $ReadOnly<{ +export type Rect = Readonly<{ bottom?: ?number, left?: ?number, right?: ?number, diff --git a/packages/react-native/Libraries/StyleSheet/StyleSheetExports.js b/packages/react-native/Libraries/StyleSheet/StyleSheetExports.js index a2df7a02b67..89942fe1227 100644 --- a/packages/react-native/Libraries/StyleSheet/StyleSheetExports.js +++ b/packages/react-native/Libraries/StyleSheet/StyleSheetExports.js @@ -188,7 +188,7 @@ export default { * An identity function for creating style sheets. */ // $FlowFixMe[unsupported-variance-annotation] - create<+S: ____Styles_Internal>(obj: S): $ReadOnly { + create<+S: ____Styles_Internal>(obj: S): Readonly { // TODO: This should return S as the return type. But first, // we need to codemod all the callsites that are typing this // return value as a number (even though it was opaque). diff --git a/packages/react-native/Libraries/StyleSheet/StyleSheetExports.js.flow b/packages/react-native/Libraries/StyleSheet/StyleSheetExports.js.flow index 031ca32d823..79bc7e261f5 100644 --- a/packages/react-native/Libraries/StyleSheet/StyleSheetExports.js.flow +++ b/packages/react-native/Libraries/StyleSheet/StyleSheetExports.js.flow @@ -13,7 +13,7 @@ import type {____Styles_Internal} from './StyleSheetTypes'; import composeStyles from '../../src/private/styles/composeStyles'; import flattenStyle from './flattenStyle'; -type AbsoluteFillStyle = $ReadOnly<{ +type AbsoluteFillStyle = Readonly<{ position: 'absolute', left: 0, right: 0, @@ -102,4 +102,4 @@ declare export const setStyleAttributePreprocessor: ( // $FlowFixMe[unsupported-variance-annotation] declare export const create: <+S: ____Styles_Internal>( obj: S & ____Styles_Internal, -) => $ReadOnly; +) => Readonly; diff --git a/packages/react-native/Libraries/StyleSheet/StyleSheetTypes.js b/packages/react-native/Libraries/StyleSheet/StyleSheetTypes.js index 0ba483758fb..6757e059f1e 100644 --- a/packages/react-native/Libraries/StyleSheet/StyleSheetTypes.js +++ b/packages/react-native/Libraries/StyleSheet/StyleSheetTypes.js @@ -55,7 +55,7 @@ export type CursorValue = 'auto' | 'pointer'; * These properties are a subset of our styles that are consumed by the layout * algorithm and affect the positioning and sizing of views. */ -type ____LayoutStyle_Internal = $ReadOnly<{ +type ____LayoutStyle_Internal = Readonly<{ /** `display` sets the display type of this component. * * It works similarly to `display` in CSS, but only support 'flex' and 'none'. @@ -675,7 +675,7 @@ type ____LayoutStyle_Internal = $ReadOnly<{ * To add a drop shadow to a view use the [`elevation` property](docs/viewstyleproptypes.html#elevation) (Android 5.0+). * To customize the color use the [`shadowColor` property](docs/shadow-props.html#shadowColor) (Android 9.0+). */ -export type ____ShadowStyle_InternalCore = $ReadOnly<{ +export type ____ShadowStyle_InternalCore = Readonly<{ /** * Sets the drop shadow color * @platform ios @@ -685,7 +685,7 @@ export type ____ShadowStyle_InternalCore = $ReadOnly<{ * Sets the drop shadow offset * @platform ios */ - shadowOffset?: $ReadOnly<{ + shadowOffset?: Readonly<{ width?: number, height?: number, }>, @@ -701,7 +701,7 @@ export type ____ShadowStyle_InternalCore = $ReadOnly<{ shadowRadius?: number, }>; -export type ____ShadowStyle_Internal = $ReadOnly<{ +export type ____ShadowStyle_Internal = Readonly<{ ...____ShadowStyle_InternalCore, ...____ShadowStyle_InternalOverrides, }>; @@ -843,7 +843,7 @@ type ____BlendMode_Internal = | 'color' | 'luminosity'; -export type ____ViewStyle_InternalBase = $ReadOnly<{ +export type ____ViewStyle_InternalBase = Readonly<{ backfaceVisibility?: 'visible' | 'hidden', backgroundColor?: ____ColorValue_Internal, borderColor?: ____ColorValue_Internal, @@ -900,14 +900,14 @@ export type ____ViewStyle_InternalBase = $ReadOnly<{ isolation?: 'auto' | 'isolate', }>; -export type ____ViewStyle_InternalCore = $ReadOnly<{ +export type ____ViewStyle_InternalCore = Readonly<{ ...$Exact<____LayoutStyle_Internal>, ...$Exact<____ShadowStyle_Internal>, ...$Exact<____TransformStyle_Internal>, ...____ViewStyle_InternalBase, }>; -export type ____ViewStyle_Internal = $ReadOnly<{ +export type ____ViewStyle_Internal = Readonly<{ ...____ViewStyle_InternalCore, ...____ViewStyle_InternalOverrides, }>; @@ -999,14 +999,14 @@ export type ____FontVariant_Internal = export type ____FontVariantArray_Internal = $ReadOnlyArray<____FontVariant_Internal>; -type ____TextStyle_InternalBase = $ReadOnly<{ +type ____TextStyle_InternalBase = Readonly<{ color?: ____ColorValue_Internal, fontFamily?: string, fontSize?: number, fontStyle?: 'normal' | 'italic', fontWeight?: ____FontWeight_Internal, fontVariant?: ____FontVariantArray_Internal | string, - textShadowOffset?: $ReadOnly<{ + textShadowOffset?: Readonly<{ width: number, height: number, }>, @@ -1030,17 +1030,17 @@ type ____TextStyle_InternalBase = $ReadOnly<{ writingDirection?: 'auto' | 'ltr' | 'rtl', }>; -export type ____TextStyle_InternalCore = $ReadOnly<{ +export type ____TextStyle_InternalCore = Readonly<{ ...$Exact<____ViewStyle_Internal>, ...____TextStyle_InternalBase, }>; -export type ____TextStyle_Internal = $ReadOnly<{ +export type ____TextStyle_Internal = Readonly<{ ...____TextStyle_InternalCore, ...____TextStyle_InternalOverrides, }>; -export type ____ImageStyle_InternalCore = $ReadOnly<{ +export type ____ImageStyle_InternalCore = Readonly<{ ...$Exact<____ViewStyle_Internal>, resizeMode?: ImageResizeMode, objectFit?: 'cover' | 'contain' | 'fill' | 'scale-down' | 'none', @@ -1049,12 +1049,12 @@ export type ____ImageStyle_InternalCore = $ReadOnly<{ overflow?: 'visible' | 'hidden', }>; -export type ____ImageStyle_Internal = $ReadOnly<{ +export type ____ImageStyle_Internal = Readonly<{ ...____ImageStyle_InternalCore, ...____ImageStyle_InternalOverrides, }>; -export type ____DangerouslyImpreciseStyle_InternalCore = $ReadOnly<{ +export type ____DangerouslyImpreciseStyle_InternalCore = Readonly<{ ...$Exact<____TextStyle_Internal>, resizeMode?: ImageResizeMode, objectFit?: 'cover' | 'contain' | 'fill' | 'scale-down' | 'none', @@ -1062,7 +1062,7 @@ export type ____DangerouslyImpreciseStyle_InternalCore = $ReadOnly<{ overlayColor?: ColorValue, }>; -export type ____DangerouslyImpreciseStyle_Internal = $ReadOnly<{ +export type ____DangerouslyImpreciseStyle_Internal = Readonly<{ ...____DangerouslyImpreciseStyle_InternalCore, ...____DangerouslyImpreciseStyle_InternalOverrides, ... @@ -1084,13 +1084,13 @@ export type ____DangerouslyImpreciseAnimatedStyleProp_Internal = WithAnimatedValue>>; export type ____ViewStyleProp_Internal = StyleProp< - $ReadOnly>, + Readonly>, >; export type ____TextStyleProp_Internal = StyleProp< - $ReadOnly>, + Readonly>, >; export type ____ImageStyleProp_Internal = StyleProp< - $ReadOnly>, + Readonly>, >; export type ____Styles_Internal = { diff --git a/packages/react-native/Libraries/StyleSheet/private/_StyleSheetTypesOverrides.js b/packages/react-native/Libraries/StyleSheet/private/_StyleSheetTypesOverrides.js index a5aab95e432..aa863ade48c 100644 --- a/packages/react-native/Libraries/StyleSheet/private/_StyleSheetTypesOverrides.js +++ b/packages/react-native/Libraries/StyleSheet/private/_StyleSheetTypesOverrides.js @@ -8,8 +8,8 @@ * @format */ -export type ____DangerouslyImpreciseStyle_InternalOverrides = $ReadOnly<{}>; -export type ____ImageStyle_InternalOverrides = $ReadOnly<{}>; -export type ____ShadowStyle_InternalOverrides = $ReadOnly<{}>; -export type ____TextStyle_InternalOverrides = $ReadOnly<{}>; -export type ____ViewStyle_InternalOverrides = $ReadOnly<{}>; +export type ____DangerouslyImpreciseStyle_InternalOverrides = Readonly<{}>; +export type ____ImageStyle_InternalOverrides = Readonly<{}>; +export type ____ShadowStyle_InternalOverrides = Readonly<{}>; +export type ____TextStyle_InternalOverrides = Readonly<{}>; +export type ____ViewStyle_InternalOverrides = Readonly<{}>; diff --git a/packages/react-native/Libraries/StyleSheet/private/_TransformStyle.js b/packages/react-native/Libraries/StyleSheet/private/_TransformStyle.js index ab847c68f6f..0152590ada7 100644 --- a/packages/react-native/Libraries/StyleSheet/private/_TransformStyle.js +++ b/packages/react-native/Libraries/StyleSheet/private/_TransformStyle.js @@ -29,7 +29,7 @@ type MaximumOneOf = $Values<{ }>, }>; -export type ____TransformStyle_Internal = $ReadOnly<{ +export type ____TransformStyle_Internal = Readonly<{ /** * `transform` accepts an array of transformation objects. Each object specifies * the property that will be transformed as the key, and the value to use in the @@ -48,7 +48,7 @@ export type ____TransformStyle_Internal = $ReadOnly<{ */ transform?: | $ReadOnlyArray< - $ReadOnly< + Readonly< MaximumOneOf< MergeUnion< | {+perspective: number | AnimatedNode} diff --git a/packages/react-native/Libraries/Text/Text.js b/packages/react-native/Libraries/Text/Text.js index a9e4036b2e3..df51994f241 100644 --- a/packages/react-native/Libraries/Text/Text.js +++ b/packages/react-native/Libraries/Text/Text.js @@ -667,7 +667,7 @@ const TextImpl: component( TextImpl.displayName = 'Text'; -type TextPressabilityProps = $ReadOnly<{ +type TextPressabilityProps = Readonly<{ onLongPress?: ?(event: GestureResponderEvent) => unknown, onPress?: ?(event: GestureResponderEvent) => unknown, onPressIn?: ?(event: GestureResponderEvent) => unknown, @@ -801,7 +801,7 @@ function useTextPressability({ ); } -type NativePressableTextProps = $ReadOnly<{ +type NativePressableTextProps = Readonly<{ textProps: NativeTextProps, textPressabilityProps: TextPressabilityProps, }>; diff --git a/packages/react-native/Libraries/Text/TextNativeComponent.js b/packages/react-native/Libraries/Text/TextNativeComponent.js index 5e0fc03c4cb..020d5ceea8b 100644 --- a/packages/react-native/Libraries/Text/TextNativeComponent.js +++ b/packages/react-native/Libraries/Text/TextNativeComponent.js @@ -17,7 +17,7 @@ import {createViewConfig} from '../NativeComponent/ViewConfig'; import UIManager from '../ReactNative/UIManager'; import createReactNativeComponentClass from '../Renderer/shims/createReactNativeComponentClass'; -export type NativeTextProps = $ReadOnly<{ +export type NativeTextProps = Readonly<{ ...TextProps, isHighlighted?: ?boolean, selectionColor?: ?ProcessedColorValue, diff --git a/packages/react-native/Libraries/Text/TextProps.js b/packages/react-native/Libraries/Text/TextProps.js index 4ca3c34e718..adbcb59d8ab 100644 --- a/packages/react-native/Libraries/Text/TextProps.js +++ b/packages/react-native/Libraries/Text/TextProps.js @@ -25,14 +25,14 @@ import type { import * as React from 'react'; -export type PressRetentionOffset = $ReadOnly<{ +export type PressRetentionOffset = Readonly<{ top: number, left: number, bottom: number, right: number, }>; -type TextPointerEventProps = $ReadOnly<{ +type TextPointerEventProps = Readonly<{ onPointerEnter?: (event: PointerEvent) => void, onPointerLeave?: (event: PointerEvent) => void, onPointerMove?: (event: PointerEvent) => void, @@ -121,7 +121,7 @@ export type TextPropsAndroid = { minimumFontScale?: ?number, }; -type TextBaseProps = $ReadOnly<{ +type TextBaseProps = Readonly<{ onAccessibilityAction?: ?(event: AccessibilityActionEvent) => unknown, /** @@ -268,7 +268,7 @@ type TextBaseProps = $ReadOnly<{ /** * @see https://reactnative.dev/docs/text#reference */ -export type TextProps = $ReadOnly<{ +export type TextProps = Readonly<{ ...TextPointerEventProps, ...TextPropsIOS, ...TextPropsAndroid, diff --git a/packages/react-native/Libraries/Types/CoreEventTypes.js b/packages/react-native/Libraries/Types/CoreEventTypes.js index 886d404494b..eb822951d45 100644 --- a/packages/react-native/Libraries/Types/CoreEventTypes.js +++ b/packages/react-native/Libraries/Types/CoreEventTypes.js @@ -10,12 +10,12 @@ import type {HostInstance} from '../../src/private/types/HostInstance'; -export type NativeSyntheticEvent<+T> = $ReadOnly<{ +export type NativeSyntheticEvent<+T> = Readonly<{ bubbles: ?boolean, cancelable: ?boolean, currentTarget: number | HostInstance, defaultPrevented: ?boolean, - dispatchConfig: $ReadOnly<{ + dispatchConfig: Readonly<{ registrationName: string, }>, eventPhase: ?number, @@ -31,14 +31,14 @@ export type NativeSyntheticEvent<+T> = $ReadOnly<{ type: ?string, }>; -export type ResponderSyntheticEvent = $ReadOnly<{ +export type ResponderSyntheticEvent = Readonly<{ ...NativeSyntheticEvent, - touchHistory: $ReadOnly<{ + touchHistory: Readonly<{ indexOfSingleActiveTouch: number, mostRecentTimeStamp: number, numberActiveTouches: number, touchBank: $ReadOnlyArray< - $ReadOnly<{ + Readonly<{ touchActive: boolean, startPageX: number, startPageY: number, @@ -54,14 +54,14 @@ export type ResponderSyntheticEvent = $ReadOnly<{ }>, }>; -export type LayoutRectangle = $ReadOnly<{ +export type LayoutRectangle = Readonly<{ x: number, y: number, width: number, height: number, }>; -export type TextLayoutLine = $ReadOnly<{ +export type TextLayoutLine = Readonly<{ ...LayoutRectangle, ascender: number, capHeight: number, @@ -71,12 +71,12 @@ export type TextLayoutLine = $ReadOnly<{ }>; export type LayoutChangeEvent = NativeSyntheticEvent< - $ReadOnly<{ + Readonly<{ layout: LayoutRectangle, }>, >; -type TextLayoutEventData = $ReadOnly<{ +type TextLayoutEventData = Readonly<{ lines: Array, }>; @@ -220,7 +220,7 @@ export interface NativePointerEvent extends NativeMouseEvent { export type PointerEvent = NativeSyntheticEvent; -export type NativeTouchEvent = $ReadOnly<{ +export type NativeTouchEvent = Readonly<{ /** * Array of all touch events that have changed since the last event */ @@ -266,29 +266,29 @@ export type NativeTouchEvent = $ReadOnly<{ export type GestureResponderEvent = ResponderSyntheticEvent; -export type NativeScrollRectangle = $ReadOnly<{ +export type NativeScrollRectangle = Readonly<{ bottom: number, left: number, right: number, top: number, }>; -export type NativeScrollPoint = $ReadOnly<{ +export type NativeScrollPoint = Readonly<{ y: number, x: number, }>; -export type NativeScrollVelocity = $ReadOnly<{ +export type NativeScrollVelocity = Readonly<{ y: number, x: number, }>; -export type NativeScrollSize = $ReadOnly<{ +export type NativeScrollSize = Readonly<{ height: number, width: number, }>; -export type NativeScrollEvent = $ReadOnly<{ +export type NativeScrollEvent = Readonly<{ contentInset: NativeScrollRectangle, contentOffset: NativeScrollPoint, contentSize: NativeScrollSize, @@ -304,7 +304,7 @@ export type NativeScrollEvent = $ReadOnly<{ export type ScrollEvent = NativeSyntheticEvent; -export type TargetedEvent = $ReadOnly<{ +export type TargetedEvent = Readonly<{ target: number, ... }>; @@ -314,7 +314,7 @@ export type BlurEvent = NativeSyntheticEvent; export type FocusEvent = NativeSyntheticEvent; export type MouseEvent = NativeSyntheticEvent< - $ReadOnly<{ + Readonly<{ clientX: number, clientY: number, pageX: number, @@ -323,7 +323,7 @@ export type MouseEvent = NativeSyntheticEvent< }>, >; -export type KeyEvent = $ReadOnly<{ +export type KeyEvent = Readonly<{ /** * The actual key that was pressed. For example, F would be "f" or "F" depending on the shift key. * @see https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key diff --git a/packages/react-native/Libraries/Utilities/Dimensions.js b/packages/react-native/Libraries/Utilities/Dimensions.js index 8ae066c54b5..d8d4b7d3391 100644 --- a/packages/react-native/Libraries/Utilities/Dimensions.js +++ b/packages/react-native/Libraries/Utilities/Dimensions.js @@ -60,7 +60,7 @@ class Dimensions { * * @param {DimensionsPayload} dims Simple string-keyed object of dimensions to set */ - static set(dims: $ReadOnly): void { + static set(dims: Readonly): void { // We calculate the window dimensions in JS so that we don't encounter loss of // precision in transferring the dimensions (which could be non-integers) over // the bridge. diff --git a/packages/react-native/Libraries/Utilities/IPerformanceLogger.js b/packages/react-native/Libraries/Utilities/IPerformanceLogger.js index 617e7138bec..19dac2ef702 100644 --- a/packages/react-native/Libraries/Utilities/IPerformanceLogger.js +++ b/packages/react-native/Libraries/Utilities/IPerformanceLogger.js @@ -34,10 +34,10 @@ export interface IPerformanceLogger { clearCompleted(): void; close(): void; currentTimestamp(): number; - getExtras(): $ReadOnly<{[key: string]: ?ExtraValue, ...}>; - getPoints(): $ReadOnly<{[key: string]: ?number, ...}>; - getPointExtras(): $ReadOnly<{[key: string]: ?Extras, ...}>; - getTimespans(): $ReadOnly<{[key: string]: ?Timespan, ...}>; + getExtras(): Readonly<{[key: string]: ?ExtraValue, ...}>; + getPoints(): Readonly<{[key: string]: ?number, ...}>; + getPointExtras(): Readonly<{[key: string]: ?Extras, ...}>; + getTimespans(): Readonly<{[key: string]: ?Timespan, ...}>; hasTimespan(key: string): boolean; isClosed(): boolean; logEverything(): void; diff --git a/packages/react-native/Libraries/Utilities/__tests__/useMergeRefs-test.js b/packages/react-native/Libraries/Utilities/__tests__/useMergeRefs-test.js index 3957027dff2..57d5ef05d85 100644 --- a/packages/react-native/Libraries/Utilities/__tests__/useMergeRefs-test.js +++ b/packages/react-native/Libraries/Utilities/__tests__/useMergeRefs-test.js @@ -37,7 +37,7 @@ class Screen { } function TestComponent( - props: $ReadOnly<{children: () => React.MixedElement}>, + props: Readonly<{children: () => React.MixedElement}>, ): React.Node { return props.children(); } diff --git a/packages/react-native/Libraries/Utilities/codegenNativeCommands.js b/packages/react-native/Libraries/Utilities/codegenNativeCommands.js index 67ae5f86542..17c271f1191 100644 --- a/packages/react-native/Libraries/Utilities/codegenNativeCommands.js +++ b/packages/react-native/Libraries/Utilities/codegenNativeCommands.js @@ -10,7 +10,7 @@ const {dispatchCommand} = require('../ReactNative/RendererProxy'); -type NativeCommandsOptions = $ReadOnly<{ +type NativeCommandsOptions = Readonly<{ supportedCommands: $ReadOnlyArray, }>; diff --git a/packages/react-native/Libraries/Utilities/codegenNativeComponent.js b/packages/react-native/Libraries/Utilities/codegenNativeComponent.js index 9cd3d2d2eda..3b6510a84c4 100644 --- a/packages/react-native/Libraries/Utilities/codegenNativeComponent.js +++ b/packages/react-native/Libraries/Utilities/codegenNativeComponent.js @@ -16,7 +16,7 @@ import requireNativeComponent from '../../Libraries/ReactNative/requireNativeCom import UIManager from '../ReactNative/UIManager'; // TODO: import from CodegenSchema once workspaces are enabled -type NativeComponentOptions = $ReadOnly<{ +type NativeComponentOptions = Readonly<{ interfaceOnly?: boolean, paperComponentName?: string, paperComponentNameDeprecated?: string, diff --git a/packages/react-native/Libraries/vendor/emitter/EventEmitter.js b/packages/react-native/Libraries/vendor/emitter/EventEmitter.js index 97f1713ca17..2ccfeb47b40 100644 --- a/packages/react-native/Libraries/vendor/emitter/EventEmitter.js +++ b/packages/react-native/Libraries/vendor/emitter/EventEmitter.js @@ -16,7 +16,7 @@ export interface EventSubscription { } export interface IEventEmitter< - TEventToArgsMap: $ReadOnly>>, + TEventToArgsMap: Readonly>>, > { addListener>( eventType: TEvent, @@ -41,7 +41,7 @@ interface Registration { } type Registry< - TEventToArgsMap: $ReadOnly>>, + TEventToArgsMap: Readonly>>, > = { [K in keyof TEventToArgsMap]: Set>, }; @@ -67,9 +67,9 @@ type Registry< * */ export default class EventEmitter< - TEventToArgsMap: $ReadOnly< + TEventToArgsMap: Readonly< Record>, - > = $ReadOnly>>, + > = Readonly>>, > implements IEventEmitter { #registry: Registry; @@ -157,7 +157,7 @@ export default class EventEmitter< } function allocate< - TEventToArgsMap: $ReadOnly>>, + TEventToArgsMap: Readonly>>, TEvent: $Keys, TEventArgs: TEventToArgsMap[TEvent], >( diff --git a/packages/react-native/flow/bom.js.flow b/packages/react-native/flow/bom.js.flow index ab3b11b9bd2..1c4d3c8b0ee 100644 --- a/packages/react-native/flow/bom.js.flow +++ b/packages/react-native/flow/bom.js.flow @@ -47,8 +47,8 @@ declare var console: { // Printing table( tabularData: - | $ReadOnly<{[key: string]: unknown, ...}> - | $ReadOnlyArray<$ReadOnly<{[key: string]: unknown, ...}>> + | Readonly<{[key: string]: unknown, ...}> + | $ReadOnlyArray> | $ReadOnlyArray<$ReadOnlyArray>, ): void, dir(...data: $ReadOnlyArray): void, diff --git a/packages/react-native/jest/mockComponent.js b/packages/react-native/jest/mockComponent.js index 30045abe899..856350d3dd7 100644 --- a/packages/react-native/jest/mockComponent.js +++ b/packages/react-native/jest/mockComponent.js @@ -11,7 +11,7 @@ import * as React from 'react'; import {createElement} from 'react'; -type Modulish = T | $ReadOnly<{default: T}>; +type Modulish = T | Readonly<{default: T}>; type ModuleDefault = T['default']; type TComponentType = React.ComponentType<{...}>; @@ -27,9 +27,8 @@ export default function mockComponent< moduleName: string, instanceMethods: ?interface {}, isESModule: TIsESModule, -): TIsESModule extends true - ? // $FlowFixMe[incompatible-use] - ModuleDefault +): TIsESModule extends true // $FlowFixMe[incompatible-use] + ? ModuleDefault : TComponentModule & typeof instanceMethods { const RealComponent: TComponentType = isESModule ? // $FlowFixMe[prop-missing] diff --git a/packages/react-native/scripts/featureflags/print.js b/packages/react-native/scripts/featureflags/print.js index e5b62459d4b..ff6cc5dd7ad 100644 --- a/packages/react-native/scripts/featureflags/print.js +++ b/packages/react-native/scripts/featureflags/print.js @@ -37,8 +37,8 @@ function getPurposeString(purpose: string): string { } function compareFeatureFlags( - [keyA, valueA]: $ReadOnly<[string, $ReadOnly<{Purpose: string, ...}>]>, - [keyB, valueB]: $ReadOnly<[string, $ReadOnly<{Purpose: string, ...}>]>, + [keyA, valueA]: Readonly<[string, Readonly<{Purpose: string, ...}>]>, + [keyB, valueB]: Readonly<[string, Readonly<{Purpose: string, ...}>]>, ): number { const purposeA = PURPOSE_ORDER.indexOf(valueA.Purpose); const purposeB = PURPOSE_ORDER.indexOf(valueB.Purpose); diff --git a/packages/react-native/scripts/featureflags/types.js b/packages/react-native/scripts/featureflags/types.js index 17370773b3e..54ce4fbb9dd 100644 --- a/packages/react-native/scripts/featureflags/types.js +++ b/packages/react-native/scripts/featureflags/types.js @@ -10,7 +10,7 @@ export type FeatureFlagValue = boolean | number | string; -export type FeatureFlagDefinitions = $ReadOnly<{ +export type FeatureFlagDefinitions = Readonly<{ common: CommonFeatureFlagList, jsOnly: JsOnlyFeatureFlagList, }>; @@ -30,7 +30,7 @@ export type OSSReleaseStageValue = export type CommonFeatureFlagConfig< TValue: FeatureFlagValue = FeatureFlagValue, -> = $ReadOnly<{ +> = Readonly<{ defaultValue: TValue, metadata: FeatureFlagMetadata, ossReleaseStage: OSSReleaseStageValue, @@ -39,24 +39,24 @@ export type CommonFeatureFlagConfig< skipNativeAPI?: true, }>; -export type CommonFeatureFlagList = $ReadOnly<{ +export type CommonFeatureFlagList = Readonly<{ [flagName: string]: CommonFeatureFlagConfig<>, }>; export type JsOnlyFeatureFlagConfig< TValue: FeatureFlagValue = FeatureFlagValue, -> = $ReadOnly<{ +> = Readonly<{ defaultValue: TValue, metadata: FeatureFlagMetadata, ossReleaseStage: OSSReleaseStageValue, }>; -export type JsOnlyFeatureFlagList = $ReadOnly<{ +export type JsOnlyFeatureFlagList = Readonly<{ [flagName: string]: JsOnlyFeatureFlagConfig<>, }>; export type FeatureFlagMetadata = - | $ReadOnly<{ + | Readonly<{ purpose: 'experimentation', /** * Approximate date when the flag was added. @@ -66,13 +66,13 @@ export type FeatureFlagMetadata = description: string, expectedReleaseValue: TValue, }> - | $ReadOnly<{ + | Readonly<{ purpose: 'operational' | 'release', description: string, expectedReleaseValue: TValue, }>; -export type GeneratorConfig = $ReadOnly<{ +export type GeneratorConfig = Readonly<{ featureFlagDefinitions: FeatureFlagDefinitions, jsPath: string, commonCxxPath: string, @@ -81,10 +81,10 @@ export type GeneratorConfig = $ReadOnly<{ androidJniPath: string, }>; -export type GeneratorOptions = $ReadOnly<{ +export type GeneratorOptions = Readonly<{ verifyUnchanged: boolean, }>; -export type GeneratorResult = $ReadOnly<{ +export type GeneratorResult = Readonly<{ [path: string]: string /* content */, }>; diff --git a/packages/react-native/src/private/animated/NativeAnimatedHelper.js b/packages/react-native/src/private/animated/NativeAnimatedHelper.js index a115addaa2f..071af9a83c6 100644 --- a/packages/react-native/src/private/animated/NativeAnimatedHelper.js +++ b/packages/react-native/src/private/animated/NativeAnimatedHelper.js @@ -406,7 +406,7 @@ function assertNativeAnimatedModule(): void { let _warnedMissingNativeAnimated = false; function shouldUseNativeDriver( - config: $ReadOnly<{...AnimationConfig, ...}> | EventConfig, + config: Readonly<{...AnimationConfig, ...}> | EventConfig, ): boolean { if (config.useNativeDriver == null) { console.warn( diff --git a/packages/react-native/src/private/animated/createAnimatedPropsMemoHook.js b/packages/react-native/src/private/animated/createAnimatedPropsMemoHook.js index 21062f744e8..504a78796cf 100644 --- a/packages/react-native/src/private/animated/createAnimatedPropsMemoHook.js +++ b/packages/react-native/src/private/animated/createAnimatedPropsMemoHook.js @@ -25,31 +25,31 @@ type CompositeKey = { | CompositeKeyComponent | AnimatedEvent | $ReadOnlyArray - | $ReadOnly<{[string]: unknown}>, + | Readonly<{[string]: unknown}>, }; type CompositeKeyComponent = | AnimatedNode | $ReadOnlyArray - | $ReadOnly<{[string]: CompositeKeyComponent}>; + | Readonly<{[string]: CompositeKeyComponent}>; -type $ReadOnlyCompositeKey = $ReadOnly<{ - style?: $ReadOnly<{[string]: CompositeKeyComponent}>, +type $ReadOnlyCompositeKey = Readonly<{ + style?: Readonly<{[string]: CompositeKeyComponent}>, [string]: | $ReadOnlyCompositeKeyComponent | AnimatedEvent | $ReadOnlyArray - | $ReadOnly<{[string]: unknown}>, + | Readonly<{[string]: unknown}>, }>; type $ReadOnlyCompositeKeyComponent = | AnimatedNode | $ReadOnlyArray<$ReadOnlyCompositeKeyComponent | null> - | $ReadOnly<{[string]: $ReadOnlyCompositeKeyComponent}>; + | Readonly<{[string]: $ReadOnlyCompositeKeyComponent}>; type AnimatedPropsMemoHook = ( () => AnimatedProps, - props: $ReadOnly<{[string]: unknown}>, + props: Readonly<{[string]: unknown}>, ) => AnimatedProps; /** @@ -62,14 +62,14 @@ export function createAnimatedPropsMemoHook( ): AnimatedPropsMemoHook { return function useAnimatedPropsMemo( create: () => AnimatedProps, - props: $ReadOnly<{[string]: unknown}>, + props: Readonly<{[string]: unknown}>, ): AnimatedProps { const compositeKey = useMemo( () => createCompositeKeyForProps(props, allowlist), [props], ); - const prevRef = useRef>(); @@ -107,7 +107,7 @@ export function createAnimatedPropsMemoHook( * returns null. */ export function createCompositeKeyForProps( - props: $ReadOnly<{[string]: unknown}>, + props: Readonly<{[string]: unknown}>, allowlist: ?AnimatedPropsAllowlist, ): $ReadOnlyCompositeKey | null { let compositeKey: CompositeKey | null = null; @@ -200,9 +200,9 @@ function createCompositeKeyForArray( * If `object` contains no `AnimatedNode` instances, this returns null. */ function createCompositeKeyForObject( - object: $ReadOnly<{[string]: unknown}>, + object: Readonly<{[string]: unknown}>, allowlist?: ?AnimatedStyleAllowlist, -): $ReadOnly<{[string]: $ReadOnlyCompositeKeyComponent}> | null { +): Readonly<{[string]: $ReadOnlyCompositeKeyComponent}> | null { let compositeKey: {[string]: $ReadOnlyCompositeKeyComponent} | null = null; const keys = Object.keys(object); @@ -355,6 +355,6 @@ function areCompositeKeyComponentsEqual( // this shim when they do. // $FlowFixMe[method-unbinding] const _hasOwnProp = Object.prototype.hasOwnProperty; -const hasOwn: (obj: $ReadOnly<{...}>, prop: string) => boolean = +const hasOwn: (obj: Readonly<{...}>, prop: string) => boolean = // $FlowFixMe[method-unbinding] Object.hasOwn ?? ((obj, prop) => _hasOwnProp.call(obj, prop)); diff --git a/packages/react-native/src/private/components/virtualview/VirtualView.js b/packages/react-native/src/private/components/virtualview/VirtualView.js index c57c9cdfc2b..245d2510a6f 100644 --- a/packages/react-native/src/private/components/virtualview/VirtualView.js +++ b/packages/react-native/src/private/components/virtualview/VirtualView.js @@ -37,14 +37,14 @@ export enum VirtualViewRenderState { None = 2, } -export type Rect = $ReadOnly<{ +export type Rect = Readonly<{ x: number, y: number, width: number, height: number, }>; -export type ModeChangeEvent = $ReadOnly<{ +export type ModeChangeEvent = Readonly<{ ...Omit, renderState: VirtualViewRenderState, mode: VirtualViewMode, diff --git a/packages/react-native/src/private/components/virtualview/VirtualViewExperimentalNativeComponent.js b/packages/react-native/src/private/components/virtualview/VirtualViewExperimentalNativeComponent.js index 81d54ad8d74..eaa20fd80c3 100644 --- a/packages/react-native/src/private/components/virtualview/VirtualViewExperimentalNativeComponent.js +++ b/packages/react-native/src/private/components/virtualview/VirtualViewExperimentalNativeComponent.js @@ -18,7 +18,7 @@ import type {HostComponent} from '../../types/HostComponent'; import codegenNativeComponent from '../../../../Libraries/Utilities/codegenNativeComponent'; -export type NativeModeChangeEvent = $ReadOnly<{ +export type NativeModeChangeEvent = Readonly<{ /** * Virtualization mode of the target view. * @@ -34,7 +34,7 @@ export type NativeModeChangeEvent = $ReadOnly<{ /** * Rect of the target view, relative to the nearest ancestor scroll container. */ - targetRect: $ReadOnly<{ + targetRect: Readonly<{ x: Double, y: Double, width: Double, @@ -51,7 +51,7 @@ export type NativeModeChangeEvent = $ReadOnly<{ * * This can be used to determine whether and how much new content to render. */ - thresholdRect: $ReadOnly<{ + thresholdRect: Readonly<{ x: Double, y: Double, width: Double, @@ -59,7 +59,7 @@ export type NativeModeChangeEvent = $ReadOnly<{ }>, }>; -type VirtualViewExperimentalNativeProps = $ReadOnly<{ +type VirtualViewExperimentalNativeProps = Readonly<{ ...ViewProps, /** diff --git a/packages/react-native/src/private/components/virtualview/VirtualViewNativeComponent.js b/packages/react-native/src/private/components/virtualview/VirtualViewNativeComponent.js index 951a000e51b..4ba5b68398e 100644 --- a/packages/react-native/src/private/components/virtualview/VirtualViewNativeComponent.js +++ b/packages/react-native/src/private/components/virtualview/VirtualViewNativeComponent.js @@ -18,7 +18,7 @@ import type {HostComponent} from '../../types/HostComponent'; import codegenNativeComponent from '../../../../Libraries/Utilities/codegenNativeComponent'; -export type NativeModeChangeEvent = $ReadOnly<{ +export type NativeModeChangeEvent = Readonly<{ /** * Virtualization mode of the target view. * @@ -34,7 +34,7 @@ export type NativeModeChangeEvent = $ReadOnly<{ /** * Rect of the target view, relative to the nearest ancestor scroll container. */ - targetRect: $ReadOnly<{ + targetRect: Readonly<{ x: Double, y: Double, width: Double, @@ -51,7 +51,7 @@ export type NativeModeChangeEvent = $ReadOnly<{ * * This can be used to determine whether and how much new content to render. */ - thresholdRect: $ReadOnly<{ + thresholdRect: Readonly<{ x: Double, y: Double, width: Double, @@ -59,7 +59,7 @@ export type NativeModeChangeEvent = $ReadOnly<{ }>, }>; -type VirtualViewNativeProps = $ReadOnly<{ +type VirtualViewNativeProps = Readonly<{ ...ViewProps, /** diff --git a/packages/react-native/src/private/components/virtualview/__tests__/VirtualView-itest.js b/packages/react-native/src/private/components/virtualview/__tests__/VirtualView-itest.js index 93792282b67..7871887d7c0 100644 --- a/packages/react-native/src/private/components/virtualview/__tests__/VirtualView-itest.js +++ b/packages/react-native/src/private/components/virtualview/__tests__/VirtualView-itest.js @@ -355,7 +355,7 @@ export function dispatchModeChangeEvent( /** * Helper to create a callback ref that records instances using WeakRefs. */ -function createWeakRefCallback(): $ReadOnly<{ +function createWeakRefCallback(): Readonly<{ weakRefs: $ReadOnlyArray>, callbackRef: React.RefSetter, }> { diff --git a/packages/react-native/src/private/devsupport/devmenu/elementinspector/BorderBox.js b/packages/react-native/src/private/devsupport/devmenu/elementinspector/BorderBox.js index 22d3f7fc3d9..af12cdb9742 100644 --- a/packages/react-native/src/private/devsupport/devmenu/elementinspector/BorderBox.js +++ b/packages/react-native/src/private/devsupport/devmenu/elementinspector/BorderBox.js @@ -16,9 +16,9 @@ import * as React from 'react'; const View = require('../../../../../Libraries/Components/View/View').default; -type Props = $ReadOnly<{ +type Props = Readonly<{ children: React.Node, - box?: ?$ReadOnly<{ + box?: ?Readonly<{ top: number, right: number, bottom: number, diff --git a/packages/react-native/src/private/devsupport/devmenu/elementinspector/BoxInspector.js b/packages/react-native/src/private/devsupport/devmenu/elementinspector/BoxInspector.js index 1b76fb88245..59aa4c801a4 100644 --- a/packages/react-native/src/private/devsupport/devmenu/elementinspector/BoxInspector.js +++ b/packages/react-native/src/private/devsupport/devmenu/elementinspector/BoxInspector.js @@ -31,7 +31,7 @@ const blank = { bottom: 0, }; -type BoxInspectorProps = $ReadOnly<{ +type BoxInspectorProps = Readonly<{ style: ViewStyleProp, frame: ?InspectedElementFrame, }>; @@ -57,10 +57,10 @@ function BoxInspector({style, frame}: BoxInspectorProps): React.Node { ); } -type BoxContainerProps = $ReadOnly<{ +type BoxContainerProps = Readonly<{ title: string, titleStyle?: TextStyleProp, - box: $ReadOnly<{ + box: Readonly<{ top: number, left: number, right: number, diff --git a/packages/react-native/src/private/devsupport/devmenu/elementinspector/ElementBox.js b/packages/react-native/src/private/devsupport/devmenu/elementinspector/ElementBox.js index 5f022484c2a..08b4e9704ca 100644 --- a/packages/react-native/src/private/devsupport/devmenu/elementinspector/ElementBox.js +++ b/packages/react-native/src/private/devsupport/devmenu/elementinspector/ElementBox.js @@ -25,15 +25,15 @@ const Dimensions = const BorderBox = require('./BorderBox').default; const resolveBoxStyle = require('./resolveBoxStyle').default; -type Props = $ReadOnly<{ +type Props = Readonly<{ frame: InspectedElementFrame, style?: ?ViewStyleProp, }>; function ElementBox({frame, style}: Props): React.Node { const flattenedStyle = flattenStyle(style) || {}; - let margin: ?$ReadOnlySchedulerUIManagerAnimationBackendShadowTreeNativeAnimatedNodesManagercreatesshared_ptr, set/getcommitUpdates()UIManagerAnimationBackend Public APIs• start(callback) → CallbackId Register animation callback, resume choreographer• stop(callbackId) Unregister callback, pause if empty• onAnimationFrame(timestamp) Process frame, execute callbacks, apply mutations• trigger() Manual frame trigger with current time (for events)• clearRegistry(surfaceId) Clear cached animated props for surface• registerJSInvoker(jsInvoker) Register JS thread invoker🔒 Thread-Safestart(), stop(),onAnimationFrame()protected by mutexReactHostRCTScheduler.mmRCTAnimationChoreographerFabricUiManagerBinding.cppAndroidAnimationChoreographerAnimationChoreographerimplementsimplementsgets shared_ptr in constructor (via SchedulerToolbox) and passes it to Animation Backendweak_ptrcreatesCADisplayLinkAndroidChoreographeronAnimationFrame()onAnimationFrameinvokesweak_ptrweak_ptrUIManagerAniamtionBackendimplementscreatesTesterAppDelegate.cppTesterAnimationChoreographerimplementscreatescreatescreatese.g. Reanimatedweak_ptrEntry point for implementingnative frame schedulingin ReactCxxPlatform(currently used by fantom)iOSAndroidFantom From 5ee695ad8f41d7c9a92a83fa1f0acd227cdab7b8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomasz=20=C5=BBelawski?= Date: Thu, 12 Feb 2026 06:31:10 -0800 Subject: [PATCH 344/585] fix: missing symbols on prebuilt Android with hermesV1 disabled (#55400) Summary: Since HermesV1 is enabled by default in React Native 0.84, the prebuilt Android artifacts are compiled with the flag `HERMES_V1_ENABLED`. This results in dropping some inspector symbols, in my case `enableDebugging` and `disableDebugging` from `inspector-modern/chrome/Registration.cpp`. This is problematic, because even if the app sets `hermesV1Enabled=false` in `gradle.properties`, it's shipped with binaries compiled with `hermesV1Enabled=true`. This makes it so I'm expecting symbols that should be available when `HERMES_V1_ENABLED` macro isn't defined - but they aren't available. I don't know what other symbols could lead to compilation failures, maybe shipping a whole other binary would be a better idea. For the time being I made a simple fix that would provide fallback implementations instead of not generating them at all. ## Changelog: [ANDROID] [FIXED] - Provide symbol fallbacks for `inspector-modern/chrome/Registration.h` when HermesV1 is disabled. Pull Request resolved: https://github.com/facebook/react-native/pull/55400 Test Plan: I tested these changes (although in `Registration.h` file) in a project, not building from source, and they worked. Reviewed By: cipolleschi Differential Revision: D92964824 Pulled By: cortinico fbshipit-source-id: a87ceab6d25095062de200d1a08821dba379240d --- .../inspector-modern/chrome/Registration.cpp | 47 +++++++++++++++++-- 1 file changed, 44 insertions(+), 3 deletions(-) diff --git a/packages/react-native/ReactCommon/hermes/inspector-modern/chrome/Registration.cpp b/packages/react-native/ReactCommon/hermes/inspector-modern/chrome/Registration.cpp index d935ef0ad6d..3274cba4f59 100644 --- a/packages/react-native/ReactCommon/hermes/inspector-modern/chrome/Registration.cpp +++ b/packages/react-native/ReactCommon/hermes/inspector-modern/chrome/Registration.cpp @@ -8,10 +8,13 @@ #include "Registration.h" #include "ConnectionDemux.h" -#if defined(HERMES_ENABLE_DEBUGGER) && !defined(HERMES_V1_ENABLED) +#if defined(HERMES_ENABLE_DEBUGGER) -namespace facebook::hermes::inspector_modern::chrome { +#include + +#if !defined(HERMES_V1_ENABLED) +namespace facebook::hermes::inspector_modern::chrome { namespace { ConnectionDemux& demux() { @@ -34,4 +37,42 @@ void disableDebugging(DebugSessionToken session) { } // namespace facebook::hermes::inspector_modern::chrome -#endif // defined(HERMES_ENABLE_DEBUGGER) && !defined(HERMES_V1_ENABLED) +#else + +namespace facebook::hermes::inspector_modern { +class RuntimeAdapter { + // Backwards compatibility definition fallback for libraries that are compiled + // without `HERMES_V1_ENABLED` but are linked against React Native with + // `HERMES_V1_ENABLED` which doesn't provide this symbol. + public: + virtual ~RuntimeAdapter() = 0; + virtual HermesRuntime& getRuntime() = 0; + virtual void tickleJs(); +}; + +namespace chrome { + +using DebugSessionToken = int; + +DebugSessionToken enableDebugging( + std::unique_ptr, + const std::string&) { + // Backwards compatibility fallback for libraries that are compiled without + // `HERMES_V1_ENABLED` but are linked against React Native with + // `HERMES_V1_ENABLED` which doesn't provide this symbol. + return -1; +}; + +void disableDebugging(DebugSessionToken) { + // Backwards compatibility fallback for libraries that are compiled without + // `HERMES_V1_ENABLED` but are linked against React Native with + // `HERMES_V1_ENABLED` which doesn't provide this symbol. +} + +} // namespace chrome + +} // namespace facebook::hermes::inspector_modern + +#endif // !defined(HERMES_V1_ENABLED) + +#endif // defined(HERMES_ENABLE_DEBUGGER) From 6802eb92ffda72fdf26d2e0afe4f06ffb59e67b8 Mon Sep 17 00:00:00 2001 From: Pieter De Baets Date: Thu, 12 Feb 2026 06:59:33 -0800 Subject: [PATCH 345/585] Move RCT_DEV_SETTINGS_ENABLE_PACKAGER_CONNECTION to its only consumer (#55528) Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/55528 Move the RCT_DEV_SETTINGS_ENABLE_PACKAGER_CONNECTION define from RCTDefines.h to RCTDevSettings.mm, which is its only consumer. This removes a __has_include dependency from the shared header, making RCTDefines.h usable as a standalone lightweight target without pulling in RCTPackagerConnection.h. Changelog: [Internal] Reviewed By: cipolleschi Differential Revision: D93018381 fbshipit-source-id: bff276bb788197bb59a7f4626cc355d85a8dea87 --- packages/react-native/React/Base/RCTDefines.h | 8 -------- packages/react-native/React/CoreModules/RCTDevSettings.mm | 8 ++++++++ 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/packages/react-native/React/Base/RCTDefines.h b/packages/react-native/React/Base/RCTDefines.h index b9bf3288acf..a36b359b615 100644 --- a/packages/react-native/React/Base/RCTDefines.h +++ b/packages/react-native/React/Base/RCTDefines.h @@ -95,14 +95,6 @@ #define RCT_DEV_MENU RCT_DEV #endif -#ifndef RCT_DEV_SETTINGS_ENABLE_PACKAGER_CONNECTION -#if RCT_DEV && (__has_include("RCTPackagerConnection.h") || __has_include()) -#define RCT_DEV_SETTINGS_ENABLE_PACKAGER_CONNECTION 1 -#else -#define RCT_DEV_SETTINGS_ENABLE_PACKAGER_CONNECTION 0 -#endif -#endif - #if RCT_DEV #define RCT_IF_DEV(...) __VA_ARGS__ #else diff --git a/packages/react-native/React/CoreModules/RCTDevSettings.mm b/packages/react-native/React/CoreModules/RCTDevSettings.mm index 712d890386f..cc4cb1c74e5 100644 --- a/packages/react-native/React/CoreModules/RCTDevSettings.mm +++ b/packages/react-native/React/CoreModules/RCTDevSettings.mm @@ -36,6 +36,14 @@ #import #endif +#ifndef RCT_DEV_SETTINGS_ENABLE_PACKAGER_CONNECTION +#if RCT_DEV && (__has_include("RCTPackagerConnection.h") || __has_include()) +#define RCT_DEV_SETTINGS_ENABLE_PACKAGER_CONNECTION 1 +#else +#define RCT_DEV_SETTINGS_ENABLE_PACKAGER_CONNECTION 0 +#endif +#endif + #if RCT_DEV_SETTINGS_ENABLE_PACKAGER_CONNECTION #import #endif From b97ca6eacf35496ea9f57add7c5439e405e11b04 Mon Sep 17 00:00:00 2001 From: Alex Hunt Date: Thu, 12 Feb 2026 09:38:27 -0800 Subject: [PATCH 346/585] Update build to better locate prepack script (#55536) Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/55536 Changelog: [Internal] Reviewed By: vzaidman Differential Revision: D92831007 fbshipit-source-id: 60089442334ca5be6046bfd7f16c816d57e62408 --- scripts/build/build.js | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/scripts/build/build.js b/scripts/build/build.js index d96c4f080c2..9ff364c58c6 100644 --- a/scripts/build/build.js +++ b/scripts/build/build.js @@ -124,10 +124,15 @@ async function buildPackage(packageName /*: string */, prepack /*: boolean */) { // Run prepack script if configured if (prepack) { await new Promise((resolve, reject) => { - const child = spawn('npm', ['run', 'prepack'], { - cwd: path.resolve(PACKAGES_DIR, packageName), - stdio: ['ignore', 'ignore', 'inherit'], - }); + const packagePath = path.resolve(PACKAGES_DIR, packageName); + const child = spawn( + process.execPath, + [path.join(__dirname, 'prepack.js')], + { + cwd: packagePath, + stdio: ['ignore', 'ignore', 'inherit'], + }, + ); child.on('close', code => { if (code !== 0) { reject(new Error(`prepack script exited with code ${code}`)); From d7a1d080c242300986935f64ac7906924a5f7189 Mon Sep 17 00:00:00 2001 From: Zeya Peng Date: Thu, 12 Feb 2026 13:32:14 -0800 Subject: [PATCH 347/585] Create featureflag viewTransitionEnabled (#55537) Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/55537 Changelog: [General] [Added] - Create featureflag viewTransitionEnabled This diff adds a new React Native feature flag `viewTransitionEnabled` to gate the View Transition API feature. The View Transition API enables animated transitions between views, providing a smooth visual experience when navigating between screens or updating UI elements. This flag allows the feature to be gradually rolled out and tested before full enablement. The flag is added across all platform layers: - JavaScript (ReactNativeFeatureFlags.js, NativeReactNativeFeatureFlags.js) - Android Kotlin (ReactNativeFeatureFlags.kt, provider, accessor, defaults) - C++/JNI (ReactNativeFeatureFlags.cpp/h, JReactNativeFeatureFlagsCxxInterop) - Feature flag config (ReactNativeFeatureFlags.config.js) Default value is `false` to ensure the feature is opt-in during experimentation. Reviewed By: NickGerleman Differential Revision: D92713074 fbshipit-source-id: cd9e567df3135f99c8a931fffab655f16883cf94 --- .../featureflags/ReactNativeFeatureFlags.kt | 8 ++++++- .../ReactNativeFeatureFlagsCxxAccessor.kt | 12 +++++++++- .../ReactNativeFeatureFlagsCxxInterop.kt | 4 +++- .../ReactNativeFeatureFlagsDefaults.kt | 4 +++- .../ReactNativeFeatureFlagsLocalAccessor.kt | 13 ++++++++++- .../ReactNativeFeatureFlagsProvider.kt | 4 +++- .../JReactNativeFeatureFlagsCxxInterop.cpp | 16 +++++++++++++- .../JReactNativeFeatureFlagsCxxInterop.h | 5 ++++- .../featureflags/ReactNativeFeatureFlags.cpp | 6 ++++- .../featureflags/ReactNativeFeatureFlags.h | 7 +++++- .../ReactNativeFeatureFlagsAccessor.cpp | 22 +++++++++++++++++-- .../ReactNativeFeatureFlagsAccessor.h | 6 +++-- .../ReactNativeFeatureFlagsDefaults.h | 6 ++++- .../ReactNativeFeatureFlagsDynamicProvider.h | 11 +++++++++- .../ReactNativeFeatureFlagsProvider.h | 3 ++- .../NativeReactNativeFeatureFlags.cpp | 7 +++++- .../NativeReactNativeFeatureFlags.h | 4 +++- .../ReactNativeFeatureFlags.config.js | 11 ++++++++++ .../featureflags/ReactNativeFeatureFlags.js | 7 +++++- .../specs/NativeReactNativeFeatureFlags.js | 3 ++- 20 files changed, 138 insertions(+), 21 deletions(-) diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlags.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlags.kt index 74b86e79981..5f5a9275d65 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlags.kt +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlags.kt @@ -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<<049cc0a1aa5ab53ad2ab11c359f49827>> + * @generated SignedSource<<4549fc9a4f431306b7dc70ef3903b8fd>> */ /** @@ -504,6 +504,12 @@ public object ReactNativeFeatureFlags { @JvmStatic public fun viewCullingOutsetRatio(): Double = accessor.viewCullingOutsetRatio() + /** + * Enable the View Transition API for animating transitions between views. + */ + @JvmStatic + public fun viewTransitionEnabled(): Boolean = accessor.viewTransitionEnabled() + /** * Initial prerender ratio for VirtualView. */ diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsCxxAccessor.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsCxxAccessor.kt index 765b88debb1..659be742cc7 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsCxxAccessor.kt +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsCxxAccessor.kt @@ -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<<6d1fc28e24576c1a63dceaa8c974cc1f>> + * @generated SignedSource<<0db6bbb173a96ab07c80a3fbe43671b3>> */ /** @@ -99,6 +99,7 @@ internal class ReactNativeFeatureFlagsCxxAccessor : ReactNativeFeatureFlagsAcces private var useTurboModuleInteropCache: Boolean? = null private var useTurboModulesCache: Boolean? = null private var viewCullingOutsetRatioCache: Double? = null + private var viewTransitionEnabledCache: Boolean? = null private var virtualViewPrerenderRatioCache: Double? = null override fun commonTestFlag(): Boolean { @@ -812,6 +813,15 @@ internal class ReactNativeFeatureFlagsCxxAccessor : ReactNativeFeatureFlagsAcces return cached } + override fun viewTransitionEnabled(): Boolean { + var cached = viewTransitionEnabledCache + if (cached == null) { + cached = ReactNativeFeatureFlagsCxxInterop.viewTransitionEnabled() + viewTransitionEnabledCache = cached + } + return cached + } + override fun virtualViewPrerenderRatio(): Double { var cached = virtualViewPrerenderRatioCache if (cached == null) { diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsCxxInterop.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsCxxInterop.kt index f25107cc6fe..d0f40e261e9 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsCxxInterop.kt +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsCxxInterop.kt @@ -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<<26410c9e406969734991456f635be4af>> + * @generated SignedSource<> */ /** @@ -186,6 +186,8 @@ public object ReactNativeFeatureFlagsCxxInterop { @DoNotStrip @JvmStatic public external fun viewCullingOutsetRatio(): Double + @DoNotStrip @JvmStatic public external fun viewTransitionEnabled(): Boolean + @DoNotStrip @JvmStatic public external fun virtualViewPrerenderRatio(): Double @DoNotStrip @JvmStatic public external fun override(provider: Any) diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsDefaults.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsDefaults.kt index 2bb5cab976f..f344b30a174 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsDefaults.kt +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsDefaults.kt @@ -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<> + * @generated SignedSource<<102ac98a8c3f2c1a2150c223a099cf72>> */ /** @@ -181,5 +181,7 @@ public open class ReactNativeFeatureFlagsDefaults : ReactNativeFeatureFlagsProvi override fun viewCullingOutsetRatio(): Double = 0.0 + override fun viewTransitionEnabled(): Boolean = false + override fun virtualViewPrerenderRatio(): Double = 5.0 } diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsLocalAccessor.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsLocalAccessor.kt index ffe01d0c090..f3cbafc8ec5 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsLocalAccessor.kt +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsLocalAccessor.kt @@ -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<> + * @generated SignedSource<> */ /** @@ -103,6 +103,7 @@ internal class ReactNativeFeatureFlagsLocalAccessor : ReactNativeFeatureFlagsAcc private var useTurboModuleInteropCache: Boolean? = null private var useTurboModulesCache: Boolean? = null private var viewCullingOutsetRatioCache: Double? = null + private var viewTransitionEnabledCache: Boolean? = null private var virtualViewPrerenderRatioCache: Double? = null override fun commonTestFlag(): Boolean { @@ -895,6 +896,16 @@ internal class ReactNativeFeatureFlagsLocalAccessor : ReactNativeFeatureFlagsAcc return cached } + override fun viewTransitionEnabled(): Boolean { + var cached = viewTransitionEnabledCache + if (cached == null) { + cached = currentProvider.viewTransitionEnabled() + accessedFeatureFlags.add("viewTransitionEnabled") + viewTransitionEnabledCache = cached + } + return cached + } + override fun virtualViewPrerenderRatio(): Double { var cached = virtualViewPrerenderRatioCache if (cached == null) { diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsProvider.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsProvider.kt index cb9050023ba..3abb8b0778c 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsProvider.kt +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsProvider.kt @@ -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<> + * @generated SignedSource<<50f2ea7e87e80a247b6c6ce8e2afd0ec>> */ /** @@ -181,5 +181,7 @@ public interface ReactNativeFeatureFlagsProvider { @DoNotStrip public fun viewCullingOutsetRatio(): Double + @DoNotStrip public fun viewTransitionEnabled(): Boolean + @DoNotStrip public fun virtualViewPrerenderRatio(): Double } diff --git a/packages/react-native/ReactAndroid/src/main/jni/react/featureflags/JReactNativeFeatureFlagsCxxInterop.cpp b/packages/react-native/ReactAndroid/src/main/jni/react/featureflags/JReactNativeFeatureFlagsCxxInterop.cpp index a861c047e82..ccbb1be9cdf 100644 --- a/packages/react-native/ReactAndroid/src/main/jni/react/featureflags/JReactNativeFeatureFlagsCxxInterop.cpp +++ b/packages/react-native/ReactAndroid/src/main/jni/react/featureflags/JReactNativeFeatureFlagsCxxInterop.cpp @@ -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<<698b775afb6ad9295c181ea3d12118d3>> + * @generated SignedSource<<0460a8b25bfb176e47fb12dc091b1961>> */ /** @@ -513,6 +513,12 @@ class ReactNativeFeatureFlagsJavaProvider return method(javaProvider_); } + bool viewTransitionEnabled() override { + static const auto method = + getReactNativeFeatureFlagsProviderJavaClass()->getMethod("viewTransitionEnabled"); + return method(javaProvider_); + } + double virtualViewPrerenderRatio() override { static const auto method = getReactNativeFeatureFlagsProviderJavaClass()->getMethod("virtualViewPrerenderRatio"); @@ -918,6 +924,11 @@ double JReactNativeFeatureFlagsCxxInterop::viewCullingOutsetRatio( return ReactNativeFeatureFlags::viewCullingOutsetRatio(); } +bool JReactNativeFeatureFlagsCxxInterop::viewTransitionEnabled( + facebook::jni::alias_ref /*unused*/) { + return ReactNativeFeatureFlags::viewTransitionEnabled(); +} + double JReactNativeFeatureFlagsCxxInterop::virtualViewPrerenderRatio( facebook::jni::alias_ref /*unused*/) { return ReactNativeFeatureFlags::virtualViewPrerenderRatio(); @@ -1191,6 +1202,9 @@ void JReactNativeFeatureFlagsCxxInterop::registerNatives() { makeNativeMethod( "viewCullingOutsetRatio", JReactNativeFeatureFlagsCxxInterop::viewCullingOutsetRatio), + makeNativeMethod( + "viewTransitionEnabled", + JReactNativeFeatureFlagsCxxInterop::viewTransitionEnabled), makeNativeMethod( "virtualViewPrerenderRatio", JReactNativeFeatureFlagsCxxInterop::virtualViewPrerenderRatio), diff --git a/packages/react-native/ReactAndroid/src/main/jni/react/featureflags/JReactNativeFeatureFlagsCxxInterop.h b/packages/react-native/ReactAndroid/src/main/jni/react/featureflags/JReactNativeFeatureFlagsCxxInterop.h index 260c4f4ea04..37ef763ce1a 100644 --- a/packages/react-native/ReactAndroid/src/main/jni/react/featureflags/JReactNativeFeatureFlagsCxxInterop.h +++ b/packages/react-native/ReactAndroid/src/main/jni/react/featureflags/JReactNativeFeatureFlagsCxxInterop.h @@ -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<<7be3a44c6ffc2c9d390f66902ef80d30>> + * @generated SignedSource<<88f40502abd13f8f57015429dd087519>> */ /** @@ -267,6 +267,9 @@ class JReactNativeFeatureFlagsCxxInterop static double viewCullingOutsetRatio( facebook::jni::alias_ref); + static bool viewTransitionEnabled( + facebook::jni::alias_ref); + static double virtualViewPrerenderRatio( facebook::jni::alias_ref); diff --git a/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlags.cpp b/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlags.cpp index 8c2a06e0224..b48a7e48ba0 100644 --- a/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlags.cpp +++ b/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlags.cpp @@ -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<<88b22330e8486a820eb42b59fb7279e4>> + * @generated SignedSource<> */ /** @@ -342,6 +342,10 @@ double ReactNativeFeatureFlags::viewCullingOutsetRatio() { return getAccessor().viewCullingOutsetRatio(); } +bool ReactNativeFeatureFlags::viewTransitionEnabled() { + return getAccessor().viewTransitionEnabled(); +} + double ReactNativeFeatureFlags::virtualViewPrerenderRatio() { return getAccessor().virtualViewPrerenderRatio(); } diff --git a/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlags.h b/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlags.h index 902ac9787e7..f42f4d26f23 100644 --- a/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlags.h +++ b/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlags.h @@ -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<> + * @generated SignedSource<<51a4817654c04c979a33f44e42312dd5>> */ /** @@ -434,6 +434,11 @@ class ReactNativeFeatureFlags { */ RN_EXPORT static double viewCullingOutsetRatio(); + /** + * Enable the View Transition API for animating transitions between views. + */ + RN_EXPORT static bool viewTransitionEnabled(); + /** * Initial prerender ratio for VirtualView. */ diff --git a/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlagsAccessor.cpp b/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlagsAccessor.cpp index 5b23711102e..7c2cc35cb5a 100644 --- a/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlagsAccessor.cpp +++ b/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlagsAccessor.cpp @@ -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<<65ca2267e4bd81dcc21f35bbfc880ba8>> + * @generated SignedSource<> */ /** @@ -1451,6 +1451,24 @@ double ReactNativeFeatureFlagsAccessor::viewCullingOutsetRatio() { return flagValue.value(); } +bool ReactNativeFeatureFlagsAccessor::viewTransitionEnabled() { + auto flagValue = viewTransitionEnabled_.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(79, "viewTransitionEnabled"); + + flagValue = currentProvider_->viewTransitionEnabled(); + viewTransitionEnabled_ = flagValue; + } + + return flagValue.value(); +} + double ReactNativeFeatureFlagsAccessor::virtualViewPrerenderRatio() { auto flagValue = virtualViewPrerenderRatio_.load(); @@ -1460,7 +1478,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(79, "virtualViewPrerenderRatio"); + markFlagAsAccessed(80, "virtualViewPrerenderRatio"); flagValue = currentProvider_->virtualViewPrerenderRatio(); virtualViewPrerenderRatio_ = flagValue; diff --git a/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlagsAccessor.h b/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlagsAccessor.h index 1c89cab6d62..4f5b133375d 100644 --- a/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlagsAccessor.h +++ b/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlagsAccessor.h @@ -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<<1aed21628664154ea7f66f15b1f760c2>> + * @generated SignedSource<<545708e361d01a42b3aef51ba71d646d>> */ /** @@ -111,6 +111,7 @@ class ReactNativeFeatureFlagsAccessor { bool useTurboModuleInterop(); bool useTurboModules(); double viewCullingOutsetRatio(); + bool viewTransitionEnabled(); double virtualViewPrerenderRatio(); void override(std::unique_ptr provider); @@ -123,7 +124,7 @@ class ReactNativeFeatureFlagsAccessor { std::unique_ptr currentProvider_; bool wasOverridden_; - std::array, 80> accessedFeatureFlags_; + std::array, 81> accessedFeatureFlags_; std::atomic> commonTestFlag_; std::atomic> cdpInteractionMetricsEnabled_; @@ -204,6 +205,7 @@ class ReactNativeFeatureFlagsAccessor { std::atomic> useTurboModuleInterop_; std::atomic> useTurboModules_; std::atomic> viewCullingOutsetRatio_; + std::atomic> viewTransitionEnabled_; std::atomic> virtualViewPrerenderRatio_; }; diff --git a/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlagsDefaults.h b/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlagsDefaults.h index 43e9c6556b1..13360f4656a 100644 --- a/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlagsDefaults.h +++ b/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlagsDefaults.h @@ -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<> + * @generated SignedSource<<777478fa4d8beba140a30edb68cc34d9>> */ /** @@ -343,6 +343,10 @@ class ReactNativeFeatureFlagsDefaults : public ReactNativeFeatureFlagsProvider { return 0.0; } + bool viewTransitionEnabled() override { + return false; + } + double virtualViewPrerenderRatio() override { return 5.0; } diff --git a/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlagsDynamicProvider.h b/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlagsDynamicProvider.h index 293067a1e2a..61a4ec167f9 100644 --- a/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlagsDynamicProvider.h +++ b/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlagsDynamicProvider.h @@ -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<> + * @generated SignedSource<<55247339124401e105501f3d9d3b5b92>> */ /** @@ -756,6 +756,15 @@ class ReactNativeFeatureFlagsDynamicProvider : public ReactNativeFeatureFlagsDef return ReactNativeFeatureFlagsDefaults::viewCullingOutsetRatio(); } + bool viewTransitionEnabled() override { + auto value = values_["viewTransitionEnabled"]; + if (!value.isNull()) { + return value.getBool(); + } + + return ReactNativeFeatureFlagsDefaults::viewTransitionEnabled(); + } + double virtualViewPrerenderRatio() override { auto value = values_["virtualViewPrerenderRatio"]; if (!value.isNull()) { diff --git a/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlagsProvider.h b/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlagsProvider.h index 7ec722a2d32..f86dab964cf 100644 --- a/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlagsProvider.h +++ b/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlagsProvider.h @@ -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<<0308cb63246c4576859383adc3cc9593>> + * @generated SignedSource<<05c9d90f759f2a6116219a1e61eeee82>> */ /** @@ -104,6 +104,7 @@ class ReactNativeFeatureFlagsProvider { virtual bool useTurboModuleInterop() = 0; virtual bool useTurboModules() = 0; virtual double viewCullingOutsetRatio() = 0; + virtual bool viewTransitionEnabled() = 0; virtual double virtualViewPrerenderRatio() = 0; }; diff --git a/packages/react-native/ReactCommon/react/nativemodule/featureflags/NativeReactNativeFeatureFlags.cpp b/packages/react-native/ReactCommon/react/nativemodule/featureflags/NativeReactNativeFeatureFlags.cpp index 4a08c4efb5e..e6cc9a06f37 100644 --- a/packages/react-native/ReactCommon/react/nativemodule/featureflags/NativeReactNativeFeatureFlags.cpp +++ b/packages/react-native/ReactCommon/react/nativemodule/featureflags/NativeReactNativeFeatureFlags.cpp @@ -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<> + * @generated SignedSource<<39413a3a4416946e3ade57074664492d>> */ /** @@ -439,6 +439,11 @@ double NativeReactNativeFeatureFlags::viewCullingOutsetRatio( return ReactNativeFeatureFlags::viewCullingOutsetRatio(); } +bool NativeReactNativeFeatureFlags::viewTransitionEnabled( + jsi::Runtime& /*runtime*/) { + return ReactNativeFeatureFlags::viewTransitionEnabled(); +} + double NativeReactNativeFeatureFlags::virtualViewPrerenderRatio( jsi::Runtime& /*runtime*/) { return ReactNativeFeatureFlags::virtualViewPrerenderRatio(); diff --git a/packages/react-native/ReactCommon/react/nativemodule/featureflags/NativeReactNativeFeatureFlags.h b/packages/react-native/ReactCommon/react/nativemodule/featureflags/NativeReactNativeFeatureFlags.h index 70e9f241ad6..fc15199230e 100644 --- a/packages/react-native/ReactCommon/react/nativemodule/featureflags/NativeReactNativeFeatureFlags.h +++ b/packages/react-native/ReactCommon/react/nativemodule/featureflags/NativeReactNativeFeatureFlags.h @@ -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<<1fa17a0bb7f29a34541d362d1ecdc788>> + * @generated SignedSource<<6ed865d409cf5df84607ffa599e46fe7>> */ /** @@ -194,6 +194,8 @@ class NativeReactNativeFeatureFlags double viewCullingOutsetRatio(jsi::Runtime& runtime); + bool viewTransitionEnabled(jsi::Runtime& runtime); + double virtualViewPrerenderRatio(jsi::Runtime& runtime); }; diff --git a/packages/react-native/scripts/featureflags/ReactNativeFeatureFlags.config.js b/packages/react-native/scripts/featureflags/ReactNativeFeatureFlags.config.js index 7ce10ba669e..6de46679820 100644 --- a/packages/react-native/scripts/featureflags/ReactNativeFeatureFlags.config.js +++ b/packages/react-native/scripts/featureflags/ReactNativeFeatureFlags.config.js @@ -890,6 +890,17 @@ const definitions: FeatureFlagDefinitions = { }, ossReleaseStage: 'none', }, + viewTransitionEnabled: { + defaultValue: false, + metadata: { + dateAdded: '2026-02-09', + description: + 'Enable the View Transition API for animating transitions between views.', + expectedReleaseValue: true, + purpose: 'experimentation', + }, + ossReleaseStage: 'none', + }, virtualViewPrerenderRatio: { defaultValue: 5, metadata: { diff --git a/packages/react-native/src/private/featureflags/ReactNativeFeatureFlags.js b/packages/react-native/src/private/featureflags/ReactNativeFeatureFlags.js index 95ab5702bf9..542bde64dad 100644 --- a/packages/react-native/src/private/featureflags/ReactNativeFeatureFlags.js +++ b/packages/react-native/src/private/featureflags/ReactNativeFeatureFlags.js @@ -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<> + * @generated SignedSource<> * @flow strict * @noformat */ @@ -126,6 +126,7 @@ export type ReactNativeFeatureFlags = $ReadOnly<{ useTurboModuleInterop: Getter, useTurboModules: Getter, viewCullingOutsetRatio: Getter, + viewTransitionEnabled: Getter, virtualViewPrerenderRatio: Getter, }>; @@ -509,6 +510,10 @@ export const useTurboModules: Getter = createNativeFlagGetter('useTurbo * Outset the culling context frame with the provided ratio. The culling context frame size will be outset by width * ratio on the left and right, and height * ratio on the top and bottom. */ export const viewCullingOutsetRatio: Getter = createNativeFlagGetter('viewCullingOutsetRatio', 0); +/** + * Enable the View Transition API for animating transitions between views. + */ +export const viewTransitionEnabled: Getter = createNativeFlagGetter('viewTransitionEnabled', false); /** * Initial prerender ratio for VirtualView. */ diff --git a/packages/react-native/src/private/featureflags/specs/NativeReactNativeFeatureFlags.js b/packages/react-native/src/private/featureflags/specs/NativeReactNativeFeatureFlags.js index 01ef6a7f3a4..87718d2a025 100644 --- a/packages/react-native/src/private/featureflags/specs/NativeReactNativeFeatureFlags.js +++ b/packages/react-native/src/private/featureflags/specs/NativeReactNativeFeatureFlags.js @@ -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<> + * @generated SignedSource<<1fe995d928d6ea2770936cdd6e2b8320>> * @flow strict * @noformat */ @@ -104,6 +104,7 @@ export interface Spec extends TurboModule { +useTurboModuleInterop?: () => boolean; +useTurboModules?: () => boolean; +viewCullingOutsetRatio?: () => number; + +viewTransitionEnabled?: () => boolean; +virtualViewPrerenderRatio?: () => number; } From 349cf1595bd0135e07862d4f51b2eb2eda610db4 Mon Sep 17 00:00:00 2001 From: Dileep Siva Sai Nallabothu Date: Thu, 12 Feb 2026 16:09:33 -0800 Subject: [PATCH 348/585] Fixing fb4a crashes due to null pointer exception (#55529) Summary: [Android][Fixed] - Fix null pointer crash in FabricUIManagerBinding::driveCxxAnimations by adding null check for scheduler Pull Request resolved: https://github.com/facebook/react-native/pull/55529 Crash failures during e2e: https://www.internalfb.com/intern/test/562949977559616 logview: https://fburl.com/logview/65na7gyr Reason: null dereference Pull Request resolved: https://github.com/facebook/react-native/pull/55529 Crash failures during e2e: https://www.internalfb.com/intern/test/562949977559616 logview: https://fburl.com/logview/65na7gyr Reason: null dereference Reviewed By: javache Differential Revision: D92986523 fbshipit-source-id: 2a193cdc93a44a59fedfb7974bb694546a2000f6 --- .../src/main/jni/react/fabric/FabricUIManagerBinding.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/packages/react-native/ReactAndroid/src/main/jni/react/fabric/FabricUIManagerBinding.cpp b/packages/react-native/ReactAndroid/src/main/jni/react/fabric/FabricUIManagerBinding.cpp index db9efc85004..42a30dde17f 100644 --- a/packages/react-native/ReactAndroid/src/main/jni/react/fabric/FabricUIManagerBinding.cpp +++ b/packages/react-native/ReactAndroid/src/main/jni/react/fabric/FabricUIManagerBinding.cpp @@ -52,7 +52,13 @@ void FabricUIManagerBinding::setPixelDensity(float pointScaleFactor) { } void FabricUIManagerBinding::driveCxxAnimations() { - getScheduler()->animationTick(); + auto scheduler = getScheduler(); + if (!scheduler) { + LOG(ERROR) + << "FabricUIManagerBinding::driveCxxAnimations: scheduler disappeared"; + return; + } + scheduler->animationTick(); } void FabricUIManagerBinding::driveAnimationBackend(jdouble frameTimeMs) { From e803a3499df78e95d8f86bba12837a1b70e8c5fb Mon Sep 17 00:00:00 2001 From: David Vacca Date: Thu, 12 Feb 2026 23:24:00 -0800 Subject: [PATCH 349/585] Fix NonStaticNestedClass: Make inner class static (#55501) Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/55501 The BaseVMFocusChangeListener inner class does not reference any members of its outer class BaseViewManager. Making it static improves memory efficiency by avoiding the implicit reference to the outer class instance. Also removed the unused type parameter and changed the method parameters from T to View since only View interface methods are used. changelog: [internal] internal Reviewed By: cortinico Differential Revision: D92020879 fbshipit-source-id: a26378ed6f9f5dfcc64c49aaf734559e1e7be09e --- .../java/com/facebook/react/uimanager/BaseViewManager.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/BaseViewManager.java b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/BaseViewManager.java index 2d47e5a291b..28d92671f19 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/BaseViewManager.java +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/BaseViewManager.java @@ -1012,18 +1012,18 @@ public void setTouchCancel(@NonNull T view, boolean value) { * especially helpful for views that are recycled so we can retain and restore the original * listener upon recycling (onDropViewInstance). */ - private class BaseVMFocusChangeListener implements OnFocusChangeListener { + private static class BaseVMFocusChangeListener implements OnFocusChangeListener { private @Nullable OnFocusChangeListener mOriginalFocusChangeListener; public BaseVMFocusChangeListener(@Nullable OnFocusChangeListener originalFocusChangeListener) { mOriginalFocusChangeListener = originalFocusChangeListener; } - public void attach(T view) { + public void attach(View view) { view.setOnFocusChangeListener(this); } - public void detach(T view) { + public void detach(View view) { view.setOnFocusChangeListener(mOriginalFocusChangeListener); } From 283442ca39a331f95d8c846a6d8956339e9848f2 Mon Sep 17 00:00:00 2001 From: David Vacca Date: Thu, 12 Feb 2026 23:24:00 -0800 Subject: [PATCH 350/585] Fix MissingOverrideAnnotation: Add @Override to flex methods (#55502) Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/55502 This change adds missing Override annotations to three methods in LayoutShadowNode that override methods from the parent class: - setFlex(float) - setFlexGrow(float) - setFlexShrink(float) These methods call super.setFlex/setFlexGrow/setFlexShrink, indicating they override parent methods and should have Override annotations for code clarity and compiler checking. changelog: [internal] internal Reviewed By: alanleedev Differential Revision: D92021000 fbshipit-source-id: 28a4d0676c18d99dddb173066964cd8c5ea321ac --- .../java/com/facebook/react/uimanager/LayoutShadowNode.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/LayoutShadowNode.java b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/LayoutShadowNode.java index 757727322c0..b83497e7e73 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/LayoutShadowNode.java +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/LayoutShadowNode.java @@ -230,6 +230,7 @@ public void setMaxHeight(Dynamic maxHeight) { maxHeight.recycle(); } + @Override @ReactProp(name = ViewProps.FLEX, defaultFloat = 0f) public void setFlex(float flex) { if (isVirtual()) { @@ -238,6 +239,7 @@ public void setFlex(float flex) { super.setFlex(flex); } + @Override @ReactProp(name = ViewProps.FLEX_GROW, defaultFloat = 0f) public void setFlexGrow(float flexGrow) { if (isVirtual()) { @@ -309,6 +311,7 @@ public void setGap(Dynamic gap) { gap.recycle(); } + @Override @ReactProp(name = ViewProps.FLEX_SHRINK, defaultFloat = 0f) public void setFlexShrink(float flexShrink) { if (isVirtual()) { From 78e2dc45497b477296f8135c2d2e562996ac59af Mon Sep 17 00:00:00 2001 From: David Vacca Date: Thu, 12 Feb 2026 23:24:00 -0800 Subject: [PATCH 351/585] Fix DeadVariable and NotInvokedPrivateMethod: Remove unused code (#55503) Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/55503 Remove unused code that was triggering lint warnings: 1. Remove `walkUpUntilNativeKindIsParent` private method that was never invoked 2. Remove `parent` variable in `applyLayoutBase` that was never accessed Both were leftover from NativeKind removal. changelog: [internal] internal Reviewed By: alanleedev Differential Revision: D92021031 fbshipit-source-id: 7549efd01ddf167df4a130c255ccf1c8d663e1d2 --- .../react/uimanager/NativeViewHierarchyOptimizer.java | 8 -------- 1 file changed, 8 deletions(-) diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/NativeViewHierarchyOptimizer.java b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/NativeViewHierarchyOptimizer.java index 8bcbd2adc6d..79f3f6b5db5 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/NativeViewHierarchyOptimizer.java +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/NativeViewHierarchyOptimizer.java @@ -231,12 +231,6 @@ public void onBatchComplete() { mTagsWithLayoutVisited.clear(); } - private NodeIndexPair walkUpUntilNativeKindIsParent( - ReactShadowNode node, int indexInNativeChildren) { - // Logic removed due to NativeKind removal - return new NodeIndexPair(node, indexInNativeChildren); - } - private void addNodeToNode(ReactShadowNode parent, ReactShadowNode child, int index) { // Logic removed due to NativeKind removal } @@ -289,8 +283,6 @@ private void applyLayoutBase(ReactShadowNode node) { } mTagsWithLayoutVisited.put(tag, true); - ReactShadowNode parent = node.getParent(); - // We use screenX/screenY (which round to integer pixels) at each node in the hierarchy to // emulate what the layout would look like if it were actually built with native views which // have to have integral top/left/bottom/right values From c8b633925fbf35d41dd7b0070063ffdedd1e98af Mon Sep 17 00:00:00 2001 From: David Vacca Date: Thu, 12 Feb 2026 23:24:00 -0800 Subject: [PATCH 352/585] Fix HasBetterKotlinAlternativeMethod: Use Kotlin joinToString (#55504) Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/55504 Replace `TextUtils.join(", ", features)` with the idiomatic Kotlin `features.joinToString(", ")`. This fixes the HasBetterKotlinAlternativeMethod lint warning and removes the now-unused TextUtils import. changelog: [internal] internal Reviewed By: alanleedev Differential Revision: D92021387 fbshipit-source-id: 38510d3c36ccaf899826f604ed4dd1e843ebe039 --- .../java/com/facebook/react/views/text/ReactTypefaceUtils.kt | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/ReactTypefaceUtils.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/ReactTypefaceUtils.kt index 85043dfcb66..e33daa691f3 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/ReactTypefaceUtils.kt +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/ReactTypefaceUtils.kt @@ -9,7 +9,6 @@ package com.facebook.react.views.text import android.content.res.AssetManager import android.graphics.Typeface -import android.text.TextUtils import com.facebook.react.bridge.ReadableArray import com.facebook.react.common.ReactConstants import com.facebook.react.common.assets.ReactFontManager @@ -93,7 +92,7 @@ public object ReactTypefaceUtils { "stylistic-twenty" -> features.add("'ss20'") } } - return TextUtils.join(", ", features) + return features.joinToString(", ") } @JvmStatic From cccc180f9da7cc0c51fce296f9159aa3d47bc701 Mon Sep 17 00:00:00 2001 From: David Vacca Date: Thu, 12 Feb 2026 23:24:00 -0800 Subject: [PATCH 353/585] Fix HasBetterKotlinAlternativeMethod: Use Kotlin joinToString in TextAttributeProps (#55505) Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/55505 Replace `TextUtils.join(", ", features)` with Kotlin's idiomatic `features.joinToString(", ")` to fix the HasBetterKotlinAlternativeMethod lint warning. Also removed the now-unused `TextUtils` import while keeping the `TextUtils.TruncateAt` import that is still in use. changelog: [internal] internal Reviewed By: alanleedev Differential Revision: D92021465 fbshipit-source-id: 3cb9e286f9f46f82817b0257dde73230ba2298d6 --- .../java/com/facebook/react/views/text/TextAttributeProps.kt | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/TextAttributeProps.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/TextAttributeProps.kt index 433afa5793a..45c8bec4c2b 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/TextAttributeProps.kt +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/TextAttributeProps.kt @@ -9,7 +9,6 @@ package com.facebook.react.views.text import android.os.Build import android.text.Layout -import android.text.TextUtils import android.text.TextUtils.TruncateAt import android.util.LayoutDirection import android.view.Gravity @@ -238,7 +237,7 @@ public class TextAttributeProps private constructor() { } } } - fontFeatureSettings = TextUtils.join(", ", features) + fontFeatureSettings = features.joinToString(", ") } private fun setFontWeight(fontWeightString: String?) { From 54b4cb5e8926770935f2c482b5f2fbdac66d2d83 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dawid=20Ma=C5=82ecki?= Date: Fri, 13 Feb 2026 02:20:28 -0800 Subject: [PATCH 354/585] Fix crash in `cloneMultiple` when families have no path to root (#55491) Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/55491 Fixes crash in `ShadowNode::cloneMultipleRecursive` which tried to access a missing root's family from the `childrenCount` map. The main issue is that in some cases there is no path between the given families to update and the root shadow node. The solution is to check after building the `childrenCount` map if it contains the root family and return `nullptr` otherwise. This behavior is closer to the `getAncestors` method which returns an empty array if there is no ancestor-descendant relationship. Due to this change, an additional check in `AnimationBackendCommitHook` is also required. ## Changelog: [General][Fixed] - Fixed crash in `cloneMultiple` when families have no path to root Reviewed By: zeyap Differential Revision: D92838809 fbshipit-source-id: a87de2c171e4f0f71e566806f5c012ab0bac69fd --- .../AnimationBackendCommitHook.cpp | 10 +++- .../react/renderer/core/ShadowNode.cpp | 2 +- .../renderer/core/tests/ShadowNodeTest.cpp | 55 +++++++++++++++++++ 3 files changed, 64 insertions(+), 3 deletions(-) diff --git a/packages/react-native/ReactCommon/react/renderer/animationbackend/AnimationBackendCommitHook.cpp b/packages/react-native/ReactCommon/react/renderer/animationbackend/AnimationBackendCommitHook.cpp index 19898d233e6..4a00926b0e2 100644 --- a/packages/react-native/ReactCommon/react/renderer/animationbackend/AnimationBackendCommitHook.cpp +++ b/packages/react-native/ReactCommon/react/renderer/animationbackend/AnimationBackendCommitHook.cpp @@ -35,8 +35,8 @@ RootShadowNode::Unshared AnimationBackendCommitHook::shadowTreeWillCommit( if (surfaceFamilies.empty()) { return newRootShadowNode; } - return std::static_pointer_cast( - newRootShadowNode->cloneMultiple( + auto clonedRootShadowNode = + std::static_pointer_cast(newRootShadowNode->cloneMultiple( surfaceFamilies, [&surfaceFamilies, &updates]( const ShadowNode& shadowNode, @@ -73,6 +73,12 @@ RootShadowNode::Unshared AnimationBackendCommitHook::shadowTreeWillCommit( .state = shadowNode.getState(), .runtimeShadowNodeReference = true}); })); + + if (clonedRootShadowNode == nullptr) { + return newRootShadowNode; + } + + return clonedRootShadowNode; } } // namespace facebook::react diff --git a/packages/react-native/ReactCommon/react/renderer/core/ShadowNode.cpp b/packages/react-native/ReactCommon/react/renderer/core/ShadowNode.cpp index 1490d874654..9b704b1a3eb 100644 --- a/packages/react-native/ReactCommon/react/renderer/core/ShadowNode.cpp +++ b/packages/react-native/ReactCommon/react/renderer/core/ShadowNode.cpp @@ -471,7 +471,7 @@ std::shared_ptr ShadowNode::cloneMultiple( } } - if (childrenCount.empty()) { + if (!childrenCount.contains(&this->getFamily())) { return nullptr; } diff --git a/packages/react-native/ReactCommon/react/renderer/core/tests/ShadowNodeTest.cpp b/packages/react-native/ReactCommon/react/renderer/core/tests/ShadowNodeTest.cpp index 2ac02a75c3e..bc4c5eb2b54 100644 --- a/packages/react-native/ReactCommon/react/renderer/core/tests/ShadowNodeTest.cpp +++ b/packages/react-native/ReactCommon/react/renderer/core/tests/ShadowNodeTest.cpp @@ -374,3 +374,58 @@ TEST_F(ShadowNodeTest, cloneMultipleWithSingleFamily) { EXPECT_EQ(newNodeABA->getTag(), nodeABA_->getTag()); EXPECT_EQ(newNodeABA.get(), nodeABA_.get()); } + +TEST_F(ShadowNodeTest, cloneMultipleReturnsNullptrWhenFamilyHasNoPathToRoot) { + auto newProps = std::make_shared(); + // nodeZ_ is not part of nodeA_'s tree + auto result = nodeA_->cloneMultiple( + {&nodeZ_->getFamily()}, + [&](const ShadowNode& oldShadowNode, const ShadowNodeFragment& fragment) { + return oldShadowNode.clone({ + .props = newProps, + .children = fragment.children, + .state = fragment.state, + }); + }); + + // cloneMultiple should return nullptr when the family has no path to the root + EXPECT_EQ(result, nullptr); +} + +TEST_F(ShadowNodeTest, cloneMultipleWithMixOfValidAndInvalidFamilies) { + auto newProps = std::make_shared(); + // nodeAB_ is in the tree, nodeZ_ is not + auto result = nodeA_->cloneMultiple( + {&nodeAB_->getFamily(), &nodeZ_->getFamily()}, + [&](const ShadowNode& oldShadowNode, const ShadowNodeFragment& fragment) { + return oldShadowNode.clone({ + .props = newProps, + .children = fragment.children, + .state = fragment.state, + }); + }); + + // Should still succeed and clone the valid family (nodeAB_) + EXPECT_NE(result, nullptr); + EXPECT_EQ(result->getTag(), nodeA_->getTag()); + EXPECT_EQ(result->getProps(), newProps); + + auto newNodeAB = result->getChildren()[1]; + EXPECT_EQ(newNodeAB->getTag(), nodeAB_->getTag()); + EXPECT_EQ(newNodeAB->getProps(), newProps); +} + +TEST_F(ShadowNodeTest, cloneMultipleWithEmptyFamilySet) { + auto newProps = std::make_shared(); + auto result = nodeA_->cloneMultiple( + {}, + [&](const ShadowNode& oldShadowNode, const ShadowNodeFragment& fragment) { + return oldShadowNode.clone({ + .props = newProps, + .children = fragment.children, + .state = fragment.state, + }); + }); + + EXPECT_EQ(result, nullptr); +} From 369a817cf0aaace85a9b62064daaad337b0eb8b3 Mon Sep 17 00:00:00 2001 From: Pieter De Baets Date: Fri, 13 Feb 2026 02:50:43 -0800 Subject: [PATCH 355/585] Fix crash in RawPropsKeyMap::at() for out-of-bounds prop name lengths (#55534) Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/55534 Replace react_native_assert calls with real bounds checks in RawPropsKeyMap::at() and RawPropsKey::render() to prevent SIGILL/SIGTRAP crashes. In at(), an invalid length now returns kRawPropsValueIndexEmpty instead of trapping. In render(), an overlong prop name is clamped to kPropNameLengthHardCap - 1 instead of asserting. Changelog: [Internal] Reviewed By: mdvacca Differential Revision: D93094839 fbshipit-source-id: 29250d06cb93e84507000551a7a60a09f2df8288 --- .../react/renderer/core/RawPropsKey.cpp | 28 ++++++++----------- .../react/renderer/core/RawPropsKeyMap.cpp | 5 +++- 2 files changed, 15 insertions(+), 18 deletions(-) diff --git a/packages/react-native/ReactCommon/react/renderer/core/RawPropsKey.cpp b/packages/react-native/ReactCommon/react/renderer/core/RawPropsKey.cpp index 81ecb15e260..d1c46ebcadd 100644 --- a/packages/react-native/ReactCommon/react/renderer/core/RawPropsKey.cpp +++ b/packages/react-native/ReactCommon/react/renderer/core/RawPropsKey.cpp @@ -11,7 +11,6 @@ #include #include -#include #include namespace facebook::react { @@ -20,34 +19,29 @@ void RawPropsKey::render(char* buffer, RawPropsPropNameLength* length) const noexcept { *length = 0; - // Prefix + constexpr size_t maxLength = kPropNameLengthHardCap - 1; + + auto appendSegment = [&](const char* segment) { + auto copyLen = std::min(std::strlen(segment), maxLength - *length); + std::memcpy(buffer + *length, segment, copyLen); + *length += static_cast(copyLen); + }; + if (prefix != nullptr) { - auto prefixLength = - static_cast(std::strlen(prefix)); - std::memcpy(buffer, prefix, prefixLength); - *length = prefixLength; + appendSegment(prefix); } - // Name - auto nameLength = static_cast(std::strlen(name)); - std::memcpy(buffer + *length, name, nameLength); - *length += nameLength; + appendSegment(name); - // Suffix if (suffix != nullptr) { - auto suffixLength = - static_cast(std::strlen(suffix)); - std::memcpy(buffer + *length, suffix, suffixLength); - *length += suffixLength; + appendSegment(suffix); } - react_native_assert(*length < kPropNameLengthHardCap); } RawPropsKey::operator std::string() const noexcept { auto buffer = std::array(); RawPropsPropNameLength length = 0; render(buffer.data(), &length); - react_native_assert(length < kPropNameLengthHardCap); return std::string{buffer.data(), length}; } diff --git a/packages/react-native/ReactCommon/react/renderer/core/RawPropsKeyMap.cpp b/packages/react-native/ReactCommon/react/renderer/core/RawPropsKeyMap.cpp index d555e293304..81b0113658d 100644 --- a/packages/react-native/ReactCommon/react/renderer/core/RawPropsKeyMap.cpp +++ b/packages/react-native/ReactCommon/react/renderer/core/RawPropsKeyMap.cpp @@ -75,7 +75,7 @@ void RawPropsKeyMap::reindex() noexcept { buckets_.resize(kPropNameLengthHardCap); - auto length = RawPropsPropNameLength{0}; + RawPropsPropNameLength length = 0; for (size_t i = 0; i < items_.size(); i++) { auto& item = items_[i]; if (item.length != length) { @@ -96,6 +96,9 @@ RawPropsValueIndex RawPropsKeyMap::at( RawPropsPropNameLength length) noexcept { react_native_assert(length > 0); react_native_assert(length < kPropNameLengthHardCap); + if (length == 0 || length >= kPropNameLengthHardCap) [[unlikely]] { + return kRawPropsValueIndexEmpty; + } // 1. Find the bucket. auto lower = int{buckets_[length - 1]}; auto upper = int{buckets_[length]} - 1; From 30600f797d37d32efe05f2fd3b884b577f35c5b6 Mon Sep 17 00:00:00 2001 From: Moti Zilberman Date: Fri, 13 Feb 2026 06:27:06 -0800 Subject: [PATCH 356/585] Add integration tests for multi-session Debugger.enable (#55542) Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/55542 Adds tests demonstrating that all target versions of Hermes (Legacy Hermes, Static Hermes stable, Static Hermes trunk) support multi-session debugging when integrated into React Native's CDP backend. Changelog: [Internal] Reviewed By: hoxyq Differential Revision: D90888853 fbshipit-source-id: 7ea1be837bde6d71ae2bca2b1487e00c62a44928 --- .../tests/JsiIntegrationTest.cpp | 67 +++++++++++++++++++ 1 file changed, 67 insertions(+) diff --git a/packages/react-native/ReactCommon/jsinspector-modern/tests/JsiIntegrationTest.cpp b/packages/react-native/ReactCommon/jsinspector-modern/tests/JsiIntegrationTest.cpp index 83e697d6d72..a88593eca56 100644 --- a/packages/react-native/ReactCommon/jsinspector-modern/tests/JsiIntegrationTest.cpp +++ b/packages/react-native/ReactCommon/jsinspector-modern/tests/JsiIntegrationTest.cpp @@ -738,6 +738,73 @@ TYPED_TEST(JsiIntegrationHermesTest, ResolveColumnBreakpointAfterReload) { scriptInfo->value()["params"]["scriptId"]); } +TYPED_TEST(JsiIntegrationHermesTest, TwoConnectionsEnableDebugger) { + this->connect(); + auto secondary = this->connectSecondary(); + + EXPECT_CALL( + this->fromPage(), onMessage(JsonEq(R"({"id": 1, "result": {}})"))); + EXPECT_CALL( + secondary.fromPage(), onMessage(JsonEq(R"({"id": 2, "result": {}})"))); + + this->toPage_->sendMessage(R"({"id": 1, "method": "Debugger.enable"})"); + secondary.toPage().sendMessage(R"({"id": 2, "method": "Debugger.enable"})"); +} + +TYPED_TEST(JsiIntegrationHermesTest, TwoConnectionsDebuggerLifecycle) { + this->connect(); + auto secondary = this->connectSecondary(); + + this->expectMessageFromPage(JsonEq(R"({"id": 1, "result": {}})")); + this->toPage_->sendMessage(R"({"id": 1, "method": "Debugger.enable"})"); + + // Connections: Main (Debugger enabled), Secondary (Debugger disabled) + // --> Only the main connection receives Debugger events. + this->expectMessageFromPage(JsonParsed(AllOf( + AtJsonPtr("/method", "Debugger.scriptParsed"), + AtJsonPtr("/params/url", "script1.js")))); + this->eval("1 + 1; //# sourceURL=script1.js"); + + // Connections: Main (Debugger enabled), Secondary (Debugger being enabled) + // --> The secondary connection receives buffered Debugger events. + EXPECT_CALL( + secondary.fromPage(), onMessage(JsonEq(R"({"id": 2, "result": {}})"))); + EXPECT_CALL( + secondary.fromPage(), + onMessage(JsonParsed(AllOf( + AtJsonPtr("/method", "Debugger.scriptParsed"), + AtJsonPtr("/params/url", "script1.js"))))); + secondary.toPage().sendMessage(R"({"id": 2, "method": "Debugger.enable"})"); + + // Connections: Main (Debugger enabled), Secondary (Debugger enabled) + // --> Both connections receive Debugger events. + this->expectMessageFromPage(JsonParsed(AllOf( + AtJsonPtr("/method", "Debugger.scriptParsed"), + AtJsonPtr("/params/url", "script2.js")))); + EXPECT_CALL( + secondary.fromPage(), + onMessage(JsonParsed(AllOf( + AtJsonPtr("/method", "Debugger.scriptParsed"), + AtJsonPtr("/params/url", "script2.js"))))); + this->eval("2 + 2; //# sourceURL=script2.js"); + + this->expectMessageFromPage(JsonEq(R"({"id": 3, "result": {}})")); + this->toPage_->sendMessage(R"({"id": 3, "method": "Debugger.disable"})"); + + // Connections: Main (Debugger disabled), Secondary (Debugger enabled) + // --> Only the secondary connection receives Debugger events. + EXPECT_CALL( + secondary.fromPage(), + onMessage(JsonParsed(AllOf( + AtJsonPtr("/method", "Debugger.scriptParsed"), + AtJsonPtr("/params/url", "script3.js"))))); + this->eval("3 + 3; //# sourceURL=script3.js"); + + EXPECT_CALL( + secondary.fromPage(), onMessage(JsonEq(R"({"id": 4, "result": {}})"))); + secondary.toPage().sendMessage(R"({"id": 4, "method": "Debugger.disable"})"); +} + TYPED_TEST(JsiIntegrationHermesTest, CDPAgentReentrancyRegressionTest) { this->connect(); From a08b2d2226d0bc39ba9406db71c8509e09791422 Mon Sep 17 00:00:00 2001 From: Rob Hogan Date: Fri, 13 Feb 2026 07:11:13 -0800 Subject: [PATCH 357/585] Bump some babel deps (code-frame,generator,parser,template,traverse,types) to latest minors (#55543) Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/55543 @public This diff updates several Babel packages to their latest versions: - `babel/code-frame`: 7.29.0 - `babel/generator`: 7.29.1 - `babel/parser`: 7.29.0 - `babel/template`: 7.28.6 - `babel/traverse`: 7.29.0 - `babel/types`: 7.29.0 Not bumping `core` or `runtime` here because they're a bit more involved, and I'm mainly interested in `traverse`. The packages here are the closure of traverse's dependency graph. Changelog: [Internal] Reviewed By: yungsters Differential Revision: D92983519 fbshipit-source-id: 9f2e71fb5d453606c697d52539f0056b7a29bc45 --- flow-typed/npm/babel-types_v7.x.x.js | 12 +-- package.json | 2 +- packages/babel-plugin-codegen/package.json | 2 +- packages/react-native-codegen/package.json | 2 +- yarn.lock | 113 ++++++++------------- 5 files changed, 52 insertions(+), 79 deletions(-) diff --git a/flow-typed/npm/babel-types_v7.x.x.js b/flow-typed/npm/babel-types_v7.x.x.js index d8d45313b9c..00aaa15964b 100644 --- a/flow-typed/npm/babel-types_v7.x.x.js +++ b/flow-typed/npm/babel-types_v7.x.x.js @@ -786,8 +786,8 @@ declare type BabelNodeExportAllDeclaration = { loc: ?BabelNodeSourceLocation, type: "ExportAllDeclaration"; source: BabelNodeStringLiteral; - assertions?: Array; attributes?: Array; + assertions?: Array; exportKind?: "type" | "value"; }; @@ -814,8 +814,8 @@ declare type BabelNodeExportNamedDeclaration = { declaration?: BabelNodeDeclaration; specifiers?: Array; source?: BabelNodeStringLiteral; - assertions?: Array; attributes?: Array; + assertions?: Array; exportKind?: "type" | "value"; }; @@ -856,8 +856,8 @@ declare type BabelNodeImportDeclaration = { type: "ImportDeclaration"; specifiers: Array; source: BabelNodeStringLiteral; - assertions?: Array; attributes?: Array; + assertions?: Array; importKind?: "type" | "typeof" | "value"; module?: boolean; phase?: "source" | "defer"; @@ -3310,12 +3310,12 @@ declare module "@babel/types" { declare export function classBody(body: Array): BabelNodeClassBody; declare export function classExpression(id?: BabelNodeIdentifier, superClass?: BabelNodeExpression, body: BabelNodeClassBody, decorators?: Array): BabelNodeClassExpression; declare export function classDeclaration(id?: BabelNodeIdentifier, superClass?: BabelNodeExpression, body: BabelNodeClassBody, decorators?: Array): BabelNodeClassDeclaration; - declare export function exportAllDeclaration(source: BabelNodeStringLiteral): BabelNodeExportAllDeclaration; + declare export function exportAllDeclaration(source: BabelNodeStringLiteral, attributes?: Array): BabelNodeExportAllDeclaration; declare export function exportDefaultDeclaration(declaration: BabelNodeTSDeclareFunction | BabelNodeFunctionDeclaration | BabelNodeClassDeclaration | BabelNodeExpression): BabelNodeExportDefaultDeclaration; - declare export function exportNamedDeclaration(declaration?: BabelNodeDeclaration, specifiers?: Array, source?: BabelNodeStringLiteral): BabelNodeExportNamedDeclaration; + declare export function exportNamedDeclaration(declaration?: BabelNodeDeclaration, specifiers?: Array, source?: BabelNodeStringLiteral, attributes?: Array): BabelNodeExportNamedDeclaration; declare export function exportSpecifier(local: BabelNodeIdentifier, exported: BabelNodeIdentifier | BabelNodeStringLiteral): BabelNodeExportSpecifier; declare export function forOfStatement(left: BabelNodeVariableDeclaration | BabelNodeLVal, right: BabelNodeExpression, body: BabelNodeStatement, _await?: boolean): BabelNodeForOfStatement; - declare export function importDeclaration(specifiers: Array, source: BabelNodeStringLiteral): BabelNodeImportDeclaration; + declare export function importDeclaration(specifiers: Array, source: BabelNodeStringLiteral, attributes?: Array): BabelNodeImportDeclaration; declare export function importDefaultSpecifier(local: BabelNodeIdentifier): BabelNodeImportDefaultSpecifier; declare export function importNamespaceSpecifier(local: BabelNodeIdentifier): BabelNodeImportNamespaceSpecifier; declare export function importSpecifier(local: BabelNodeIdentifier, imported: BabelNodeIdentifier | BabelNodeStringLiteral): BabelNodeImportSpecifier; diff --git a/package.json b/package.json index e12a41e4b34..9fef34a83d2 100644 --- a/package.json +++ b/package.json @@ -46,7 +46,7 @@ "devDependencies": { "@babel/core": "^7.25.2", "@babel/eslint-parser": "^7.25.1", - "@babel/generator": "^7.25.0", + "@babel/generator": "^7.29.1", "@babel/plugin-syntax-typescript": "^7.25.4", "@babel/plugin-transform-regenerator": "^7.24.7", "@babel/preset-env": "^7.25.3", diff --git a/packages/babel-plugin-codegen/package.json b/packages/babel-plugin-codegen/package.json index 144b0a62f55..4a50dd44f55 100644 --- a/packages/babel-plugin-codegen/package.json +++ b/packages/babel-plugin-codegen/package.json @@ -25,7 +25,7 @@ "index.js" ], "dependencies": { - "@babel/traverse": "^7.25.3", + "@babel/traverse": "^7.29.0", "@react-native/codegen": "0.85.0-main" }, "devDependencies": { diff --git a/packages/react-native-codegen/package.json b/packages/react-native-codegen/package.json index b6135a79021..09196af1f85 100644 --- a/packages/react-native-codegen/package.json +++ b/packages/react-native-codegen/package.json @@ -30,7 +30,7 @@ ], "dependencies": { "@babel/core": "^7.25.2", - "@babel/parser": "^7.25.3", + "@babel/parser": "^7.29.0", "hermes-parser": "0.33.3", "invariant": "^2.2.4", "nullthrows": "^1.1.1", diff --git a/yarn.lock b/yarn.lock index 8f53fbda65c..424b5709150 100644 --- a/yarn.lock +++ b/yarn.lock @@ -10,12 +10,12 @@ "@jridgewell/gen-mapping" "^0.3.5" "@jridgewell/trace-mapping" "^0.3.24" -"@babel/code-frame@^7.0.0", "@babel/code-frame@^7.12.13", "@babel/code-frame@^7.16.0", "@babel/code-frame@^7.24.7", "@babel/code-frame@^7.26.2", "@babel/code-frame@^7.27.1": - version "7.27.1" - resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.27.1.tgz#200f715e66d52a23b221a9435534a91cc13ad5be" - integrity sha512-cjQ7ZlQ0Mv3b47hABuTevyTuYN4i+loJKGeV9flcCgIK37cCXRh+L1bd3iBHlynerhQ7BhCkn2BPbQUL+rGqFg== +"@babel/code-frame@^7.0.0", "@babel/code-frame@^7.12.13", "@babel/code-frame@^7.16.0", "@babel/code-frame@^7.24.7", "@babel/code-frame@^7.27.1", "@babel/code-frame@^7.28.6", "@babel/code-frame@^7.29.0": + version "7.29.0" + resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.29.0.tgz#7cd7a59f15b3cc0dcd803038f7792712a7d0b15c" + integrity sha512-9NhCeYjq9+3uxgdtp20LSiJXJvN0FeCtNGpJxuMFZ1Kv3cWUNb6DOhJwUvcVCzKGR66cw4njwM6hrJLqgOwbcw== dependencies: - "@babel/helper-validator-identifier" "^7.27.1" + "@babel/helper-validator-identifier" "^7.28.5" js-tokens "^4.0.0" picocolors "^1.1.1" @@ -54,24 +54,13 @@ eslint-visitor-keys "^2.1.0" semver "^6.3.1" -"@babel/generator@^7.25.0", "@babel/generator@^7.28.0", "@babel/generator@^7.7.2": - version "7.28.0" - resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.28.0.tgz#9cc2f7bd6eb054d77dc66c2664148a0c5118acd2" - integrity sha512-lJjzvrbEeWrhB4P3QBsH7tey117PjLZnDbLiQEKjQ/fNJTjuq4HSqgFA+UNSwZT8D7dxxbnuSBMsa1lrWzKlQg== +"@babel/generator@^7.25.0", "@babel/generator@^7.28.0", "@babel/generator@^7.29.0", "@babel/generator@^7.29.1", "@babel/generator@^7.7.2": + version "7.29.1" + resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.29.1.tgz#d09876290111abbb00ef962a7b83a5307fba0d50" + integrity sha512-qsaF+9Qcm2Qv8SRIMMscAvG4O3lJ0F1GuMo5HR/Bp02LopNgnZBC/EkbevHFeGs4ls/oPz9v+Bsmzbkbe+0dUw== dependencies: - "@babel/parser" "^7.28.0" - "@babel/types" "^7.28.0" - "@jridgewell/gen-mapping" "^0.3.12" - "@jridgewell/trace-mapping" "^0.3.28" - jsesc "^3.0.2" - -"@babel/generator@^7.26.9": - version "7.28.3" - resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.28.3.tgz#9626c1741c650cbac39121694a0f2d7451b8ef3e" - integrity sha512-3lSpxGgvnmZznmBkCRnVREPUFJv2wrv9iAoFDvADJc0ypmdOxdUtcLeBgBJ6zE0PMeTKnxeQzyk0xTBq4Ep7zw== - dependencies: - "@babel/parser" "^7.28.3" - "@babel/types" "^7.28.2" + "@babel/parser" "^7.29.0" + "@babel/types" "^7.29.0" "@jridgewell/gen-mapping" "^0.3.12" "@jridgewell/trace-mapping" "^0.3.28" jsesc "^3.0.2" @@ -205,6 +194,11 @@ resolved "https://registry.yarnpkg.com/@babel/helper-validator-identifier/-/helper-validator-identifier-7.27.1.tgz#a7054dcc145a967dd4dc8fee845a57c1316c9df8" integrity sha512-D2hP9eA+Sqx1kBZgzxZh0y1trbuU+JoDkiEwqhQ36nodYqJwyEIhPSdMNd7lOm/4io72luTPWH20Yda0xOuUow== +"@babel/helper-validator-identifier@^7.28.5": + version "7.28.5" + resolved "https://registry.yarnpkg.com/@babel/helper-validator-identifier/-/helper-validator-identifier-7.28.5.tgz#010b6938fab7cb7df74aa2bbc06aa503b8fe5fb4" + integrity sha512-qSs4ifwzKJSV39ucNjsvc6WVHs6b7S03sOh2OcHF9UHfVPqWWALUsNUVzhSBiItjRZoLHx7nIarVjqKVusUZ1Q== + "@babel/helper-validator-option@^7.25.9", "@babel/helper-validator-option@^7.27.1": version "7.27.1" resolved "https://registry.yarnpkg.com/@babel/helper-validator-option/-/helper-validator-option-7.27.1.tgz#fa52f5b1e7db1ab049445b421c4471303897702f" @@ -227,19 +221,19 @@ "@babel/template" "^7.27.2" "@babel/types" "^7.27.6" -"@babel/parser@^7.1.0", "@babel/parser@^7.14.7", "@babel/parser@^7.20.7", "@babel/parser@^7.23.9", "@babel/parser@^7.24.4", "@babel/parser@^7.25.3", "@babel/parser@^7.27.2", "@babel/parser@^7.28.0": +"@babel/parser@^7.1.0", "@babel/parser@^7.14.7", "@babel/parser@^7.20.7", "@babel/parser@^7.23.9", "@babel/parser@^7.24.4", "@babel/parser@^7.25.3", "@babel/parser@^7.28.0": version "7.28.0" resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.28.0.tgz#979829fbab51a29e13901e5a80713dbcb840825e" integrity sha512-jVZGvOxOuNSsuQuLRTh13nU0AogFlw32w/MT+LV6D3sP5WdbW61E77RnkbaO2dUvmPAYrBDJXGn5gGS6tH4j8g== dependencies: "@babel/types" "^7.28.0" -"@babel/parser@^7.26.9", "@babel/parser@^7.28.3": - version "7.28.3" - resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.28.3.tgz#d2d25b814621bca5fe9d172bc93792547e7a2a71" - integrity sha512-7+Ey1mAgYqFAx2h0RuoxcQT5+MlG3GTV0TQrgr7/ZliKsm/MNDxVVutlWaziMq7wJNAz8MTqz55XLpWvva6StA== +"@babel/parser@^7.28.6", "@babel/parser@^7.29.0": + version "7.29.0" + resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.29.0.tgz#669ef345add7d057e92b7ed15f0bac07611831b6" + integrity sha512-IyDgFV5GeDUVX4YdF/3CPULtVGSXXMLh1xVIgdCgxApktqnQV0r7/8Nqthg+8YLGaAtdyIlo2qIdZrbCv4+7ww== dependencies: - "@babel/types" "^7.28.2" + "@babel/types" "^7.29.0" "@babel/plugin-bugfix-firefox-class-in-computed-class-key@^7.25.9": version "7.25.9" @@ -1034,56 +1028,35 @@ dependencies: regenerator-runtime "^0.14.0" -"@babel/template@^7.25.0", "@babel/template@^7.25.9", "@babel/template@^7.26.9", "@babel/template@^7.27.2", "@babel/template@^7.3.3": - version "7.27.2" - resolved "https://registry.yarnpkg.com/@babel/template/-/template-7.27.2.tgz#fa78ceed3c4e7b63ebf6cb39e5852fca45f6809d" - integrity sha512-LPDZ85aEJyYSd18/DkjNh4/y1ntkE5KwUHWTiqgRxruuZL2F1yuHligVHLvcHY2vMHXttKFpJn6LwfI7cw7ODw== +"@babel/template@^7.25.0", "@babel/template@^7.25.9", "@babel/template@^7.27.2", "@babel/template@^7.28.6", "@babel/template@^7.3.3": + version "7.28.6" + resolved "https://registry.yarnpkg.com/@babel/template/-/template-7.28.6.tgz#0e7e56ecedb78aeef66ce7972b082fce76a23e57" + integrity sha512-YA6Ma2KsCdGb+WC6UpBVFJGXL58MDA6oyONbjyF/+5sBgxY/dwkhLogbMT2GXXyU84/IhRw/2D1Os1B/giz+BQ== dependencies: - "@babel/code-frame" "^7.27.1" - "@babel/parser" "^7.27.2" - "@babel/types" "^7.27.1" - -"@babel/traverse--for-generate-function-map@npm:@babel/traverse@^7.25.3", "@babel/traverse@^7.25.3", "@babel/traverse@^7.25.9", "@babel/traverse@^7.26.8": - version "7.26.9" - resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.26.9.tgz#4398f2394ba66d05d988b2ad13c219a2c857461a" - integrity sha512-ZYW7L+pL8ahU5fXmNbPF+iZFHCv5scFak7MZ9bwaRPLUhHh7QQEMjZUg0HevihoqCM5iSYHN61EyCoZvqC+bxg== - dependencies: - "@babel/code-frame" "^7.26.2" - "@babel/generator" "^7.26.9" - "@babel/parser" "^7.26.9" - "@babel/template" "^7.26.9" - "@babel/types" "^7.26.9" - debug "^4.3.1" - globals "^11.1.0" + "@babel/code-frame" "^7.28.6" + "@babel/parser" "^7.28.6" + "@babel/types" "^7.28.6" -"@babel/traverse@^7.27.1", "@babel/traverse@^7.27.3", "@babel/traverse@^7.28.0": - version "7.28.0" - resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.28.0.tgz#518aa113359b062042379e333db18380b537e34b" - integrity sha512-mGe7UK5wWyh0bKRfupsUchrQGqvDbZDbKJw+kcRGSmdHVYrv+ltd0pnpDTVpiTqnaBru9iEvA8pz8W46v0Amwg== +"@babel/traverse--for-generate-function-map@npm:@babel/traverse@^7.25.3", "@babel/traverse@^7.25.3", "@babel/traverse@^7.25.9", "@babel/traverse@^7.26.8", "@babel/traverse@^7.27.1", "@babel/traverse@^7.27.3", "@babel/traverse@^7.28.0", "@babel/traverse@^7.29.0": + version "7.29.0" + resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.29.0.tgz#f323d05001440253eead3c9c858adbe00b90310a" + integrity sha512-4HPiQr0X7+waHfyXPZpWPfWL/J7dcN1mx9gL6WdQVMbPnF3+ZhSMs8tCxN7oHddJE9fhNE7+lxdnlyemKfJRuA== dependencies: - "@babel/code-frame" "^7.27.1" - "@babel/generator" "^7.28.0" + "@babel/code-frame" "^7.29.0" + "@babel/generator" "^7.29.0" "@babel/helper-globals" "^7.28.0" - "@babel/parser" "^7.28.0" - "@babel/template" "^7.27.2" - "@babel/types" "^7.28.0" + "@babel/parser" "^7.29.0" + "@babel/template" "^7.28.6" + "@babel/types" "^7.29.0" debug "^4.3.1" -"@babel/types@^7.0.0", "@babel/types@^7.20.7", "@babel/types@^7.25.2", "@babel/types@^7.25.9", "@babel/types@^7.27.1", "@babel/types@^7.27.3", "@babel/types@^7.27.6", "@babel/types@^7.28.0", "@babel/types@^7.3.3", "@babel/types@^7.4.4": - version "7.28.0" - resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.28.0.tgz#2fd0159a6dc7353933920c43136335a9b264d950" - integrity sha512-jYnje+JyZG5YThjHiF28oT4SIZLnYOcSBb6+SDaFIyzDVSkXQmQQYclJ2R+YxcdmK0AX6x1E5OQNtuh3jHDrUg== +"@babel/types@^7.0.0", "@babel/types@^7.20.7", "@babel/types@^7.25.2", "@babel/types@^7.25.9", "@babel/types@^7.27.1", "@babel/types@^7.27.3", "@babel/types@^7.27.6", "@babel/types@^7.28.0", "@babel/types@^7.28.6", "@babel/types@^7.29.0", "@babel/types@^7.3.3", "@babel/types@^7.4.4": + version "7.29.0" + resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.29.0.tgz#9f5b1e838c446e72cf3cd4b918152b8c605e37c7" + integrity sha512-LwdZHpScM4Qz8Xw2iKSzS+cfglZzJGvofQICy7W7v4caru4EaAmyUuO6BGrbyQ2mYV11W0U8j5mBhd14dd3B0A== dependencies: "@babel/helper-string-parser" "^7.27.1" - "@babel/helper-validator-identifier" "^7.27.1" - -"@babel/types@^7.26.9", "@babel/types@^7.28.2": - version "7.28.2" - resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.28.2.tgz#da9db0856a9a88e0a13b019881d7513588cf712b" - integrity sha512-ruv7Ae4J5dUYULmeXw1gmb7rYRz57OWCPM57pHojnLq/3Z1CK2lNSLTCVjxVk1F/TZHwOZZrOWi0ur95BbLxNQ== - dependencies: - "@babel/helper-string-parser" "^7.27.1" - "@babel/helper-validator-identifier" "^7.27.1" + "@babel/helper-validator-identifier" "^7.28.5" "@bcoe/v8-coverage@^0.2.3": version "0.2.3" From a308014d879dffc142335aff344ace2bfd77eb26 Mon Sep 17 00:00:00 2001 From: Emily Brown Date: Fri, 13 Feb 2026 09:37:44 -0800 Subject: [PATCH 358/585] Suppress LogBox during performance tracing (#55470) Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/55470 LogBox errors and warnings can affect performance trace measurements by triggering UI updates during profiling. This change adds a mechanism to suppress LogBox messages when CDP performance tracing is active. It clears the logbox when tracing starts and drops messages during tracing The implementation consists of: 1. **Native observer infrastructure** (`RuntimeTarget.cpp/h`, `RuntimeTargetPerformanceTracerObserver.cpp/h`): `RuntimeTarget` subscribes to the `PerformanceTracer` singleton's state changes and forwards them into JavaScript. It uses helper functions in `RuntimeTargetPerformanceTracerObserver` to install a `__PERFORMANCE_TRACER_OBSERVER__` object on the JavaScript global (a global because it needs to exist before the module system initializes), which tracks tracing state and notifies subscribers via `onTracingStateChange`. 2. **JavaScript observer** (`PerformanceTracerObserver.js`): Provides a clean API to check tracing status (`isTracing()`) and subscribe to state changes. Gracefully handles environments where native support isn't available. 3. **LogBox integration** (`LogBoxData.js`): Subscribes to the performance tracer observer and: - Clears all LogBox messages when tracing starts - Skips logging new errors and exceptions while tracing is active This ensures trace measurements are not impacted by LogBox UI rendering during profiling sessions. Changelog: [GENERAL] [CHANGED] - Suppress LogBox warnings and errors during CDP performance tracing Reviewed By: hoxyq Differential Revision: D92527815 fbshipit-source-id: 975e042766194d9702be2c9e222fd452bb99d841 --- .../Libraries/LogBox/Data/LogBoxData.js | 20 +++ .../LogBox/Data/__tests__/LogBoxData-test.js | 133 +++++++++++++++++ .../jsinspector-modern/RuntimeAgent.cpp | 6 + .../jsinspector-modern/RuntimeTarget.cpp | 24 ++- .../jsinspector-modern/RuntimeTarget.h | 19 +++ .../RuntimeTargetTracingStateObserver.cpp | 27 ++++ .../RuntimeTargetTracingStateObserver.h | 27 ++++ .../rndevtools/GlobalStateObserver.js | 10 +- .../rndevtools/TracingStateObserver.js | 28 ++++ .../__tests__/TracingStateObserver-test.js | 139 ++++++++++++++++++ 10 files changed, 428 insertions(+), 5 deletions(-) create mode 100644 packages/react-native/ReactCommon/jsinspector-modern/RuntimeTargetTracingStateObserver.cpp create mode 100644 packages/react-native/ReactCommon/jsinspector-modern/RuntimeTargetTracingStateObserver.h create mode 100644 packages/react-native/src/private/devsupport/rndevtools/TracingStateObserver.js create mode 100644 packages/react-native/src/private/devsupport/rndevtools/__tests__/TracingStateObserver-test.js diff --git a/packages/react-native/Libraries/LogBox/Data/LogBoxData.js b/packages/react-native/Libraries/LogBox/Data/LogBoxData.js index de1ff3a5cc0..94b632e431c 100644 --- a/packages/react-native/Libraries/LogBox/Data/LogBoxData.js +++ b/packages/react-native/Libraries/LogBox/Data/LogBoxData.js @@ -14,6 +14,7 @@ import type {Stack} from './LogBoxSymbolication'; import type {Category, ExtendedExceptionData, Message} from './parseLogBoxLog'; import DebuggerSessionObserver from '../../../src/private/devsupport/rndevtools/FuseboxSessionObserver'; +import TracingStateObserver from '../../../src/private/devsupport/rndevtools/TracingStateObserver'; import toExtendedError from '../../../src/private/utilities/toExtendedError'; import parseErrorStack from '../../Core/Devtools/parseErrorStack'; import NativeLogBox from '../../NativeModules/specs/NativeLogBox'; @@ -71,6 +72,7 @@ let _isDisabled = false; let _selectedIndex = -1; let hasShownFuseboxWarningsMigrationMessage = false; let hostTargetSessionObserverSubscription = null; +let tracingStateObserverSubscription = null; let warningFilter: WarningFilter = function (format) { return { @@ -205,6 +207,20 @@ export function addLog(log: LogData): void { ); } + if (tracingStateObserverSubscription == null) { + tracingStateObserverSubscription = TracingStateObserver.subscribe( + isTracing => { + if (isTracing) { + clear(); + } + }, + ); + } + + if (TracingStateObserver.isTracing()) { + return; + } + // If Host has Fusebox support if (log.level === 'warn' && global.__FUSEBOX_HAS_FULL_CONSOLE_SUPPORT__) { // And there is no active debugging session @@ -241,6 +257,10 @@ export function addLog(log: LogData): void { } export function addException(error: ExtendedExceptionData): void { + if (TracingStateObserver.isTracing()) { + return; + } + // Parsing logs are expensive so we schedule this // otherwise spammy logs would pause rendering. setImmediate(() => { diff --git a/packages/react-native/Libraries/LogBox/Data/__tests__/LogBoxData-test.js b/packages/react-native/Libraries/LogBox/Data/__tests__/LogBoxData-test.js index e7880ef8c38..15d955b2094 100644 --- a/packages/react-native/Libraries/LogBox/Data/__tests__/LogBoxData-test.js +++ b/packages/react-native/Libraries/LogBox/Data/__tests__/LogBoxData-test.js @@ -721,4 +721,137 @@ describe('LogBoxData', () => { LogBoxData.setAppInfo(() => info); expect(LogBoxData.getAppInfo()).toBe(info); }); + + describe('Performance tracing suppression', () => { + let mockIsTracing: () => boolean; + let mockSubscribeCallback: ((isTracing: boolean) => void) | null = null; + + beforeEach(() => { + mockIsTracing = jest.fn(() => false); + mockSubscribeCallback = null; + + jest.doMock( + '../../../../src/private/devsupport/rndevtools/TracingStateObserver', + () => ({ + __esModule: true, + default: { + isTracing: () => mockIsTracing(), + subscribe: (callback: (isTracing: boolean) => void) => { + mockSubscribeCallback = callback; + return () => { + mockSubscribeCallback = null; + }; + }, + }, + }), + ); + + jest.resetModules(); + }); + + afterEach(() => { + jest.unmock( + '../../../../src/private/devsupport/rndevtools/TracingStateObserver', + ); + }); + + it('suppresses logs when performance tracing is active', () => { + const LogBoxDataWithMock = require('../LogBoxData'); + + LogBoxDataWithMock.addLog({ + level: 'warn', + message: {content: 'Before tracing', substitutions: []}, + category: 'before-tracing', + componentStack: [], + }); + jest.runOnlyPendingTimers(); + + const observerBefore = jest.fn(); + LogBoxDataWithMock.observe(observerBefore).unsubscribe(); + expect(Array.from(observerBefore.mock.calls[0][0].logs).length).toBe(1); + + mockIsTracing = jest.fn(() => true); + + LogBoxDataWithMock.addLog({ + level: 'warn', + message: {content: 'During tracing', substitutions: []}, + category: 'during-tracing', + componentStack: [], + }); + jest.runOnlyPendingTimers(); + + const observerDuring = jest.fn(); + LogBoxDataWithMock.observe(observerDuring).unsubscribe(); + expect(Array.from(observerDuring.mock.calls[0][0].logs).length).toBe(1); + }); + + it('suppresses exceptions when performance tracing is active', () => { + const LogBoxDataWithMock = require('../LogBoxData'); + + LogBoxDataWithMock.addException({ + message: 'Before tracing exception', + isComponentError: false, + originalMessage: 'Before tracing exception', + name: 'console.error', + componentStack: '', + stack: [], + id: 0, + isFatal: false, + }); + jest.runOnlyPendingTimers(); + + const observerBefore = jest.fn(); + LogBoxDataWithMock.observe(observerBefore).unsubscribe(); + expect(Array.from(observerBefore.mock.calls[0][0].logs).length).toBe(1); + + mockIsTracing = jest.fn(() => true); + + LogBoxDataWithMock.addException({ + message: 'During tracing exception', + isComponentError: false, + originalMessage: 'During tracing exception', + name: 'console.error', + componentStack: '', + stack: [], + id: 1, + isFatal: false, + }); + jest.runOnlyPendingTimers(); + + const observerDuring = jest.fn(); + LogBoxDataWithMock.observe(observerDuring).unsubscribe(); + expect(Array.from(observerDuring.mock.calls[0][0].logs).length).toBe(1); + }); + + it('clears logs when tracing starts', () => { + const LogBoxDataWithMock = require('../LogBoxData'); + + LogBoxDataWithMock.addLog({ + level: 'warn', + message: {content: 'Log 1', substitutions: []}, + category: 'log-1', + componentStack: [], + }); + LogBoxDataWithMock.addLog({ + level: 'warn', + message: {content: 'Log 2', substitutions: []}, + category: 'log-2', + componentStack: [], + }); + jest.runOnlyPendingTimers(); + + const observerBefore = jest.fn(); + LogBoxDataWithMock.observe(observerBefore).unsubscribe(); + expect(Array.from(observerBefore.mock.calls[0][0].logs).length).toBe(2); + + if (mockSubscribeCallback) { + mockSubscribeCallback(true); + } + jest.runOnlyPendingTimers(); + + const observerAfter = jest.fn(); + LogBoxDataWithMock.observe(observerAfter).unsubscribe(); + expect(Array.from(observerAfter.mock.calls[0][0].logs).length).toBe(0); + }); + }); }); diff --git a/packages/react-native/ReactCommon/jsinspector-modern/RuntimeAgent.cpp b/packages/react-native/ReactCommon/jsinspector-modern/RuntimeAgent.cpp index 819f9205e7a..24b89fa9336 100644 --- a/packages/react-native/ReactCommon/jsinspector-modern/RuntimeAgent.cpp +++ b/packages/react-native/ReactCommon/jsinspector-modern/RuntimeAgent.cpp @@ -155,9 +155,15 @@ RuntimeTracingAgent::RuntimeTracingAgent( if (state.enabledCategories.contains(tracing::Category::JavaScriptSampling)) { targetController_.enableSamplingProfiler(); } + if (state.mode == tracing::Mode::CDP) { + targetController_.emitTracingStateChange(true); + } } RuntimeTracingAgent::~RuntimeTracingAgent() { + if (state_.mode == tracing::Mode::CDP) { + targetController_.emitTracingStateChange(false); + } if (state_.enabledCategories.contains( tracing::Category::JavaScriptSampling)) { targetController_.disableSamplingProfiler(); diff --git a/packages/react-native/ReactCommon/jsinspector-modern/RuntimeTarget.cpp b/packages/react-native/ReactCommon/jsinspector-modern/RuntimeTarget.cpp index 1a1807696fb..317f1e1ae55 100644 --- a/packages/react-native/ReactCommon/jsinspector-modern/RuntimeTarget.cpp +++ b/packages/react-native/ReactCommon/jsinspector-modern/RuntimeTarget.cpp @@ -9,7 +9,7 @@ #include #include -#include +#include #include @@ -43,6 +43,7 @@ void RuntimeTarget::installGlobals() { // NOTE: RuntimeTarget::installDebuggerSessionObserver is in // RuntimeTargetDebuggerSessionObserver.cpp installDebuggerSessionObserver(); + installTracingStateObserver(); // NOTE: RuntimeTarget::installNetworkReporterAPI is in // RuntimeTargetNetwork.cpp installNetworkReporterAPI(); @@ -157,6 +158,23 @@ void RuntimeTarget::emitDebuggerSessionDestroyed() { }); } +void RuntimeTarget::installTracingStateObserver() { + jsExecutor_([](jsi::Runtime& runtime) { + jsinspector_modern::installTracingStateObserver(runtime); + }); +} + +void RuntimeTarget::emitTracingStateChange(bool isTracing) { + jsExecutor_([isTracing](jsi::Runtime& runtime) { + try { + emitTracingStateObserverChange(runtime, isTracing); + } catch (jsi::JSError&) { + // Suppress any errors, they should not be visible to the user + // and should not affect runtime. + } + }); +} + void RuntimeTarget::enableSamplingProfiler() { delegate_.enableSamplingProfiler(); } @@ -275,6 +293,10 @@ RuntimeTargetController::collectSamplingProfile() { return target_.collectSamplingProfile(); } +void RuntimeTargetController::emitTracingStateChange(bool isTracing) { + target_.emitTracingStateChange(isTracing); +} + void RuntimeTargetController::notifyDomainStateChanged( Domain domain, bool enabled, diff --git a/packages/react-native/ReactCommon/jsinspector-modern/RuntimeTarget.h b/packages/react-native/ReactCommon/jsinspector-modern/RuntimeTarget.h index 7312baac0db..14f28919054 100644 --- a/packages/react-native/ReactCommon/jsinspector-modern/RuntimeTarget.h +++ b/packages/react-native/ReactCommon/jsinspector-modern/RuntimeTarget.h @@ -21,6 +21,7 @@ #include #include +#include #include #ifndef JSINSPECTOR_EXPORT @@ -147,6 +148,11 @@ class RuntimeTargetController { */ tracing::RuntimeSamplingProfile collectSamplingProfile(); + /** + * Emits a tracing state change to JavaScript via the tracing state observer. + */ + void emitTracingStateChange(bool isTracing); + private: RuntimeTarget &target_; }; @@ -262,6 +268,7 @@ class JSINSPECTOR_EXPORT RuntimeTarget : public EnableExecutorFromThis tracingAgent_; + /** * Start sampling profiler for a particular JavaScript runtime. */ @@ -304,6 +311,13 @@ class JSINSPECTOR_EXPORT RuntimeTarget : public EnableExecutorFromThis + +namespace facebook::react::jsinspector_modern { + +void installTracingStateObserver(jsi::Runtime& runtime) { + installGlobalStateObserver( + runtime, + "__TRACING_STATE_OBSERVER__", + "isTracing", + "onTracingStateChange"); +} + +void emitTracingStateObserverChange(jsi::Runtime& runtime, bool isTracing) { + emitGlobalStateObserverChange( + runtime, "__TRACING_STATE_OBSERVER__", "onTracingStateChange", isTracing); +} + +} // namespace facebook::react::jsinspector_modern diff --git a/packages/react-native/ReactCommon/jsinspector-modern/RuntimeTargetTracingStateObserver.h b/packages/react-native/ReactCommon/jsinspector-modern/RuntimeTargetTracingStateObserver.h new file mode 100644 index 00000000000..95f1595e883 --- /dev/null +++ b/packages/react-native/ReactCommon/jsinspector-modern/RuntimeTargetTracingStateObserver.h @@ -0,0 +1,27 @@ +/* + * 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 + +namespace facebook::react::jsinspector_modern { + +/** + * Installs __TRACING_STATE_OBSERVER__ object on the JavaScript's global + * object, which can be referenced from JavaScript side for determining the + * status of performance tracing. + */ +void installTracingStateObserver(jsi::Runtime &runtime); + +/** + * Emits the tracing state change to JavaScript by calling onTracingStateChange + * on __TRACING_STATE_OBSERVER__. + */ +void emitTracingStateObserverChange(jsi::Runtime &runtime, bool isTracing); + +} // namespace facebook::react::jsinspector_modern diff --git a/packages/react-native/src/private/devsupport/rndevtools/GlobalStateObserver.js b/packages/react-native/src/private/devsupport/rndevtools/GlobalStateObserver.js index 2a802c83429..dc1988a4c80 100644 --- a/packages/react-native/src/private/devsupport/rndevtools/GlobalStateObserver.js +++ b/packages/react-native/src/private/devsupport/rndevtools/GlobalStateObserver.js @@ -21,18 +21,20 @@ * This class provides a JS-friendly API over that global object. */ class GlobalStateObserver { - #hasNativeSupport: boolean; #globalName: string; #statusProperty: string; constructor(globalName: string, statusProperty: string) { this.#globalName = globalName; this.#statusProperty = statusProperty; - this.#hasNativeSupport = global.hasOwnProperty(globalName); + } + + #hasNativeSupport(): boolean { + return global.hasOwnProperty(this.#globalName); } getStatus(): boolean { - if (!this.#hasNativeSupport) { + if (!this.#hasNativeSupport()) { return false; } @@ -40,7 +42,7 @@ class GlobalStateObserver { } subscribe(callback: (status: boolean) => void): () => void { - if (!this.#hasNativeSupport) { + if (!this.#hasNativeSupport()) { return () => {}; } diff --git a/packages/react-native/src/private/devsupport/rndevtools/TracingStateObserver.js b/packages/react-native/src/private/devsupport/rndevtools/TracingStateObserver.js new file mode 100644 index 00000000000..821fc28a567 --- /dev/null +++ b/packages/react-native/src/private/devsupport/rndevtools/TracingStateObserver.js @@ -0,0 +1,28 @@ +/** + * 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 + * @format + */ + +import GlobalStateObserver from './GlobalStateObserver'; + +const observer = new GlobalStateObserver( + '__TRACING_STATE_OBSERVER__', + 'isTracing', +); + +const TracingStateObserver = { + isTracing(): boolean { + return observer.getStatus(); + }, + + subscribe(callback: (isTracing: boolean) => void): () => void { + return observer.subscribe(callback); + }, +}; + +export default TracingStateObserver; diff --git a/packages/react-native/src/private/devsupport/rndevtools/__tests__/TracingStateObserver-test.js b/packages/react-native/src/private/devsupport/rndevtools/__tests__/TracingStateObserver-test.js new file mode 100644 index 00000000000..d780def274e --- /dev/null +++ b/packages/react-native/src/private/devsupport/rndevtools/__tests__/TracingStateObserver-test.js @@ -0,0 +1,139 @@ +/** + * 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'; + +describe('TracingStateObserver', () => { + beforeEach(() => { + jest.resetModules(); + delete global.__TRACING_STATE_OBSERVER__; + }); + + describe('without native support', () => { + it('isTracing returns false when native observer is not available', () => { + const TracingStateObserver = require('../TracingStateObserver').default; + expect(TracingStateObserver.isTracing()).toBe(false); + }); + + it('subscribe returns a no-op unsubscribe when native observer is not available', () => { + const TracingStateObserver = require('../TracingStateObserver').default; + const callback = jest.fn(); + const unsubscribe = TracingStateObserver.subscribe(callback); + + expect(typeof unsubscribe).toBe('function'); + + expect(() => unsubscribe()).not.toThrow(); + }); + }); + + describe('with native support', () => { + beforeEach(() => { + const mockSubscribers = new Set<(isTracing: boolean) => void>(); + global.__TRACING_STATE_OBSERVER__ = { + isTracing: false, + subscribers: mockSubscribers, + onTracingStateChange: (isTracing: boolean) => { + global.__TRACING_STATE_OBSERVER__.isTracing = isTracing; + mockSubscribers.forEach(callback => callback(isTracing)); + }, + }; + }); + + it('isTracing returns current tracing state', () => { + const TracingStateObserver = require('../TracingStateObserver').default; + + expect(TracingStateObserver.isTracing()).toBe(false); + + global.__TRACING_STATE_OBSERVER__.onTracingStateChange(true); + expect(TracingStateObserver.isTracing()).toBe(true); + + global.__TRACING_STATE_OBSERVER__.onTracingStateChange(false); + expect(TracingStateObserver.isTracing()).toBe(false); + }); + + it('subscribe adds callback to subscribers and returns unsubscribe function', () => { + const TracingStateObserver = require('../TracingStateObserver').default; + const callback = jest.fn(); + + const unsubscribe = TracingStateObserver.subscribe(callback); + + expect(global.__TRACING_STATE_OBSERVER__.subscribers.has(callback)).toBe( + true, + ); + + global.__TRACING_STATE_OBSERVER__.onTracingStateChange(true); + expect(callback).toHaveBeenCalledWith(true); + + unsubscribe(); + expect(global.__TRACING_STATE_OBSERVER__.subscribers.has(callback)).toBe( + false, + ); + + callback.mockClear(); + global.__TRACING_STATE_OBSERVER__.onTracingStateChange(false); + expect(callback).not.toHaveBeenCalled(); + }); + + it('multiple subscribers receive state changes', () => { + const TracingStateObserver = require('../TracingStateObserver').default; + const callback1 = jest.fn(); + const callback2 = jest.fn(); + + TracingStateObserver.subscribe(callback1); + TracingStateObserver.subscribe(callback2); + + global.__TRACING_STATE_OBSERVER__.onTracingStateChange(true); + + expect(callback1).toHaveBeenCalledWith(true); + expect(callback2).toHaveBeenCalledWith(true); + }); + }); + + describe('with late native support installation', () => { + it('detects native global installed after module load', () => { + const TracingStateObserver = require('../TracingStateObserver').default; + expect(TracingStateObserver.isTracing()).toBe(false); + + const mockSubscribers = new Set<(isTracing: boolean) => void>(); + global.__TRACING_STATE_OBSERVER__ = { + isTracing: true, + subscribers: mockSubscribers, + onTracingStateChange: (isTracing: boolean) => { + global.__TRACING_STATE_OBSERVER__.isTracing = isTracing; + mockSubscribers.forEach(cb => cb(isTracing)); + }, + }; + + expect(TracingStateObserver.isTracing()).toBe(true); + }); + + it('subscribes when native global is installed after module load', () => { + const TracingStateObserver = require('../TracingStateObserver').default; + + const mockSubscribers = new Set<(isTracing: boolean) => void>(); + global.__TRACING_STATE_OBSERVER__ = { + isTracing: false, + subscribers: mockSubscribers, + onTracingStateChange: (isTracing: boolean) => { + global.__TRACING_STATE_OBSERVER__.isTracing = isTracing; + mockSubscribers.forEach(cb => cb(isTracing)); + }, + }; + + const callback = jest.fn(); + TracingStateObserver.subscribe(callback); + + expect(mockSubscribers.has(callback)).toBe(true); + + global.__TRACING_STATE_OBSERVER__.onTracingStateChange(true); + expect(callback).toHaveBeenCalledWith(true); + }); + }); +}); From 6f54846a08025c05ab7c7bf514f189085cde7b18 Mon Sep 17 00:00:00 2001 From: Alexander Martinz Date: Fri, 13 Feb 2026 09:55:21 -0800 Subject: [PATCH 359/585] Allow overriding dev server ip via property (#55531) Summary: Similiar to how a specific port can be set also allow for setting a specific ip for the dev server. This allows for easy configuration to aid in generating [reproducible builds](https://izzyondroid.org/docs/reproducibleBuilds/). ## Changelog: [ANDROID] [ADDED] - Allow specifying dev server ip via gradle property Pull Request resolved: https://github.com/facebook/react-native/pull/55531 Test Plan: 1) Add `reactNativeDevServerIp=localhost` to `gradle.properties` 2) Generate an APK 3) Analyze the APK and check that the value of the string resource type `react_native_dev_server_ip` matches the value set in `gradle.properties`. Reviewed By: cortinico Differential Revision: D93143296 Pulled By: CalixTang fbshipit-source-id: d0be23e9495f0ba1a6034dc31b6e725fd94a6a02 --- .../kotlin/com/facebook/react/utils/AgpConfiguratorUtils.kt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/gradle-plugin/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/utils/AgpConfiguratorUtils.kt b/packages/gradle-plugin/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/utils/AgpConfiguratorUtils.kt index 2608e77f43f..c4a7b359d54 100644 --- a/packages/gradle-plugin/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/utils/AgpConfiguratorUtils.kt +++ b/packages/gradle-plugin/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/utils/AgpConfiguratorUtils.kt @@ -88,6 +88,7 @@ internal object AgpConfiguratorUtils { } fun configureDevServerLocation(project: Project) { + val devServerIp = project.properties["reactNativeDevServerIp"]?.toString() ?: getHostIpAddress() val devServerPort = project.properties["reactNativeDevServerPort"]?.toString() ?: DEFAULT_DEV_SERVER_PORT @@ -100,7 +101,7 @@ internal object AgpConfiguratorUtils { ext.defaultConfig.resValue( "string", "react_native_dev_server_ip", - getHostIpAddress(), + devServerIp, ) ext.defaultConfig.resValue("integer", "react_native_dev_server_port", devServerPort) } From 9eb68a5eec61773434d3cecadc3df6b499c68eb0 Mon Sep 17 00:00:00 2001 From: Fabrizio Cucci Date: Fri, 13 Feb 2026 10:44:18 -0800 Subject: [PATCH 360/585] Remove enableClipChildrenForOverflowHidden logic (#55546) Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/55546 Changelog: [Internal] It looks like we have completely misunderstood the semantic of `clipChildren`. Looking at the Android [source code](https://cs.android.com/android/platform/superproject/+/android-latest-release:frameworks/base/core/java/android/view/ViewGroup.java;l=4607?q=setClipToPadding&ss=android%2Fplatform%2Fsuperproject&fbclid=IwY2xjawP8LExleHRuA2FlbQIxMQBzcnRjBmFwcF9pZAEwAAEeQkZx96WcTaA0mIUVGXeFAxH_aLVBMR0an0N8jeKCYX4E-j9HW0eLnzZcSJI_aem__yWzHP0_x-bPxCQS1nN19w), it seems that `setClipChildren(true)` on a ViewGroup X means clipping **each child** to the **child's own bounds**, not the parent's bound. Which means also [this](https://www.internalfb.com/code/aosp-vendor-meta-coresdk/[oculus-14.0%3Af0b9166acbb68da2e1e9f7622ba1b7fcee672ebc]/api-src/volumetricwindow/java/horizonos/view/interaction/providers/ViewInteractionNodeProvider.java?lines=502) line in HzOS is based on the same incorrect assumption. Ultimately, RN should not be populating `clipChildren` when `overflow: hidden` is set. Reviewed By: javache Differential Revision: D93237429 fbshipit-source-id: 0c3b18c829ef3880f8cc931263792c50aafa1333 --- .../main/java/com/facebook/react/views/view/ReactViewGroup.kt | 3 --- 1 file changed, 3 deletions(-) diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/view/ReactViewGroup.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/view/ReactViewGroup.kt index 7248d895655..0276e369b13 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/view/ReactViewGroup.kt +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/view/ReactViewGroup.kt @@ -819,9 +819,6 @@ public open class ReactViewGroup public constructor(context: Context?) : } else { Overflow.fromString(overflow) } - if (ReactNativeFeatureFlags.enableClipChildrenForOverflowHidden()) { - clipChildren = (_overflow == Overflow.HIDDEN) - } invalidate() } From 7146c13bc01a7fb0649c2c657e403691b05d011b Mon Sep 17 00:00:00 2001 From: Fabrizio Cucci Date: Fri, 13 Feb 2026 10:44:18 -0800 Subject: [PATCH 361/585] Remove enableClipChildrenForOverflowHidden feature flag (#55547) Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/55547 Changelog: [Internal] It looks like we have completely misunderstood the semantic of `clipChildren`. Looking at the Android [source code](https://cs.android.com/android/platform/superproject/+/android-latest-release:frameworks/base/core/java/android/view/ViewGroup.java;l=4607?q=setClipToPadding&ss=android%2Fplatform%2Fsuperproject&fbclid=IwY2xjawP8LExleHRuA2FlbQIxMQBzcnRjBmFwcF9pZAEwAAEeQkZx96WcTaA0mIUVGXeFAxH_aLVBMR0an0N8jeKCYX4E-j9HW0eLnzZcSJI_aem__yWzHP0_x-bPxCQS1nN19w), it seems that `setClipChildren(true)` on a ViewGroup X means clipping **each child** to the **child's own bounds**, not the parent's bound. Which means also [this](https://www.internalfb.com/code/aosp-vendor-meta-coresdk/[oculus-14.0%3Af0b9166acbb68da2e1e9f7622ba1b7fcee672ebc]/api-src/volumetricwindow/java/horizonos/view/interaction/providers/ViewInteractionNodeProvider.java?lines=502) line in HzOS is based on the same incorrect assumption. Ultimately, RN should not be populating `clipChildren` when `overflow: hidden` is set. Reviewed By: Abbondanzo Differential Revision: D93238810 fbshipit-source-id: aff74b1f339fa707bcec1667580ce710a49f93dd --- .../featureflags/ReactNativeFeatureFlags.kt | 8 +- .../ReactNativeFeatureFlagsCxxAccessor.kt | 12 +- .../ReactNativeFeatureFlagsCxxInterop.kt | 4 +- .../ReactNativeFeatureFlagsDefaults.kt | 4 +- .../ReactNativeFeatureFlagsLocalAccessor.kt | 13 +- .../ReactNativeFeatureFlagsProvider.kt | 4 +- .../JReactNativeFeatureFlagsCxxInterop.cpp | 16 +- .../JReactNativeFeatureFlagsCxxInterop.h | 5 +- .../featureflags/ReactNativeFeatureFlags.cpp | 6 +- .../featureflags/ReactNativeFeatureFlags.h | 7 +- .../ReactNativeFeatureFlagsAccessor.cpp | 150 ++++++++---------- .../ReactNativeFeatureFlagsAccessor.h | 6 +- .../ReactNativeFeatureFlagsDefaults.h | 6 +- .../ReactNativeFeatureFlagsDynamicProvider.h | 11 +- .../ReactNativeFeatureFlagsProvider.h | 3 +- .../NativeReactNativeFeatureFlags.cpp | 7 +- .../NativeReactNativeFeatureFlags.h | 4 +- .../ReactNativeFeatureFlags.config.js | 10 -- .../featureflags/ReactNativeFeatureFlags.js | 7 +- .../specs/NativeReactNativeFeatureFlags.js | 3 +- 20 files changed, 85 insertions(+), 201 deletions(-) diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlags.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlags.kt index 5f5a9275d65..eff943289b1 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlags.kt +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlags.kt @@ -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<<4549fc9a4f431306b7dc70ef3903b8fd>> + * @generated SignedSource<<67ef2bd30983c949f41e014297dabd6e>> */ /** @@ -120,12 +120,6 @@ public object ReactNativeFeatureFlags { @JvmStatic public fun enableBridgelessArchitecture(): Boolean = accessor.enableBridgelessArchitecture() - /** - * When overflow: hidden is set, also set clipChildren to true so that clipped content does not occlude content outside the parent - */ - @JvmStatic - public fun enableClipChildrenForOverflowHidden(): Boolean = accessor.enableClipChildrenForOverflowHidden() - /** * Enable prop iterator setter-style construction of Props in C++ (this flag is not used in Java). */ diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsCxxAccessor.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsCxxAccessor.kt index 659be742cc7..77ce14c422c 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsCxxAccessor.kt +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsCxxAccessor.kt @@ -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<<0db6bbb173a96ab07c80a3fbe43671b3>> + * @generated SignedSource<> */ /** @@ -35,7 +35,6 @@ internal class ReactNativeFeatureFlagsCxxAccessor : ReactNativeFeatureFlagsAcces private var enableAndroidLinearTextCache: Boolean? = null private var enableAndroidTextMeasurementOptimizationsCache: Boolean? = null private var enableBridgelessArchitectureCache: Boolean? = null - private var enableClipChildrenForOverflowHiddenCache: Boolean? = null private var enableCppPropsIteratorSetterCache: Boolean? = null private var enableCustomFocusSearchOnClippedElementsAndroidCache: Boolean? = null private var enableDestroyShadowTreeRevisionAsyncCache: Boolean? = null @@ -237,15 +236,6 @@ internal class ReactNativeFeatureFlagsCxxAccessor : ReactNativeFeatureFlagsAcces return cached } - override fun enableClipChildrenForOverflowHidden(): Boolean { - var cached = enableClipChildrenForOverflowHiddenCache - if (cached == null) { - cached = ReactNativeFeatureFlagsCxxInterop.enableClipChildrenForOverflowHidden() - enableClipChildrenForOverflowHiddenCache = cached - } - return cached - } - override fun enableCppPropsIteratorSetter(): Boolean { var cached = enableCppPropsIteratorSetterCache if (cached == null) { diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsCxxInterop.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsCxxInterop.kt index d0f40e261e9..4e69d2adc4a 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsCxxInterop.kt +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsCxxInterop.kt @@ -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<> + * @generated SignedSource<> */ /** @@ -58,8 +58,6 @@ public object ReactNativeFeatureFlagsCxxInterop { @DoNotStrip @JvmStatic public external fun enableBridgelessArchitecture(): Boolean - @DoNotStrip @JvmStatic public external fun enableClipChildrenForOverflowHidden(): Boolean - @DoNotStrip @JvmStatic public external fun enableCppPropsIteratorSetter(): Boolean @DoNotStrip @JvmStatic public external fun enableCustomFocusSearchOnClippedElementsAndroid(): Boolean diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsDefaults.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsDefaults.kt index f344b30a174..474b3da78d6 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsDefaults.kt +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsDefaults.kt @@ -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<<102ac98a8c3f2c1a2150c223a099cf72>> + * @generated SignedSource<<62ddb63e95e2b2aff842c5d13210d742>> */ /** @@ -53,8 +53,6 @@ public open class ReactNativeFeatureFlagsDefaults : ReactNativeFeatureFlagsProvi override fun enableBridgelessArchitecture(): Boolean = false - override fun enableClipChildrenForOverflowHidden(): Boolean = false - override fun enableCppPropsIteratorSetter(): Boolean = false override fun enableCustomFocusSearchOnClippedElementsAndroid(): Boolean = true diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsLocalAccessor.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsLocalAccessor.kt index f3cbafc8ec5..2e6e246813a 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsLocalAccessor.kt +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsLocalAccessor.kt @@ -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<> + * @generated SignedSource<<477ec1cf98790b5219ed37092ae958cc>> */ /** @@ -39,7 +39,6 @@ internal class ReactNativeFeatureFlagsLocalAccessor : ReactNativeFeatureFlagsAcc private var enableAndroidLinearTextCache: Boolean? = null private var enableAndroidTextMeasurementOptimizationsCache: Boolean? = null private var enableBridgelessArchitectureCache: Boolean? = null - private var enableClipChildrenForOverflowHiddenCache: Boolean? = null private var enableCppPropsIteratorSetterCache: Boolean? = null private var enableCustomFocusSearchOnClippedElementsAndroidCache: Boolean? = null private var enableDestroyShadowTreeRevisionAsyncCache: Boolean? = null @@ -256,16 +255,6 @@ internal class ReactNativeFeatureFlagsLocalAccessor : ReactNativeFeatureFlagsAcc return cached } - override fun enableClipChildrenForOverflowHidden(): Boolean { - var cached = enableClipChildrenForOverflowHiddenCache - if (cached == null) { - cached = currentProvider.enableClipChildrenForOverflowHidden() - accessedFeatureFlags.add("enableClipChildrenForOverflowHidden") - enableClipChildrenForOverflowHiddenCache = cached - } - return cached - } - override fun enableCppPropsIteratorSetter(): Boolean { var cached = enableCppPropsIteratorSetterCache if (cached == null) { diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsProvider.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsProvider.kt index 3abb8b0778c..2eed3c97aba 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsProvider.kt +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsProvider.kt @@ -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<<50f2ea7e87e80a247b6c6ce8e2afd0ec>> + * @generated SignedSource<<4480d856ab56f2ecb216610b6e4ae31e>> */ /** @@ -53,8 +53,6 @@ public interface ReactNativeFeatureFlagsProvider { @DoNotStrip public fun enableBridgelessArchitecture(): Boolean - @DoNotStrip public fun enableClipChildrenForOverflowHidden(): Boolean - @DoNotStrip public fun enableCppPropsIteratorSetter(): Boolean @DoNotStrip public fun enableCustomFocusSearchOnClippedElementsAndroid(): Boolean diff --git a/packages/react-native/ReactAndroid/src/main/jni/react/featureflags/JReactNativeFeatureFlagsCxxInterop.cpp b/packages/react-native/ReactAndroid/src/main/jni/react/featureflags/JReactNativeFeatureFlagsCxxInterop.cpp index ccbb1be9cdf..91657979e42 100644 --- a/packages/react-native/ReactAndroid/src/main/jni/react/featureflags/JReactNativeFeatureFlagsCxxInterop.cpp +++ b/packages/react-native/ReactAndroid/src/main/jni/react/featureflags/JReactNativeFeatureFlagsCxxInterop.cpp @@ -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<<0460a8b25bfb176e47fb12dc091b1961>> + * @generated SignedSource<<176845e66b87994db4a9199df21740c0>> */ /** @@ -129,12 +129,6 @@ class ReactNativeFeatureFlagsJavaProvider return method(javaProvider_); } - bool enableClipChildrenForOverflowHidden() override { - static const auto method = - getReactNativeFeatureFlagsProviderJavaClass()->getMethod("enableClipChildrenForOverflowHidden"); - return method(javaProvider_); - } - bool enableCppPropsIteratorSetter() override { static const auto method = getReactNativeFeatureFlagsProviderJavaClass()->getMethod("enableCppPropsIteratorSetter"); @@ -604,11 +598,6 @@ bool JReactNativeFeatureFlagsCxxInterop::enableBridgelessArchitecture( return ReactNativeFeatureFlags::enableBridgelessArchitecture(); } -bool JReactNativeFeatureFlagsCxxInterop::enableClipChildrenForOverflowHidden( - facebook::jni::alias_ref /*unused*/) { - return ReactNativeFeatureFlags::enableClipChildrenForOverflowHidden(); -} - bool JReactNativeFeatureFlagsCxxInterop::enableCppPropsIteratorSetter( facebook::jni::alias_ref /*unused*/) { return ReactNativeFeatureFlags::enableCppPropsIteratorSetter(); @@ -1010,9 +999,6 @@ void JReactNativeFeatureFlagsCxxInterop::registerNatives() { makeNativeMethod( "enableBridgelessArchitecture", JReactNativeFeatureFlagsCxxInterop::enableBridgelessArchitecture), - makeNativeMethod( - "enableClipChildrenForOverflowHidden", - JReactNativeFeatureFlagsCxxInterop::enableClipChildrenForOverflowHidden), makeNativeMethod( "enableCppPropsIteratorSetter", JReactNativeFeatureFlagsCxxInterop::enableCppPropsIteratorSetter), diff --git a/packages/react-native/ReactAndroid/src/main/jni/react/featureflags/JReactNativeFeatureFlagsCxxInterop.h b/packages/react-native/ReactAndroid/src/main/jni/react/featureflags/JReactNativeFeatureFlagsCxxInterop.h index 37ef763ce1a..651ee6f8647 100644 --- a/packages/react-native/ReactAndroid/src/main/jni/react/featureflags/JReactNativeFeatureFlagsCxxInterop.h +++ b/packages/react-native/ReactAndroid/src/main/jni/react/featureflags/JReactNativeFeatureFlagsCxxInterop.h @@ -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<<88f40502abd13f8f57015429dd087519>> + * @generated SignedSource<<4078cafe7570b1478adc0b278a25155a>> */ /** @@ -75,9 +75,6 @@ class JReactNativeFeatureFlagsCxxInterop static bool enableBridgelessArchitecture( facebook::jni::alias_ref); - static bool enableClipChildrenForOverflowHidden( - facebook::jni::alias_ref); - static bool enableCppPropsIteratorSetter( facebook::jni::alias_ref); diff --git a/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlags.cpp b/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlags.cpp index b48a7e48ba0..932769fb954 100644 --- a/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlags.cpp +++ b/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlags.cpp @@ -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<> + * @generated SignedSource<> */ /** @@ -86,10 +86,6 @@ bool ReactNativeFeatureFlags::enableBridgelessArchitecture() { return getAccessor().enableBridgelessArchitecture(); } -bool ReactNativeFeatureFlags::enableClipChildrenForOverflowHidden() { - return getAccessor().enableClipChildrenForOverflowHidden(); -} - bool ReactNativeFeatureFlags::enableCppPropsIteratorSetter() { return getAccessor().enableCppPropsIteratorSetter(); } diff --git a/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlags.h b/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlags.h index f42f4d26f23..70ae43f8f37 100644 --- a/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlags.h +++ b/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlags.h @@ -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<<51a4817654c04c979a33f44e42312dd5>> + * @generated SignedSource<> */ /** @@ -114,11 +114,6 @@ class ReactNativeFeatureFlags { */ RN_EXPORT static bool enableBridgelessArchitecture(); - /** - * When overflow: hidden is set, also set clipChildren to true so that clipped content does not occlude content outside the parent - */ - RN_EXPORT static bool enableClipChildrenForOverflowHidden(); - /** * Enable prop iterator setter-style construction of Props in C++ (this flag is not used in Java). */ diff --git a/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlagsAccessor.cpp b/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlagsAccessor.cpp index 7c2cc35cb5a..4741bba3d35 100644 --- a/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlagsAccessor.cpp +++ b/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlagsAccessor.cpp @@ -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<> + * @generated SignedSource<> */ /** @@ -299,24 +299,6 @@ bool ReactNativeFeatureFlagsAccessor::enableBridgelessArchitecture() { return flagValue.value(); } -bool ReactNativeFeatureFlagsAccessor::enableClipChildrenForOverflowHidden() { - auto flagValue = enableClipChildrenForOverflowHidden_.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(15, "enableClipChildrenForOverflowHidden"); - - flagValue = currentProvider_->enableClipChildrenForOverflowHidden(); - enableClipChildrenForOverflowHidden_ = flagValue; - } - - return flagValue.value(); -} - bool ReactNativeFeatureFlagsAccessor::enableCppPropsIteratorSetter() { auto flagValue = enableCppPropsIteratorSetter_.load(); @@ -326,7 +308,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(16, "enableCppPropsIteratorSetter"); + markFlagAsAccessed(15, "enableCppPropsIteratorSetter"); flagValue = currentProvider_->enableCppPropsIteratorSetter(); enableCppPropsIteratorSetter_ = flagValue; @@ -344,7 +326,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(17, "enableCustomFocusSearchOnClippedElementsAndroid"); + markFlagAsAccessed(16, "enableCustomFocusSearchOnClippedElementsAndroid"); flagValue = currentProvider_->enableCustomFocusSearchOnClippedElementsAndroid(); enableCustomFocusSearchOnClippedElementsAndroid_ = flagValue; @@ -362,7 +344,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(18, "enableDestroyShadowTreeRevisionAsync"); + markFlagAsAccessed(17, "enableDestroyShadowTreeRevisionAsync"); flagValue = currentProvider_->enableDestroyShadowTreeRevisionAsync(); enableDestroyShadowTreeRevisionAsync_ = flagValue; @@ -380,7 +362,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(19, "enableDoubleMeasurementFixAndroid"); + markFlagAsAccessed(18, "enableDoubleMeasurementFixAndroid"); flagValue = currentProvider_->enableDoubleMeasurementFixAndroid(); enableDoubleMeasurementFixAndroid_ = flagValue; @@ -398,7 +380,7 @@ bool ReactNativeFeatureFlagsAccessor::enableEagerMainQueueModulesOnIOS() { // be accessing the provider multiple times but the end state of this // instance and the returned flag value would be the same. - markFlagAsAccessed(20, "enableEagerMainQueueModulesOnIOS"); + markFlagAsAccessed(19, "enableEagerMainQueueModulesOnIOS"); flagValue = currentProvider_->enableEagerMainQueueModulesOnIOS(); enableEagerMainQueueModulesOnIOS_ = flagValue; @@ -416,7 +398,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(21, "enableEagerRootViewAttachment"); + markFlagAsAccessed(20, "enableEagerRootViewAttachment"); flagValue = currentProvider_->enableEagerRootViewAttachment(); enableEagerRootViewAttachment_ = flagValue; @@ -434,7 +416,7 @@ bool ReactNativeFeatureFlagsAccessor::enableExclusivePropsUpdateAndroid() { // be accessing the provider multiple times but the end state of this // instance and the returned flag value would be the same. - markFlagAsAccessed(22, "enableExclusivePropsUpdateAndroid"); + markFlagAsAccessed(21, "enableExclusivePropsUpdateAndroid"); flagValue = currentProvider_->enableExclusivePropsUpdateAndroid(); enableExclusivePropsUpdateAndroid_ = flagValue; @@ -452,7 +434,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(23, "enableFabricLogs"); + markFlagAsAccessed(22, "enableFabricLogs"); flagValue = currentProvider_->enableFabricLogs(); enableFabricLogs_ = flagValue; @@ -470,7 +452,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(24, "enableFabricRenderer"); + markFlagAsAccessed(23, "enableFabricRenderer"); flagValue = currentProvider_->enableFabricRenderer(); enableFabricRenderer_ = flagValue; @@ -488,7 +470,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(25, "enableFontScaleChangesUpdatingLayout"); + markFlagAsAccessed(24, "enableFontScaleChangesUpdatingLayout"); flagValue = currentProvider_->enableFontScaleChangesUpdatingLayout(); enableFontScaleChangesUpdatingLayout_ = flagValue; @@ -506,7 +488,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(26, "enableIOSTextBaselineOffsetPerLine"); + markFlagAsAccessed(25, "enableIOSTextBaselineOffsetPerLine"); flagValue = currentProvider_->enableIOSTextBaselineOffsetPerLine(); enableIOSTextBaselineOffsetPerLine_ = flagValue; @@ -524,7 +506,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(27, "enableIOSViewClipToPaddingBox"); + markFlagAsAccessed(26, "enableIOSViewClipToPaddingBox"); flagValue = currentProvider_->enableIOSViewClipToPaddingBox(); enableIOSViewClipToPaddingBox_ = flagValue; @@ -542,7 +524,7 @@ bool ReactNativeFeatureFlagsAccessor::enableImagePrefetchingAndroid() { // be accessing the provider multiple times but the end state of this // instance and the returned flag value would be the same. - markFlagAsAccessed(28, "enableImagePrefetchingAndroid"); + markFlagAsAccessed(27, "enableImagePrefetchingAndroid"); flagValue = currentProvider_->enableImagePrefetchingAndroid(); enableImagePrefetchingAndroid_ = flagValue; @@ -560,7 +542,7 @@ bool ReactNativeFeatureFlagsAccessor::enableImagePrefetchingJNIBatchingAndroid() // be accessing the provider multiple times but the end state of this // instance and the returned flag value would be the same. - markFlagAsAccessed(29, "enableImagePrefetchingJNIBatchingAndroid"); + markFlagAsAccessed(28, "enableImagePrefetchingJNIBatchingAndroid"); flagValue = currentProvider_->enableImagePrefetchingJNIBatchingAndroid(); enableImagePrefetchingJNIBatchingAndroid_ = flagValue; @@ -578,7 +560,7 @@ bool ReactNativeFeatureFlagsAccessor::enableImagePrefetchingOnUiThreadAndroid() // be accessing the provider multiple times but the end state of this // instance and the returned flag value would be the same. - markFlagAsAccessed(30, "enableImagePrefetchingOnUiThreadAndroid"); + markFlagAsAccessed(29, "enableImagePrefetchingOnUiThreadAndroid"); flagValue = currentProvider_->enableImagePrefetchingOnUiThreadAndroid(); enableImagePrefetchingOnUiThreadAndroid_ = flagValue; @@ -596,7 +578,7 @@ bool ReactNativeFeatureFlagsAccessor::enableImmediateUpdateModeForContentOffsetC // be accessing the provider multiple times but the end state of this // instance and the returned flag value would be the same. - markFlagAsAccessed(31, "enableImmediateUpdateModeForContentOffsetChanges"); + markFlagAsAccessed(30, "enableImmediateUpdateModeForContentOffsetChanges"); flagValue = currentProvider_->enableImmediateUpdateModeForContentOffsetChanges(); enableImmediateUpdateModeForContentOffsetChanges_ = flagValue; @@ -614,7 +596,7 @@ bool ReactNativeFeatureFlagsAccessor::enableImperativeFocus() { // be accessing the provider multiple times but the end state of this // instance and the returned flag value would be the same. - markFlagAsAccessed(32, "enableImperativeFocus"); + markFlagAsAccessed(31, "enableImperativeFocus"); flagValue = currentProvider_->enableImperativeFocus(); enableImperativeFocus_ = flagValue; @@ -632,7 +614,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(33, "enableInteropViewManagerClassLookUpOptimizationIOS"); + markFlagAsAccessed(32, "enableInteropViewManagerClassLookUpOptimizationIOS"); flagValue = currentProvider_->enableInteropViewManagerClassLookUpOptimizationIOS(); enableInteropViewManagerClassLookUpOptimizationIOS_ = flagValue; @@ -650,7 +632,7 @@ bool ReactNativeFeatureFlagsAccessor::enableIntersectionObserverByDefault() { // be accessing the provider multiple times but the end state of this // instance and the returned flag value would be the same. - markFlagAsAccessed(34, "enableIntersectionObserverByDefault"); + markFlagAsAccessed(33, "enableIntersectionObserverByDefault"); flagValue = currentProvider_->enableIntersectionObserverByDefault(); enableIntersectionObserverByDefault_ = flagValue; @@ -668,7 +650,7 @@ bool ReactNativeFeatureFlagsAccessor::enableKeyEvents() { // be accessing the provider multiple times but the end state of this // instance and the returned flag value would be the same. - markFlagAsAccessed(35, "enableKeyEvents"); + markFlagAsAccessed(34, "enableKeyEvents"); flagValue = currentProvider_->enableKeyEvents(); enableKeyEvents_ = flagValue; @@ -686,7 +668,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(36, "enableLayoutAnimationsOnAndroid"); + markFlagAsAccessed(35, "enableLayoutAnimationsOnAndroid"); flagValue = currentProvider_->enableLayoutAnimationsOnAndroid(); enableLayoutAnimationsOnAndroid_ = flagValue; @@ -704,7 +686,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(37, "enableLayoutAnimationsOnIOS"); + markFlagAsAccessed(36, "enableLayoutAnimationsOnIOS"); flagValue = currentProvider_->enableLayoutAnimationsOnIOS(); enableLayoutAnimationsOnIOS_ = flagValue; @@ -722,7 +704,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(38, "enableMainQueueCoordinatorOnIOS"); + markFlagAsAccessed(37, "enableMainQueueCoordinatorOnIOS"); flagValue = currentProvider_->enableMainQueueCoordinatorOnIOS(); enableMainQueueCoordinatorOnIOS_ = flagValue; @@ -740,7 +722,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(39, "enableModuleArgumentNSNullConversionIOS"); + markFlagAsAccessed(38, "enableModuleArgumentNSNullConversionIOS"); flagValue = currentProvider_->enableModuleArgumentNSNullConversionIOS(); enableModuleArgumentNSNullConversionIOS_ = flagValue; @@ -758,7 +740,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(40, "enableNativeCSSParsing"); + markFlagAsAccessed(39, "enableNativeCSSParsing"); flagValue = currentProvider_->enableNativeCSSParsing(); enableNativeCSSParsing_ = flagValue; @@ -776,7 +758,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(41, "enableNetworkEventReporting"); + markFlagAsAccessed(40, "enableNetworkEventReporting"); flagValue = currentProvider_->enableNetworkEventReporting(); enableNetworkEventReporting_ = flagValue; @@ -794,7 +776,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(42, "enablePreparedTextLayout"); + markFlagAsAccessed(41, "enablePreparedTextLayout"); flagValue = currentProvider_->enablePreparedTextLayout(); enablePreparedTextLayout_ = flagValue; @@ -812,7 +794,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(43, "enablePropsUpdateReconciliationAndroid"); + markFlagAsAccessed(42, "enablePropsUpdateReconciliationAndroid"); flagValue = currentProvider_->enablePropsUpdateReconciliationAndroid(); enablePropsUpdateReconciliationAndroid_ = flagValue; @@ -830,7 +812,7 @@ bool ReactNativeFeatureFlagsAccessor::enableSwiftUIBasedFilters() { // be accessing the provider multiple times but the end state of this // instance and the returned flag value would be the same. - markFlagAsAccessed(44, "enableSwiftUIBasedFilters"); + markFlagAsAccessed(43, "enableSwiftUIBasedFilters"); flagValue = currentProvider_->enableSwiftUIBasedFilters(); enableSwiftUIBasedFilters_ = flagValue; @@ -848,7 +830,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(45, "enableViewCulling"); + markFlagAsAccessed(44, "enableViewCulling"); flagValue = currentProvider_->enableViewCulling(); enableViewCulling_ = flagValue; @@ -866,7 +848,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(46, "enableViewRecycling"); + markFlagAsAccessed(45, "enableViewRecycling"); flagValue = currentProvider_->enableViewRecycling(); enableViewRecycling_ = flagValue; @@ -884,7 +866,7 @@ bool ReactNativeFeatureFlagsAccessor::enableViewRecyclingForImage() { // be accessing the provider multiple times but the end state of this // instance and the returned flag value would be the same. - markFlagAsAccessed(47, "enableViewRecyclingForImage"); + markFlagAsAccessed(46, "enableViewRecyclingForImage"); flagValue = currentProvider_->enableViewRecyclingForImage(); enableViewRecyclingForImage_ = flagValue; @@ -902,7 +884,7 @@ bool ReactNativeFeatureFlagsAccessor::enableViewRecyclingForScrollView() { // be accessing the provider multiple times but the end state of this // instance and the returned flag value would be the same. - markFlagAsAccessed(48, "enableViewRecyclingForScrollView"); + markFlagAsAccessed(47, "enableViewRecyclingForScrollView"); flagValue = currentProvider_->enableViewRecyclingForScrollView(); enableViewRecyclingForScrollView_ = flagValue; @@ -920,7 +902,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(49, "enableViewRecyclingForText"); + markFlagAsAccessed(48, "enableViewRecyclingForText"); flagValue = currentProvider_->enableViewRecyclingForText(); enableViewRecyclingForText_ = flagValue; @@ -938,7 +920,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(50, "enableViewRecyclingForView"); + markFlagAsAccessed(49, "enableViewRecyclingForView"); flagValue = currentProvider_->enableViewRecyclingForView(); enableViewRecyclingForView_ = flagValue; @@ -956,7 +938,7 @@ bool ReactNativeFeatureFlagsAccessor::enableVirtualViewContainerStateExperimenta // be accessing the provider multiple times but the end state of this // instance and the returned flag value would be the same. - markFlagAsAccessed(51, "enableVirtualViewContainerStateExperimental"); + markFlagAsAccessed(50, "enableVirtualViewContainerStateExperimental"); flagValue = currentProvider_->enableVirtualViewContainerStateExperimental(); enableVirtualViewContainerStateExperimental_ = flagValue; @@ -974,7 +956,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(52, "enableVirtualViewDebugFeatures"); + markFlagAsAccessed(51, "enableVirtualViewDebugFeatures"); flagValue = currentProvider_->enableVirtualViewDebugFeatures(); enableVirtualViewDebugFeatures_ = flagValue; @@ -992,7 +974,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(53, "fixMappingOfEventPrioritiesBetweenFabricAndReact"); + markFlagAsAccessed(52, "fixMappingOfEventPrioritiesBetweenFabricAndReact"); flagValue = currentProvider_->fixMappingOfEventPrioritiesBetweenFabricAndReact(); fixMappingOfEventPrioritiesBetweenFabricAndReact_ = flagValue; @@ -1010,7 +992,7 @@ bool ReactNativeFeatureFlagsAccessor::fixTextClippingAndroid15useBoundsForWidth( // be accessing the provider multiple times but the end state of this // instance and the returned flag value would be the same. - markFlagAsAccessed(54, "fixTextClippingAndroid15useBoundsForWidth"); + markFlagAsAccessed(53, "fixTextClippingAndroid15useBoundsForWidth"); flagValue = currentProvider_->fixTextClippingAndroid15useBoundsForWidth(); fixTextClippingAndroid15useBoundsForWidth_ = flagValue; @@ -1028,7 +1010,7 @@ bool ReactNativeFeatureFlagsAccessor::fuseboxAssertSingleHostState() { // be accessing the provider multiple times but the end state of this // instance and the returned flag value would be the same. - markFlagAsAccessed(55, "fuseboxAssertSingleHostState"); + markFlagAsAccessed(54, "fuseboxAssertSingleHostState"); flagValue = currentProvider_->fuseboxAssertSingleHostState(); fuseboxAssertSingleHostState_ = flagValue; @@ -1046,7 +1028,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(56, "fuseboxEnabledRelease"); + markFlagAsAccessed(55, "fuseboxEnabledRelease"); flagValue = currentProvider_->fuseboxEnabledRelease(); fuseboxEnabledRelease_ = flagValue; @@ -1064,7 +1046,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(57, "fuseboxNetworkInspectionEnabled"); + markFlagAsAccessed(56, "fuseboxNetworkInspectionEnabled"); flagValue = currentProvider_->fuseboxNetworkInspectionEnabled(); fuseboxNetworkInspectionEnabled_ = flagValue; @@ -1082,7 +1064,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(58, "hideOffscreenVirtualViewsOnIOS"); + markFlagAsAccessed(57, "hideOffscreenVirtualViewsOnIOS"); flagValue = currentProvider_->hideOffscreenVirtualViewsOnIOS(); hideOffscreenVirtualViewsOnIOS_ = flagValue; @@ -1100,7 +1082,7 @@ bool ReactNativeFeatureFlagsAccessor::overrideBySynchronousMountPropsAtMountingA // be accessing the provider multiple times but the end state of this // instance and the returned flag value would be the same. - markFlagAsAccessed(59, "overrideBySynchronousMountPropsAtMountingAndroid"); + markFlagAsAccessed(58, "overrideBySynchronousMountPropsAtMountingAndroid"); flagValue = currentProvider_->overrideBySynchronousMountPropsAtMountingAndroid(); overrideBySynchronousMountPropsAtMountingAndroid_ = flagValue; @@ -1118,7 +1100,7 @@ bool ReactNativeFeatureFlagsAccessor::perfIssuesEnabled() { // be accessing the provider multiple times but the end state of this // instance and the returned flag value would be the same. - markFlagAsAccessed(60, "perfIssuesEnabled"); + markFlagAsAccessed(59, "perfIssuesEnabled"); flagValue = currentProvider_->perfIssuesEnabled(); perfIssuesEnabled_ = flagValue; @@ -1136,7 +1118,7 @@ bool ReactNativeFeatureFlagsAccessor::perfMonitorV2Enabled() { // be accessing the provider multiple times but the end state of this // instance and the returned flag value would be the same. - markFlagAsAccessed(61, "perfMonitorV2Enabled"); + markFlagAsAccessed(60, "perfMonitorV2Enabled"); flagValue = currentProvider_->perfMonitorV2Enabled(); perfMonitorV2Enabled_ = flagValue; @@ -1154,7 +1136,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(62, "preparedTextCacheSize"); + markFlagAsAccessed(61, "preparedTextCacheSize"); flagValue = currentProvider_->preparedTextCacheSize(); preparedTextCacheSize_ = flagValue; @@ -1172,7 +1154,7 @@ bool ReactNativeFeatureFlagsAccessor::preventShadowTreeCommitExhaustion() { // be accessing the provider multiple times but the end state of this // instance and the returned flag value would be the same. - markFlagAsAccessed(63, "preventShadowTreeCommitExhaustion"); + markFlagAsAccessed(62, "preventShadowTreeCommitExhaustion"); flagValue = currentProvider_->preventShadowTreeCommitExhaustion(); preventShadowTreeCommitExhaustion_ = flagValue; @@ -1190,7 +1172,7 @@ bool ReactNativeFeatureFlagsAccessor::shouldPressibilityUseW3CPointerEventsForHo // be accessing the provider multiple times but the end state of this // instance and the returned flag value would be the same. - markFlagAsAccessed(64, "shouldPressibilityUseW3CPointerEventsForHover"); + markFlagAsAccessed(63, "shouldPressibilityUseW3CPointerEventsForHover"); flagValue = currentProvider_->shouldPressibilityUseW3CPointerEventsForHover(); shouldPressibilityUseW3CPointerEventsForHover_ = flagValue; @@ -1208,7 +1190,7 @@ bool ReactNativeFeatureFlagsAccessor::shouldTriggerResponderTransferOnScrollAndr // be accessing the provider multiple times but the end state of this // instance and the returned flag value would be the same. - markFlagAsAccessed(65, "shouldTriggerResponderTransferOnScrollAndroid"); + markFlagAsAccessed(64, "shouldTriggerResponderTransferOnScrollAndroid"); flagValue = currentProvider_->shouldTriggerResponderTransferOnScrollAndroid(); shouldTriggerResponderTransferOnScrollAndroid_ = flagValue; @@ -1226,7 +1208,7 @@ bool ReactNativeFeatureFlagsAccessor::skipActivityIdentityAssertionOnHostPause() // be accessing the provider multiple times but the end state of this // instance and the returned flag value would be the same. - markFlagAsAccessed(66, "skipActivityIdentityAssertionOnHostPause"); + markFlagAsAccessed(65, "skipActivityIdentityAssertionOnHostPause"); flagValue = currentProvider_->skipActivityIdentityAssertionOnHostPause(); skipActivityIdentityAssertionOnHostPause_ = flagValue; @@ -1244,7 +1226,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(67, "traceTurboModulePromiseRejectionsOnAndroid"); + markFlagAsAccessed(66, "traceTurboModulePromiseRejectionsOnAndroid"); flagValue = currentProvider_->traceTurboModulePromiseRejectionsOnAndroid(); traceTurboModulePromiseRejectionsOnAndroid_ = flagValue; @@ -1262,7 +1244,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(68, "updateRuntimeShadowNodeReferencesOnCommit"); + markFlagAsAccessed(67, "updateRuntimeShadowNodeReferencesOnCommit"); flagValue = currentProvider_->updateRuntimeShadowNodeReferencesOnCommit(); updateRuntimeShadowNodeReferencesOnCommit_ = flagValue; @@ -1280,7 +1262,7 @@ bool ReactNativeFeatureFlagsAccessor::updateRuntimeShadowNodeReferencesOnCommitT // be accessing the provider multiple times but the end state of this // instance and the returned flag value would be the same. - markFlagAsAccessed(69, "updateRuntimeShadowNodeReferencesOnCommitThread"); + markFlagAsAccessed(68, "updateRuntimeShadowNodeReferencesOnCommitThread"); flagValue = currentProvider_->updateRuntimeShadowNodeReferencesOnCommitThread(); updateRuntimeShadowNodeReferencesOnCommitThread_ = flagValue; @@ -1298,7 +1280,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(70, "useAlwaysAvailableJSErrorHandling"); + markFlagAsAccessed(69, "useAlwaysAvailableJSErrorHandling"); flagValue = currentProvider_->useAlwaysAvailableJSErrorHandling(); useAlwaysAvailableJSErrorHandling_ = flagValue; @@ -1316,7 +1298,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(71, "useFabricInterop"); + markFlagAsAccessed(70, "useFabricInterop"); flagValue = currentProvider_->useFabricInterop(); useFabricInterop_ = flagValue; @@ -1334,7 +1316,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(72, "useNativeViewConfigsInBridgelessMode"); + markFlagAsAccessed(71, "useNativeViewConfigsInBridgelessMode"); flagValue = currentProvider_->useNativeViewConfigsInBridgelessMode(); useNativeViewConfigsInBridgelessMode_ = flagValue; @@ -1352,7 +1334,7 @@ bool ReactNativeFeatureFlagsAccessor::useNestedScrollViewAndroid() { // be accessing the provider multiple times but the end state of this // instance and the returned flag value would be the same. - markFlagAsAccessed(73, "useNestedScrollViewAndroid"); + markFlagAsAccessed(72, "useNestedScrollViewAndroid"); flagValue = currentProvider_->useNestedScrollViewAndroid(); useNestedScrollViewAndroid_ = flagValue; @@ -1370,7 +1352,7 @@ bool ReactNativeFeatureFlagsAccessor::useSharedAnimatedBackend() { // be accessing the provider multiple times but the end state of this // instance and the returned flag value would be the same. - markFlagAsAccessed(74, "useSharedAnimatedBackend"); + markFlagAsAccessed(73, "useSharedAnimatedBackend"); flagValue = currentProvider_->useSharedAnimatedBackend(); useSharedAnimatedBackend_ = flagValue; @@ -1388,7 +1370,7 @@ bool ReactNativeFeatureFlagsAccessor::useTraitHiddenOnAndroid() { // be accessing the provider multiple times but the end state of this // instance and the returned flag value would be the same. - markFlagAsAccessed(75, "useTraitHiddenOnAndroid"); + markFlagAsAccessed(74, "useTraitHiddenOnAndroid"); flagValue = currentProvider_->useTraitHiddenOnAndroid(); useTraitHiddenOnAndroid_ = flagValue; @@ -1406,7 +1388,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(76, "useTurboModuleInterop"); + markFlagAsAccessed(75, "useTurboModuleInterop"); flagValue = currentProvider_->useTurboModuleInterop(); useTurboModuleInterop_ = flagValue; @@ -1424,7 +1406,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(77, "useTurboModules"); + markFlagAsAccessed(76, "useTurboModules"); flagValue = currentProvider_->useTurboModules(); useTurboModules_ = flagValue; @@ -1442,7 +1424,7 @@ double ReactNativeFeatureFlagsAccessor::viewCullingOutsetRatio() { // be accessing the provider multiple times but the end state of this // instance and the returned flag value would be the same. - markFlagAsAccessed(78, "viewCullingOutsetRatio"); + markFlagAsAccessed(77, "viewCullingOutsetRatio"); flagValue = currentProvider_->viewCullingOutsetRatio(); viewCullingOutsetRatio_ = flagValue; @@ -1460,7 +1442,7 @@ bool ReactNativeFeatureFlagsAccessor::viewTransitionEnabled() { // be accessing the provider multiple times but the end state of this // instance and the returned flag value would be the same. - markFlagAsAccessed(79, "viewTransitionEnabled"); + markFlagAsAccessed(78, "viewTransitionEnabled"); flagValue = currentProvider_->viewTransitionEnabled(); viewTransitionEnabled_ = flagValue; @@ -1478,7 +1460,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(80, "virtualViewPrerenderRatio"); + markFlagAsAccessed(79, "virtualViewPrerenderRatio"); flagValue = currentProvider_->virtualViewPrerenderRatio(); virtualViewPrerenderRatio_ = flagValue; diff --git a/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlagsAccessor.h b/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlagsAccessor.h index 4f5b133375d..a1133d323f2 100644 --- a/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlagsAccessor.h +++ b/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlagsAccessor.h @@ -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<<545708e361d01a42b3aef51ba71d646d>> + * @generated SignedSource<> */ /** @@ -47,7 +47,6 @@ class ReactNativeFeatureFlagsAccessor { bool enableAndroidLinearText(); bool enableAndroidTextMeasurementOptimizations(); bool enableBridgelessArchitecture(); - bool enableClipChildrenForOverflowHidden(); bool enableCppPropsIteratorSetter(); bool enableCustomFocusSearchOnClippedElementsAndroid(); bool enableDestroyShadowTreeRevisionAsync(); @@ -124,7 +123,7 @@ class ReactNativeFeatureFlagsAccessor { std::unique_ptr currentProvider_; bool wasOverridden_; - std::array, 81> accessedFeatureFlags_; + std::array, 80> accessedFeatureFlags_; std::atomic> commonTestFlag_; std::atomic> cdpInteractionMetricsEnabled_; @@ -141,7 +140,6 @@ class ReactNativeFeatureFlagsAccessor { std::atomic> enableAndroidLinearText_; std::atomic> enableAndroidTextMeasurementOptimizations_; std::atomic> enableBridgelessArchitecture_; - std::atomic> enableClipChildrenForOverflowHidden_; std::atomic> enableCppPropsIteratorSetter_; std::atomic> enableCustomFocusSearchOnClippedElementsAndroid_; std::atomic> enableDestroyShadowTreeRevisionAsync_; diff --git a/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlagsDefaults.h b/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlagsDefaults.h index 13360f4656a..6c304c6bf40 100644 --- a/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlagsDefaults.h +++ b/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlagsDefaults.h @@ -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<<777478fa4d8beba140a30edb68cc34d9>> + * @generated SignedSource<<3e0a2c49ce52691f15ed127568a8bda8>> */ /** @@ -87,10 +87,6 @@ class ReactNativeFeatureFlagsDefaults : public ReactNativeFeatureFlagsProvider { return false; } - bool enableClipChildrenForOverflowHidden() override { - return false; - } - bool enableCppPropsIteratorSetter() override { return false; } diff --git a/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlagsDynamicProvider.h b/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlagsDynamicProvider.h index 61a4ec167f9..e74c2bc6dff 100644 --- a/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlagsDynamicProvider.h +++ b/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlagsDynamicProvider.h @@ -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<<55247339124401e105501f3d9d3b5b92>> + * @generated SignedSource<<071d8d1951fa9737eded3cd8a423eb8a>> */ /** @@ -180,15 +180,6 @@ class ReactNativeFeatureFlagsDynamicProvider : public ReactNativeFeatureFlagsDef return ReactNativeFeatureFlagsDefaults::enableBridgelessArchitecture(); } - bool enableClipChildrenForOverflowHidden() override { - auto value = values_["enableClipChildrenForOverflowHidden"]; - if (!value.isNull()) { - return value.getBool(); - } - - return ReactNativeFeatureFlagsDefaults::enableClipChildrenForOverflowHidden(); - } - bool enableCppPropsIteratorSetter() override { auto value = values_["enableCppPropsIteratorSetter"]; if (!value.isNull()) { diff --git a/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlagsProvider.h b/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlagsProvider.h index f86dab964cf..6e05fd21cdd 100644 --- a/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlagsProvider.h +++ b/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlagsProvider.h @@ -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<<05c9d90f759f2a6116219a1e61eeee82>> + * @generated SignedSource<<5678ce5959c4d862ea03b968a7fe07e1>> */ /** @@ -40,7 +40,6 @@ class ReactNativeFeatureFlagsProvider { virtual bool enableAndroidLinearText() = 0; virtual bool enableAndroidTextMeasurementOptimizations() = 0; virtual bool enableBridgelessArchitecture() = 0; - virtual bool enableClipChildrenForOverflowHidden() = 0; virtual bool enableCppPropsIteratorSetter() = 0; virtual bool enableCustomFocusSearchOnClippedElementsAndroid() = 0; virtual bool enableDestroyShadowTreeRevisionAsync() = 0; diff --git a/packages/react-native/ReactCommon/react/nativemodule/featureflags/NativeReactNativeFeatureFlags.cpp b/packages/react-native/ReactCommon/react/nativemodule/featureflags/NativeReactNativeFeatureFlags.cpp index e6cc9a06f37..a91509b843b 100644 --- a/packages/react-native/ReactCommon/react/nativemodule/featureflags/NativeReactNativeFeatureFlags.cpp +++ b/packages/react-native/ReactCommon/react/nativemodule/featureflags/NativeReactNativeFeatureFlags.cpp @@ -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<<39413a3a4416946e3ade57074664492d>> + * @generated SignedSource<<54a1cd3bf2a43d8bcb92bc0a467a778c>> */ /** @@ -119,11 +119,6 @@ bool NativeReactNativeFeatureFlags::enableBridgelessArchitecture( return ReactNativeFeatureFlags::enableBridgelessArchitecture(); } -bool NativeReactNativeFeatureFlags::enableClipChildrenForOverflowHidden( - jsi::Runtime& /*runtime*/) { - return ReactNativeFeatureFlags::enableClipChildrenForOverflowHidden(); -} - bool NativeReactNativeFeatureFlags::enableCppPropsIteratorSetter( jsi::Runtime& /*runtime*/) { return ReactNativeFeatureFlags::enableCppPropsIteratorSetter(); diff --git a/packages/react-native/ReactCommon/react/nativemodule/featureflags/NativeReactNativeFeatureFlags.h b/packages/react-native/ReactCommon/react/nativemodule/featureflags/NativeReactNativeFeatureFlags.h index fc15199230e..0b8e3a86864 100644 --- a/packages/react-native/ReactCommon/react/nativemodule/featureflags/NativeReactNativeFeatureFlags.h +++ b/packages/react-native/ReactCommon/react/nativemodule/featureflags/NativeReactNativeFeatureFlags.h @@ -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<<6ed865d409cf5df84607ffa599e46fe7>> + * @generated SignedSource<<55bd70d1f64dcbcdcf9173e4f4b7aff6>> */ /** @@ -66,8 +66,6 @@ class NativeReactNativeFeatureFlags bool enableBridgelessArchitecture(jsi::Runtime& runtime); - bool enableClipChildrenForOverflowHidden(jsi::Runtime& runtime); - bool enableCppPropsIteratorSetter(jsi::Runtime& runtime); bool enableCustomFocusSearchOnClippedElementsAndroid(jsi::Runtime& runtime); diff --git a/packages/react-native/scripts/featureflags/ReactNativeFeatureFlags.config.js b/packages/react-native/scripts/featureflags/ReactNativeFeatureFlags.config.js index 6de46679820..cf8a2b4ef3b 100644 --- a/packages/react-native/scripts/featureflags/ReactNativeFeatureFlags.config.js +++ b/packages/react-native/scripts/featureflags/ReactNativeFeatureFlags.config.js @@ -212,16 +212,6 @@ const definitions: FeatureFlagDefinitions = { }, ossReleaseStage: 'canary', }, - enableClipChildrenForOverflowHidden: { - defaultValue: false, - metadata: { - description: - 'When overflow: hidden is set, also set clipChildren to true so that clipped content does not occlude content outside the parent', - expectedReleaseValue: true, - purpose: 'release', - }, - ossReleaseStage: 'none', - }, enableCppPropsIteratorSetter: { defaultValue: false, metadata: { diff --git a/packages/react-native/src/private/featureflags/ReactNativeFeatureFlags.js b/packages/react-native/src/private/featureflags/ReactNativeFeatureFlags.js index 542bde64dad..fb09dbf3850 100644 --- a/packages/react-native/src/private/featureflags/ReactNativeFeatureFlags.js +++ b/packages/react-native/src/private/featureflags/ReactNativeFeatureFlags.js @@ -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<> + * @generated SignedSource<<1f591f0e6d65b58c811cb57d13f7f764>> * @flow strict * @noformat */ @@ -62,7 +62,6 @@ export type ReactNativeFeatureFlags = $ReadOnly<{ enableAndroidLinearText: Getter, enableAndroidTextMeasurementOptimizations: Getter, enableBridgelessArchitecture: Getter, - enableClipChildrenForOverflowHidden: Getter, enableCppPropsIteratorSetter: Getter, enableCustomFocusSearchOnClippedElementsAndroid: Getter, enableDestroyShadowTreeRevisionAsync: Getter, @@ -254,10 +253,6 @@ export const enableAndroidTextMeasurementOptimizations: Getter = create * Feature flag to enable the new bridgeless architecture. Note: Enabling this will force enable the following flags: `useTurboModules` & `enableFabricRenderer`. */ export const enableBridgelessArchitecture: Getter = createNativeFlagGetter('enableBridgelessArchitecture', false); -/** - * When overflow: hidden is set, also set clipChildren to true so that clipped content does not occlude content outside the parent - */ -export const enableClipChildrenForOverflowHidden: Getter = createNativeFlagGetter('enableClipChildrenForOverflowHidden', false); /** * Enable prop iterator setter-style construction of Props in C++ (this flag is not used in Java). */ diff --git a/packages/react-native/src/private/featureflags/specs/NativeReactNativeFeatureFlags.js b/packages/react-native/src/private/featureflags/specs/NativeReactNativeFeatureFlags.js index 87718d2a025..6fa59ada0de 100644 --- a/packages/react-native/src/private/featureflags/specs/NativeReactNativeFeatureFlags.js +++ b/packages/react-native/src/private/featureflags/specs/NativeReactNativeFeatureFlags.js @@ -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<<1fe995d928d6ea2770936cdd6e2b8320>> + * @generated SignedSource<> * @flow strict * @noformat */ @@ -40,7 +40,6 @@ export interface Spec extends TurboModule { +enableAndroidLinearText?: () => boolean; +enableAndroidTextMeasurementOptimizations?: () => boolean; +enableBridgelessArchitecture?: () => boolean; - +enableClipChildrenForOverflowHidden?: () => boolean; +enableCppPropsIteratorSetter?: () => boolean; +enableCustomFocusSearchOnClippedElementsAndroid?: () => boolean; +enableDestroyShadowTreeRevisionAsync?: () => boolean; From 5d0d94111977db2ee261d32231908c340e761ecc Mon Sep 17 00:00:00 2001 From: Luna Wei Date: Fri, 13 Feb 2026 14:06:25 -0800 Subject: [PATCH 362/585] useAnimatedValue in react-native-github (#55551) Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/55551 Changelog: [Internal] - Migrated 8 files in `xplat/js/react-native-github/packages/rn-tester/` from the manual `useRef(new Animated.Value(x))` pattern to the `useAnimatedValue(x)` hook. Reviewed By: fabriziocucci Differential Revision: D93258352 fbshipit-source-id: 778a2edbd3e168284c5e6b313bd3aa0102d0523f --- .../js/examples/Animated/EasingExample.js | 11 ++++++----- .../js/examples/Animated/MovingBoxExample.js | 16 ++++++---------- .../Animated/PressabilityWithNativeDrivers.js | 6 +++--- .../js/examples/AnimatedGratuitousApp/AnExSet.js | 13 ++++++++++--- .../examples/AnimatedGratuitousApp/AnExTilt.js | 15 ++++++++++----- .../CompatibilityAnimatedPointerMove.js | 8 ++++---- .../js/examples/Filter/FilterExample.js | 12 ++++++++++-- .../js/examples/Transform/TransformExample.js | 13 ++++++++++--- 8 files changed, 59 insertions(+), 35 deletions(-) diff --git a/packages/rn-tester/js/examples/Animated/EasingExample.js b/packages/rn-tester/js/examples/Animated/EasingExample.js index 46db230695c..ad2c7500024 100644 --- a/packages/rn-tester/js/examples/Animated/EasingExample.js +++ b/packages/rn-tester/js/examples/Animated/EasingExample.js @@ -23,6 +23,7 @@ import { StyleSheet, Text, View, + useAnimatedValue, } from 'react-native'; type Props = Readonly<{}>; @@ -87,9 +88,9 @@ function EasingItem({ item: EasingListItem, useNativeDriver: boolean, }): React.Node { - const opacityAndScale = useRef(new Animated.Value(1)); + const opacityAndScale = useAnimatedValue(1); const animation = useRef( - Animated.timing(opacityAndScale.current, { + Animated.timing(opacityAndScale, { toValue: 1, duration: 1200, easing: item.easing, @@ -100,8 +101,8 @@ function EasingItem({ const animatedStyles = [ styles.box, { - opacity: opacityAndScale.current, - transform: [{scale: opacityAndScale.current}], + opacity: opacityAndScale, + transform: [{scale: opacityAndScale}], }, ]; @@ -115,7 +116,7 @@ function EasingItem({ { - opacityAndScale.current.setValue(0); + opacityAndScale.setValue(0); animation.current.start(); }}> Animate diff --git a/packages/rn-tester/js/examples/Animated/MovingBoxExample.js b/packages/rn-tester/js/examples/Animated/MovingBoxExample.js index 56e9fc88925..84c8e0c48c4 100644 --- a/packages/rn-tester/js/examples/Animated/MovingBoxExample.js +++ b/packages/rn-tester/js/examples/Animated/MovingBoxExample.js @@ -14,8 +14,8 @@ import RNTConfigurationBlock from '../../components/RNTConfigurationBlock'; import RNTesterButton from '../../components/RNTesterButton'; import ToggleNativeDriver from './utils/ToggleNativeDriver'; import * as React from 'react'; -import {useRef, useState} from 'react'; -import {Animated, StyleSheet, Text, View} from 'react-native'; +import {useState} from 'react'; +import {Animated, StyleSheet, Text, View, useAnimatedValue} from 'react-native'; const containerWidth = 200; const boxSize = 50; @@ -59,12 +59,12 @@ const styles = StyleSheet.create({ type Props = Readonly<{}>; function MovingBoxView({useNativeDriver}: {useNativeDriver: boolean}) { - const x = useRef(new Animated.Value(0)); + const x = useAnimatedValue(0); const [update, setUpdate] = useState(0); const [boxVisible, setBoxVisible] = useState(true); const moveTo = (pos: number) => { - Animated.timing(x.current, { + Animated.timing(x, { toValue: pos, duration: 1000, useNativeDriver, @@ -76,7 +76,7 @@ function MovingBoxView({useNativeDriver}: {useNativeDriver: boolean}) { }; const toggleText = boxVisible ? 'Hide' : 'Show'; const onReset = () => { - x.current.resetAnimation(); + x.resetAnimation(); setUpdate(update + 1); }; return ( @@ -85,11 +85,7 @@ function MovingBoxView({useNativeDriver}: {useNativeDriver: boolean}) { {boxVisible ? ( ) : ( The box view is not being rendered diff --git a/packages/rn-tester/js/examples/Animated/PressabilityWithNativeDrivers.js b/packages/rn-tester/js/examples/Animated/PressabilityWithNativeDrivers.js index 2b92ca80a27..1b76cf8e3a2 100644 --- a/packages/rn-tester/js/examples/Animated/PressabilityWithNativeDrivers.js +++ b/packages/rn-tester/js/examples/Animated/PressabilityWithNativeDrivers.js @@ -11,13 +11,13 @@ import type {RNTesterModuleExample} from '../../types/RNTesterTypes'; import * as React from 'react'; -import {useRef, useState} from 'react'; -import {Animated, Button, Text, View} from 'react-native'; +import {useState} from 'react'; +import {Animated, Button, Text, View, useAnimatedValue} from 'react-native'; const componentList: number[] = Array.from({length: 100}, (_, i) => i + 1); function PressableWithNativeDriver() { - const currScroll = useRef(new Animated.Value(0)).current; + const currScroll = useAnimatedValue(0); const [count, setCount] = useState(0); return ( diff --git a/packages/rn-tester/js/examples/AnimatedGratuitousApp/AnExSet.js b/packages/rn-tester/js/examples/AnimatedGratuitousApp/AnExSet.js index 4df8cfb6914..a4fec8a10c5 100644 --- a/packages/rn-tester/js/examples/AnimatedGratuitousApp/AnExSet.js +++ b/packages/rn-tester/js/examples/AnimatedGratuitousApp/AnExSet.js @@ -14,8 +14,15 @@ import AnExBobble from './AnExBobble'; import AnExChained from './AnExChained'; import AnExScroll from './AnExScroll'; import AnExTilt from './AnExTilt'; -import React, {useRef, useState} from 'react'; -import {Animated, PanResponder, StyleSheet, Text, View} from 'react-native'; +import React, {useState} from 'react'; +import { + Animated, + PanResponder, + StyleSheet, + Text, + View, + useAnimatedValue, +} from 'react-native'; const randColor = () => { const colors = [0, 1, 2].map(() => Math.floor(Math.random() * 150 + 100)); @@ -39,7 +46,7 @@ const AnExSet = ({ }: AnExSetProps): React.Node => { const [closeColor] = useState(randColor()); const [openColor] = useState(randColor()); - const dismissY = useRef(new Animated.Value(0)).current; + const dismissY = useAnimatedValue(0); const dismissResponder = PanResponder.create({ onStartShouldSetPanResponder: () => isActive, diff --git a/packages/rn-tester/js/examples/AnimatedGratuitousApp/AnExTilt.js b/packages/rn-tester/js/examples/AnimatedGratuitousApp/AnExTilt.js index af3130e8d98..80760d8fdaa 100644 --- a/packages/rn-tester/js/examples/AnimatedGratuitousApp/AnExTilt.js +++ b/packages/rn-tester/js/examples/AnimatedGratuitousApp/AnExTilt.js @@ -10,13 +10,18 @@ 'use strict'; -import React, {useCallback, useEffect, useRef} from 'react'; -import {Animated, PanResponder, StyleSheet} from 'react-native'; +import React, {useCallback, useEffect} from 'react'; +import { + Animated, + PanResponder, + StyleSheet, + useAnimatedValue, +} from 'react-native'; const AnExTilt = (): React.Node => { - const panX = useRef(new Animated.Value(0)).current; - const opacity = useRef(new Animated.Value(1)).current; - const burns = useRef(new Animated.Value(1.15)).current; + const panX = useAnimatedValue(0); + const opacity = useAnimatedValue(1); + const burns = useAnimatedValue(1.15); const tiltPanResponder = PanResponder.create({ onStartShouldSetPanResponder: () => true, diff --git a/packages/rn-tester/js/examples/Experimental/Compatibility/CompatibilityAnimatedPointerMove.js b/packages/rn-tester/js/examples/Experimental/Compatibility/CompatibilityAnimatedPointerMove.js index a05925d42de..bb3458e48ed 100644 --- a/packages/rn-tester/js/examples/Experimental/Compatibility/CompatibilityAnimatedPointerMove.js +++ b/packages/rn-tester/js/examples/Experimental/Compatibility/CompatibilityAnimatedPointerMove.js @@ -12,8 +12,8 @@ import type {RNTesterModuleExample} from '../../../types/RNTesterTypes'; import ToggleNativeDriver from '../../Animated/utils/ToggleNativeDriver'; import * as React from 'react'; -import {useRef, useState} from 'react'; -import {Animated, StyleSheet, Text} from 'react-native'; +import {useState} from 'react'; +import {Animated, StyleSheet, Text, useAnimatedValue} from 'react-native'; const WIDTH = 200; const HEIGHT = 250; @@ -39,8 +39,8 @@ const styles = StyleSheet.create({ }); function CompatibilityAnimatedPointerMove(): React.Node { - const xCoord = useRef(new Animated.Value(0)).current; - const yCoord = useRef(new Animated.Value(0)).current; + const xCoord = useAnimatedValue(0); + const yCoord = useAnimatedValue(0); const [useNativeDriver, setUseNativeDriver] = useState(true); return ( diff --git a/packages/rn-tester/js/examples/Filter/FilterExample.js b/packages/rn-tester/js/examples/Filter/FilterExample.js index d1d9b0a8307..8df9767911d 100644 --- a/packages/rn-tester/js/examples/Filter/FilterExample.js +++ b/packages/rn-tester/js/examples/Filter/FilterExample.js @@ -15,7 +15,15 @@ import type {ViewStyleProp} from 'react-native/Libraries/StyleSheet/StyleSheet'; import React from 'react'; import {useState} from 'react'; -import {Animated, Button, Image, StyleSheet, Text, View} from 'react-native'; +import { + Animated, + Button, + Image, + StyleSheet, + Text, + View, + useAnimatedValue, +} from 'react-native'; const alphaHotdog = require('../../assets/alpha-hotdog.png'); const hotdog = require('../../assets/hotdog.jpg'); @@ -278,7 +286,7 @@ exports.examples = [ ] as Array; const AnimatedBlurExample = () => { - const animatedValue = React.useRef(new Animated.Value(0)).current; + const animatedValue = useAnimatedValue(0); const [isBlurred, setIsBlurred] = React.useState(false); const onPress = () => { diff --git a/packages/rn-tester/js/examples/Transform/TransformExample.js b/packages/rn-tester/js/examples/Transform/TransformExample.js index c3b1501a9bc..262206a9c0e 100644 --- a/packages/rn-tester/js/examples/Transform/TransformExample.js +++ b/packages/rn-tester/js/examples/Transform/TransformExample.js @@ -12,8 +12,15 @@ import type {RNTesterModuleExample} from '../../types/RNTesterTypes'; import type {AnimatedNode} from 'react-native/Libraries/Animated/AnimatedExports'; import * as React from 'react'; -import {useEffect, useRef, useState} from 'react'; -import {Animated, Easing, StyleSheet, Text, View} from 'react-native'; +import {useEffect, useState} from 'react'; +import { + Animated, + Easing, + StyleSheet, + Text, + View, + useAnimatedValue, +} from 'react-native'; function AnimateTransformSingleProp() { const [theta] = useState(new Animated.Value(45)); @@ -53,7 +60,7 @@ function AnimateTransformSingleProp() { } function TransformOriginExample() { - const rotateAnim = useRef(new Animated.Value(0)).current; + const rotateAnim = useAnimatedValue(0); useEffect(() => { Animated.loop( From 36182241e69bd2aced243b3b62d8cabbcd8e4ecd Mon Sep 17 00:00:00 2001 From: Nick Gerleman Date: Fri, 13 Feb 2026 16:17:00 -0800 Subject: [PATCH 363/585] Remove TextInlineImageNativeComponent Remnants (#55434) Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/55434 This is used by `Image`, to render a different component when under a `TextAncestorContext`, but the underlying component is remapped by Fabric to instead be interpreted as `Image`. We can delete the code JS side safely, since it will use the existing registered View manager, Fabric will already redirect to. We can also then delete the redirection in Fabric, since the component is no longer ever used. See `componentNameByReactViewName.cpp`, where this is also removed. Changelog: [Internal] Reviewed By: mdvacca, javache, cortinico Differential Revision: D92481981 fbshipit-source-id: c33897efee124eaabed5447266389f34709650e0 --- .../Libraries/Image/Image.android.js | 16 +----- .../Image/TextInlineImageNativeComponent.js | 49 ------------------- .../componentNameByReactViewName.cpp | 5 -- 3 files changed, 1 insertion(+), 69 deletions(-) delete mode 100644 packages/react-native/Libraries/Image/TextInlineImageNativeComponent.js diff --git a/packages/react-native/Libraries/Image/Image.android.js b/packages/react-native/Libraries/Image/Image.android.js index ba410cc8233..b30c90dc0d4 100644 --- a/packages/react-native/Libraries/Image/Image.android.js +++ b/packages/react-native/Libraries/Image/Image.android.js @@ -18,7 +18,6 @@ import type {AbstractImageAndroid, ImageAndroid} from './ImageTypes.flow'; import * as ReactNativeFeatureFlags from '../../src/private/featureflags/ReactNativeFeatureFlags'; import flattenStyle from '../StyleSheet/flattenStyle'; import StyleSheet from '../StyleSheet/StyleSheet'; -import TextAncestorContext from '../Text/TextAncestorContext'; import ImageAnalyticsTagContext from './ImageAnalyticsTagContext'; import { unstable_getImageComponentDecorator, @@ -31,7 +30,6 @@ import NativeImageLoaderAndroid, { type ImageSize, } from './NativeImageLoaderAndroid'; import resolveAssetSource from './resolveAssetSource'; -import TextInlineImageNativeComponent from './TextInlineImageNativeComponent'; import * as React from 'react'; import {use} from 'react'; @@ -326,24 +324,12 @@ let BaseImage: AbstractImageAndroid = ({ const actualRef = useWrapRefWithImageAttachedCallbacks(forwardedRef); - const hasTextAncestor = use(TextAncestorContext); const analyticTag = use(ImageAnalyticsTagContext); if (analyticTag !== null) { nativeProps.internal_analyticTag = analyticTag; } - return hasTextAncestor ? ( - - ) : ( - - ); + return ; }; let _BaseImage = BaseImage; diff --git a/packages/react-native/Libraries/Image/TextInlineImageNativeComponent.js b/packages/react-native/Libraries/Image/TextInlineImageNativeComponent.js deleted file mode 100644 index 48ee4a554b4..00000000000 --- a/packages/react-native/Libraries/Image/TextInlineImageNativeComponent.js +++ /dev/null @@ -1,49 +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'; - -import type {HostComponent} from '../../src/private/types/HostComponent'; -import type {ViewProps} from '../Components/View/ViewPropTypes'; -import type {PartialViewConfig} from '../Renderer/shims/ReactNativeTypes'; -import type {ColorValue} from '../StyleSheet/StyleSheet'; -import type {ImageResizeMode} from './ImageResizeMode'; - -import * as NativeComponentRegistry from '../NativeComponent/NativeComponentRegistry'; - -type RCTTextInlineImageNativeProps = Readonly<{ - ...ViewProps, - resizeMode?: ?ImageResizeMode, - src?: ?ReadonlyArray>, - tintColor?: ?ColorValue, - headers?: ?{[string]: string}, -}>; - -export const __INTERNAL_VIEW_CONFIG: PartialViewConfig = { - uiViewClassName: 'RCTTextInlineImage', - bubblingEventTypes: {}, - directEventTypes: {}, - validAttributes: { - resizeMode: true, - src: true, - tintColor: { - process: require('../StyleSheet/processColor').default, - }, - headers: true, - }, -}; - -const TextInlineImage: HostComponent = - NativeComponentRegistry.get( - 'RCTTextInlineImage', - () => __INTERNAL_VIEW_CONFIG, - ); - -export default TextInlineImage; diff --git a/packages/react-native/ReactCommon/react/renderer/componentregistry/componentNameByReactViewName.cpp b/packages/react-native/ReactCommon/react/renderer/componentregistry/componentNameByReactViewName.cpp index de9e3200876..25e3b2cb107 100644 --- a/packages/react-native/ReactCommon/react/renderer/componentregistry/componentNameByReactViewName.cpp +++ b/packages/react-native/ReactCommon/react/renderer/componentregistry/componentNameByReactViewName.cpp @@ -28,11 +28,6 @@ std::string componentNameByReactViewName(std::string viewName) { return "Paragraph"; } - // TODO T63839307: remove this condition after deleting TextInlineImage from - // old renderer code - if (viewName == "TextInlineImage") { - return "Image"; - } if (viewName == "VirtualText") { return "Text"; } From b92d37879e8e6ca5dbb3c0047a50b20ae6286bc5 Mon Sep 17 00:00:00 2001 From: Zeya Peng Date: Fri, 13 Feb 2026 21:34:22 -0800 Subject: [PATCH 364/585] upstream useAnimatedColor and useAnimatedValueXY (#55539) Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/55539 Move `useAnimatedValueXY` and `useAnimatedColor` hooks into react-native-github so they can be used by OSS alongside the existing `useAnimatedValue` hook which can only take number value. ## Changelog: [General] [Added] - upstream useAnimatedColor and useAnimatedValueXY Reviewed By: fabriziocucci Differential Revision: D93125807 fbshipit-source-id: 74fb3925e8d495cddce7b28bdf852995854f85bb --- .../Libraries/Animated/Animated.d.ts | 9 ++++++- .../Libraries/Animated/useAnimatedColor.d.ts | 15 +++++++++++ .../Libraries/Animated/useAnimatedColor.js | 25 ++++++++++++++++++ .../Animated/useAnimatedValueXY.d.ts | 15 +++++++++++ .../Libraries/Animated/useAnimatedValueXY.js | 26 +++++++++++++++++++ packages/react-native/ReactNativeApi.d.ts | 15 ++++++++++- packages/react-native/index.js | 6 +++++ packages/react-native/index.js.flow | 2 ++ packages/react-native/types/index.d.ts | 2 ++ 9 files changed, 113 insertions(+), 2 deletions(-) create mode 100644 packages/react-native/Libraries/Animated/useAnimatedColor.d.ts create mode 100644 packages/react-native/Libraries/Animated/useAnimatedColor.js create mode 100644 packages/react-native/Libraries/Animated/useAnimatedValueXY.d.ts create mode 100644 packages/react-native/Libraries/Animated/useAnimatedValueXY.js diff --git a/packages/react-native/Libraries/Animated/Animated.d.ts b/packages/react-native/Libraries/Animated/Animated.d.ts index 39af8707b3b..6432625bdee 100644 --- a/packages/react-native/Libraries/Animated/Animated.d.ts +++ b/packages/react-native/Libraries/Animated/Animated.d.ts @@ -77,6 +77,13 @@ export namespace Animated { readonly useNativeDriver: boolean; }; + type AnimatedColorInputValue = + | RgbaValue + | RgbaAnimatedValue + | ColorValue + | null + | undefined; + class AnimatedColor extends AnimatedWithChildren { r: AnimatedValue; g: AnimatedValue; @@ -84,7 +91,7 @@ export namespace Animated { a: AnimatedValue; constructor( - valueIn?: RgbaValue | RgbaAnimatedValue | ColorValue | null, + valueIn?: AnimatedColorInputValue, config?: AnimatedConfig | null, ); nativeColor: unknown; // Unsure what to do here diff --git a/packages/react-native/Libraries/Animated/useAnimatedColor.d.ts b/packages/react-native/Libraries/Animated/useAnimatedColor.d.ts new file mode 100644 index 00000000000..73b052c2966 --- /dev/null +++ b/packages/react-native/Libraries/Animated/useAnimatedColor.d.ts @@ -0,0 +1,15 @@ +/** + * 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. + * + * @format + */ + +import type {Animated} from './Animated'; + +export function useAnimatedColor( + inputValue?: Animated.AnimatedColorInputValue, + config?: Animated.AnimatedConfig | null | undefined, +): Animated.AnimatedColor; diff --git a/packages/react-native/Libraries/Animated/useAnimatedColor.js b/packages/react-native/Libraries/Animated/useAnimatedColor.js new file mode 100644 index 00000000000..766ec3a56b4 --- /dev/null +++ b/packages/react-native/Libraries/Animated/useAnimatedColor.js @@ -0,0 +1,25 @@ +/** + * 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 {AnimatedColorConfig, InputValue} from './nodes/AnimatedColor'; + +import Animated from './Animated'; +import {useRef} from 'react'; + +export default function useAnimatedColor( + inputValue?: InputValue, + config?: ?AnimatedColorConfig, +): Animated.Color { + const ref = useRef(null); + if (ref.current == null) { + ref.current = new Animated.Color(inputValue, config); + } + return ref.current; +} diff --git a/packages/react-native/Libraries/Animated/useAnimatedValueXY.d.ts b/packages/react-native/Libraries/Animated/useAnimatedValueXY.d.ts new file mode 100644 index 00000000000..01295a35b44 --- /dev/null +++ b/packages/react-native/Libraries/Animated/useAnimatedValueXY.d.ts @@ -0,0 +1,15 @@ +/** + * 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. + * + * @format + */ + +import type {Animated} from './Animated'; + +export function useAnimatedValueXY( + initialValue: {x: number; y: number}, + config?: Animated.AnimatedConfig | null | undefined, +): Animated.ValueXY; diff --git a/packages/react-native/Libraries/Animated/useAnimatedValueXY.js b/packages/react-native/Libraries/Animated/useAnimatedValueXY.js new file mode 100644 index 00000000000..ee5654ad363 --- /dev/null +++ b/packages/react-native/Libraries/Animated/useAnimatedValueXY.js @@ -0,0 +1,26 @@ +/** + * 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 Animated from './Animated'; +import {useRef} from 'react'; + +export default function useAnimatedValueXY( + initialValue: { + x: number, + y: number, + }, + config?: ?Animated.AnimatedConfig, +): Animated.ValueXY { + const ref = useRef(null); + if (ref.current == null) { + ref.current = new Animated.ValueXY(initialValue, config); + } + return ref.current; +} diff --git a/packages/react-native/ReactNativeApi.d.ts b/packages/react-native/ReactNativeApi.d.ts index c35d225b429..9229bb4336f 100644 --- a/packages/react-native/ReactNativeApi.d.ts +++ b/packages/react-native/ReactNativeApi.d.ts @@ -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<<74ac46b82182a7d97e92c933a361f583>> + * @generated SignedSource<<6463b0a4f3acbeb07e6759c345b927d8>> * * This file was generated by scripts/js-api/build-types/index.js. */ @@ -5651,10 +5651,21 @@ declare type UnsafeEventObject = Object declare type UnsafeMixed = unknown declare type UnsafeNativeEventObject = Object declare type UnsafeObject = Object +declare function useAnimatedColor( + inputValue?: InputValue, + config?: AnimatedColorConfig | null | undefined, +): Animated.Color declare function useAnimatedValue( initialValue: number, config?: Animated.AnimatedConfig | null | undefined, ): Animated.Value +declare function useAnimatedValueXY( + initialValue: { + x: number + y: number + }, + config?: Animated.AnimatedConfig | null | undefined, +): Animated.ValueXY declare function useColorScheme(): ColorSchemeName | null | undefined declare function usePressability( config: null | PressabilityConfig | undefined, @@ -6253,7 +6264,9 @@ export { processColor, // 6e877698 registerCallableModule, // 839c8cfe requireNativeComponent, // 72c09c3d + useAnimatedColor, // e3511f81 useAnimatedValue, // b18adb63 + useAnimatedValueXY, // c7ee2332 useColorScheme, // c216d6f7 usePressability, // fe1f27d8 useWindowDimensions, // bb4b683f diff --git a/packages/react-native/index.js b/packages/react-native/index.js index 719b64fb5be..b50fbadcf99 100644 --- a/packages/react-native/index.js +++ b/packages/react-native/index.js @@ -341,6 +341,12 @@ module.exports = { get useAnimatedValue() { return require('./Libraries/Animated/useAnimatedValue').default; }, + get useAnimatedValueXY() { + return require('./Libraries/Animated/useAnimatedValueXY').default; + }, + get useAnimatedColor() { + return require('./Libraries/Animated/useAnimatedColor').default; + }, get useColorScheme() { return require('./Libraries/Utilities/useColorScheme').default; }, diff --git a/packages/react-native/index.js.flow b/packages/react-native/index.js.flow index 63d8dffd584..c712a912878 100644 --- a/packages/react-native/index.js.flow +++ b/packages/react-native/index.js.flow @@ -407,6 +407,8 @@ export * as TurboModuleRegistry from './Libraries/TurboModule/TurboModuleRegistr export {default as UIManager} from './Libraries/ReactNative/UIManager'; export {unstable_batchedUpdates} from './Libraries/ReactNative/RendererProxy'; export {default as useAnimatedValue} from './Libraries/Animated/useAnimatedValue'; +export {default as useAnimatedValueXY} from './Libraries/Animated/useAnimatedValueXY'; +export {default as useAnimatedColor} from './Libraries/Animated/useAnimatedColor'; export type { PressabilityConfig, EventHandlers as PressabilityEventHandlers, diff --git a/packages/react-native/types/index.d.ts b/packages/react-native/types/index.d.ts index f4bb82eabe4..b2f6f02d46b 100644 --- a/packages/react-native/types/index.d.ts +++ b/packages/react-native/types/index.d.ts @@ -75,6 +75,8 @@ export * from '../Libraries/Alert/Alert'; export * from '../Libraries/Animated/Animated'; export * from '../Libraries/Animated/Easing'; export * from '../Libraries/Animated/useAnimatedValue'; +export * from '../Libraries/Animated/useAnimatedValueXY'; +export * from '../Libraries/Animated/useAnimatedColor'; export * from '../Libraries/AppState/AppState'; export * from '../Libraries/BatchedBridge/NativeModules'; export * from '../Libraries/Components/AccessibilityInfo/AccessibilityInfo'; From 51ec52e8068bd90cca20d9e5bfe369565fb0454f Mon Sep 17 00:00:00 2001 From: Peter Abbondanzo Date: Sat, 14 Feb 2026 09:57:22 -0800 Subject: [PATCH 365/585] Fix image disappearing on Nougat with antialiased border radius clipping (#55527) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/55527 On API 25 (Nougat), the `DST_OUT` + `EVEN_ODD` inverse path technique in `clipWithAntiAliasing()` doesn't render correctly — it erases all image content instead of just the area outside the rounded rect. The bug manifests specifically with ReactImageView (Fresco-backed) but not plain ImageView. ReactImageView's Fresco hierarchy configures `RoundingParams.RoundingMethod.BITMAP_ONLY`, which causes the drawable chain to draw through a `BitmapShader`-based paint. This shader-based drawing interacts badly with the `EVEN_ODD` fill + `DST_OUT` compositing inside a hardware-accelerated `saveLayer` on API 24's Skia renderer. The fix replaces the `EVEN_ODD` + `DST_OUT` technique with a nested `saveLayer` using `DST_IN` compositing, following the same pattern used by Facebook's Keyframes library (`AbstractLayer.applyClip`). The mask shape is drawn into a separate layer; when restored with `DST_IN`, content is preserved only where the mask is opaque. A `drawColor(CLEAR)` call after `saveLayer` ensures the layer starts fully transparent — without this, on API 24, the layer may retain parent content, causing `DST_IN` to see non-zero alpha everywhere and clip nothing. Changelog: [Android][Fixed] - Fix image content disappearing on API 24 (Nougat) when antialiased border radius clipping is applied Reviewed By: NickGerleman Differential Revision: D92980234 fbshipit-source-id: ea6d05d8f06346371eab1c406538e91bbd78d0ae --- .../uimanager/BackgroundStyleApplicator.kt | 23 +++++++++++-------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/BackgroundStyleApplicator.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/BackgroundStyleApplicator.kt index 1837125fb2f..a0862a96190 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/BackgroundStyleApplicator.kt +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/BackgroundStyleApplicator.kt @@ -590,16 +590,21 @@ public object BackgroundStyleApplicator { paddingBoxPath.setFillType(Path.FillType.INVERSE_WINDING) canvas.drawPath(paddingBoxPath, maskPaint) } else { - // Create an inverse path: outer rect minus the rounded rect (using even-odd fill rule) - val inversePath = Path() - inversePath.addRect(0f, 0f, view.width.toFloat(), view.height.toFloat(), Path.Direction.CW) - inversePath.addPath(paddingBoxPath) - inversePath.setFillType(Path.FillType.EVEN_ODD) - - // Use DST_OUT to remove content where the mask is drawn (outside the rounded rect) - maskPaint.xfermode = PorterDuffXfermode(PorterDuff.Mode.DST_OUT) + // API < 28: Use a nested saveLayer with DST_IN compositing to mask content to the + // padding box path. EVEN_ODD fill + DST_OUT has rendering bugs on API 24's hardware + // renderer, so we avoid that technique. Instead, draw the mask shape into a separate + // layer; when restored with DST_IN, content is preserved only where the mask is opaque. + val dstInPaint = Paint() + dstInPaint.xfermode = PorterDuffXfermode(PorterDuff.Mode.DST_IN) + val maskSave = + canvas.saveLayer(0f, 0f, view.width.toFloat(), view.height.toFloat(), dstInPaint) + // Clear the layer to ensure it starts fully transparent. On API 24, saveLayer may not + // initialize the buffer to transparent, causing DST_IN to see non-zero alpha everywhere. + canvas.drawColor(Color.TRANSPARENT, PorterDuff.Mode.CLEAR) + maskPaint.xfermode = null maskPaint.color = Color.BLACK - canvas.drawPath(inversePath, maskPaint) + canvas.drawPath(paddingBoxPath, maskPaint) + canvas.restoreToCount(maskSave) } // Restore the layer From 4a7bc4c0e7424bf0dcea9ae2a3c1ce3e4cbb1333 Mon Sep 17 00:00:00 2001 From: Jakub Piasecki Date: Mon, 16 Feb 2026 01:32:50 -0800 Subject: [PATCH 366/585] Refactor how we promote shadow tree revisions as latest for JS consistency (#54833) Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/54833 Changelog: [General][Changed] - Refactor how shadow tree revisions are promoted as latest for JS consistency Changes `LazyShadowTreeRevisionConsistencyManager::updateCurrentRevision` to pull the latest commited revision for a given surface id instead of accepting the new revision as a parameter. This way, the new revision is read from the same place for every update, which opens up the way to implement commit branching. This change will allow to always read from the JS tree revision, if it exists. Reviewed By: rubennorte Differential Revision: D88151490 fbshipit-source-id: 05b9c5e0bf87c7984513bc853a173ad25d4ff592 --- .../react/renderer/uimanager/UIManager.cpp | 21 +++++----- ...zyShadowTreeRevisionConsistencyManager.cpp | 40 ++++++++----------- ...LazyShadowTreeRevisionConsistencyManager.h | 4 +- ...adowTreeRevisionConsistencyManagerTest.cpp | 12 +++--- 4 files changed, 37 insertions(+), 40 deletions(-) diff --git a/packages/react-native/ReactCommon/react/renderer/uimanager/UIManager.cpp b/packages/react-native/ReactCommon/react/renderer/uimanager/UIManager.cpp index c1d12096c2f..8dddd3ced43 100644 --- a/packages/react-native/ReactCommon/react/renderer/uimanager/UIManager.cpp +++ b/packages/react-native/ReactCommon/react/renderer/uimanager/UIManager.cpp @@ -188,8 +188,10 @@ void UIManager::completeSurface( ShadowTree::CommitOptions commitOptions) { TraceSection s("UIManager::completeSurface", "surfaceId", surfaceId); + ShadowTree::CommitStatus result; + shadowTreeRegistry_.visit(surfaceId, [&](const ShadowTree& shadowTree) { - auto result = shadowTree.commit( + result = shadowTree.commit( [&](const RootShadowNode& oldRootShadowNode) { return std::make_shared( oldRootShadowNode, @@ -199,18 +201,17 @@ void UIManager::completeSurface( }); }, commitOptions); + }); - if (result == ShadowTree::CommitStatus::Succeeded) { - // It's safe to update the visible revision of the shadow tree immediately - // after we commit a specific one. - lazyShadowTreeRevisionConsistencyManager_->updateCurrentRevision( - surfaceId, shadowTree.getCurrentRevision().rootShadowNode); + if (result == ShadowTree::CommitStatus::Succeeded) { + // It's safe to update the visible revision of the shadow tree immediately + // after we commit a specific one. + lazyShadowTreeRevisionConsistencyManager_->updateCurrentRevision(surfaceId); - if (ReactNativeFeatureFlags::useSharedAnimatedBackend()) { - animationBackend_->clearRegistry(surfaceId); - } + if (ReactNativeFeatureFlags::useSharedAnimatedBackend()) { + animationBackend_->clearRegistry(surfaceId); } - }); + } } void UIManager::setIsJSResponder( diff --git a/packages/react-native/ReactCommon/react/renderer/uimanager/consistency/LazyShadowTreeRevisionConsistencyManager.cpp b/packages/react-native/ReactCommon/react/renderer/uimanager/consistency/LazyShadowTreeRevisionConsistencyManager.cpp index 85cd9cd5158..8afaad89b39 100644 --- a/packages/react-native/ReactCommon/react/renderer/uimanager/consistency/LazyShadowTreeRevisionConsistencyManager.cpp +++ b/packages/react-native/ReactCommon/react/renderer/uimanager/consistency/LazyShadowTreeRevisionConsistencyManager.cpp @@ -15,22 +15,32 @@ LazyShadowTreeRevisionConsistencyManager:: ShadowTreeRegistry& shadowTreeRegistry) : shadowTreeRegistry_(shadowTreeRegistry) {} -void LazyShadowTreeRevisionConsistencyManager::updateCurrentRevision( - SurfaceId surfaceId, - RootShadowNode::Shared rootShadowNode) { +std::shared_ptr +LazyShadowTreeRevisionConsistencyManager::updateCurrentRevision( + SurfaceId surfaceId) { + // This method is only going to be called from JS, so we don't need to protect + // the access to the shadow tree registry as well. + // If this was multi-threaded, we would need to protect it to avoid capturing + // root shadow nodes concurrently. + RootShadowNode::Shared rootShadowNode; + shadowTreeRegistry_.visit(surfaceId, [&](const ShadowTree& shadowTree) { + rootShadowNode = shadowTree.getCurrentRevision().rootShadowNode; + }); + std::unique_lock lock(capturedRootShadowNodesForConsistencyMutex_); // We don't need to store the revision if we haven't locked. // We can resolve lazily when requested. if (lockCount > 0) { - capturedRootShadowNodesForConsistency_[surfaceId] = - std::move(rootShadowNode); + capturedRootShadowNodesForConsistency_[surfaceId] = rootShadowNode; } + + return rootShadowNode; } #pragma mark - ShadowTreeRevisionProvider -RootShadowNode::Shared +std::shared_ptr LazyShadowTreeRevisionConsistencyManager::getCurrentRevision( SurfaceId surfaceId) { { @@ -43,23 +53,7 @@ LazyShadowTreeRevisionConsistencyManager::getCurrentRevision( } } - // This method is only going to be called from JS, so we don't need to protect - // the access to the shadow tree registry as well. - // If this was multi-threaded, we would need to protect it to avoid capturing - // root shadow nodes concurrently. - RootShadowNode::Shared rootShadowNode; - shadowTreeRegistry_.visit(surfaceId, [&](const ShadowTree& shadowTree) { - rootShadowNode = shadowTree.getCurrentRevision().rootShadowNode; - }); - - { - std::unique_lock lock(capturedRootShadowNodesForConsistencyMutex_); - if (lockCount > 0) { - capturedRootShadowNodesForConsistency_[surfaceId] = rootShadowNode; - } - } - - return rootShadowNode; + return updateCurrentRevision(surfaceId); } #pragma mark - ConsistentShadowTreeRevisionProvider diff --git a/packages/react-native/ReactCommon/react/renderer/uimanager/consistency/LazyShadowTreeRevisionConsistencyManager.h b/packages/react-native/ReactCommon/react/renderer/uimanager/consistency/LazyShadowTreeRevisionConsistencyManager.h index 96c7537ed28..b63ec2977db 100644 --- a/packages/react-native/ReactCommon/react/renderer/uimanager/consistency/LazyShadowTreeRevisionConsistencyManager.h +++ b/packages/react-native/ReactCommon/react/renderer/uimanager/consistency/LazyShadowTreeRevisionConsistencyManager.h @@ -28,11 +28,11 @@ class LazyShadowTreeRevisionConsistencyManager : public ShadowTreeRevisionConsis public: explicit LazyShadowTreeRevisionConsistencyManager(ShadowTreeRegistry &shadowTreeRegistry); - void updateCurrentRevision(SurfaceId surfaceId, RootShadowNode::Shared rootShadowNode); + std::shared_ptr updateCurrentRevision(SurfaceId surfaceId); #pragma mark - ShadowTreeRevisionProvider - RootShadowNode::Shared getCurrentRevision(SurfaceId surfaceId) override; + std::shared_ptr getCurrentRevision(SurfaceId surfaceId) override; #pragma mark - ShadowTreeRevisionConsistencyManager diff --git a/packages/react-native/ReactCommon/react/renderer/uimanager/consistency/tests/LazyShadowTreeRevisionConsistencyManagerTest.cpp b/packages/react-native/ReactCommon/react/renderer/uimanager/consistency/tests/LazyShadowTreeRevisionConsistencyManagerTest.cpp index 01d43d096c5..322172b3de1 100644 --- a/packages/react-native/ReactCommon/react/renderer/uimanager/consistency/tests/LazyShadowTreeRevisionConsistencyManagerTest.cpp +++ b/packages/react-native/ReactCommon/react/renderer/uimanager/consistency/tests/LazyShadowTreeRevisionConsistencyManagerTest.cpp @@ -141,7 +141,7 @@ TEST_F( EXPECT_EQ(consistencyManager_.getCurrentRevision(0), nullptr); - consistencyManager_.updateCurrentRevision(0, newRootShadowNode); + consistencyManager_.updateCurrentRevision(0); EXPECT_NE(consistencyManager_.getCurrentRevision(0), nullptr); EXPECT_EQ( @@ -176,7 +176,7 @@ TEST_F( EXPECT_EQ(consistencyManager_.getCurrentRevision(0), nullptr); - consistencyManager_.updateCurrentRevision(0, newRootShadowNode); + consistencyManager_.updateCurrentRevision(0); EXPECT_EQ( consistencyManager_.getCurrentRevision(0).get(), newRootShadowNode.get()); @@ -192,7 +192,7 @@ TEST_F( {}); }); - consistencyManager_.updateCurrentRevision(0, newRootShadowNode2); + consistencyManager_.updateCurrentRevision(0); EXPECT_EQ( consistencyManager_.getCurrentRevision(0).get(), @@ -265,7 +265,7 @@ TEST_F( EXPECT_EQ( consistencyManager_.getCurrentRevision(0).get(), newRootShadowNode.get()); - consistencyManager_.updateCurrentRevision(0, newRootShadowNode2); + consistencyManager_.updateCurrentRevision(0); // Updated EXPECT_EQ( @@ -344,7 +344,9 @@ TEST_F(LazyShadowTreeRevisionConsistencyManagerTest, testUpdateToUnmounted) { EXPECT_EQ( consistencyManager_.getCurrentRevision(0).get(), newRootShadowNode.get()); - consistencyManager_.updateCurrentRevision(0, nullptr); + shadowTreeRegistry_.remove(0); + + consistencyManager_.updateCurrentRevision(0); // Updated EXPECT_EQ(consistencyManager_.getCurrentRevision(0).get(), nullptr); From 61e9629a60f7856a4a58718f5c82a87ed4e7c190 Mon Sep 17 00:00:00 2001 From: Jakub Piasecki Date: Mon, 16 Feb 2026 01:32:50 -0800 Subject: [PATCH 367/585] Add feature flag for Fabric commit branching (#54834) Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/54834 Changelog: [Internal] Adds a feature flag for the Fabric commit branching mechanism. Reviewed By: mdvacca Differential Revision: D88151491 fbshipit-source-id: d3c9b8579da205b2b222f8851a28a930f95b0f15 --- .../featureflags/ReactNativeFeatureFlags.kt | 8 +- .../ReactNativeFeatureFlagsCxxAccessor.kt | 12 +- .../ReactNativeFeatureFlagsCxxInterop.kt | 4 +- .../ReactNativeFeatureFlagsDefaults.kt | 4 +- .../ReactNativeFeatureFlagsLocalAccessor.kt | 13 +- .../ReactNativeFeatureFlagsProvider.kt | 4 +- .../JReactNativeFeatureFlagsCxxInterop.cpp | 16 ++- .../JReactNativeFeatureFlagsCxxInterop.h | 5 +- .../featureflags/ReactNativeFeatureFlags.cpp | 6 +- .../featureflags/ReactNativeFeatureFlags.h | 7 +- .../ReactNativeFeatureFlagsAccessor.cpp | 136 ++++++++++-------- .../ReactNativeFeatureFlagsAccessor.h | 6 +- .../ReactNativeFeatureFlagsDefaults.h | 6 +- .../ReactNativeFeatureFlagsDynamicProvider.h | 11 +- .../ReactNativeFeatureFlagsProvider.h | 3 +- .../NativeReactNativeFeatureFlags.cpp | 7 +- .../NativeReactNativeFeatureFlags.h | 4 +- .../ReactNativeFeatureFlags.config.js | 10 ++ .../featureflags/ReactNativeFeatureFlags.js | 7 +- .../specs/NativeReactNativeFeatureFlags.js | 3 +- 20 files changed, 194 insertions(+), 78 deletions(-) diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlags.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlags.kt index eff943289b1..ddf64551394 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlags.kt +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlags.kt @@ -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<<67ef2bd30983c949f41e014297dabd6e>> + * @generated SignedSource<<65e8cae8a55213f4b08ec4d896a05c00>> */ /** @@ -162,6 +162,12 @@ public object ReactNativeFeatureFlags { @JvmStatic public fun enableExclusivePropsUpdateAndroid(): Boolean = accessor.enableExclusivePropsUpdateAndroid() + /** + * Enables Fabric commit branching to fix starvation problems and atomic JS updates. + */ + @JvmStatic + public fun enableFabricCommitBranching(): Boolean = accessor.enableFabricCommitBranching() + /** * This feature flag enables logs for Fabric. */ diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsCxxAccessor.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsCxxAccessor.kt index 77ce14c422c..deda8570f22 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsCxxAccessor.kt +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsCxxAccessor.kt @@ -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<> + * @generated SignedSource<> */ /** @@ -42,6 +42,7 @@ internal class ReactNativeFeatureFlagsCxxAccessor : ReactNativeFeatureFlagsAcces private var enableEagerMainQueueModulesOnIOSCache: Boolean? = null private var enableEagerRootViewAttachmentCache: Boolean? = null private var enableExclusivePropsUpdateAndroidCache: Boolean? = null + private var enableFabricCommitBranchingCache: Boolean? = null private var enableFabricLogsCache: Boolean? = null private var enableFabricRendererCache: Boolean? = null private var enableFontScaleChangesUpdatingLayoutCache: Boolean? = null @@ -299,6 +300,15 @@ internal class ReactNativeFeatureFlagsCxxAccessor : ReactNativeFeatureFlagsAcces return cached } + override fun enableFabricCommitBranching(): Boolean { + var cached = enableFabricCommitBranchingCache + if (cached == null) { + cached = ReactNativeFeatureFlagsCxxInterop.enableFabricCommitBranching() + enableFabricCommitBranchingCache = cached + } + return cached + } + override fun enableFabricLogs(): Boolean { var cached = enableFabricLogsCache if (cached == null) { diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsCxxInterop.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsCxxInterop.kt index 4e69d2adc4a..e1fc5716b4e 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsCxxInterop.kt +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsCxxInterop.kt @@ -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<> + * @generated SignedSource<> */ /** @@ -72,6 +72,8 @@ public object ReactNativeFeatureFlagsCxxInterop { @DoNotStrip @JvmStatic public external fun enableExclusivePropsUpdateAndroid(): Boolean + @DoNotStrip @JvmStatic public external fun enableFabricCommitBranching(): Boolean + @DoNotStrip @JvmStatic public external fun enableFabricLogs(): Boolean @DoNotStrip @JvmStatic public external fun enableFabricRenderer(): Boolean diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsDefaults.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsDefaults.kt index 474b3da78d6..c0249bf8683 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsDefaults.kt +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsDefaults.kt @@ -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<<62ddb63e95e2b2aff842c5d13210d742>> + * @generated SignedSource<<0139bc7a7b2ae5c9175f44de1ac80105>> */ /** @@ -67,6 +67,8 @@ public open class ReactNativeFeatureFlagsDefaults : ReactNativeFeatureFlagsProvi override fun enableExclusivePropsUpdateAndroid(): Boolean = false + override fun enableFabricCommitBranching(): Boolean = false + override fun enableFabricLogs(): Boolean = false override fun enableFabricRenderer(): Boolean = false diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsLocalAccessor.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsLocalAccessor.kt index 2e6e246813a..7ccdb793016 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsLocalAccessor.kt +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsLocalAccessor.kt @@ -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<<477ec1cf98790b5219ed37092ae958cc>> + * @generated SignedSource<> */ /** @@ -46,6 +46,7 @@ internal class ReactNativeFeatureFlagsLocalAccessor : ReactNativeFeatureFlagsAcc private var enableEagerMainQueueModulesOnIOSCache: Boolean? = null private var enableEagerRootViewAttachmentCache: Boolean? = null private var enableExclusivePropsUpdateAndroidCache: Boolean? = null + private var enableFabricCommitBranchingCache: Boolean? = null private var enableFabricLogsCache: Boolean? = null private var enableFabricRendererCache: Boolean? = null private var enableFontScaleChangesUpdatingLayoutCache: Boolean? = null @@ -325,6 +326,16 @@ internal class ReactNativeFeatureFlagsLocalAccessor : ReactNativeFeatureFlagsAcc return cached } + override fun enableFabricCommitBranching(): Boolean { + var cached = enableFabricCommitBranchingCache + if (cached == null) { + cached = currentProvider.enableFabricCommitBranching() + accessedFeatureFlags.add("enableFabricCommitBranching") + enableFabricCommitBranchingCache = cached + } + return cached + } + override fun enableFabricLogs(): Boolean { var cached = enableFabricLogsCache if (cached == null) { diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsProvider.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsProvider.kt index 2eed3c97aba..e1278f51261 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsProvider.kt +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsProvider.kt @@ -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<<4480d856ab56f2ecb216610b6e4ae31e>> + * @generated SignedSource<> */ /** @@ -67,6 +67,8 @@ public interface ReactNativeFeatureFlagsProvider { @DoNotStrip public fun enableExclusivePropsUpdateAndroid(): Boolean + @DoNotStrip public fun enableFabricCommitBranching(): Boolean + @DoNotStrip public fun enableFabricLogs(): Boolean @DoNotStrip public fun enableFabricRenderer(): Boolean diff --git a/packages/react-native/ReactAndroid/src/main/jni/react/featureflags/JReactNativeFeatureFlagsCxxInterop.cpp b/packages/react-native/ReactAndroid/src/main/jni/react/featureflags/JReactNativeFeatureFlagsCxxInterop.cpp index 91657979e42..d1aa05d33fa 100644 --- a/packages/react-native/ReactAndroid/src/main/jni/react/featureflags/JReactNativeFeatureFlagsCxxInterop.cpp +++ b/packages/react-native/ReactAndroid/src/main/jni/react/featureflags/JReactNativeFeatureFlagsCxxInterop.cpp @@ -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<<176845e66b87994db4a9199df21740c0>> + * @generated SignedSource<<4386581c81476b6f7684a8766642db13>> */ /** @@ -171,6 +171,12 @@ class ReactNativeFeatureFlagsJavaProvider return method(javaProvider_); } + bool enableFabricCommitBranching() override { + static const auto method = + getReactNativeFeatureFlagsProviderJavaClass()->getMethod("enableFabricCommitBranching"); + return method(javaProvider_); + } + bool enableFabricLogs() override { static const auto method = getReactNativeFeatureFlagsProviderJavaClass()->getMethod("enableFabricLogs"); @@ -633,6 +639,11 @@ bool JReactNativeFeatureFlagsCxxInterop::enableExclusivePropsUpdateAndroid( return ReactNativeFeatureFlags::enableExclusivePropsUpdateAndroid(); } +bool JReactNativeFeatureFlagsCxxInterop::enableFabricCommitBranching( + facebook::jni::alias_ref /*unused*/) { + return ReactNativeFeatureFlags::enableFabricCommitBranching(); +} + bool JReactNativeFeatureFlagsCxxInterop::enableFabricLogs( facebook::jni::alias_ref /*unused*/) { return ReactNativeFeatureFlags::enableFabricLogs(); @@ -1020,6 +1031,9 @@ void JReactNativeFeatureFlagsCxxInterop::registerNatives() { makeNativeMethod( "enableExclusivePropsUpdateAndroid", JReactNativeFeatureFlagsCxxInterop::enableExclusivePropsUpdateAndroid), + makeNativeMethod( + "enableFabricCommitBranching", + JReactNativeFeatureFlagsCxxInterop::enableFabricCommitBranching), makeNativeMethod( "enableFabricLogs", JReactNativeFeatureFlagsCxxInterop::enableFabricLogs), diff --git a/packages/react-native/ReactAndroid/src/main/jni/react/featureflags/JReactNativeFeatureFlagsCxxInterop.h b/packages/react-native/ReactAndroid/src/main/jni/react/featureflags/JReactNativeFeatureFlagsCxxInterop.h index 651ee6f8647..3d39e84acb5 100644 --- a/packages/react-native/ReactAndroid/src/main/jni/react/featureflags/JReactNativeFeatureFlagsCxxInterop.h +++ b/packages/react-native/ReactAndroid/src/main/jni/react/featureflags/JReactNativeFeatureFlagsCxxInterop.h @@ -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<<4078cafe7570b1478adc0b278a25155a>> + * @generated SignedSource<<49c9151beb66235968403b1091de3f56>> */ /** @@ -96,6 +96,9 @@ class JReactNativeFeatureFlagsCxxInterop static bool enableExclusivePropsUpdateAndroid( facebook::jni::alias_ref); + static bool enableFabricCommitBranching( + facebook::jni::alias_ref); + static bool enableFabricLogs( facebook::jni::alias_ref); diff --git a/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlags.cpp b/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlags.cpp index 932769fb954..956ec09b2eb 100644 --- a/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlags.cpp +++ b/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlags.cpp @@ -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<> + * @generated SignedSource<> */ /** @@ -114,6 +114,10 @@ bool ReactNativeFeatureFlags::enableExclusivePropsUpdateAndroid() { return getAccessor().enableExclusivePropsUpdateAndroid(); } +bool ReactNativeFeatureFlags::enableFabricCommitBranching() { + return getAccessor().enableFabricCommitBranching(); +} + bool ReactNativeFeatureFlags::enableFabricLogs() { return getAccessor().enableFabricLogs(); } diff --git a/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlags.h b/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlags.h index 70ae43f8f37..056741e7925 100644 --- a/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlags.h +++ b/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlags.h @@ -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<> + * @generated SignedSource<> */ /** @@ -149,6 +149,11 @@ class ReactNativeFeatureFlags { */ RN_EXPORT static bool enableExclusivePropsUpdateAndroid(); + /** + * Enables Fabric commit branching to fix starvation problems and atomic JS updates. + */ + RN_EXPORT static bool enableFabricCommitBranching(); + /** * This feature flag enables logs for Fabric. */ diff --git a/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlagsAccessor.cpp b/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlagsAccessor.cpp index 4741bba3d35..315bdee9678 100644 --- a/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlagsAccessor.cpp +++ b/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlagsAccessor.cpp @@ -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<> + * @generated SignedSource<> */ /** @@ -425,6 +425,24 @@ bool ReactNativeFeatureFlagsAccessor::enableExclusivePropsUpdateAndroid() { return flagValue.value(); } +bool ReactNativeFeatureFlagsAccessor::enableFabricCommitBranching() { + auto flagValue = enableFabricCommitBranching_.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(22, "enableFabricCommitBranching"); + + flagValue = currentProvider_->enableFabricCommitBranching(); + enableFabricCommitBranching_ = flagValue; + } + + return flagValue.value(); +} + bool ReactNativeFeatureFlagsAccessor::enableFabricLogs() { auto flagValue = enableFabricLogs_.load(); @@ -434,7 +452,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(22, "enableFabricLogs"); + markFlagAsAccessed(23, "enableFabricLogs"); flagValue = currentProvider_->enableFabricLogs(); enableFabricLogs_ = flagValue; @@ -452,7 +470,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(23, "enableFabricRenderer"); + markFlagAsAccessed(24, "enableFabricRenderer"); flagValue = currentProvider_->enableFabricRenderer(); enableFabricRenderer_ = flagValue; @@ -470,7 +488,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(24, "enableFontScaleChangesUpdatingLayout"); + markFlagAsAccessed(25, "enableFontScaleChangesUpdatingLayout"); flagValue = currentProvider_->enableFontScaleChangesUpdatingLayout(); enableFontScaleChangesUpdatingLayout_ = flagValue; @@ -488,7 +506,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(25, "enableIOSTextBaselineOffsetPerLine"); + markFlagAsAccessed(26, "enableIOSTextBaselineOffsetPerLine"); flagValue = currentProvider_->enableIOSTextBaselineOffsetPerLine(); enableIOSTextBaselineOffsetPerLine_ = flagValue; @@ -506,7 +524,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(26, "enableIOSViewClipToPaddingBox"); + markFlagAsAccessed(27, "enableIOSViewClipToPaddingBox"); flagValue = currentProvider_->enableIOSViewClipToPaddingBox(); enableIOSViewClipToPaddingBox_ = flagValue; @@ -524,7 +542,7 @@ bool ReactNativeFeatureFlagsAccessor::enableImagePrefetchingAndroid() { // be accessing the provider multiple times but the end state of this // instance and the returned flag value would be the same. - markFlagAsAccessed(27, "enableImagePrefetchingAndroid"); + markFlagAsAccessed(28, "enableImagePrefetchingAndroid"); flagValue = currentProvider_->enableImagePrefetchingAndroid(); enableImagePrefetchingAndroid_ = flagValue; @@ -542,7 +560,7 @@ bool ReactNativeFeatureFlagsAccessor::enableImagePrefetchingJNIBatchingAndroid() // be accessing the provider multiple times but the end state of this // instance and the returned flag value would be the same. - markFlagAsAccessed(28, "enableImagePrefetchingJNIBatchingAndroid"); + markFlagAsAccessed(29, "enableImagePrefetchingJNIBatchingAndroid"); flagValue = currentProvider_->enableImagePrefetchingJNIBatchingAndroid(); enableImagePrefetchingJNIBatchingAndroid_ = flagValue; @@ -560,7 +578,7 @@ bool ReactNativeFeatureFlagsAccessor::enableImagePrefetchingOnUiThreadAndroid() // be accessing the provider multiple times but the end state of this // instance and the returned flag value would be the same. - markFlagAsAccessed(29, "enableImagePrefetchingOnUiThreadAndroid"); + markFlagAsAccessed(30, "enableImagePrefetchingOnUiThreadAndroid"); flagValue = currentProvider_->enableImagePrefetchingOnUiThreadAndroid(); enableImagePrefetchingOnUiThreadAndroid_ = flagValue; @@ -578,7 +596,7 @@ bool ReactNativeFeatureFlagsAccessor::enableImmediateUpdateModeForContentOffsetC // be accessing the provider multiple times but the end state of this // instance and the returned flag value would be the same. - markFlagAsAccessed(30, "enableImmediateUpdateModeForContentOffsetChanges"); + markFlagAsAccessed(31, "enableImmediateUpdateModeForContentOffsetChanges"); flagValue = currentProvider_->enableImmediateUpdateModeForContentOffsetChanges(); enableImmediateUpdateModeForContentOffsetChanges_ = flagValue; @@ -596,7 +614,7 @@ bool ReactNativeFeatureFlagsAccessor::enableImperativeFocus() { // be accessing the provider multiple times but the end state of this // instance and the returned flag value would be the same. - markFlagAsAccessed(31, "enableImperativeFocus"); + markFlagAsAccessed(32, "enableImperativeFocus"); flagValue = currentProvider_->enableImperativeFocus(); enableImperativeFocus_ = flagValue; @@ -614,7 +632,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(32, "enableInteropViewManagerClassLookUpOptimizationIOS"); + markFlagAsAccessed(33, "enableInteropViewManagerClassLookUpOptimizationIOS"); flagValue = currentProvider_->enableInteropViewManagerClassLookUpOptimizationIOS(); enableInteropViewManagerClassLookUpOptimizationIOS_ = flagValue; @@ -632,7 +650,7 @@ bool ReactNativeFeatureFlagsAccessor::enableIntersectionObserverByDefault() { // be accessing the provider multiple times but the end state of this // instance and the returned flag value would be the same. - markFlagAsAccessed(33, "enableIntersectionObserverByDefault"); + markFlagAsAccessed(34, "enableIntersectionObserverByDefault"); flagValue = currentProvider_->enableIntersectionObserverByDefault(); enableIntersectionObserverByDefault_ = flagValue; @@ -650,7 +668,7 @@ bool ReactNativeFeatureFlagsAccessor::enableKeyEvents() { // be accessing the provider multiple times but the end state of this // instance and the returned flag value would be the same. - markFlagAsAccessed(34, "enableKeyEvents"); + markFlagAsAccessed(35, "enableKeyEvents"); flagValue = currentProvider_->enableKeyEvents(); enableKeyEvents_ = flagValue; @@ -668,7 +686,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(35, "enableLayoutAnimationsOnAndroid"); + markFlagAsAccessed(36, "enableLayoutAnimationsOnAndroid"); flagValue = currentProvider_->enableLayoutAnimationsOnAndroid(); enableLayoutAnimationsOnAndroid_ = flagValue; @@ -686,7 +704,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(36, "enableLayoutAnimationsOnIOS"); + markFlagAsAccessed(37, "enableLayoutAnimationsOnIOS"); flagValue = currentProvider_->enableLayoutAnimationsOnIOS(); enableLayoutAnimationsOnIOS_ = flagValue; @@ -704,7 +722,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(37, "enableMainQueueCoordinatorOnIOS"); + markFlagAsAccessed(38, "enableMainQueueCoordinatorOnIOS"); flagValue = currentProvider_->enableMainQueueCoordinatorOnIOS(); enableMainQueueCoordinatorOnIOS_ = flagValue; @@ -722,7 +740,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(38, "enableModuleArgumentNSNullConversionIOS"); + markFlagAsAccessed(39, "enableModuleArgumentNSNullConversionIOS"); flagValue = currentProvider_->enableModuleArgumentNSNullConversionIOS(); enableModuleArgumentNSNullConversionIOS_ = flagValue; @@ -740,7 +758,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(39, "enableNativeCSSParsing"); + markFlagAsAccessed(40, "enableNativeCSSParsing"); flagValue = currentProvider_->enableNativeCSSParsing(); enableNativeCSSParsing_ = flagValue; @@ -758,7 +776,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(40, "enableNetworkEventReporting"); + markFlagAsAccessed(41, "enableNetworkEventReporting"); flagValue = currentProvider_->enableNetworkEventReporting(); enableNetworkEventReporting_ = flagValue; @@ -776,7 +794,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(41, "enablePreparedTextLayout"); + markFlagAsAccessed(42, "enablePreparedTextLayout"); flagValue = currentProvider_->enablePreparedTextLayout(); enablePreparedTextLayout_ = flagValue; @@ -794,7 +812,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(42, "enablePropsUpdateReconciliationAndroid"); + markFlagAsAccessed(43, "enablePropsUpdateReconciliationAndroid"); flagValue = currentProvider_->enablePropsUpdateReconciliationAndroid(); enablePropsUpdateReconciliationAndroid_ = flagValue; @@ -812,7 +830,7 @@ bool ReactNativeFeatureFlagsAccessor::enableSwiftUIBasedFilters() { // be accessing the provider multiple times but the end state of this // instance and the returned flag value would be the same. - markFlagAsAccessed(43, "enableSwiftUIBasedFilters"); + markFlagAsAccessed(44, "enableSwiftUIBasedFilters"); flagValue = currentProvider_->enableSwiftUIBasedFilters(); enableSwiftUIBasedFilters_ = flagValue; @@ -830,7 +848,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(44, "enableViewCulling"); + markFlagAsAccessed(45, "enableViewCulling"); flagValue = currentProvider_->enableViewCulling(); enableViewCulling_ = flagValue; @@ -848,7 +866,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(45, "enableViewRecycling"); + markFlagAsAccessed(46, "enableViewRecycling"); flagValue = currentProvider_->enableViewRecycling(); enableViewRecycling_ = flagValue; @@ -866,7 +884,7 @@ bool ReactNativeFeatureFlagsAccessor::enableViewRecyclingForImage() { // be accessing the provider multiple times but the end state of this // instance and the returned flag value would be the same. - markFlagAsAccessed(46, "enableViewRecyclingForImage"); + markFlagAsAccessed(47, "enableViewRecyclingForImage"); flagValue = currentProvider_->enableViewRecyclingForImage(); enableViewRecyclingForImage_ = flagValue; @@ -884,7 +902,7 @@ bool ReactNativeFeatureFlagsAccessor::enableViewRecyclingForScrollView() { // be accessing the provider multiple times but the end state of this // instance and the returned flag value would be the same. - markFlagAsAccessed(47, "enableViewRecyclingForScrollView"); + markFlagAsAccessed(48, "enableViewRecyclingForScrollView"); flagValue = currentProvider_->enableViewRecyclingForScrollView(); enableViewRecyclingForScrollView_ = flagValue; @@ -902,7 +920,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(48, "enableViewRecyclingForText"); + markFlagAsAccessed(49, "enableViewRecyclingForText"); flagValue = currentProvider_->enableViewRecyclingForText(); enableViewRecyclingForText_ = flagValue; @@ -920,7 +938,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(49, "enableViewRecyclingForView"); + markFlagAsAccessed(50, "enableViewRecyclingForView"); flagValue = currentProvider_->enableViewRecyclingForView(); enableViewRecyclingForView_ = flagValue; @@ -938,7 +956,7 @@ bool ReactNativeFeatureFlagsAccessor::enableVirtualViewContainerStateExperimenta // be accessing the provider multiple times but the end state of this // instance and the returned flag value would be the same. - markFlagAsAccessed(50, "enableVirtualViewContainerStateExperimental"); + markFlagAsAccessed(51, "enableVirtualViewContainerStateExperimental"); flagValue = currentProvider_->enableVirtualViewContainerStateExperimental(); enableVirtualViewContainerStateExperimental_ = flagValue; @@ -956,7 +974,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(51, "enableVirtualViewDebugFeatures"); + markFlagAsAccessed(52, "enableVirtualViewDebugFeatures"); flagValue = currentProvider_->enableVirtualViewDebugFeatures(); enableVirtualViewDebugFeatures_ = flagValue; @@ -974,7 +992,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(52, "fixMappingOfEventPrioritiesBetweenFabricAndReact"); + markFlagAsAccessed(53, "fixMappingOfEventPrioritiesBetweenFabricAndReact"); flagValue = currentProvider_->fixMappingOfEventPrioritiesBetweenFabricAndReact(); fixMappingOfEventPrioritiesBetweenFabricAndReact_ = flagValue; @@ -992,7 +1010,7 @@ bool ReactNativeFeatureFlagsAccessor::fixTextClippingAndroid15useBoundsForWidth( // be accessing the provider multiple times but the end state of this // instance and the returned flag value would be the same. - markFlagAsAccessed(53, "fixTextClippingAndroid15useBoundsForWidth"); + markFlagAsAccessed(54, "fixTextClippingAndroid15useBoundsForWidth"); flagValue = currentProvider_->fixTextClippingAndroid15useBoundsForWidth(); fixTextClippingAndroid15useBoundsForWidth_ = flagValue; @@ -1010,7 +1028,7 @@ bool ReactNativeFeatureFlagsAccessor::fuseboxAssertSingleHostState() { // be accessing the provider multiple times but the end state of this // instance and the returned flag value would be the same. - markFlagAsAccessed(54, "fuseboxAssertSingleHostState"); + markFlagAsAccessed(55, "fuseboxAssertSingleHostState"); flagValue = currentProvider_->fuseboxAssertSingleHostState(); fuseboxAssertSingleHostState_ = flagValue; @@ -1028,7 +1046,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(55, "fuseboxEnabledRelease"); + markFlagAsAccessed(56, "fuseboxEnabledRelease"); flagValue = currentProvider_->fuseboxEnabledRelease(); fuseboxEnabledRelease_ = flagValue; @@ -1046,7 +1064,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(56, "fuseboxNetworkInspectionEnabled"); + markFlagAsAccessed(57, "fuseboxNetworkInspectionEnabled"); flagValue = currentProvider_->fuseboxNetworkInspectionEnabled(); fuseboxNetworkInspectionEnabled_ = flagValue; @@ -1064,7 +1082,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(57, "hideOffscreenVirtualViewsOnIOS"); + markFlagAsAccessed(58, "hideOffscreenVirtualViewsOnIOS"); flagValue = currentProvider_->hideOffscreenVirtualViewsOnIOS(); hideOffscreenVirtualViewsOnIOS_ = flagValue; @@ -1082,7 +1100,7 @@ bool ReactNativeFeatureFlagsAccessor::overrideBySynchronousMountPropsAtMountingA // be accessing the provider multiple times but the end state of this // instance and the returned flag value would be the same. - markFlagAsAccessed(58, "overrideBySynchronousMountPropsAtMountingAndroid"); + markFlagAsAccessed(59, "overrideBySynchronousMountPropsAtMountingAndroid"); flagValue = currentProvider_->overrideBySynchronousMountPropsAtMountingAndroid(); overrideBySynchronousMountPropsAtMountingAndroid_ = flagValue; @@ -1100,7 +1118,7 @@ bool ReactNativeFeatureFlagsAccessor::perfIssuesEnabled() { // be accessing the provider multiple times but the end state of this // instance and the returned flag value would be the same. - markFlagAsAccessed(59, "perfIssuesEnabled"); + markFlagAsAccessed(60, "perfIssuesEnabled"); flagValue = currentProvider_->perfIssuesEnabled(); perfIssuesEnabled_ = flagValue; @@ -1118,7 +1136,7 @@ bool ReactNativeFeatureFlagsAccessor::perfMonitorV2Enabled() { // be accessing the provider multiple times but the end state of this // instance and the returned flag value would be the same. - markFlagAsAccessed(60, "perfMonitorV2Enabled"); + markFlagAsAccessed(61, "perfMonitorV2Enabled"); flagValue = currentProvider_->perfMonitorV2Enabled(); perfMonitorV2Enabled_ = flagValue; @@ -1136,7 +1154,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(61, "preparedTextCacheSize"); + markFlagAsAccessed(62, "preparedTextCacheSize"); flagValue = currentProvider_->preparedTextCacheSize(); preparedTextCacheSize_ = flagValue; @@ -1154,7 +1172,7 @@ bool ReactNativeFeatureFlagsAccessor::preventShadowTreeCommitExhaustion() { // be accessing the provider multiple times but the end state of this // instance and the returned flag value would be the same. - markFlagAsAccessed(62, "preventShadowTreeCommitExhaustion"); + markFlagAsAccessed(63, "preventShadowTreeCommitExhaustion"); flagValue = currentProvider_->preventShadowTreeCommitExhaustion(); preventShadowTreeCommitExhaustion_ = flagValue; @@ -1172,7 +1190,7 @@ bool ReactNativeFeatureFlagsAccessor::shouldPressibilityUseW3CPointerEventsForHo // be accessing the provider multiple times but the end state of this // instance and the returned flag value would be the same. - markFlagAsAccessed(63, "shouldPressibilityUseW3CPointerEventsForHover"); + markFlagAsAccessed(64, "shouldPressibilityUseW3CPointerEventsForHover"); flagValue = currentProvider_->shouldPressibilityUseW3CPointerEventsForHover(); shouldPressibilityUseW3CPointerEventsForHover_ = flagValue; @@ -1190,7 +1208,7 @@ bool ReactNativeFeatureFlagsAccessor::shouldTriggerResponderTransferOnScrollAndr // be accessing the provider multiple times but the end state of this // instance and the returned flag value would be the same. - markFlagAsAccessed(64, "shouldTriggerResponderTransferOnScrollAndroid"); + markFlagAsAccessed(65, "shouldTriggerResponderTransferOnScrollAndroid"); flagValue = currentProvider_->shouldTriggerResponderTransferOnScrollAndroid(); shouldTriggerResponderTransferOnScrollAndroid_ = flagValue; @@ -1208,7 +1226,7 @@ bool ReactNativeFeatureFlagsAccessor::skipActivityIdentityAssertionOnHostPause() // be accessing the provider multiple times but the end state of this // instance and the returned flag value would be the same. - markFlagAsAccessed(65, "skipActivityIdentityAssertionOnHostPause"); + markFlagAsAccessed(66, "skipActivityIdentityAssertionOnHostPause"); flagValue = currentProvider_->skipActivityIdentityAssertionOnHostPause(); skipActivityIdentityAssertionOnHostPause_ = flagValue; @@ -1226,7 +1244,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(66, "traceTurboModulePromiseRejectionsOnAndroid"); + markFlagAsAccessed(67, "traceTurboModulePromiseRejectionsOnAndroid"); flagValue = currentProvider_->traceTurboModulePromiseRejectionsOnAndroid(); traceTurboModulePromiseRejectionsOnAndroid_ = flagValue; @@ -1244,7 +1262,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(67, "updateRuntimeShadowNodeReferencesOnCommit"); + markFlagAsAccessed(68, "updateRuntimeShadowNodeReferencesOnCommit"); flagValue = currentProvider_->updateRuntimeShadowNodeReferencesOnCommit(); updateRuntimeShadowNodeReferencesOnCommit_ = flagValue; @@ -1262,7 +1280,7 @@ bool ReactNativeFeatureFlagsAccessor::updateRuntimeShadowNodeReferencesOnCommitT // be accessing the provider multiple times but the end state of this // instance and the returned flag value would be the same. - markFlagAsAccessed(68, "updateRuntimeShadowNodeReferencesOnCommitThread"); + markFlagAsAccessed(69, "updateRuntimeShadowNodeReferencesOnCommitThread"); flagValue = currentProvider_->updateRuntimeShadowNodeReferencesOnCommitThread(); updateRuntimeShadowNodeReferencesOnCommitThread_ = flagValue; @@ -1280,7 +1298,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(69, "useAlwaysAvailableJSErrorHandling"); + markFlagAsAccessed(70, "useAlwaysAvailableJSErrorHandling"); flagValue = currentProvider_->useAlwaysAvailableJSErrorHandling(); useAlwaysAvailableJSErrorHandling_ = flagValue; @@ -1298,7 +1316,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(70, "useFabricInterop"); + markFlagAsAccessed(71, "useFabricInterop"); flagValue = currentProvider_->useFabricInterop(); useFabricInterop_ = flagValue; @@ -1316,7 +1334,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(71, "useNativeViewConfigsInBridgelessMode"); + markFlagAsAccessed(72, "useNativeViewConfigsInBridgelessMode"); flagValue = currentProvider_->useNativeViewConfigsInBridgelessMode(); useNativeViewConfigsInBridgelessMode_ = flagValue; @@ -1334,7 +1352,7 @@ bool ReactNativeFeatureFlagsAccessor::useNestedScrollViewAndroid() { // be accessing the provider multiple times but the end state of this // instance and the returned flag value would be the same. - markFlagAsAccessed(72, "useNestedScrollViewAndroid"); + markFlagAsAccessed(73, "useNestedScrollViewAndroid"); flagValue = currentProvider_->useNestedScrollViewAndroid(); useNestedScrollViewAndroid_ = flagValue; @@ -1352,7 +1370,7 @@ bool ReactNativeFeatureFlagsAccessor::useSharedAnimatedBackend() { // be accessing the provider multiple times but the end state of this // instance and the returned flag value would be the same. - markFlagAsAccessed(73, "useSharedAnimatedBackend"); + markFlagAsAccessed(74, "useSharedAnimatedBackend"); flagValue = currentProvider_->useSharedAnimatedBackend(); useSharedAnimatedBackend_ = flagValue; @@ -1370,7 +1388,7 @@ bool ReactNativeFeatureFlagsAccessor::useTraitHiddenOnAndroid() { // be accessing the provider multiple times but the end state of this // instance and the returned flag value would be the same. - markFlagAsAccessed(74, "useTraitHiddenOnAndroid"); + markFlagAsAccessed(75, "useTraitHiddenOnAndroid"); flagValue = currentProvider_->useTraitHiddenOnAndroid(); useTraitHiddenOnAndroid_ = flagValue; @@ -1388,7 +1406,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(75, "useTurboModuleInterop"); + markFlagAsAccessed(76, "useTurboModuleInterop"); flagValue = currentProvider_->useTurboModuleInterop(); useTurboModuleInterop_ = flagValue; @@ -1406,7 +1424,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(76, "useTurboModules"); + markFlagAsAccessed(77, "useTurboModules"); flagValue = currentProvider_->useTurboModules(); useTurboModules_ = flagValue; @@ -1424,7 +1442,7 @@ double ReactNativeFeatureFlagsAccessor::viewCullingOutsetRatio() { // be accessing the provider multiple times but the end state of this // instance and the returned flag value would be the same. - markFlagAsAccessed(77, "viewCullingOutsetRatio"); + markFlagAsAccessed(78, "viewCullingOutsetRatio"); flagValue = currentProvider_->viewCullingOutsetRatio(); viewCullingOutsetRatio_ = flagValue; @@ -1442,7 +1460,7 @@ bool ReactNativeFeatureFlagsAccessor::viewTransitionEnabled() { // be accessing the provider multiple times but the end state of this // instance and the returned flag value would be the same. - markFlagAsAccessed(78, "viewTransitionEnabled"); + markFlagAsAccessed(79, "viewTransitionEnabled"); flagValue = currentProvider_->viewTransitionEnabled(); viewTransitionEnabled_ = flagValue; @@ -1460,7 +1478,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(79, "virtualViewPrerenderRatio"); + markFlagAsAccessed(80, "virtualViewPrerenderRatio"); flagValue = currentProvider_->virtualViewPrerenderRatio(); virtualViewPrerenderRatio_ = flagValue; diff --git a/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlagsAccessor.h b/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlagsAccessor.h index a1133d323f2..aa76f95a68f 100644 --- a/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlagsAccessor.h +++ b/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlagsAccessor.h @@ -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<> + * @generated SignedSource<> */ /** @@ -54,6 +54,7 @@ class ReactNativeFeatureFlagsAccessor { bool enableEagerMainQueueModulesOnIOS(); bool enableEagerRootViewAttachment(); bool enableExclusivePropsUpdateAndroid(); + bool enableFabricCommitBranching(); bool enableFabricLogs(); bool enableFabricRenderer(); bool enableFontScaleChangesUpdatingLayout(); @@ -123,7 +124,7 @@ class ReactNativeFeatureFlagsAccessor { std::unique_ptr currentProvider_; bool wasOverridden_; - std::array, 80> accessedFeatureFlags_; + std::array, 81> accessedFeatureFlags_; std::atomic> commonTestFlag_; std::atomic> cdpInteractionMetricsEnabled_; @@ -147,6 +148,7 @@ class ReactNativeFeatureFlagsAccessor { std::atomic> enableEagerMainQueueModulesOnIOS_; std::atomic> enableEagerRootViewAttachment_; std::atomic> enableExclusivePropsUpdateAndroid_; + std::atomic> enableFabricCommitBranching_; std::atomic> enableFabricLogs_; std::atomic> enableFabricRenderer_; std::atomic> enableFontScaleChangesUpdatingLayout_; diff --git a/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlagsDefaults.h b/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlagsDefaults.h index 6c304c6bf40..7ac1e669b7f 100644 --- a/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlagsDefaults.h +++ b/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlagsDefaults.h @@ -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<<3e0a2c49ce52691f15ed127568a8bda8>> + * @generated SignedSource<<3cd7cb9afed3b596d9846a4701234677>> */ /** @@ -115,6 +115,10 @@ class ReactNativeFeatureFlagsDefaults : public ReactNativeFeatureFlagsProvider { return false; } + bool enableFabricCommitBranching() override { + return false; + } + bool enableFabricLogs() override { return false; } diff --git a/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlagsDynamicProvider.h b/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlagsDynamicProvider.h index e74c2bc6dff..8094ea9aac1 100644 --- a/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlagsDynamicProvider.h +++ b/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlagsDynamicProvider.h @@ -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<<071d8d1951fa9737eded3cd8a423eb8a>> + * @generated SignedSource<<86fa523d5b3be2d21f7b327de973e5bc>> */ /** @@ -243,6 +243,15 @@ class ReactNativeFeatureFlagsDynamicProvider : public ReactNativeFeatureFlagsDef return ReactNativeFeatureFlagsDefaults::enableExclusivePropsUpdateAndroid(); } + bool enableFabricCommitBranching() override { + auto value = values_["enableFabricCommitBranching"]; + if (!value.isNull()) { + return value.getBool(); + } + + return ReactNativeFeatureFlagsDefaults::enableFabricCommitBranching(); + } + bool enableFabricLogs() override { auto value = values_["enableFabricLogs"]; if (!value.isNull()) { diff --git a/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlagsProvider.h b/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlagsProvider.h index 6e05fd21cdd..9d238ad3490 100644 --- a/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlagsProvider.h +++ b/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlagsProvider.h @@ -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<<5678ce5959c4d862ea03b968a7fe07e1>> + * @generated SignedSource<> */ /** @@ -47,6 +47,7 @@ class ReactNativeFeatureFlagsProvider { virtual bool enableEagerMainQueueModulesOnIOS() = 0; virtual bool enableEagerRootViewAttachment() = 0; virtual bool enableExclusivePropsUpdateAndroid() = 0; + virtual bool enableFabricCommitBranching() = 0; virtual bool enableFabricLogs() = 0; virtual bool enableFabricRenderer() = 0; virtual bool enableFontScaleChangesUpdatingLayout() = 0; diff --git a/packages/react-native/ReactCommon/react/nativemodule/featureflags/NativeReactNativeFeatureFlags.cpp b/packages/react-native/ReactCommon/react/nativemodule/featureflags/NativeReactNativeFeatureFlags.cpp index a91509b843b..5dff1c0eb96 100644 --- a/packages/react-native/ReactCommon/react/nativemodule/featureflags/NativeReactNativeFeatureFlags.cpp +++ b/packages/react-native/ReactCommon/react/nativemodule/featureflags/NativeReactNativeFeatureFlags.cpp @@ -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<<54a1cd3bf2a43d8bcb92bc0a467a778c>> + * @generated SignedSource<> */ /** @@ -154,6 +154,11 @@ bool NativeReactNativeFeatureFlags::enableExclusivePropsUpdateAndroid( return ReactNativeFeatureFlags::enableExclusivePropsUpdateAndroid(); } +bool NativeReactNativeFeatureFlags::enableFabricCommitBranching( + jsi::Runtime& /*runtime*/) { + return ReactNativeFeatureFlags::enableFabricCommitBranching(); +} + bool NativeReactNativeFeatureFlags::enableFabricLogs( jsi::Runtime& /*runtime*/) { return ReactNativeFeatureFlags::enableFabricLogs(); diff --git a/packages/react-native/ReactCommon/react/nativemodule/featureflags/NativeReactNativeFeatureFlags.h b/packages/react-native/ReactCommon/react/nativemodule/featureflags/NativeReactNativeFeatureFlags.h index 0b8e3a86864..43b16108189 100644 --- a/packages/react-native/ReactCommon/react/nativemodule/featureflags/NativeReactNativeFeatureFlags.h +++ b/packages/react-native/ReactCommon/react/nativemodule/featureflags/NativeReactNativeFeatureFlags.h @@ -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<<55bd70d1f64dcbcdcf9173e4f4b7aff6>> + * @generated SignedSource<> */ /** @@ -80,6 +80,8 @@ class NativeReactNativeFeatureFlags bool enableExclusivePropsUpdateAndroid(jsi::Runtime& runtime); + bool enableFabricCommitBranching(jsi::Runtime& runtime); + bool enableFabricLogs(jsi::Runtime& runtime); bool enableFabricRenderer(jsi::Runtime& runtime); diff --git a/packages/react-native/scripts/featureflags/ReactNativeFeatureFlags.config.js b/packages/react-native/scripts/featureflags/ReactNativeFeatureFlags.config.js index cf8a2b4ef3b..0a43b9158c6 100644 --- a/packages/react-native/scripts/featureflags/ReactNativeFeatureFlags.config.js +++ b/packages/react-native/scripts/featureflags/ReactNativeFeatureFlags.config.js @@ -286,6 +286,16 @@ const definitions: FeatureFlagDefinitions = { }, ossReleaseStage: 'none', }, + enableFabricCommitBranching: { + defaultValue: false, + metadata: { + description: + 'Enables Fabric commit branching to fix starvation problems and atomic JS updates.', + expectedReleaseValue: true, + purpose: 'release', + }, + ossReleaseStage: 'none', + }, enableFabricLogs: { defaultValue: false, metadata: { diff --git a/packages/react-native/src/private/featureflags/ReactNativeFeatureFlags.js b/packages/react-native/src/private/featureflags/ReactNativeFeatureFlags.js index fb09dbf3850..6497edf936f 100644 --- a/packages/react-native/src/private/featureflags/ReactNativeFeatureFlags.js +++ b/packages/react-native/src/private/featureflags/ReactNativeFeatureFlags.js @@ -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<<1f591f0e6d65b58c811cb57d13f7f764>> + * @generated SignedSource<> * @flow strict * @noformat */ @@ -69,6 +69,7 @@ export type ReactNativeFeatureFlags = $ReadOnly<{ enableEagerMainQueueModulesOnIOS: Getter, enableEagerRootViewAttachment: Getter, enableExclusivePropsUpdateAndroid: Getter, + enableFabricCommitBranching: Getter, enableFabricLogs: Getter, enableFabricRenderer: Getter, enableFontScaleChangesUpdatingLayout: Getter, @@ -281,6 +282,10 @@ export const enableEagerRootViewAttachment: Getter = createNativeFlagGe * When enabled, Android will disable Props 1.5 raw value merging when Props 2.0 is available. */ export const enableExclusivePropsUpdateAndroid: Getter = createNativeFlagGetter('enableExclusivePropsUpdateAndroid', false); +/** + * Enables Fabric commit branching to fix starvation problems and atomic JS updates. + */ +export const enableFabricCommitBranching: Getter = createNativeFlagGetter('enableFabricCommitBranching', false); /** * This feature flag enables logs for Fabric. */ diff --git a/packages/react-native/src/private/featureflags/specs/NativeReactNativeFeatureFlags.js b/packages/react-native/src/private/featureflags/specs/NativeReactNativeFeatureFlags.js index 6fa59ada0de..44f08d416c9 100644 --- a/packages/react-native/src/private/featureflags/specs/NativeReactNativeFeatureFlags.js +++ b/packages/react-native/src/private/featureflags/specs/NativeReactNativeFeatureFlags.js @@ -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<> + * @generated SignedSource<> * @flow strict * @noformat */ @@ -47,6 +47,7 @@ export interface Spec extends TurboModule { +enableEagerMainQueueModulesOnIOS?: () => boolean; +enableEagerRootViewAttachment?: () => boolean; +enableExclusivePropsUpdateAndroid?: () => boolean; + +enableFabricCommitBranching?: () => boolean; +enableFabricLogs?: () => boolean; +enableFabricRenderer?: () => boolean; +enableFontScaleChangesUpdatingLayout?: () => boolean; From 45b4817414928c9bfa0b055bb09533ac177cada6 Mon Sep 17 00:00:00 2001 From: Jakub Piasecki Date: Mon, 16 Feb 2026 01:32:50 -0800 Subject: [PATCH 368/585] Implement Fabric commit branching (behind a flag) (#54835) Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/54835 Changelog: [General][Changed] - Changed how React changes are commited to the Shadow Tree (behind a feature flag) Introduces two branches for the Shadow Tree commits - React always commits to the JS revision, while other sources should commit to the main revision. Commits to the JS revision schedule a "merge" commit at the end of the event loop pass to upstream the React changes to the main revision. "Merge" means taking the JS revision and promoting it to become the new main, losing changes that happened between fork and merge. Preservation of these changes is the responsibility of the party that created them, and they should be reapplied using a commit hook. The main synchronization points here are: - react revision promotion/promoted revision merge - During merge, the promoted revision is read and reset (UI thread), while promotion itself updated the promoted revision (JS thread) - react commit/promoted revision merge - In case the promoted revision being merged is the same as the current React revision, the latter needs to be reset (UI thread), so that during the next JS commit it forks from the "main" branch (JS thread). - react commit/react revision promotion - Both access the `currentReactRevision`, in case of a main thread render, those might happen to run concurrently on JS/UI thread Reviewed By: javache, rubennorte Differential Revision: D88151489 fbshipit-source-id: c70898ad25fbe5362c991be237c3fd0c1cf6ddcf --- .../__tests__/SyncOnCommit-itest.js | 2 +- .../NativeFantomTestSpecificMethods.cpp | 32 +++ .../NativeFantomTestSpecificMethods.h | 2 + .../react/renderer/mounting/ShadowTree.cpp | 133 +++++++-- .../react/renderer/mounting/ShadowTree.h | 35 ++- .../renderer/mounting/ShadowTreeDelegate.h | 11 + .../tests/StateReconciliationTest.cpp | 6 + .../react/renderer/scheduler/Scheduler.cpp | 15 ++ .../react/renderer/scheduler/Scheduler.h | 2 + .../react/renderer/uimanager/UIManager.cpp | 20 ++ .../react/renderer/uimanager/UIManager.h | 7 + .../renderer/uimanager/UIManagerDelegate.h | 10 + ...zyShadowTreeRevisionConsistencyManager.cpp | 4 +- ...LazyShadowTreeRevisionConsistencyManager.h | 1 - ...adowTreeRevisionConsistencyManagerTest.cpp | 6 + .../react/runtime/ReactHost.cpp | 3 + .../ShadowNodeReferenceCounter-itest.js | 1 + .../ShadowNodeRevisionGetter-itest.js | 1 + .../__tests__/ShadowTreeBranching-itest.js | 252 ++++++++++++++++++ .../__tests__/UIConsistency-itest.js | 1 + .../mounting/__tests__/Mounting-itest.js | 1 + .../specs/NativeFantomTestSpecificMethods.js | 2 + .../__tests__/ReactNativeElement-itest.js | 1 + 23 files changed, 521 insertions(+), 27 deletions(-) create mode 100644 packages/react-native/src/private/renderer/branching/__tests__/ShadowTreeBranching-itest.js diff --git a/packages/react-native/Libraries/ReactNative/__tests__/SyncOnCommit-itest.js b/packages/react-native/Libraries/ReactNative/__tests__/SyncOnCommit-itest.js index faada0aa8f3..cd0cfebe74a 100644 --- a/packages/react-native/Libraries/ReactNative/__tests__/SyncOnCommit-itest.js +++ b/packages/react-native/Libraries/ReactNative/__tests__/SyncOnCommit-itest.js @@ -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. * - * @fantom_flags updateRuntimeShadowNodeReferencesOnCommit:true + * @fantom_flags updateRuntimeShadowNodeReferencesOnCommit:true enableFabricCommitBranching:* * @fantom_react_fb_flags passChildrenWhenCloningPersistedNodes:true * @flow strict-local * @format diff --git a/packages/react-native/ReactCommon/react/nativemodule/fantomtestspecificmethods/NativeFantomTestSpecificMethods.cpp b/packages/react-native/ReactCommon/react/nativemodule/fantomtestspecificmethods/NativeFantomTestSpecificMethods.cpp index 680ba595be4..a3ac0b0effe 100644 --- a/packages/react-native/ReactCommon/react/nativemodule/fantomtestspecificmethods/NativeFantomTestSpecificMethods.cpp +++ b/packages/react-native/ReactCommon/react/nativemodule/fantomtestspecificmethods/NativeFantomTestSpecificMethods.cpp @@ -49,4 +49,36 @@ void NativeFantomTestSpecificMethods::takeFunctionAndNoop( jsi::Runtime& runtime, jsi::Function function) {} +void NativeFantomTestSpecificMethods::setRootNodeSize( + jsi::Runtime& runtime, + int surfaceId, + float width, + float height) { + auto& uiManager = getUIManagerFromRuntime(runtime); + + uiManager.getShadowTreeRegistry().visit( + surfaceId, [&](const ShadowTree& shadowTree) { + shadowTree.commit( + [&](const RootShadowNode& oldRootShadowNode) + -> RootShadowNode::Unshared { + PropsParserContext propsParserContext{ + surfaceId, *uiManager.getContextContainer()}; + + const auto& mainBranchRootProps = + oldRootShadowNode.getConcreteProps(); + const auto layoutContext = mainBranchRootProps.layoutContext; + auto layoutConstraints = mainBranchRootProps.layoutConstraints; + + layoutConstraints.maximumSize.width = width; + layoutConstraints.maximumSize.height = height; + layoutConstraints.minimumSize.width = width; + layoutConstraints.minimumSize.height = height; + + return oldRootShadowNode.clone( + propsParserContext, layoutConstraints, layoutContext); + }, + {.source = ShadowTreeCommitSource::Unknown}); + }); +} + } // namespace facebook::react diff --git a/packages/react-native/ReactCommon/react/nativemodule/fantomtestspecificmethods/NativeFantomTestSpecificMethods.h b/packages/react-native/ReactCommon/react/nativemodule/fantomtestspecificmethods/NativeFantomTestSpecificMethods.h index a82fa536122..aff0dbf4fc9 100644 --- a/packages/react-native/ReactCommon/react/nativemodule/fantomtestspecificmethods/NativeFantomTestSpecificMethods.h +++ b/packages/react-native/ReactCommon/react/nativemodule/fantomtestspecificmethods/NativeFantomTestSpecificMethods.h @@ -21,6 +21,8 @@ class NativeFantomTestSpecificMethods : public NativeFantomTestSpecificMethodsCx void takeFunctionAndNoop(jsi::Runtime &runtime, jsi::Function callback); + void setRootNodeSize(jsi::Runtime &runtime, int surfaceId, float width, float height); + private: std::shared_ptr fantomForcedCloneCommitHook_{}; }; diff --git a/packages/react-native/ReactCommon/react/renderer/mounting/ShadowTree.cpp b/packages/react-native/ReactCommon/react/renderer/mounting/ShadowTree.cpp index 58c5bbaa4e0..ec806e3be22 100644 --- a/packages/react-native/ReactCommon/react/renderer/mounting/ShadowTree.cpp +++ b/packages/react-native/ReactCommon/react/renderer/mounting/ShadowTree.cpp @@ -220,7 +220,7 @@ void ShadowTree::setCommitMode(CommitMode commitMode) const { auto revision = ShadowTreeRevision{}; { - ShadowTree::UniqueLock lock = uniqueCommitLock(); + ShadowTree::UniqueLock lock = uniqueRevisionLock(); if (commitMode_ == commitMode) { return; @@ -238,7 +238,7 @@ void ShadowTree::setCommitMode(CommitMode commitMode) const { } CommitMode ShadowTree::getCommitMode() const { - SharedLock lock = sharedCommitLock(); + SharedLock lock = sharedRevisionLock(); return commitMode_; } @@ -262,7 +262,7 @@ CommitStatus ShadowTree::commit( } { - std::unique_lock lock(commitMutexRecursive_); + std::unique_lock lock(revisionMutexRecursive_); return tryCommit(transaction, commitOptions); } } else { @@ -286,18 +286,32 @@ CommitStatus ShadowTree::tryCommit( const CommitOptions& commitOptions) const { TraceSection s("ShadowTree::commit"); + auto isReactBranch = ReactNativeFeatureFlags::enableFabricCommitBranching() && + commitOptions.source == CommitSource::React; + + // Commits on the JS branch are never synchronous. + react_native_assert(!isReactBranch || !commitOptions.mountSynchronously); + auto telemetry = TransactionTelemetry{}; telemetry.willCommit(); CommitMode commitMode; auto oldRevision = ShadowTreeRevision{}; + auto oldRevisionForStateProgression = ShadowTreeRevision{}; auto newRevision = ShadowTreeRevision{}; { // Reading `currentRevision_` in shared manner. - SharedLock lock = sharedCommitLock(); + SharedLock lock = sharedRevisionLock(); commitMode = commitMode_; - oldRevision = currentRevision_; + + if (isReactBranch && currentReactRevision_.has_value()) { + oldRevision = currentReactRevision_.value(); + } else { + oldRevision = currentRevision_; + } + + oldRevisionForStateProgression = currentRevision_; } const auto& oldRootShadowNode = oldRevision.rootShadowNode; @@ -308,8 +322,8 @@ CommitStatus ShadowTree::tryCommit( } if (commitOptions.enableStateReconciliation) { - auto updatedNewRootShadowNode = - progressState(*newRootShadowNode, *oldRootShadowNode); + auto updatedNewRootShadowNode = progressState( + *newRootShadowNode, *oldRevisionForStateProgression.rootShadowNode); if (updatedNewRootShadowNode) { newRootShadowNode = std::static_pointer_cast(updatedNewRootShadowNode); @@ -336,9 +350,10 @@ CommitStatus ShadowTree::tryCommit( { // Updating `currentRevision_` in unique manner if it hasn't changed. - UniqueLock lock = uniqueCommitLock(); + UniqueLock lock = uniqueRevisionLock( + /*defer*/ isReactBranch); - if (currentRevision_.number != oldRevision.number) { + if (!isReactBranch && currentRevision_.number != oldRevision.number) { return CommitStatus::Failed; } @@ -364,12 +379,21 @@ CommitStatus ShadowTree::tryCommit( .number = newRevisionNumber, .telemetry = telemetry}; - currentRevision_ = newRevision; + if (isReactBranch) { + // Lock the deferred lock to ensure that the new React revision is not + // reset during a scheduled merge. + std::visit([](auto& concreteLock) { concreteLock.lock(); }, lock); + currentReactRevision_ = newRevision; + } else { + currentRevision_ = newRevision; + } } emitLayoutEvents(affectedLayoutableNodes); - if (commitMode == CommitMode::Normal) { + if (isReactBranch) { + scheduleReactRevisionPromotion(); + } else if (commitMode == CommitMode::Normal) { mount(std::move(newRevision), commitOptions.mountSynchronously); } @@ -377,10 +401,15 @@ CommitStatus ShadowTree::tryCommit( } ShadowTreeRevision ShadowTree::getCurrentRevision() const { - SharedLock lock = sharedCommitLock(); + SharedLock lock = sharedRevisionLock(); return currentRevision_; } +std::optional ShadowTree::getCurrentReactRevision() const { + SharedLock lock = sharedRevisionLock(); + return currentReactRevision_; +} + void ShadowTree::mount(ShadowTreeRevision revision, bool mountSynchronously) const { mountingCoordinator_->push(std::move(revision)); @@ -388,6 +417,72 @@ void ShadowTree::mount(ShadowTreeRevision revision, bool mountSynchronously) mountingCoordinator_, mountSynchronously); } +void ShadowTree::mergeReactRevision() const { + ShadowTreeRevision promotedRevision; + + { + UniqueLock lock = uniqueRevisionLock(false); + + if (!reactRevisionToBePromoted_.has_value()) { + return; + } + + promotedRevision = + std::exchange(reactRevisionToBePromoted_, std::nullopt).value(); + } + + const auto mergedRevisionNumber = promotedRevision.number; + + this->commit( + [revision = std::move(promotedRevision)]( + const RootShadowNode& /*oldRootShadowNode*/) { + return std::make_shared( + *revision.rootShadowNode, ShadowNodeFragment{}); + }, + { + .enableStateReconciliation = true, + .mountSynchronously = true, + .source = CommitSource::ReactRevisionMerge, + }); + + { + UniqueLock commitLock = uniqueRevisionLock( + /*defer*/ false); + + // If the current react revision is the same as the one that was just + // merged, clear it. + if (currentReactRevision_.has_value() && + mergedRevisionNumber == currentReactRevision_.value().number) { + currentReactRevision_.reset(); + } + } +} + +void ShadowTree::promoteReactRevision() const { + ShadowTreeRevision currentReactRevision; + { + SharedLock lock = sharedRevisionLock(); + // Promotion happens at the end of the event loop tick, it's possible to + // have more than one promotion in a row. In this case, all but the first + // one should no-op. + if (!currentReactRevision_.has_value()) { + return; + } + currentReactRevision = currentReactRevision_.value(); + } + + { + UniqueLock lock = uniqueRevisionLock(false); + reactRevisionToBePromoted_ = std::move(currentReactRevision); + } + + delegate_.shadowTreeDidPromoteReactRevision(*this); +} + +void ShadowTree::scheduleReactRevisionPromotion() const { + delegate_.shadowTreeDidFinishReactCommit(*this); +} + void ShadowTree::commitEmptyTree() const { commit( [](const RootShadowNode& oldRootShadowNode) @@ -426,19 +521,21 @@ void ShadowTree::notifyDelegatesOfUpdates() const { delegate_.shadowTreeDidFinishTransaction(mountingCoordinator_, true); } -inline ShadowTree::UniqueLock ShadowTree::uniqueCommitLock() const { +inline ShadowTree::UniqueLock ShadowTree::uniqueRevisionLock(bool defer) const { if (ReactNativeFeatureFlags::preventShadowTreeCommitExhaustion()) { - return std::unique_lock{commitMutexRecursive_}; + return defer ? std::unique_lock{revisionMutexRecursive_, std::defer_lock} + : std::unique_lock{revisionMutexRecursive_}; } else { - return std::unique_lock{commitMutex_}; + return defer ? std::unique_lock{revisionMutex_, std::defer_lock} + : std::unique_lock{revisionMutex_}; } } -inline ShadowTree::SharedLock ShadowTree::sharedCommitLock() const { +inline ShadowTree::SharedLock ShadowTree::sharedRevisionLock() const { if (ReactNativeFeatureFlags::preventShadowTreeCommitExhaustion()) { - return std::unique_lock{commitMutexRecursive_}; + return std::unique_lock{revisionMutexRecursive_}; } else { - return std::shared_lock{commitMutex_}; + return std::shared_lock{revisionMutex_}; } } diff --git a/packages/react-native/ReactCommon/react/renderer/mounting/ShadowTree.h b/packages/react-native/ReactCommon/react/renderer/mounting/ShadowTree.h index c1f51fc1a91..b97680b8c25 100644 --- a/packages/react-native/ReactCommon/react/renderer/mounting/ShadowTree.h +++ b/packages/react-native/ReactCommon/react/renderer/mounting/ShadowTree.h @@ -51,6 +51,7 @@ enum class ShadowTreeCommitSource { Unknown, React, AnimationEndSync, + ReactRevisionMerge, }; struct ShadowTreeCommitOptions { @@ -124,6 +125,12 @@ class ShadowTree final { */ ShadowTreeRevision getCurrentRevision() const; + /* + * Returns a `ShadowTreeRevision` representing the momentary state of + * the `ShadowTree` in the JS thread. + */ + std::optional getCurrentReactRevision() const; + /* * Commit an empty tree (a new `RootShadowNode` with no children). */ @@ -137,6 +144,18 @@ class ShadowTree final { std::shared_ptr getMountingCoordinator() const; + /** + * Promotes the current React revision to be merged into the main branch of the + * ShadowTree. + */ + void promoteReactRevision() const; + + /** + * Commits the currently promoted React revision to the "main" branch of the + * ShadowTree. No-op if the promoted React revision doesn't exist. + */ + void mergeReactRevision() const; + private: constexpr static ShadowTreeRevision::Number INITIAL_REVISION{0}; @@ -144,19 +163,23 @@ class ShadowTree final { void emitLayoutEvents(std::vector &affectedLayoutableNodes) const; + void scheduleReactRevisionPromotion() const; + const SurfaceId surfaceId_; const ShadowTreeDelegate &delegate_; - mutable std::shared_mutex commitMutex_; - mutable std::recursive_mutex commitMutexRecursive_; - mutable CommitMode commitMode_{CommitMode::Normal}; // Protected by `commitMutex_`. - mutable ShadowTreeRevision currentRevision_; // Protected by `commitMutex_`. + mutable std::shared_mutex revisionMutex_; + mutable std::recursive_mutex revisionMutexRecursive_; + mutable CommitMode commitMode_{CommitMode::Normal}; // Protected by `revisionMutex_`. + mutable ShadowTreeRevision currentRevision_; // Protected by `revisionMutex_`. + mutable std::optional currentReactRevision_; // Protected by `revisionMutex_`. + mutable std::optional reactRevisionToBePromoted_; // Protected by `revisionMutex_`. std::shared_ptr mountingCoordinator_; using UniqueLock = std::variant, std::unique_lock>; using SharedLock = std::variant, std::unique_lock>; - inline UniqueLock uniqueCommitLock() const; - inline SharedLock sharedCommitLock() const; + inline UniqueLock uniqueRevisionLock(bool defer = false) const; + inline SharedLock sharedRevisionLock() const; }; } // namespace facebook::react diff --git a/packages/react-native/ReactCommon/react/renderer/mounting/ShadowTreeDelegate.h b/packages/react-native/ReactCommon/react/renderer/mounting/ShadowTreeDelegate.h index 650d898a6f3..3dde9c5837c 100644 --- a/packages/react-native/ReactCommon/react/renderer/mounting/ShadowTreeDelegate.h +++ b/packages/react-native/ReactCommon/react/renderer/mounting/ShadowTreeDelegate.h @@ -38,6 +38,17 @@ class ShadowTreeDelegate { std::shared_ptr mountingCoordinator, bool mountSynchronously) const = 0; + /* + * Called right after Shadow Tree commits a new React revision of the tree. + */ + virtual void shadowTreeDidFinishReactCommit(const ShadowTree &shadowTree) const = 0; + + /* + * Called right after Shadow Tree promotes a React revision of the tree to + * be merged. + */ + virtual void shadowTreeDidPromoteReactRevision(const ShadowTree &shadowTree) const = 0; + virtual ~ShadowTreeDelegate() noexcept = default; }; diff --git a/packages/react-native/ReactCommon/react/renderer/mounting/tests/StateReconciliationTest.cpp b/packages/react-native/ReactCommon/react/renderer/mounting/tests/StateReconciliationTest.cpp index 7290d76cc63..721a46700be 100644 --- a/packages/react-native/ReactCommon/react/renderer/mounting/tests/StateReconciliationTest.cpp +++ b/packages/react-native/ReactCommon/react/renderer/mounting/tests/StateReconciliationTest.cpp @@ -37,6 +37,12 @@ class DummyShadowTreeDelegate : public ShadowTreeDelegate { void shadowTreeDidFinishTransaction( std::shared_ptr mountingCoordinator, bool /*mountSynchronously*/) const override {} + + void shadowTreeDidFinishReactCommit( + const ShadowTree& /*shadowTree*/) const override {} + + void shadowTreeDidPromoteReactRevision( + const ShadowTree& /*shadowTree*/) const override {} }; namespace { diff --git a/packages/react-native/ReactCommon/react/renderer/scheduler/Scheduler.cpp b/packages/react-native/ReactCommon/react/renderer/scheduler/Scheduler.cpp index bf0e3d93a04..af2a59f0a28 100644 --- a/packages/react-native/ReactCommon/react/renderer/scheduler/Scheduler.cpp +++ b/packages/react-native/ReactCommon/react/renderer/scheduler/Scheduler.cpp @@ -366,6 +366,21 @@ void Scheduler::uiManagerShouldRemoveEventListener( removeEventListener(listener); } +void Scheduler::uiManagerDidFinishReactCommit(const ShadowTree& shadowTree) { + auto surfaceId = shadowTree.getSurfaceId(); + runtimeScheduler_->scheduleRenderingUpdate( + surfaceId, [surfaceId, uiManager = uiManager_]() { + uiManager->getShadowTreeRegistry().visit( + surfaceId, + [](const ShadowTree& tree) { tree.promoteReactRevision(); }); + }); +} + +void Scheduler::uiManagerDidPromoteReactRevision(const ShadowTree& shadowTree) { + // Replaced by scheduling on the UI thread in the following diff. + shadowTree.mergeReactRevision(); +} + void Scheduler::uiManagerDidStartSurface(const ShadowTree& shadowTree) { std::shared_lock lock(onSurfaceStartCallbackMutex_); if (onSurfaceStartCallback_) { diff --git a/packages/react-native/ReactCommon/react/renderer/scheduler/Scheduler.h b/packages/react-native/ReactCommon/react/renderer/scheduler/Scheduler.h index 80be380a48e..080c5407c13 100644 --- a/packages/react-native/ReactCommon/react/renderer/scheduler/Scheduler.h +++ b/packages/react-native/ReactCommon/react/renderer/scheduler/Scheduler.h @@ -95,6 +95,8 @@ class Scheduler final : public UIManagerDelegate { void uiManagerDidUpdateShadowTree(const std::unordered_map &tagToProps) override; void uiManagerShouldAddEventListener(std::shared_ptr listener) final; void uiManagerShouldRemoveEventListener(const std::shared_ptr &listener) final; + void uiManagerDidFinishReactCommit(const ShadowTree &shadowTree) override; + void uiManagerDidPromoteReactRevision(const ShadowTree &shadowTree) override; void uiManagerDidStartSurface(const ShadowTree &shadowTree) override; #pragma mark - ContextContainer diff --git a/packages/react-native/ReactCommon/react/renderer/uimanager/UIManager.cpp b/packages/react-native/ReactCommon/react/renderer/uimanager/UIManager.cpp index 8dddd3ced43..1239c8a73f7 100644 --- a/packages/react-native/ReactCommon/react/renderer/uimanager/UIManager.cpp +++ b/packages/react-native/ReactCommon/react/renderer/uimanager/UIManager.cpp @@ -644,6 +644,20 @@ void UIManager::shadowTreeDidFinishTransaction( } } +void UIManager::shadowTreeDidFinishReactCommit( + const ShadowTree& shadowTree) const { + if (delegate_ != nullptr) { + delegate_->uiManagerDidFinishReactCommit(shadowTree); + } +} + +void UIManager::shadowTreeDidPromoteReactRevision( + const ShadowTree& shadowTree) const { + if (delegate_ != nullptr) { + delegate_->uiManagerDidPromoteReactRevision(shadowTree); + } +} + void UIManager::reportMount(SurfaceId surfaceId) const { TraceSection s("UIManager::reportMount"); @@ -718,6 +732,12 @@ void UIManager::synchronouslyUpdateViewOnUIThread( } } +#pragma mark ContextContainer + +std::shared_ptr UIManager::getContextContainer() const { + return contextContainer_; +} + #pragma mark - Add & Remove event listener void UIManager::addEventListener( diff --git a/packages/react-native/ReactCommon/react/renderer/uimanager/UIManager.h b/packages/react-native/ReactCommon/react/renderer/uimanager/UIManager.h index eac4b5d9a49..bb287fe40f2 100644 --- a/packages/react-native/ReactCommon/react/renderer/uimanager/UIManager.h +++ b/packages/react-native/ReactCommon/react/renderer/uimanager/UIManager.h @@ -135,6 +135,10 @@ class UIManager final : public ShadowTreeDelegate { const RootShadowNode::Unshared &newRootShadowNode, const ShadowTree::CommitOptions &commitOptions) const override; + void shadowTreeDidFinishReactCommit(const ShadowTree &shadowTree) const override; + + void shadowTreeDidPromoteReactRevision(const ShadowTree &shadowTree) const override; + std::shared_ptr createNode( Tag tag, const std::string &componentName, @@ -201,6 +205,9 @@ class UIManager final : public ShadowTreeDelegate { void updateShadowTree(std::unordered_map &&tagToProps); +#pragma mark - ContextContainer + std::shared_ptr getContextContainer() const; + #pragma mark - Add & Remove event listener void addEventListener(std::shared_ptr listener); diff --git a/packages/react-native/ReactCommon/react/renderer/uimanager/UIManagerDelegate.h b/packages/react-native/ReactCommon/react/renderer/uimanager/UIManagerDelegate.h index 32df5c92f10..92ee339f092 100644 --- a/packages/react-native/ReactCommon/react/renderer/uimanager/UIManagerDelegate.h +++ b/packages/react-native/ReactCommon/react/renderer/uimanager/UIManagerDelegate.h @@ -84,6 +84,16 @@ class UIManagerDelegate { */ virtual void uiManagerDidStartSurface(const ShadowTree &shadowTree) = 0; + /* + * Called after a new React revision of the shadow tree is committed. + */ + virtual void uiManagerDidFinishReactCommit(const ShadowTree &shadowTree) = 0; + + /* + * Called after a React revision of the shadow tree is promoted to be merged. + */ + virtual void uiManagerDidPromoteReactRevision(const ShadowTree &shadowTree) = 0; + using OnSurfaceStartCallback = std::function; virtual void uiManagerShouldSetOnSurfaceStartCallback(OnSurfaceStartCallback &&callback) = 0; diff --git a/packages/react-native/ReactCommon/react/renderer/uimanager/consistency/LazyShadowTreeRevisionConsistencyManager.cpp b/packages/react-native/ReactCommon/react/renderer/uimanager/consistency/LazyShadowTreeRevisionConsistencyManager.cpp index 8afaad89b39..cf11c7f9d28 100644 --- a/packages/react-native/ReactCommon/react/renderer/uimanager/consistency/LazyShadowTreeRevisionConsistencyManager.cpp +++ b/packages/react-native/ReactCommon/react/renderer/uimanager/consistency/LazyShadowTreeRevisionConsistencyManager.cpp @@ -24,7 +24,9 @@ LazyShadowTreeRevisionConsistencyManager::updateCurrentRevision( // root shadow nodes concurrently. RootShadowNode::Shared rootShadowNode; shadowTreeRegistry_.visit(surfaceId, [&](const ShadowTree& shadowTree) { - rootShadowNode = shadowTree.getCurrentRevision().rootShadowNode; + auto reactRevision = shadowTree.getCurrentReactRevision(); + rootShadowNode = + reactRevision.value_or(shadowTree.getCurrentRevision()).rootShadowNode; }); std::unique_lock lock(capturedRootShadowNodesForConsistencyMutex_); diff --git a/packages/react-native/ReactCommon/react/renderer/uimanager/consistency/LazyShadowTreeRevisionConsistencyManager.h b/packages/react-native/ReactCommon/react/renderer/uimanager/consistency/LazyShadowTreeRevisionConsistencyManager.h index b63ec2977db..c7ab5af7fac 100644 --- a/packages/react-native/ReactCommon/react/renderer/uimanager/consistency/LazyShadowTreeRevisionConsistencyManager.h +++ b/packages/react-native/ReactCommon/react/renderer/uimanager/consistency/LazyShadowTreeRevisionConsistencyManager.h @@ -13,7 +13,6 @@ #include #include #include -#include namespace facebook::react { diff --git a/packages/react-native/ReactCommon/react/renderer/uimanager/consistency/tests/LazyShadowTreeRevisionConsistencyManagerTest.cpp b/packages/react-native/ReactCommon/react/renderer/uimanager/consistency/tests/LazyShadowTreeRevisionConsistencyManagerTest.cpp index 322172b3de1..349a79f3d49 100644 --- a/packages/react-native/ReactCommon/react/renderer/uimanager/consistency/tests/LazyShadowTreeRevisionConsistencyManagerTest.cpp +++ b/packages/react-native/ReactCommon/react/renderer/uimanager/consistency/tests/LazyShadowTreeRevisionConsistencyManagerTest.cpp @@ -27,6 +27,12 @@ class FakeShadowTreeDelegate : public ShadowTreeDelegate { void shadowTreeDidFinishTransaction( std::shared_ptr mountingCoordinator, bool /*mountSynchronously*/) const override {} + + void shadowTreeDidFinishReactCommit( + const ShadowTree& /*shadowTree*/) const override {} + + void shadowTreeDidPromoteReactRevision( + const ShadowTree& /*shadowTree*/) const override {} }; class LazyShadowTreeRevisionConsistencyManagerTest : public ::testing::Test { diff --git a/packages/react-native/ReactCxxPlatform/react/runtime/ReactHost.cpp b/packages/react-native/ReactCxxPlatform/react/runtime/ReactHost.cpp index 7affd88dca0..74427d2a72b 100644 --- a/packages/react-native/ReactCxxPlatform/react/runtime/ReactHost.cpp +++ b/packages/react-native/ReactCxxPlatform/react/runtime/ReactHost.cpp @@ -311,6 +311,9 @@ void ReactHost::destroyReactInstance() { reactInstanceData_->contextContainer->erase(RuntimeSchedulerKey); reactInstanceData_->mountingManager->setSchedulerTaskExecutor(nullptr); + reactInstanceData_->mountingManager = nullptr; + reactInstanceData_->contextContainer = nullptr; + reactInstanceData_->turboModuleProviders.clear(); reactInstance_ = nullptr; reactInstanceData_->messageQueueThread = nullptr; } diff --git a/packages/react-native/src/private/__tests__/utilities/__tests__/ShadowNodeReferenceCounter-itest.js b/packages/react-native/src/private/__tests__/utilities/__tests__/ShadowNodeReferenceCounter-itest.js index 5bb74b14601..00112dd2900 100644 --- a/packages/react-native/src/private/__tests__/utilities/__tests__/ShadowNodeReferenceCounter-itest.js +++ b/packages/react-native/src/private/__tests__/utilities/__tests__/ShadowNodeReferenceCounter-itest.js @@ -4,6 +4,7 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * + * @fantom_flags enableFabricCommitBranching:* * @flow strict-local * @format */ diff --git a/packages/react-native/src/private/__tests__/utilities/__tests__/ShadowNodeRevisionGetter-itest.js b/packages/react-native/src/private/__tests__/utilities/__tests__/ShadowNodeRevisionGetter-itest.js index 3475f0cb385..f5bd1e3bfbd 100644 --- a/packages/react-native/src/private/__tests__/utilities/__tests__/ShadowNodeRevisionGetter-itest.js +++ b/packages/react-native/src/private/__tests__/utilities/__tests__/ShadowNodeRevisionGetter-itest.js @@ -4,6 +4,7 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * + * @fantom_flags enableFabricCommitBranching:* * @flow strict-local * @format */ diff --git a/packages/react-native/src/private/renderer/branching/__tests__/ShadowTreeBranching-itest.js b/packages/react-native/src/private/renderer/branching/__tests__/ShadowTreeBranching-itest.js new file mode 100644 index 00000000000..d37fa968119 --- /dev/null +++ b/packages/react-native/src/private/renderer/branching/__tests__/ShadowTreeBranching-itest.js @@ -0,0 +1,252 @@ +/** + * 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 enableFabricCommitBranching: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 {View} from 'react-native'; +import NativeFantomTestSpecificMethods from 'react-native/src/private/testing/fantom/specs/NativeFantomTestSpecificMethods'; +import ReactNativeElement from 'react-native/src/private/webapis/dom/nodes/ReactNativeElement'; + +describe('ShadowTreeBranching', () => { + function LayoutEffectObserver({onCommit}: {onCommit: () => void}) { + React.useLayoutEffect(() => { + onCommit(); + }); + return null; + } + + it('should not mount React revision before merging them', () => { + const root = Fantom.createRoot(); + + Fantom.runTask(() => { + root.render(); + }); + + expect(root.takeMountingManagerLogs()).toEqual([ + 'Update {type: "RootView", nativeID: (root)}', + 'Create {type: "View", nativeID: "view"}', + 'Insert {type: "View", parentNativeID: (root), index: 0, nativeID: "view"}', + ]); + + let updatesBeforeEndOfTask: $ReadOnlyArray = []; + + Fantom.runTask(() => { + root.render( + <> + + { + updatesBeforeEndOfTask = root.takeMountingManagerLogs(); + }} + /> + , + ); + }); + + const updatesAfterEndOfTask = root.takeMountingManagerLogs(); + + // The intermediate React revision should not be mounted + expect(updatesBeforeEndOfTask).toEqual([]); + expect(updatesAfterEndOfTask).toEqual([ + 'Update {type: "View", nativeID: "view"}', + ]); + }); + + it('should not skip intermediate React commits', () => { + const root = Fantom.createRoot(); + + let updatesBeforeEndOfTask: $ReadOnlyArray = []; + + // When rendered with `shouldTriggerIntermediate=false`, it renders two views + // both with blue background. When rendered with `shouldTriggerIntermediate=true`, + // it renders two views, the first one with red background and the second one + // with blue background. The layout effect will update the second view to red. + // The intermediate React revision with different background colors should not + // be committed. + function AutoUpdateComponent({ + shouldTriggerIntermediate, + }: { + shouldTriggerIntermediate: boolean, + }) { + const [intermediateRender, setIntermediateRender] = React.useState(false); + + return ( + + + + { + if (shouldTriggerIntermediate) { + if (!intermediateRender) { + setIntermediateRender(true); + return; + } + + updatesBeforeEndOfTask = root.takeMountingManagerLogs(); + } + }} + /> + + ); + } + + Fantom.runTask(() => { + root.render(); + }); + + expect(root.takeMountingManagerLogs()).toEqual([ + 'Update {type: "RootView", nativeID: (root)}', + 'Create {type: "View", nativeID: "view"}', + 'Create {type: "View", nativeID: "A"}', + 'Create {type: "View", nativeID: "B"}', + 'Insert {type: "View", parentNativeID: "view", index: 0, nativeID: "A"}', + 'Insert {type: "View", parentNativeID: "view", index: 1, nativeID: "B"}', + 'Insert {type: "View", parentNativeID: (root), index: 0, nativeID: "view"}', + ]); + + Fantom.runTask(() => { + root.render(); + }); + + const updatesAfterEndOfTask = root.takeMountingManagerLogs(); + + // The intermediate React revision should not be committed + expect(updatesBeforeEndOfTask).toEqual([]); + expect(updatesAfterEndOfTask).toEqual([ + 'Update {type: "View", nativeID: "A"}', + 'Update {type: "View", nativeID: "B"}', + ]); + }); + + it('should provide up-to-date data when read from JS', () => { + const root = Fantom.createRoot(); + + const viewRef = React.createRef(); + + Fantom.runTask(() => { + root.render( + , + ); + }); + + expect(root.takeMountingManagerLogs()).toEqual([ + 'Update {type: "RootView", nativeID: (root)}', + 'Create {type: "View", nativeID: "view"}', + 'Insert {type: "View", parentNativeID: (root), index: 0, nativeID: "view"}', + ]); + + let dimensions: [number, number] = [0, 0]; + let mountingManagerLogs: Array = []; + + Fantom.runTask(() => { + root.render( + <> + + { + mountingManagerLogs = root.takeMountingManagerLogs(); + + // The React revision is not merged yet but the new dimensions + // should be visible from JS + const viewNode = ensureInstance( + viewRef.current, + ReactNativeElement, + ); + const rect = viewNode.getBoundingClientRect(); + dimensions = [rect.width, rect.height]; + }} + /> + , + ); + }); + + expect(mountingManagerLogs).toEqual([]); + expect(dimensions).toEqual([50, 50]); + }); + + it('should not mount intermediate React tree when committing from another source', () => { + const root = Fantom.createRoot(); + + const viewRef = React.createRef(); + + Fantom.runTask(() => { + root.render( + , + ); + }); + + expect(root.takeMountingManagerLogs()).toEqual([ + 'Update {type: "RootView", nativeID: (root)}', + 'Create {type: "View", nativeID: "view"}', + 'Insert {type: "View", parentNativeID: (root), index: 0, nativeID: "view"}', + ]); + + let mountingManagerLogsBeforeEndOfTask: Array = []; + + Fantom.runTask(() => { + root.render( + <> + + { + NativeFantomTestSpecificMethods.setRootNodeSize( + root.getRootTag() as $FlowFixMe, + 150, + 150, + ); + + mountingManagerLogsBeforeEndOfTask = + root.takeMountingManagerLogs(); + }} + /> + , + ); + }); + + // Commit made from outside of React - it should not mount intermediate React tree + expect(mountingManagerLogsBeforeEndOfTask).toEqual([ + 'Update {type: "RootView", nativeID: (root)}', + ]); + + // Commit made from React - it should mount the final React tree + // NOTE: The RootView update should not be included here, fixed + // in a following diff + expect(root.takeMountingManagerLogs()).toEqual([ + 'Update {type: "RootView", nativeID: (root)}', + 'Update {type: "View", nativeID: "view"}', + ]); + }); +}); diff --git a/packages/react-native/src/private/renderer/consistency/__tests__/UIConsistency-itest.js b/packages/react-native/src/private/renderer/consistency/__tests__/UIConsistency-itest.js index 526d4873196..31a945eecde 100644 --- a/packages/react-native/src/private/renderer/consistency/__tests__/UIConsistency-itest.js +++ b/packages/react-native/src/private/renderer/consistency/__tests__/UIConsistency-itest.js @@ -4,6 +4,7 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * + * @fantom_flags enableFabricCommitBranching:* * @flow strict-local * @format */ diff --git a/packages/react-native/src/private/renderer/mounting/__tests__/Mounting-itest.js b/packages/react-native/src/private/renderer/mounting/__tests__/Mounting-itest.js index 16e2474401b..faea08c6d4a 100644 --- a/packages/react-native/src/private/renderer/mounting/__tests__/Mounting-itest.js +++ b/packages/react-native/src/private/renderer/mounting/__tests__/Mounting-itest.js @@ -4,6 +4,7 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * + * @fantom_flags enableFabricCommitBranching:* * @flow strict-local * @format */ diff --git a/packages/react-native/src/private/testing/fantom/specs/NativeFantomTestSpecificMethods.js b/packages/react-native/src/private/testing/fantom/specs/NativeFantomTestSpecificMethods.js index 6277b704cdc..f10f0a8fecb 100644 --- a/packages/react-native/src/private/testing/fantom/specs/NativeFantomTestSpecificMethods.js +++ b/packages/react-native/src/private/testing/fantom/specs/NativeFantomTestSpecificMethods.js @@ -9,6 +9,7 @@ */ import type {TurboModule} from '../../../../../Libraries/TurboModule/RCTExport'; +import type {Float, Int32} from '../../../../../Libraries/Types/CodegenTypes'; import * as TurboModuleRegistry from '../../../../../Libraries/TurboModule/TurboModuleRegistry'; @@ -24,6 +25,7 @@ import * as TurboModuleRegistry from '../../../../../Libraries/TurboModule/Turbo export interface Spec extends TurboModule { +registerForcedCloneCommitHook: () => void; +takeFunctionAndNoop: (fn: () => void) => void; + +setRootNodeSize: (surfaceId: Int32, width: Float, height: Float) => void; } export default (TurboModuleRegistry.getEnforcing( diff --git a/packages/react-native/src/private/webapis/dom/nodes/__tests__/ReactNativeElement-itest.js b/packages/react-native/src/private/webapis/dom/nodes/__tests__/ReactNativeElement-itest.js index 1f650b95a3c..196348fee7c 100644 --- a/packages/react-native/src/private/webapis/dom/nodes/__tests__/ReactNativeElement-itest.js +++ b/packages/react-native/src/private/webapis/dom/nodes/__tests__/ReactNativeElement-itest.js @@ -4,6 +4,7 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * + * @fantom_flags enableFabricCommitBranching:* * @flow strict-local * @format */ From 47e5e6c3945b97fd64b9dd0465a30b42259d6157 Mon Sep 17 00:00:00 2001 From: Jakub Piasecki Date: Mon, 16 Feb 2026 01:32:50 -0800 Subject: [PATCH 369/585] Schedule JS revision merge on the main thread (#54837) Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/54837 Changelog: [General][Changed] - The JS revision merge now is scheduled on the main thread Changes the Shadow Tree branching to schedule JS revision merge on the main thread instead of running it immediately at the end of the event loop. This will prevent shadow tree exhaustion when committing to the main branch, since all commits there will be happening on the same thread. Reviewed By: javache, rubennorte Differential Revision: D88736123 fbshipit-source-id: da9fc04bc80bd76749768fd3bfdbaa6a9c9ac368 --- .../react-native/React/Fabric/RCTScheduler.h | 2 ++ .../react-native/React/Fabric/RCTScheduler.mm | 6 ++++++ .../React/Fabric/RCTSurfacePresenter.mm | 9 +++++++++ .../react/fabric/FabricUIManager.java | 19 +++++++++++++++++++ .../react/fabric/FabricUIManagerBinding.kt | 2 ++ .../react/fabric/FabricMountingManager.cpp | 7 +++++++ .../jni/react/fabric/FabricMountingManager.h | 2 ++ .../react/fabric/FabricUIManagerBinding.cpp | 19 +++++++++++++++++++ .../jni/react/fabric/FabricUIManagerBinding.h | 4 ++++ .../react/renderer/scheduler/Scheduler.cpp | 5 +++-- .../renderer/scheduler/SchedulerDelegate.h | 6 ++++++ .../scheduler/SchedulerDelegateImpl.cpp | 13 +++++++++++++ .../scheduler/SchedulerDelegateImpl.h | 5 +++++ .../react/runtime/ReactHost.cpp | 6 ++++-- 14 files changed, 101 insertions(+), 4 deletions(-) diff --git a/packages/react-native/React/Fabric/RCTScheduler.h b/packages/react-native/React/Fabric/RCTScheduler.h index ed585390890..8b809580c10 100644 --- a/packages/react-native/React/Fabric/RCTScheduler.h +++ b/packages/react-native/React/Fabric/RCTScheduler.h @@ -31,6 +31,8 @@ NS_ASSUME_NONNULL_BEGIN - (void)schedulerShouldRenderTransactions: (std::shared_ptr)mountingCoordinator; +- (void)schedulerShouldMergeReactRevision:(facebook::react::SurfaceId)surfaceId; + - (void)schedulerDidDispatchCommand:(const facebook::react::ShadowView &)shadowView commandName:(const std::string &)commandName args:(const folly::dynamic &)args; diff --git a/packages/react-native/React/Fabric/RCTScheduler.mm b/packages/react-native/React/Fabric/RCTScheduler.mm index 76922e26287..408ed9545b2 100644 --- a/packages/react-native/React/Fabric/RCTScheduler.mm +++ b/packages/react-native/React/Fabric/RCTScheduler.mm @@ -37,6 +37,12 @@ void schedulerShouldRenderTransactions(const std::shared_ptrgetShadowTreeRegistry().visit( + surfaceId, [](const ShadowTree &shadowTree) { shadowTree.mergeReactRevision(); }); + }); +} + - (void)schedulerDidDispatchCommand:(const ShadowView &)shadowView commandName:(const std::string &)commandName args:(const folly::dynamic &)args diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/fabric/FabricUIManager.java b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/fabric/FabricUIManager.java index 4cd41bc0fa2..998586790bf 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/fabric/FabricUIManager.java +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/fabric/FabricUIManager.java @@ -964,6 +964,25 @@ public void runGuarded() { } } + @SuppressWarnings("unused") + @AnyThread + @ThreadConfined(ANY) + private void scheduleReactRevisionMerge(int surfaceId) { + if (UiThreadUtil.isOnUiThread()) { + if (mBinding != null) { + mBinding.mergeReactRevision(surfaceId); + } + } else { + UiThreadUtil.runOnUiThread( + () -> { + FabricUIManagerBinding binding = mBinding; + if (binding != null) { + binding.mergeReactRevision(surfaceId); + } + }); + } + } + /** * This method initiates preloading of an image specified by ImageSource. It can later be consumed * by an ImageView. diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/fabric/FabricUIManagerBinding.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/fabric/FabricUIManagerBinding.kt index 0373e9d2be1..cad82b4f1b1 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/fabric/FabricUIManagerBinding.kt +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/fabric/FabricUIManagerBinding.kt @@ -89,6 +89,8 @@ internal class FabricUIManagerBinding : HybridClassBase() { animationBackendChoreographer: AnimationBackendChoreographer ) + external fun mergeReactRevision(surfaceId: Int) + fun register( runtimeExecutor: RuntimeExecutor, runtimeScheduler: RuntimeScheduler, diff --git a/packages/react-native/ReactAndroid/src/main/jni/react/fabric/FabricMountingManager.cpp b/packages/react-native/ReactAndroid/src/main/jni/react/fabric/FabricMountingManager.cpp index 8b966236899..95ddd80e6d9 100644 --- a/packages/react-native/ReactAndroid/src/main/jni/react/fabric/FabricMountingManager.cpp +++ b/packages/react-native/ReactAndroid/src/main/jni/react/fabric/FabricMountingManager.cpp @@ -1206,4 +1206,11 @@ void FabricMountingManager::synchronouslyUpdateViewOnUIThread( synchronouslyUpdateViewOnUIThreadJNI(javaUIManager_, viewTag, propsMap); } +void FabricMountingManager::scheduleReactRevisionMerge(SurfaceId surfaceId) { + static const auto scheduleReactRevisionMerge = + JFabricUIManager::javaClassStatic()->getMethod( + "scheduleReactRevisionMerge"); + scheduleReactRevisionMerge(javaUIManager_, surfaceId); +} + } // namespace facebook::react diff --git a/packages/react-native/ReactAndroid/src/main/jni/react/fabric/FabricMountingManager.h b/packages/react-native/ReactAndroid/src/main/jni/react/fabric/FabricMountingManager.h index 9fd87538d16..98a66775bae 100644 --- a/packages/react-native/ReactAndroid/src/main/jni/react/fabric/FabricMountingManager.h +++ b/packages/react-native/ReactAndroid/src/main/jni/react/fabric/FabricMountingManager.h @@ -54,6 +54,8 @@ class FabricMountingManager final { void synchronouslyUpdateViewOnUIThread(Tag viewTag, const folly::dynamic &props); + void scheduleReactRevisionMerge(SurfaceId surfaceId); + private: bool isOnMainThread(); diff --git a/packages/react-native/ReactAndroid/src/main/jni/react/fabric/FabricUIManagerBinding.cpp b/packages/react-native/ReactAndroid/src/main/jni/react/fabric/FabricUIManagerBinding.cpp index 42a30dde17f..15c34793d06 100644 --- a/packages/react-native/ReactAndroid/src/main/jni/react/fabric/FabricUIManagerBinding.cpp +++ b/packages/react-native/ReactAndroid/src/main/jni/react/fabric/FabricUIManagerBinding.cpp @@ -701,6 +701,23 @@ void FabricUIManagerBinding::schedulerShouldRenderTransactions( } } +void FabricUIManagerBinding::schedulerShouldMergeReactRevision( + SurfaceId surfaceId) { + std::shared_lock lock(installMutex_); + auto mountingManager = + getMountingManager("schedulerShouldMergeReactRevision"); + if (mountingManager) { + mountingManager->scheduleReactRevisionMerge(surfaceId); + } +} + +void FabricUIManagerBinding::mergeReactRevision(SurfaceId surfaceId) { + std::shared_lock lock(installMutex_); + scheduler_->getUIManager()->getShadowTreeRegistry().visit( + surfaceId, + [](const ShadowTree& shadowTree) { shadowTree.mergeReactRevision(); }); +} + void FabricUIManagerBinding::schedulerDidRequestPreliminaryViewAllocation( const ShadowNode& shadowNode) { using namespace std::literals::string_view_literals; @@ -838,6 +855,8 @@ void FabricUIManagerBinding::registerNatives() { makeNativeMethod( "setAnimationBackendChoreographer", FabricUIManagerBinding::setAnimationBackendChoreographer), + makeNativeMethod( + "mergeReactRevision", FabricUIManagerBinding::mergeReactRevision), }); } diff --git a/packages/react-native/ReactAndroid/src/main/jni/react/fabric/FabricUIManagerBinding.h b/packages/react-native/ReactAndroid/src/main/jni/react/fabric/FabricUIManagerBinding.h index a84659c5412..6d129e7ffea 100644 --- a/packages/react-native/ReactAndroid/src/main/jni/react/fabric/FabricUIManagerBinding.h +++ b/packages/react-native/ReactAndroid/src/main/jni/react/fabric/FabricUIManagerBinding.h @@ -97,6 +97,10 @@ class FabricUIManagerBinding : public jni::HybridClass, void schedulerShouldRenderTransactions( const std::shared_ptr &mountingCoordinator) override; + void schedulerShouldMergeReactRevision(SurfaceId surfaceId) override; + + void mergeReactRevision(SurfaceId surfaceId); + void schedulerDidRequestPreliminaryViewAllocation(const ShadowNode &shadowNode) override; void schedulerDidDispatchCommand( diff --git a/packages/react-native/ReactCommon/react/renderer/scheduler/Scheduler.cpp b/packages/react-native/ReactCommon/react/renderer/scheduler/Scheduler.cpp index af2a59f0a28..7bec66e48fb 100644 --- a/packages/react-native/ReactCommon/react/renderer/scheduler/Scheduler.cpp +++ b/packages/react-native/ReactCommon/react/renderer/scheduler/Scheduler.cpp @@ -377,8 +377,9 @@ void Scheduler::uiManagerDidFinishReactCommit(const ShadowTree& shadowTree) { } void Scheduler::uiManagerDidPromoteReactRevision(const ShadowTree& shadowTree) { - // Replaced by scheduling on the UI thread in the following diff. - shadowTree.mergeReactRevision(); + if (delegate_ != nullptr) { + delegate_->schedulerShouldMergeReactRevision(shadowTree.getSurfaceId()); + } } void Scheduler::uiManagerDidStartSurface(const ShadowTree& shadowTree) { diff --git a/packages/react-native/ReactCommon/react/renderer/scheduler/SchedulerDelegate.h b/packages/react-native/ReactCommon/react/renderer/scheduler/SchedulerDelegate.h index afa2d57de65..fafb5f90f29 100644 --- a/packages/react-native/ReactCommon/react/renderer/scheduler/SchedulerDelegate.h +++ b/packages/react-native/ReactCommon/react/renderer/scheduler/SchedulerDelegate.h @@ -38,6 +38,12 @@ class SchedulerDelegate { virtual void schedulerShouldRenderTransactions( const std::shared_ptr &mountingCoordinator) = 0; + /* + * Called at the end of the event loop if there were commits to the JS + * during the pass and JS branch should be "merged" to the main revision. + */ + virtual void schedulerShouldMergeReactRevision(SurfaceId surfaceId) = 0; + /* * Called right after a new ShadowNode was created. */ diff --git a/packages/react-native/ReactCxxPlatform/react/renderer/scheduler/SchedulerDelegateImpl.cpp b/packages/react-native/ReactCxxPlatform/react/renderer/scheduler/SchedulerDelegateImpl.cpp index ad9ca80551b..dcc1df6a5cd 100644 --- a/packages/react-native/ReactCxxPlatform/react/renderer/scheduler/SchedulerDelegateImpl.cpp +++ b/packages/react-native/ReactCxxPlatform/react/renderer/scheduler/SchedulerDelegateImpl.cpp @@ -6,6 +6,7 @@ */ #include "SchedulerDelegateImpl.h" +#include namespace facebook::react { @@ -13,6 +14,11 @@ SchedulerDelegateImpl::SchedulerDelegateImpl( std::shared_ptr mountingManager) noexcept : mountingManager_(std::move(mountingManager)) {} +void SchedulerDelegateImpl::setUIManager( + std::shared_ptr uiManager) noexcept { + uiManager_ = uiManager; +} + void SchedulerDelegateImpl::schedulerDidFinishTransaction( const std::shared_ptr& /*mountingCoordinator*/) { // no-op, we will flush the transaction from schedulerShouldRenderTransactions @@ -30,6 +36,13 @@ void SchedulerDelegateImpl::schedulerShouldRenderTransactions( } } +void SchedulerDelegateImpl::schedulerShouldMergeReactRevision( + SurfaceId surfaceId) { + uiManager_->getShadowTreeRegistry().visit( + surfaceId, + [](const ShadowTree& shadowTree) { shadowTree.mergeReactRevision(); }); +} + void SchedulerDelegateImpl::schedulerDidRequestPreliminaryViewAllocation( const ShadowNode& shadowNode) {} diff --git a/packages/react-native/ReactCxxPlatform/react/renderer/scheduler/SchedulerDelegateImpl.h b/packages/react-native/ReactCxxPlatform/react/renderer/scheduler/SchedulerDelegateImpl.h index 2167e5fe143..b60f33962ce 100644 --- a/packages/react-native/ReactCxxPlatform/react/renderer/scheduler/SchedulerDelegateImpl.h +++ b/packages/react-native/ReactCxxPlatform/react/renderer/scheduler/SchedulerDelegateImpl.h @@ -25,12 +25,16 @@ class SchedulerDelegateImpl : public SchedulerDelegate { SchedulerDelegateImpl(const SchedulerDelegateImpl &) = delete; SchedulerDelegateImpl &operator=(const SchedulerDelegateImpl &) = delete; + void setUIManager(std::shared_ptr uiManager) noexcept; + private: void schedulerDidFinishTransaction(const std::shared_ptr &mountingCoordinator) override; void schedulerShouldRenderTransactions( const std::shared_ptr &mountingCoordinator) override; + void schedulerShouldMergeReactRevision(SurfaceId surfaceId) override; + void schedulerDidRequestPreliminaryViewAllocation(const ShadowNode &shadowNode) override; void schedulerDidDispatchCommand( @@ -48,6 +52,7 @@ class SchedulerDelegateImpl : public SchedulerDelegate { void schedulerDidUpdateShadowTree(const std::unordered_map &tagToProps) override; std::shared_ptr mountingManager_; + std::shared_ptr uiManager_; }; }; // namespace facebook::react diff --git a/packages/react-native/ReactCxxPlatform/react/runtime/ReactHost.cpp b/packages/react-native/ReactCxxPlatform/react/runtime/ReactHost.cpp index 74427d2a72b..eb54ebd0fe8 100644 --- a/packages/react-native/ReactCxxPlatform/react/runtime/ReactHost.cpp +++ b/packages/react-native/ReactCxxPlatform/react/runtime/ReactHost.cpp @@ -229,12 +229,14 @@ void ReactHost::createReactInstance() { }; toolbox.animationChoreographer = reactInstanceData_->animationChoreographer; - schedulerDelegate_ = std::make_unique( + auto schedulerDelegate = std::make_unique( reactInstanceData_->mountingManager); scheduler_ = - std::make_unique(toolbox, nullptr, schedulerDelegate_.get()); + std::make_unique(toolbox, nullptr, schedulerDelegate.get()); surfaceManager_ = std::make_unique(*scheduler_); + schedulerDelegate->setUIManager(scheduler_->getUIManager()); + schedulerDelegate_ = std::move(schedulerDelegate); reactInstanceData_->mountingManager->setSchedulerTaskExecutor( [this](SchedulerTask&& task) { runOnScheduler(std::move(task)); }); From c8d498d62d73ea8d58a6017bd0283e43d78d2c8a Mon Sep 17 00:00:00 2001 From: Jakub Piasecki Date: Mon, 16 Feb 2026 01:32:50 -0800 Subject: [PATCH 370/585] Add a synchronization mechanism for the layout information kept in the root nodes on the React branch (#54836) Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/54836 Changelog: [General][Added] Added a synchronization mechanism for the layout information between the React branch and the main branch of the ShadowTree Since layout constraints and layout context are being kept in the props of the `RootShadowNode`, it was possible for the JS revision merge to lose an update if it was being commited concurrently. Reviewed By: rubennorte Differential Revision: D88839901 fbshipit-source-id: f81d96dacf60b4e5da29da32ada468c967a2c9df --- .../react/renderer/mounting/ShadowTree.cpp | 38 +++++++++++++++++++ .../__tests__/ShadowTreeBranching-itest.js | 3 -- 2 files changed, 38 insertions(+), 3 deletions(-) diff --git a/packages/react-native/ReactCommon/react/renderer/mounting/ShadowTree.cpp b/packages/react-native/ReactCommon/react/renderer/mounting/ShadowTree.cpp index ec806e3be22..9dbeee58107 100644 --- a/packages/react-native/ReactCommon/react/renderer/mounting/ShadowTree.cpp +++ b/packages/react-native/ReactCommon/react/renderer/mounting/ShadowTree.cpp @@ -170,6 +170,37 @@ static std::shared_ptr progressState( }); } +/* + * Updates the layout context and layout metrics on the RootNode for commits + * coming from React. The RootNode is managed outside of it, and may have been + * modified concurrently with the React revision. + */ +static std::shared_ptr progressRootLayoutInfo( + const std::shared_ptr& shadowNode, + const RootShadowNode& baseShadowNode, + const ShadowTreeCommitOptions& commitOptions) { + if (commitOptions.source == ShadowTreeCommitSource::React || + commitOptions.source == ShadowTreeCommitSource::ReactRevisionMerge) { + const auto& mainBranchRootProps = baseShadowNode.getConcreteProps(); + const auto& jsBranchRootProps = shadowNode->getConcreteProps(); + + if (mainBranchRootProps.layoutConstraints == + jsBranchRootProps.layoutConstraints && + mainBranchRootProps.layoutContext == jsBranchRootProps.layoutContext) { + // The layout information kept in the JS branch is up to date. + return shadowNode; + } + + const auto clonedNode = baseShadowNode.ShadowNode::clone( + {.children = std::make_shared< + const std::vector>>( + shadowNode->getChildren())}); + return std::static_pointer_cast(clonedNode); + } + + return shadowNode; +} + ShadowTree::ShadowTree( SurfaceId surfaceId, const LayoutConstraints& layoutConstraints, @@ -330,6 +361,13 @@ CommitStatus ShadowTree::tryCommit( } } + if (ReactNativeFeatureFlags::enableFabricCommitBranching()) { + newRootShadowNode = progressRootLayoutInfo( + newRootShadowNode, + *oldRevisionForStateProgression.rootShadowNode, + commitOptions); + } + // Run commit hooks. newRootShadowNode = delegate_.shadowTreeWillCommit( *this, oldRootShadowNode, newRootShadowNode, commitOptions); diff --git a/packages/react-native/src/private/renderer/branching/__tests__/ShadowTreeBranching-itest.js b/packages/react-native/src/private/renderer/branching/__tests__/ShadowTreeBranching-itest.js index d37fa968119..c2db162e2f5 100644 --- a/packages/react-native/src/private/renderer/branching/__tests__/ShadowTreeBranching-itest.js +++ b/packages/react-native/src/private/renderer/branching/__tests__/ShadowTreeBranching-itest.js @@ -242,10 +242,7 @@ describe('ShadowTreeBranching', () => { ]); // Commit made from React - it should mount the final React tree - // NOTE: The RootView update should not be included here, fixed - // in a following diff expect(root.takeMountingManagerLogs()).toEqual([ - 'Update {type: "RootView", nativeID: (root)}', 'Update {type: "View", nativeID: "view"}', ]); }); From 149a4b8dcde07df9c2f4d8456463ad242a2cb842 Mon Sep 17 00:00:00 2001 From: Bartlomiej Bloniarz Date: Mon, 16 Feb 2026 04:17:43 -0800 Subject: [PATCH 371/585] Add animation backend examples to catalyst (#55474) Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/55474 This diff adds two examples for the purpose of showcasing the layout-updating capabilities of the Shared Animation Backend. # Changelog [General][Added] - Animation Backend examples in RNTester Reviewed By: zeyap Differential Revision: D92714034 fbshipit-source-id: ca5c86e15d9a54a6db7d278fb46bb47aad012198 --- .../AnimationBackend/AnimationBackendIndex.js | 29 ++ .../AnimationBackend/ChessboardExample.js | 134 ++++++++ .../AnimationBackend/SwipeableListExample.js | 286 ++++++++++++++++++ .../js/utils/RNTesterList.android.js | 6 + .../rn-tester/js/utils/RNTesterList.ios.js | 5 + 5 files changed, 460 insertions(+) create mode 100644 packages/rn-tester/js/examples/AnimationBackend/AnimationBackendIndex.js create mode 100644 packages/rn-tester/js/examples/AnimationBackend/ChessboardExample.js create mode 100644 packages/rn-tester/js/examples/AnimationBackend/SwipeableListExample.js diff --git a/packages/rn-tester/js/examples/AnimationBackend/AnimationBackendIndex.js b/packages/rn-tester/js/examples/AnimationBackend/AnimationBackendIndex.js new file mode 100644 index 00000000000..f8eb3d25d77 --- /dev/null +++ b/packages/rn-tester/js/examples/AnimationBackend/AnimationBackendIndex.js @@ -0,0 +1,29 @@ +/** + * 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 {RNTesterModule} from '../../types/RNTesterTypes'; + +import PlaygroundExample from './ChessboardExample'; +import SwipeableListExample from './SwipeableListExample'; +import * as ReactNativeFeatureFlags from 'react-native/src/private/featureflags/ReactNativeFeatureFlags'; + +const canUseBackend = + // eslint-disable-next-line + ReactNativeFeatureFlags.useSharedAnimatedBackend() && + ReactNativeFeatureFlags.cxxNativeAnimatedEnabled(); + +export default ({ + framework: 'React', + title: 'Animation Backend', + category: 'UI', + description: `Examples demonstrating the Animation Backend for layout-updating animations. ${canUseBackend ? '' : 'You need to enable c++ Animated and the Animation Backend to see these examples.'}`, + showIndividualExamples: true, + examples: canUseBackend ? [PlaygroundExample, SwipeableListExample] : [], +}: RNTesterModule); diff --git a/packages/rn-tester/js/examples/AnimationBackend/ChessboardExample.js b/packages/rn-tester/js/examples/AnimationBackend/ChessboardExample.js new file mode 100644 index 00000000000..5bf011860ba --- /dev/null +++ b/packages/rn-tester/js/examples/AnimationBackend/ChessboardExample.js @@ -0,0 +1,134 @@ +/** + * 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 {RNTesterModuleExample} from '../../types/RNTesterTypes'; + +import * as React from 'react'; +import {useMemo} from 'react'; +import {Animated, StyleSheet, Text, View, useAnimatedValue} from 'react-native'; +import {allowStyleProp} from 'react-native/Libraries/Animated/NativeAnimatedAllowlist'; + +allowStyleProp('width'); +allowStyleProp('height'); +const colors = ['lime', 'green']; + +function useLoop() { + const animatedValue = useAnimatedValue(0); + + React.useEffect(() => { + const animation = Animated.loop( + Animated.sequence([ + Animated.timing(animatedValue, { + toValue: 1, + duration: 1000, + useNativeDriver: true, + }), + Animated.timing(animatedValue, { + toValue: 0, + duration: 1000, + useNativeDriver: true, + }), + ]), + ); + animation.start(); + + return () => { + animation.stop(); + }; + }, [animatedValue]); + + return animatedValue; +} + +const N = 12; +const STATE_MAX = 30; + +function ChessboardExample() { + const [state, setState] = React.useState(0); + + const animatedValue = useLoop(); + + React.useEffect(() => { + const id = setInterval(() => { + setState(s => (s + 1) % STATE_MAX); + }, 10); + return () => { + clearInterval(id); + }; + }, []); + + const animatedStyle = useMemo(() => { + return { + width: animatedValue.interpolate({ + inputRange: [0, 1], + outputRange: [10, 30], + }), + height: animatedValue.interpolate({ + inputRange: [0, 1], + outputRange: [10, 30], + }), + }; + }, [animatedValue]); + + return ( + + {state} + + + {[...Array(N).keys()].map(i => ( + + {[...Array(N).keys()].map(j => ( + + ))} + + ))} + + + + ); +} + +const styles = StyleSheet.create({ + workaround: { + height: 400, + }, + chessboard: { + alignItems: 'flex-start', + }, + border: { + borderWidth: 10, + borderColor: 'red', + }, + row: { + flexDirection: 'row', + }, + text: { + fontSize: 20, + fontWeight: 'bold', + textAlign: 'center', + margin: 10, + }, +}); + +export default ({ + title: 'Chessboard', + name: 'chessboard', + description: 'Combine animating layout with state updates', + render: (): React.Node => , +}: RNTesterModuleExample); diff --git a/packages/rn-tester/js/examples/AnimationBackend/SwipeableListExample.js b/packages/rn-tester/js/examples/AnimationBackend/SwipeableListExample.js new file mode 100644 index 00000000000..2ede306fa51 --- /dev/null +++ b/packages/rn-tester/js/examples/AnimationBackend/SwipeableListExample.js @@ -0,0 +1,286 @@ +/** + * 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 {RNTesterModuleExample} from '../../types/RNTesterTypes'; + +import * as React from 'react'; +import {useCallback, useMemo, useRef} from 'react'; +import { + Alert, + Animated, + Dimensions, + Easing, + PanResponder, + StyleSheet, + Text, + TouchableOpacity, + View, + useAnimatedValue, +} from 'react-native'; +import {allowStyleProp} from 'react-native/Libraries/Animated/NativeAnimatedAllowlist'; + +allowStyleProp('height'); + +const windowDimensions = Dimensions.get('window'); +const BUTTON_WIDTH = 80; +const MAX_TRANSLATE = -BUTTON_WIDTH; + +type Data = { + id: string, + title: string, +}; + +const initialData: $ReadOnlyArray = [ + {id: '1', title: 'Kate Bell'}, + {id: '2', title: 'John Appleseed'}, + {id: '3', title: 'Mark Zuckerberg'}, + {id: '4', title: 'Iron Man'}, + {id: '5', title: 'Captain America'}, + {id: '6', title: 'Batman'}, + {id: '7', title: 'Matt Smith'}, +]; + +const springConfig = { + stiffness: 1000, + damping: 500, + mass: 3, + overshootClamping: true, + useNativeDriver: true, +}; + +const timingConfig = { + duration: 400, + easing: Easing.bezier(0.25, 0.1, 0.25, 1), + useNativeDriver: true, +}; + +function SwipeableListExample(): React.Node { + const [data, setData] = React.useState<$ReadOnlyArray>(initialData); + + const handleRemove = useCallback((id: string) => { + setData(currentData => currentData.filter(item => item.id !== id)); + Alert.alert('Removed'); + }, []); + + return ( + + {data.map(item => ( + handleRemove(item.id)} + /> + ))} + + ); +} + +type ListItemProps = { + item: Data, + onRemove: () => void, +}; + +function ListItem({item, onRemove}: ListItemProps): React.Node { + const isRemoving = useRef(false); + const translateX = useAnimatedValue(0); + const removalOffset = useAnimatedValue(0); // Separate value for removal animation + const height = useAnimatedValue(78); + const opacity = useAnimatedValue(1); + + const clampedTranslateX = useMemo( + () => + translateX.interpolate({ + inputRange: [MAX_TRANSLATE, 0], + outputRange: [MAX_TRANSLATE, 0], + extrapolate: 'clamp', + }), + [translateX], + ); + + // Combine clamped pan position with removal offset + const finalTranslateX = useMemo( + () => Animated.add(clampedTranslateX, removalOffset), + [clampedTranslateX, removalOffset], + ); + + const panResponder = useMemo( + () => + PanResponder.create({ + onMoveShouldSetPanResponder: (_, gestureState) => { + return Math.abs(gestureState.dx) > 10; + }, + onPanResponderGrant: () => { + translateX.extractOffset(); + }, + onPanResponderMove: Animated.event([null, {dx: translateX}], { + useNativeDriver: false, + }), + onPanResponderRelease: (_, gestureState) => { + translateX.flattenOffset(); + + const shouldOpen = gestureState.vx < -0.05; + const targetValue = shouldOpen ? MAX_TRANSLATE : 0; + + Animated.spring(translateX, { + toValue: targetValue, + velocity: gestureState.vx, + ...springConfig, + }).start(); + }, + }), + [translateX], + ); + + const handleRemove = useCallback(() => { + if (isRemoving.current) { + return; + } + isRemoving.current = true; + + // Animate removal offset separately - this bypasses the clamp + Animated.parallel([ + Animated.timing(height, { + toValue: 0, + ...timingConfig, + }), + Animated.timing(opacity, { + toValue: 0, + ...timingConfig, + }), + Animated.timing(removalOffset, { + toValue: -windowDimensions.width - MAX_TRANSLATE, + ...timingConfig, + }), + ]).start(() => { + onRemove(); + }); + }, [height, opacity, removalOffset, onRemove]); + + const animatedStyle = useMemo( + () => ({ + height, + opacity, + transform: [{translateX: finalTranslateX}], + }), + [height, opacity, finalTranslateX], + ); + + const removeButton = useMemo( + () => ({ + title: 'Delete', + backgroundColor: 'red', + color: 'white', + onPress: handleRemove, + }), + [handleRemove], + ); + + return ( + + + + +