From 0ac82ef83afcc1e9616031caa5a749a07a0edbf0 Mon Sep 17 00:00:00 2001 From: Samuel Susla Date: Tue, 20 May 2025 06:48:11 -0700 Subject: [PATCH] use C++ Native Animated from JS if enabled (#51337) Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/51337 changelog: [internal] When C++ Native Animated is used, we can't be using TurboModuleAnimated native module. This diff just add the check to make sure that if C++ Native Animated is used, it will be correctly referenced from JS. Reviewed By: lenaic Differential Revision: D74490166 fbshipit-source-id: 1b6de3227707168618052ff4ca6a02ca11337607 --- .../Libraries/Animated/shouldUseTurboAnimatedModule.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/packages/react-native/Libraries/Animated/shouldUseTurboAnimatedModule.js b/packages/react-native/Libraries/Animated/shouldUseTurboAnimatedModule.js index 0a780617e48..2758cc73469 100644 --- a/packages/react-native/Libraries/Animated/shouldUseTurboAnimatedModule.js +++ b/packages/react-native/Libraries/Animated/shouldUseTurboAnimatedModule.js @@ -8,10 +8,15 @@ * @format */ +import * as ReactNativeFeatureFlags from '../../src/private/featureflags/ReactNativeFeatureFlags'; import Platform from '../Utilities/Platform'; function shouldUseTurboAnimatedModule(): boolean { - return Platform.OS === 'ios' && global.RN$Bridgeless === true; + if (ReactNativeFeatureFlags.cxxNativeAnimatedEnabled()) { + return false; + } else { + return Platform.OS === 'ios' && global.RN$Bridgeless === true; + } } export default shouldUseTurboAnimatedModule;