Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import AnimatedValue from '../../../Libraries/Animated/nodes/AnimatedValue';
import {isPublicInstance as isFabricPublicInstance} from '../../../Libraries/ReactNative/ReactFabricPublicInstance/ReactFabricPublicInstanceUtils';
import {RootTagContext} from '../../../Libraries/ReactNative/RootTag';
import useRefEffect from '../../../Libraries/Utilities/useRefEffect';
import warnOnce from '../../../Libraries/Utilities/warnOnce';
import * as ReactNativeFeatureFlags from '../featureflags/ReactNativeFeatureFlags';
import {createAnimatedPropsMemoHook} from './createAnimatedPropsMemoHook';
import NativeAnimatedHelper from './NativeAnimatedHelper';
Expand Down Expand Up @@ -52,9 +53,6 @@ export default function createAnimatedPropsHook(
): AnimatedPropsHook {
const useAnimatedPropsMemo = createAnimatedPropsMemoHook(allowlist);

const useNativePropsInFabric =
ReactNativeFeatureFlags.shouldUseSetNativePropsInFabric();

return function useAnimatedProps<TProps extends {...}, TInstance>(
props: TProps,
): [ReducedProps<TProps>, CallbackRef<TInstance | null>] {
Expand Down Expand Up @@ -145,6 +143,17 @@ export default function createAnimatedPropsHook(
return;
}

// TODO: T274006331 - Remove js-only animation once shared backend is fully rolled out
const isNativeDriverForced =
NativeAnimatedHelper.isNativeDriverForced();
if (isNativeDriverForced) {
warnOnce(
'animated-force-native-driver-js-update',
'Animated: Expected the animation node to use the native driver when the native driver is forced.',
);
return;
}

if (
typeof instance !== 'object' ||
typeof instance?.setNativeProps !== 'function'
Expand All @@ -160,6 +169,8 @@ export default function createAnimatedPropsHook(
return instance.setNativeProps(node.__getAnimatedValue());
}

const useNativePropsInFabric =
ReactNativeFeatureFlags.shouldUseSetNativePropsInFabric();
if (!useNativePropsInFabric) {
// Check 5: setNativeProps are disabled.
return scheduleUpdate();
Expand Down
Loading