Skip to content

Commit 550aadd

Browse files
Fix setLayoutAnimationEnabled assigning variable to itself (#56387)
Summary: `setLayoutAnimationEnabled()` in `LayoutAnimation.js` assigns `isLayoutAnimationEnabled` back to itself instead of the `value` parameter: ```js // Before (bug) function setLayoutAnimationEnabled(value: boolean) { isLayoutAnimationEnabled = isLayoutAnimationEnabled; // no-op } // After (fixed) function setLayoutAnimationEnabled(value: boolean) { isLayoutAnimationEnabled = value; } ``` This makes the function a complete no-op, meaning LayoutAnimation can never be toggled at runtime once initialized from the feature flag. ## Changelog: [GENERAL] [FIXED] - Fix setLayoutAnimationEnabled not applying the value parameter Pull Request resolved: #56387 Test Plan: 1. Call `LayoutAnimation.setLayoutAnimationEnabled(false)` and verify layout animations are disabled 2. Call `LayoutAnimation.setLayoutAnimationEnabled(true)` and verify they re-enable 3. Previously both calls had no effect due to the self-assignment bug Reviewed By: Abbondanzo Differential Revision: D122803610 Pulled By: cortinico fbshipit-source-id: 7ed2ab77b36ef61fa397778e048be70f2d0ca370
1 parent a7f81c8 commit 550aadd

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

‎packages/react-native/Libraries/LayoutAnimation/LayoutAnimation.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ let isLayoutAnimationEnabled: boolean =
4646
ReactNativeFeatureFlags.isLayoutAnimationEnabled();
4747

4848
function setLayoutAnimationEnabled(value: boolean) {
49-
isLayoutAnimationEnabled = isLayoutAnimationEnabled;
49+
isLayoutAnimationEnabled = value;
5050
}
5151

5252
/**

0 commit comments

Comments
 (0)