Skip to content

Commit a5e6add

Browse files
zeyapmeta-codesync[bot]
authored andcommitted
Remove feature flag cxxNativeAnimatedRemoveJsSync (#54740)
Summary: Pull Request resolved: #54740 ## Changelog: [Internal] [Changed] - Remove feature flag cxxNativeAnimatedRemoveJsSync It's always rolled out with cxx animated and we haven't found new issues with it Reviewed By: lenaic Differential Revision: D88082232 fbshipit-source-id: 3b9f29c20a7f41cd1d826257a9e2c42c11fcee0f
1 parent 257f036 commit a5e6add

25 files changed

+132
-267
lines changed

packages/react-native/Libraries/Animated/__tests__/Animated-itest.js

Lines changed: 12 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
* This source code is licensed under the MIT license found in the
55
* LICENSE file in the root directory of this source tree.
66
*
7-
* @fantom_flags cxxNativeAnimatedRemoveJsSync:*
87
* @flow strict-local
98
* @format
109
*/
@@ -18,7 +17,6 @@ import * as Fantom from '@react-native/fantom';
1817
import {createRef} from 'react';
1918
import {Animated, View, useAnimatedValue} from 'react-native';
2019
import {allowStyleProp} from 'react-native/Libraries/Animated/NativeAnimatedAllowlist';
21-
import * as ReactNativeFeatureFlags from 'react-native/src/private/featureflags/ReactNativeFeatureFlags';
2220
import ReactNativeElement from 'react-native/src/private/webapis/dom/nodes/ReactNativeElement';
2321

2422
test('moving box by 100 points', () => {
@@ -76,14 +74,9 @@ test('moving box by 100 points', () => {
7674
Fantom.unstable_produceFramesForDuration(500);
7775

7876
// Animation is completed now. C++ Animated will commit the final position to the shadow tree.
79-
if (ReactNativeFeatureFlags.cxxNativeAnimatedRemoveJsSync()) {
80-
// TODO(T232605345): this shouldn't be neccessary once we fix Android's race condition.
81-
Fantom.runWorkLoop();
82-
expect(viewElement.getBoundingClientRect().x).toBe(100);
83-
} else {
84-
Fantom.runWorkLoop(); // Animated still schedules a React state update for synchronisation to shadow tree
85-
expect(viewElement.getBoundingClientRect().x).toBe(100);
86-
}
77+
// TODO(T232605345): this shouldn't be neccessary once we fix Android's race condition.
78+
Fantom.runWorkLoop();
79+
expect(viewElement.getBoundingClientRect().x).toBe(100);
8780
});
8881

8982
test('animation driven by onScroll event', () => {
@@ -334,21 +327,11 @@ test('moving box by 50 points with offset 10', () => {
334327
.translateX,
335328
).toBeCloseTo(60, 0.001);
336329

337-
if (ReactNativeFeatureFlags.cxxNativeAnimatedRemoveJsSync()) {
338-
// TODO(T232605345): The following line won't be necessary once race condition on Android is fixed.
339-
Fantom.runWorkLoop();
340-
expect(root.getRenderedOutput({props: ['transform']}).toJSX()).toEqual(
341-
<rn-view transform='[{"translateX": 60.000000}]' />,
342-
);
343-
} else {
344-
expect(root.getRenderedOutput({props: ['transform']}).toJSX()).toEqual(
345-
<rn-view transform="[]" />,
346-
);
347-
Fantom.runWorkLoop(); // Animated still schedules a React state update for synchronisation to shadow tree
348-
expect(root.getRenderedOutput({props: ['transform']}).toJSX()).toEqual(
349-
<rn-view transform='[{"translateX": 60.000000}]' />, // // must include offset.
350-
);
351-
}
330+
// TODO(T232605345): The following line won't be necessary once race condition on Android is fixed.
331+
Fantom.runWorkLoop();
332+
expect(root.getRenderedOutput({props: ['transform']}).toJSX()).toEqual(
333+
<rn-view transform='[{"translateX": 60.000000}]' />,
334+
);
352335

353336
expect(finishValue?.finished).toBe(true);
354337
expect(finishValue?.value).toBe(50); // must not include offset.
@@ -734,16 +717,10 @@ test('Animated.sequence', () => {
734717
Fantom.unstable_getDirectManipulationProps(element).transform[0].translateY,
735718
).toBeCloseTo(0, 0.001);
736719

737-
if (ReactNativeFeatureFlags.cxxNativeAnimatedRemoveJsSync()) {
738-
// TODO(T232605345): The following two lines won't be necessary once race condition on Android is fixed
739-
expect(element.getBoundingClientRect().y).toBe(-16);
740-
Fantom.runWorkLoop();
741-
expect(element.getBoundingClientRect().y).toBe(0);
742-
} else {
743-
expect(element.getBoundingClientRect().y).toBe(-16);
744-
Fantom.runWorkLoop(); // React update to sync end state of 2nd timing animation in sequence
745-
expect(element.getBoundingClientRect().y).toBe(0);
746-
}
720+
// TODO(T232605345): The following two lines won't be necessary once race condition on Android is fixed
721+
expect(element.getBoundingClientRect().y).toBe(-16);
722+
Fantom.runWorkLoop();
723+
expect(element.getBoundingClientRect().y).toBe(0);
747724

748725
expect(_isSequenceFinished).toBe(true);
749726
});

packages/react-native/Libraries/Animated/__tests__/AnimatedBackend-itest.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,16 @@ test('animated opacity', () => {
6969
_opacityAnimation?.stop();
7070
});
7171

72+
// TODO: T246961305 rendered output should be <rn-view opacity="0" /> at this point
73+
expect(root.getRenderedOutput({props: ['opacity']}).toJSX()).toEqual(
74+
<rn-view />,
75+
);
76+
77+
// Re-render
78+
Fantom.runTask(() => {
79+
root.render(<MyApp />);
80+
});
81+
7282
expect(root.getRenderedOutput({props: ['opacity']}).toJSX()).toEqual(
7383
<rn-view opacity="0" />,
7484
);

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -151,8 +151,7 @@ export default class Animation {
151151
animatedValue.__onAnimatedValueUpdateReceived(value, offset);
152152

153153
const isJsSyncRemoved =
154-
ReactNativeFeatureFlags.cxxNativeAnimatedEnabled() &&
155-
ReactNativeFeatureFlags.cxxNativeAnimatedRemoveJsSync();
154+
ReactNativeFeatureFlags.cxxNativeAnimatedEnabled();
156155
if (!isJsSyncRemoved) {
157156
if (this.__isLooping === true) {
158157
return;

packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlags.kt

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* This source code is licensed under the MIT license found in the
55
* LICENSE file in the root directory of this source tree.
66
*
7-
* @generated SignedSource<<2e69f1b64e18567abff05a1f8bc7014d>>
7+
* @generated SignedSource<<5685f79f9b08afe94f5b3e8ec8ff6748>>
88
*/
99

1010
/**
@@ -48,12 +48,6 @@ public object ReactNativeFeatureFlags {
4848
@JvmStatic
4949
public fun cxxNativeAnimatedEnabled(): Boolean = accessor.cxxNativeAnimatedEnabled()
5050

51-
/**
52-
* Removes JS sync at end of native animation
53-
*/
54-
@JvmStatic
55-
public fun cxxNativeAnimatedRemoveJsSync(): Boolean = accessor.cxxNativeAnimatedRemoveJsSync()
56-
5751
/**
5852
* Dispatch view commands in mount item order.
5953
*/

packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsCxxAccessor.kt

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* This source code is licensed under the MIT license found in the
55
* LICENSE file in the root directory of this source tree.
66
*
7-
* @generated SignedSource<<82bc3d80b3f36ee448ede8f69ba90248>>
7+
* @generated SignedSource<<6645323047d21e58469de0d385954eab>>
88
*/
99

1010
/**
@@ -23,7 +23,6 @@ internal class ReactNativeFeatureFlagsCxxAccessor : ReactNativeFeatureFlagsAcces
2323
private var commonTestFlagCache: Boolean? = null
2424
private var cdpInteractionMetricsEnabledCache: Boolean? = null
2525
private var cxxNativeAnimatedEnabledCache: Boolean? = null
26-
private var cxxNativeAnimatedRemoveJsSyncCache: Boolean? = null
2726
private var disableEarlyViewCommandExecutionCache: Boolean? = null
2827
private var disableImageViewPreallocationAndroidCache: Boolean? = null
2928
private var disableMountItemReorderingAndroidCache: Boolean? = null
@@ -138,15 +137,6 @@ internal class ReactNativeFeatureFlagsCxxAccessor : ReactNativeFeatureFlagsAcces
138137
return cached
139138
}
140139

141-
override fun cxxNativeAnimatedRemoveJsSync(): Boolean {
142-
var cached = cxxNativeAnimatedRemoveJsSyncCache
143-
if (cached == null) {
144-
cached = ReactNativeFeatureFlagsCxxInterop.cxxNativeAnimatedRemoveJsSync()
145-
cxxNativeAnimatedRemoveJsSyncCache = cached
146-
}
147-
return cached
148-
}
149-
150140
override fun disableEarlyViewCommandExecution(): Boolean {
151141
var cached = disableEarlyViewCommandExecutionCache
152142
if (cached == null) {

packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsCxxInterop.kt

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* This source code is licensed under the MIT license found in the
55
* LICENSE file in the root directory of this source tree.
66
*
7-
* @generated SignedSource<<c94da1f2b880dbcbd02b2ccc1da0c387>>
7+
* @generated SignedSource<<3da42d9ffdbba52e9e1d11a4e4dac8c4>>
88
*/
99

1010
/**
@@ -34,8 +34,6 @@ public object ReactNativeFeatureFlagsCxxInterop {
3434

3535
@DoNotStrip @JvmStatic public external fun cxxNativeAnimatedEnabled(): Boolean
3636

37-
@DoNotStrip @JvmStatic public external fun cxxNativeAnimatedRemoveJsSync(): Boolean
38-
3937
@DoNotStrip @JvmStatic public external fun disableEarlyViewCommandExecution(): Boolean
4038

4139
@DoNotStrip @JvmStatic public external fun disableImageViewPreallocationAndroid(): Boolean

packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsDefaults.kt

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* This source code is licensed under the MIT license found in the
55
* LICENSE file in the root directory of this source tree.
66
*
7-
* @generated SignedSource<<a5795c5441af8d4e4151e4c89304fb2f>>
7+
* @generated SignedSource<<46e1f708d91d5ec45c866b8192192e72>>
88
*/
99

1010
/**
@@ -29,8 +29,6 @@ public open class ReactNativeFeatureFlagsDefaults : ReactNativeFeatureFlagsProvi
2929

3030
override fun cxxNativeAnimatedEnabled(): Boolean = false
3131

32-
override fun cxxNativeAnimatedRemoveJsSync(): Boolean = false
33-
3432
override fun disableEarlyViewCommandExecution(): Boolean = false
3533

3634
override fun disableImageViewPreallocationAndroid(): Boolean = false

packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsLocalAccessor.kt

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* This source code is licensed under the MIT license found in the
55
* LICENSE file in the root directory of this source tree.
66
*
7-
* @generated SignedSource<<ceaebd9c6453b8d6a44e5d45343e0ba4>>
7+
* @generated SignedSource<<c19ea5e9ad6435b1f8587287cacf020b>>
88
*/
99

1010
/**
@@ -27,7 +27,6 @@ internal class ReactNativeFeatureFlagsLocalAccessor : ReactNativeFeatureFlagsAcc
2727
private var commonTestFlagCache: Boolean? = null
2828
private var cdpInteractionMetricsEnabledCache: Boolean? = null
2929
private var cxxNativeAnimatedEnabledCache: Boolean? = null
30-
private var cxxNativeAnimatedRemoveJsSyncCache: Boolean? = null
3130
private var disableEarlyViewCommandExecutionCache: Boolean? = null
3231
private var disableImageViewPreallocationAndroidCache: Boolean? = null
3332
private var disableMountItemReorderingAndroidCache: Boolean? = null
@@ -145,16 +144,6 @@ internal class ReactNativeFeatureFlagsLocalAccessor : ReactNativeFeatureFlagsAcc
145144
return cached
146145
}
147146

148-
override fun cxxNativeAnimatedRemoveJsSync(): Boolean {
149-
var cached = cxxNativeAnimatedRemoveJsSyncCache
150-
if (cached == null) {
151-
cached = currentProvider.cxxNativeAnimatedRemoveJsSync()
152-
accessedFeatureFlags.add("cxxNativeAnimatedRemoveJsSync")
153-
cxxNativeAnimatedRemoveJsSyncCache = cached
154-
}
155-
return cached
156-
}
157-
158147
override fun disableEarlyViewCommandExecution(): Boolean {
159148
var cached = disableEarlyViewCommandExecutionCache
160149
if (cached == null) {

packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsProvider.kt

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* This source code is licensed under the MIT license found in the
55
* LICENSE file in the root directory of this source tree.
66
*
7-
* @generated SignedSource<<91441ffa16383203cf8ef82e1edf4451>>
7+
* @generated SignedSource<<17400be6ee20befd9eafb094455dfb63>>
88
*/
99

1010
/**
@@ -29,8 +29,6 @@ public interface ReactNativeFeatureFlagsProvider {
2929

3030
@DoNotStrip public fun cxxNativeAnimatedEnabled(): Boolean
3131

32-
@DoNotStrip public fun cxxNativeAnimatedRemoveJsSync(): Boolean
33-
3432
@DoNotStrip public fun disableEarlyViewCommandExecution(): Boolean
3533

3634
@DoNotStrip public fun disableImageViewPreallocationAndroid(): Boolean

packages/react-native/ReactAndroid/src/main/jni/react/featureflags/JReactNativeFeatureFlagsCxxInterop.cpp

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* This source code is licensed under the MIT license found in the
55
* LICENSE file in the root directory of this source tree.
66
*
7-
* @generated SignedSource<<95616bb241e59e35a9f4b3667cbc0822>>
7+
* @generated SignedSource<<66f2c701d95db2fbeefb2705ae326e08>>
88
*/
99

1010
/**
@@ -57,12 +57,6 @@ class ReactNativeFeatureFlagsJavaProvider
5757
return method(javaProvider_);
5858
}
5959

60-
bool cxxNativeAnimatedRemoveJsSync() override {
61-
static const auto method =
62-
getReactNativeFeatureFlagsProviderJavaClass()->getMethod<jboolean()>("cxxNativeAnimatedRemoveJsSync");
63-
return method(javaProvider_);
64-
}
65-
6660
bool disableEarlyViewCommandExecution() override {
6761
static const auto method =
6862
getReactNativeFeatureFlagsProviderJavaClass()->getMethod<jboolean()>("disableEarlyViewCommandExecution");
@@ -598,11 +592,6 @@ bool JReactNativeFeatureFlagsCxxInterop::cxxNativeAnimatedEnabled(
598592
return ReactNativeFeatureFlags::cxxNativeAnimatedEnabled();
599593
}
600594

601-
bool JReactNativeFeatureFlagsCxxInterop::cxxNativeAnimatedRemoveJsSync(
602-
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop> /*unused*/) {
603-
return ReactNativeFeatureFlags::cxxNativeAnimatedRemoveJsSync();
604-
}
605-
606595
bool JReactNativeFeatureFlagsCxxInterop::disableEarlyViewCommandExecution(
607596
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop> /*unused*/) {
608597
return ReactNativeFeatureFlags::disableEarlyViewCommandExecution();
@@ -1073,9 +1062,6 @@ void JReactNativeFeatureFlagsCxxInterop::registerNatives() {
10731062
makeNativeMethod(
10741063
"cxxNativeAnimatedEnabled",
10751064
JReactNativeFeatureFlagsCxxInterop::cxxNativeAnimatedEnabled),
1076-
makeNativeMethod(
1077-
"cxxNativeAnimatedRemoveJsSync",
1078-
JReactNativeFeatureFlagsCxxInterop::cxxNativeAnimatedRemoveJsSync),
10791065
makeNativeMethod(
10801066
"disableEarlyViewCommandExecution",
10811067
JReactNativeFeatureFlagsCxxInterop::disableEarlyViewCommandExecution),

0 commit comments

Comments
 (0)