File tree Expand file tree Collapse file tree 3 files changed +19
-2
lines changed
Libraries/Animated/animations Expand file tree Collapse file tree 3 files changed +19
-2
lines changed Original file line number Diff line number Diff line change @@ -14,6 +14,7 @@ import type {PlatformConfig} from '../AnimatedPlatformConfig';
14
14
import type AnimatedNode from '../nodes/AnimatedNode' ;
15
15
import type AnimatedValue from '../nodes/AnimatedValue' ;
16
16
17
+ import * as ReactNativeFeatureFlags from '../../../src/private/featureflags/ReactNativeFeatureFlags' ;
17
18
import NativeAnimatedHelper from '../NativeAnimatedHelper' ;
18
19
import AnimatedProps from '../nodes/AnimatedProps' ;
19
20
@@ -92,7 +93,12 @@ export default class Animation {
92
93
try {
93
94
const config = this . __getNativeAnimationConfig ( ) ;
94
95
animatedValue . __makeNative ( config . platformConfig ) ;
95
- this . _nativeId = NativeAnimatedHelper . generateNewAnimationId ( ) ;
96
+ if (
97
+ ! this . _nativeId ||
98
+ ! ReactNativeFeatureFlags . animatedShouldUsePermanentAnimationId ( )
99
+ ) {
100
+ this . _nativeId = NativeAnimatedHelper . generateNewAnimationId ( ) ;
101
+ }
96
102
NativeAnimatedHelper . API . startAnimatingNode (
97
103
this . _nativeId ,
98
104
animatedValue . __getNativeTag ( ) ,
Original file line number Diff line number Diff line change @@ -167,6 +167,11 @@ const definitions: FeatureFlagDefinitions = {
167
167
description :
168
168
'Enables an experimental flush-queue debouncing in Animated.js.' ,
169
169
} ,
170
+ animatedShouldUsePermanentAnimationId : {
171
+ defaultValue : false ,
172
+ description :
173
+ 'Enables an experimental option to reuse the native ID for an animation.' ,
174
+ } ,
170
175
animatedShouldUseSingleOp : {
171
176
defaultValue : false ,
172
177
description :
Original file line number Diff line number Diff line change 4
4
* This source code is licensed under the MIT license found in the
5
5
* LICENSE file in the root directory of this source tree.
6
6
*
7
- * @generated SignedSource<<522f11a571457cb932f451cf81bd384a >>
7
+ * @generated SignedSource<<3ff3985c50d0b1abc5116a657e148938 >>
8
8
* @flow strict-local
9
9
*/
10
10
@@ -28,6 +28,7 @@ import {
28
28
export type ReactNativeFeatureFlagsJsOnly = {
29
29
jsOnlyTestFlag : Getter < boolean > ,
30
30
animatedShouldDebounceQueueFlush : Getter < boolean > ,
31
+ animatedShouldUsePermanentAnimationId : Getter < boolean > ,
31
32
animatedShouldUseSingleOp : Getter < boolean > ,
32
33
enableAccessToHostTreeInFabric : Getter < boolean > ,
33
34
isLayoutAnimationEnabled : Getter < boolean > ,
@@ -78,6 +79,11 @@ export const jsOnlyTestFlag: Getter<boolean> = createJavaScriptFlagGetter('jsOnl
78
79
*/
79
80
export const animatedShouldDebounceQueueFlush : Getter < boolean > = createJavaScriptFlagGetter ( 'animatedShouldDebounceQueueFlush' , false ) ;
80
81
82
+ /**
83
+ * Enables an experimental option to reuse the native ID for an animation.
84
+ */
85
+ export const animatedShouldUsePermanentAnimationId : Getter < boolean > = createJavaScriptFlagGetter ( 'animatedShouldUsePermanentAnimationId' , false ) ;
86
+
81
87
/**
82
88
* Enables an experimental mega-operation for Animated.js that replaces many calls to native with a single call into native, to reduce JSI/JNI traffic.
83
89
*/
You can’t perform that action at this time.
0 commit comments