Skip to content

Commit 6adfaad

Browse files
zeyapfacebook-github-bot
authored andcommitted
Remove native animation fabric sync in JS and infinite animation loop workaround
Summary: ## Changelog: [General] [Changed] - Remove native animation fabric sync in JS and infinite animation loop workaround, when cxxNativeAnimated is enabled when cxxNativeAnimated is enabled, we'll sync native animation props back to Fabric in native, when that happens we can remove the code in JS for same purpose Differential Revision: D74198568
1 parent 0925ee8 commit 6adfaad

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

packages/react-native/Libraries/Animated/animations/Animation.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import type AnimatedNode from '../nodes/AnimatedNode';
1313
import type AnimatedValue from '../nodes/AnimatedValue';
1414

1515
import NativeAnimatedHelper from '../../../src/private/animated/NativeAnimatedHelper';
16+
import * as ReactNativeFeatureFlags from '../../../src/private/featureflags/ReactNativeFeatureFlags';
1617
import AnimatedProps from '../nodes/AnimatedProps';
1718

1819
export type EndResult = {
@@ -149,8 +150,10 @@ export default class Animation {
149150
if (value != null) {
150151
animatedValue.__onAnimatedValueUpdateReceived(value, offset);
151152

152-
if (this.__isLooping === true) {
153-
return;
153+
if (!ReactNativeFeatureFlags.cxxNativeAnimatedEnabled()) {
154+
if (this.__isLooping === true) {
155+
return;
156+
}
154157
}
155158

156159
// Once the JS side node is synced with the updated values, trigger an

packages/react-native/src/private/animated/createAnimatedPropsHook.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,10 @@ export default function createAnimatedPropsHook(
125125
}
126126

127127
const isFabricNode = isFabricInstance(instance);
128-
if (node.__isNative) {
128+
if (
129+
node.__isNative &&
130+
!ReactNativeFeatureFlags.cxxNativeAnimatedEnabled()
131+
) {
129132
// Check 2: this is an animation driven by native.
130133
// In native driven animations, this callback is only called once the animation completes.
131134
if (isFabricNode) {

0 commit comments

Comments
 (0)