react-native-reanimated 2.3.0-beta.3 → 2.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Common/cpp/NativeModules/NativeReanimatedModule.cpp +9 -0
- package/Common/cpp/NativeModules/NativeReanimatedModuleSpec.cpp +13 -0
- package/Common/cpp/Tools/FeaturesConfig.cpp +5 -0
- package/Common/cpp/Tools/RuntimeDecorator.cpp +38 -2
- package/Common/cpp/headers/NativeModules/NativeReanimatedModule.h +3 -0
- package/Common/cpp/headers/NativeModules/NativeReanimatedModuleSpec.h +5 -0
- package/Common/cpp/headers/Tools/FeaturesConfig.h +19 -0
- package/Common/cpp/headers/Tools/PlatformDepMethodsHolder.h +2 -0
- package/Common/cpp/headers/Tools/RuntimeDecorator.h +8 -7
- package/README.md +1 -1
- package/RNReanimated.podspec +20 -3
- package/android/build.gradle +31 -5
- package/android/expo/linking.gradle +46 -0
- package/android/expo/src/main/java/com/swmansion/reanimated/EXReanimatedAdapter.java +12 -0
- package/android/expo/src/main/java/expo/modules/adapters/reanimated/EXReanimatedPackage.java +26 -0
- package/android/react-native-reanimated-63-hermes.aar +0 -0
- package/android/react-native-reanimated-63-jsc.aar +0 -0
- package/android/react-native-reanimated-64-hermes.aar +0 -0
- package/android/react-native-reanimated-64-jsc.aar +0 -0
- package/android/react-native-reanimated-65-hermes.aar +0 -0
- package/android/react-native-reanimated-65-jsc.aar +0 -0
- package/android/react-native-reanimated-66-hermes.aar +0 -0
- package/android/react-native-reanimated-66-jsc.aar +0 -0
- package/android/react-native-reanimated-67-hermes.aar +0 -0
- package/android/react-native-reanimated-67-jsc.aar +0 -0
- package/expo-module.config.json +3 -0
- package/ios/LayoutReanimation/REAAnimationsManager.m +64 -19
- package/ios/LayoutReanimation/REAUIManager.mm +63 -18
- package/ios/Nodes/REAPropsNode.m +1 -1
- package/ios/REAEventDispatcher.m +1 -1
- package/ios/REAModule.h +0 -2
- package/ios/REAModule.m +0 -3
- package/ios/REANodesManager.m +1 -0
- package/ios/RNGestureHandlerStateManager.h +5 -0
- package/ios/native/NativeMethods.h +5 -0
- package/ios/native/NativeMethods.mm +8 -1
- package/ios/native/NativeProxy.h +1 -0
- package/ios/native/NativeProxy.mm +10 -2
- package/ios/native/REAInitializer.mm +7 -3
- package/lib/src/Animated.js +31 -0
- package/lib/{ConfigHelper.js → src/ConfigHelper.js} +0 -0
- package/lib/{ReanimatedEventEmitter.js → src/ReanimatedEventEmitter.js} +0 -0
- package/lib/{ReanimatedModule.js → src/ReanimatedModule.js} +0 -0
- package/lib/{ReanimatedModule.macos.js → src/ReanimatedModule.macos.js} +0 -0
- package/lib/{ReanimatedModule.native.js → src/ReanimatedModule.native.js} +0 -0
- package/lib/{ReanimatedModule.windows.js → src/ReanimatedModule.windows.js} +0 -0
- package/lib/{ReanimatedModuleCompat.js → src/ReanimatedModuleCompat.js} +0 -0
- package/lib/{__mocks__ → src/__mocks__}/ReanimatedEventEmitter.js +0 -0
- package/lib/{__mocks__ → src/__mocks__}/ReanimatedModule.native.js +0 -0
- package/lib/{createAnimatedComponent.js → src/createAnimatedComponent.js} +55 -37
- package/lib/src/index.js +31 -0
- package/lib/{reanimated1 → src/reanimated1}/Easing.js +0 -0
- package/lib/{reanimated1 → src/reanimated1}/SpringConfig.js +0 -0
- package/lib/{reanimated1 → src/reanimated1}/Transitioning.js +0 -0
- package/lib/{reanimated1 → src/reanimated1}/animations/Animation.js +0 -0
- package/lib/{reanimated1 → src/reanimated1}/animations/SpringUtils.js +0 -0
- package/lib/{reanimated1 → src/reanimated1}/animations/backwardCompatibleAnimWrapper.js +0 -0
- package/lib/{reanimated1 → src/reanimated1}/animations/decay.js +0 -0
- package/lib/{reanimated1 → src/reanimated1}/animations/spring.js +0 -0
- package/lib/{reanimated1 → src/reanimated1}/animations/timing.js +0 -0
- package/lib/{reanimated1 → src/reanimated1}/base.js +0 -0
- package/lib/{reanimated1 → src/reanimated1}/core/AnimatedAlways.js +0 -0
- package/lib/{reanimated1 → src/reanimated1}/core/AnimatedBezier.js +0 -0
- package/lib/{reanimated1 → src/reanimated1}/core/AnimatedBlock.js +0 -0
- package/lib/{reanimated1 → src/reanimated1}/core/AnimatedCall.js +0 -0
- package/lib/{reanimated1 → src/reanimated1}/core/AnimatedCallFunc.js +0 -0
- package/lib/{reanimated1 → src/reanimated1}/core/AnimatedClock.js +0 -0
- package/lib/{reanimated1 → src/reanimated1}/core/AnimatedClockTest.js +0 -0
- package/lib/{reanimated1 → src/reanimated1}/core/AnimatedCode.js +0 -0
- package/lib/{reanimated1 → src/reanimated1}/core/AnimatedConcat.js +0 -0
- package/lib/{reanimated1 → src/reanimated1}/core/AnimatedCond.js +0 -0
- package/lib/{reanimated1 → src/reanimated1}/core/AnimatedDebug.js +0 -0
- package/lib/{reanimated1 → src/reanimated1}/core/AnimatedEvent.js +0 -0
- package/lib/{reanimated1 → src/reanimated1}/core/AnimatedFunction.js +0 -0
- package/lib/{reanimated1 → src/reanimated1}/core/AnimatedNode.js +0 -0
- package/lib/{reanimated1 → src/reanimated1}/core/AnimatedOperator.js +0 -0
- package/lib/{reanimated1 → src/reanimated1}/core/AnimatedParam.js +0 -0
- package/lib/{reanimated1 → src/reanimated1}/core/AnimatedProps.js +0 -0
- package/lib/{reanimated1 → src/reanimated1}/core/AnimatedSet.js +0 -0
- package/lib/{reanimated1 → src/reanimated1}/core/AnimatedStartClock.js +0 -0
- package/lib/{reanimated1 → src/reanimated1}/core/AnimatedStopClock.js +0 -0
- package/lib/{reanimated1 → src/reanimated1}/core/AnimatedStyle.js +0 -0
- package/lib/{reanimated1 → src/reanimated1}/core/AnimatedTransform.js +0 -0
- package/lib/{reanimated1 → src/reanimated1}/core/AnimatedValue.js +0 -0
- package/lib/{reanimated1 → src/reanimated1}/core/Core.test.js +1 -1
- package/lib/{reanimated1 → src/reanimated1}/core/InternalAnimatedValue.js +0 -0
- package/lib/{reanimated1 → src/reanimated1}/core/__mocks__/AnimatedProps.js +0 -0
- package/lib/{reanimated1 → src/reanimated1}/core/createEventObjectProxyPolyfill.js +0 -0
- package/lib/{reanimated1 → src/reanimated1}/derived/__mocks__/evaluateOnce.js +0 -0
- package/lib/{reanimated1 → src/reanimated1}/derived/acc.js +0 -0
- package/lib/{reanimated1 → src/reanimated1}/derived/color.js +0 -0
- package/lib/{reanimated1 → src/reanimated1}/derived/diff.js +0 -0
- package/lib/{reanimated1 → src/reanimated1}/derived/diffClamp.js +0 -0
- package/lib/{reanimated1 → src/reanimated1}/derived/evaluateOnce.js +0 -0
- package/lib/{reanimated1 → src/reanimated1}/derived/index.js +0 -0
- package/lib/{reanimated1 → src/reanimated1}/derived/interpolate.js +0 -0
- package/lib/{reanimated1 → src/reanimated1}/derived/interpolateColors.js +0 -0
- package/lib/{reanimated1 → src/reanimated1}/derived/onChange.js +0 -0
- package/lib/{reanimated1 → src/reanimated1}/derived/useCode.js +0 -0
- package/lib/{reanimated1 → src/reanimated1}/index.js +0 -0
- package/lib/{reanimated1 → src/reanimated1}/operators.js +0 -0
- package/lib/{reanimated1 → src/reanimated1}/useValue.js +0 -0
- package/lib/{reanimated1 → src/reanimated1}/val.js +0 -0
- package/lib/{reanimated2 → src/reanimated2}/Bezier.js +0 -0
- package/lib/{reanimated2 → src/reanimated2}/Colors.js +0 -0
- package/lib/{reanimated2 → src/reanimated2}/Easing.js +0 -0
- package/lib/{reanimated2 → src/reanimated2}/NativeMethods.js +7 -0
- package/lib/{reanimated2 → src/reanimated2}/NativeReanimated/NativeReanimated.js +3 -0
- package/lib/{reanimated2 → src/reanimated2}/NativeReanimated/index.js +0 -0
- package/lib/{reanimated2 → src/reanimated2}/PlatformChecker.js +0 -0
- package/lib/{reanimated2 → src/reanimated2}/PropAdapters.js +0 -0
- package/lib/{reanimated2 → src/reanimated2}/UpdateProps.js +1 -1
- package/lib/{reanimated2 → src/reanimated2}/ViewDescriptorsSet.js +4 -2
- package/lib/{reanimated2 → src/reanimated2}/WorkletEventHandler.js +0 -0
- package/lib/{reanimated2 → src/reanimated2}/__mocks__/MutableValue.js +0 -0
- package/lib/{reanimated2 → src/reanimated2}/__mocks__/NativeReanimated.js +0 -0
- package/lib/{reanimated2 → src/reanimated2}/__mocks__/NativeReanimated.native.js +0 -0
- package/lib/{reanimated2 → src/reanimated2}/animation/commonTypes.js +0 -0
- package/lib/{reanimated2 → src/reanimated2}/animation/decay.js +0 -0
- package/lib/{reanimated2 → src/reanimated2}/animation/delay.js +0 -0
- package/lib/{reanimated2 → src/reanimated2}/animation/index.js +0 -0
- package/lib/{reanimated2 → src/reanimated2}/animation/repeat.js +0 -0
- package/lib/{reanimated2 → src/reanimated2}/animation/sequence.js +0 -0
- package/lib/{reanimated2 → src/reanimated2}/animation/spring.js +0 -0
- package/lib/{reanimated2 → src/reanimated2}/animation/styleAnimation.js +5 -0
- package/lib/{reanimated2 → src/reanimated2}/animation/timing.js +0 -0
- package/lib/{reanimated2 → src/reanimated2}/animation/util.js +0 -0
- package/lib/{reanimated2 → src/reanimated2}/commonTypes.js +0 -0
- package/lib/src/reanimated2/component/FlatList.js +30 -0
- package/lib/src/reanimated2/component/WrappedComponents.js +9 -0
- package/lib/src/reanimated2/component/index.js +4 -0
- package/lib/{reanimated2 → src/reanimated2}/core.js +27 -3
- package/lib/{reanimated2 → src/reanimated2}/globals.d.ts +5 -0
- package/lib/{reanimated2 → src/reanimated2}/hook/Hooks.js +0 -0
- package/lib/{reanimated2 → src/reanimated2}/hook/commonTypes.js +0 -0
- package/lib/{reanimated2 → src/reanimated2}/hook/index.js +0 -0
- package/lib/{reanimated2 → src/reanimated2}/hook/useAnimatedGestureHandler.js +0 -0
- package/lib/{reanimated2 → src/reanimated2}/hook/useAnimatedReaction.js +0 -0
- package/lib/{reanimated2 → src/reanimated2}/hook/useAnimatedRef.js +0 -0
- package/lib/{reanimated2 → src/reanimated2}/hook/useAnimatedScrollHandler.js +0 -0
- package/lib/{reanimated2 → src/reanimated2}/hook/useAnimatedStyle.js +0 -0
- package/lib/{reanimated2 → src/reanimated2}/hook/useDerivedValue.js +0 -0
- package/lib/{reanimated2 → src/reanimated2}/hook/useSharedValue.js +0 -0
- package/lib/{reanimated2 → src/reanimated2}/hook/utils.js +0 -0
- package/lib/{reanimated2 → src/reanimated2}/index.js +0 -0
- package/lib/{reanimated2 → src/reanimated2}/interpolation.js +0 -0
- package/lib/{reanimated2 → src/reanimated2}/jestUtils.js +0 -0
- package/lib/{reanimated2 → src/reanimated2}/js-reanimated/JSReanimated.js +3 -0
- package/lib/{reanimated2 → src/reanimated2}/js-reanimated/Mapper.js +4 -1
- package/lib/{reanimated2 → src/reanimated2}/js-reanimated/MapperRegistry.js +0 -0
- package/lib/{reanimated2 → src/reanimated2}/js-reanimated/MutableValue.js +0 -0
- package/lib/{reanimated2 → src/reanimated2}/js-reanimated/index.js +3 -0
- package/lib/{reanimated2 → src/reanimated2}/layoutReanimation/LayoutAnimationRepository.js +14 -5
- package/lib/{reanimated2 → src/reanimated2}/layoutReanimation/animationBuilder/BaseAnimationBuilder.js +0 -0
- package/lib/{reanimated2 → src/reanimated2}/layoutReanimation/animationBuilder/ComplexAnimationBuilder.js +0 -0
- package/lib/{reanimated2 → src/reanimated2}/layoutReanimation/animationBuilder/Keyframe.js +0 -0
- package/lib/{reanimated2 → src/reanimated2}/layoutReanimation/animationBuilder/commonTypes.js +0 -0
- package/lib/{reanimated2 → src/reanimated2}/layoutReanimation/animationBuilder/index.js +0 -0
- package/lib/{reanimated2 → src/reanimated2}/layoutReanimation/defaultAnimations/Bounce.js +0 -0
- package/lib/src/reanimated2/layoutReanimation/defaultAnimations/Default.js +36 -0
- package/lib/{reanimated2 → src/reanimated2}/layoutReanimation/defaultAnimations/Fade.js +0 -0
- package/lib/{reanimated2 → src/reanimated2}/layoutReanimation/defaultAnimations/Flip.js +8 -8
- package/lib/{reanimated2 → src/reanimated2}/layoutReanimation/defaultAnimations/Lightspeed.js +0 -0
- package/lib/{reanimated2 → src/reanimated2}/layoutReanimation/defaultAnimations/Pinwheel.js +0 -0
- package/lib/{reanimated2 → src/reanimated2}/layoutReanimation/defaultAnimations/Roll.js +0 -0
- package/lib/{reanimated2 → src/reanimated2}/layoutReanimation/defaultAnimations/Rotate.js +16 -16
- package/lib/{reanimated2 → src/reanimated2}/layoutReanimation/defaultAnimations/Slide.js +16 -16
- package/lib/{reanimated2 → src/reanimated2}/layoutReanimation/defaultAnimations/Stretch.js +0 -0
- package/lib/{reanimated2 → src/reanimated2}/layoutReanimation/defaultAnimations/Zoom.js +4 -4
- package/lib/{reanimated2 → src/reanimated2}/layoutReanimation/defaultAnimations/index.js +0 -0
- package/lib/{reanimated2 → src/reanimated2}/layoutReanimation/defaultTransitions/CurvedTransition.js +20 -8
- package/lib/{reanimated2 → src/reanimated2}/layoutReanimation/defaultTransitions/EntryExitTransition.js +3 -3
- package/lib/{reanimated2 → src/reanimated2}/layoutReanimation/defaultTransitions/FadingTransition.js +8 -8
- package/lib/{reanimated2 → src/reanimated2}/layoutReanimation/defaultTransitions/JumpingTransition.js +10 -10
- package/lib/{reanimated2 → src/reanimated2}/layoutReanimation/defaultTransitions/LinearTransition.js +8 -8
- package/lib/{reanimated2 → src/reanimated2}/layoutReanimation/defaultTransitions/SequencedTransition.js +8 -8
- package/lib/{reanimated2 → src/reanimated2}/layoutReanimation/defaultTransitions/index.js +0 -0
- package/lib/{reanimated2 → src/reanimated2}/layoutReanimation/index.js +0 -0
- package/lib/{reanimated2 → src/reanimated2}/mock.js +0 -0
- package/lib/{reanimated2 → src/reanimated2}/platform-specific/RNRenderer.js +0 -0
- package/lib/{reanimated2 → src/reanimated2}/platform-specific/RNRenderer.web.js +0 -0
- package/lib/{reanimated2 → src/reanimated2}/utils.js +0 -0
- package/lib/{setAndForwardRef.js → src/setAndForwardRef.js} +0 -0
- package/mock.js +1 -1
- package/package.json +4 -3
- package/plugin.js +10 -3
- package/react-native-reanimated.d.ts +40 -23
- package/src/Animated.js +11 -5
- package/src/createAnimatedComponent.tsx +86 -43
- package/src/reanimated1/core/Core.test.js +1 -1
- package/src/reanimated2/NativeMethods.ts +13 -1
- package/src/reanimated2/NativeReanimated/NativeReanimated.ts +4 -0
- package/src/reanimated2/UpdateProps.ts +1 -1
- package/src/reanimated2/ViewDescriptorsSet.ts +6 -2
- package/src/reanimated2/animation/styleAnimation.ts +9 -0
- package/src/reanimated2/component/FlatList.tsx +44 -0
- package/src/reanimated2/component/WrappedComponents.ts +11 -0
- package/src/reanimated2/component/index.ts +9 -0
- package/src/reanimated2/core.ts +38 -3
- package/src/reanimated2/globals.d.ts +5 -0
- package/src/reanimated2/js-reanimated/JSReanimated.ts +6 -0
- package/src/reanimated2/js-reanimated/Mapper.ts +3 -1
- package/src/reanimated2/js-reanimated/index.ts +5 -0
- package/src/reanimated2/layoutReanimation/LayoutAnimationRepository.ts +18 -5
- package/src/reanimated2/layoutReanimation/animationBuilder/commonTypes.ts +39 -20
- package/src/reanimated2/layoutReanimation/animationBuilder/index.ts +5 -1
- package/src/reanimated2/layoutReanimation/defaultAnimations/Default.ts +21 -15
- package/src/reanimated2/layoutReanimation/defaultAnimations/Flip.ts +29 -24
- package/src/reanimated2/layoutReanimation/defaultAnimations/Rotate.ts +61 -34
- package/src/reanimated2/layoutReanimation/defaultAnimations/Slide.ts +49 -34
- package/src/reanimated2/layoutReanimation/defaultAnimations/Zoom.ts +17 -12
- package/src/reanimated2/layoutReanimation/defaultTransitions/CurvedTransition.ts +20 -8
- package/src/reanimated2/layoutReanimation/defaultTransitions/EntryExitTransition.ts +9 -9
- package/src/reanimated2/layoutReanimation/defaultTransitions/FadingTransition.ts +8 -8
- package/src/reanimated2/layoutReanimation/defaultTransitions/JumpingTransition.ts +20 -14
- package/src/reanimated2/layoutReanimation/defaultTransitions/LinearTransition.ts +14 -8
- package/src/reanimated2/layoutReanimation/defaultTransitions/SequencedTransition.ts +24 -12
- package/lib/Animated.js +0 -25
- package/lib/index.js +0 -25
- package/lib/reanimated2/layoutReanimation/defaultAnimations/Default.js +0 -36
|
@@ -17,18 +17,26 @@ import './reanimated2/layoutReanimation/LayoutAnimationRepository';
|
|
|
17
17
|
import invariant from 'invariant';
|
|
18
18
|
import { adaptViewConfig } from './ConfigHelper';
|
|
19
19
|
import { RNRenderer } from './reanimated2/platform-specific/RNRenderer';
|
|
20
|
-
import {
|
|
20
|
+
import {
|
|
21
|
+
makeMutable,
|
|
22
|
+
runOnUI,
|
|
23
|
+
enableLayoutAnimations,
|
|
24
|
+
} from './reanimated2/core';
|
|
21
25
|
import {
|
|
22
26
|
DefaultEntering,
|
|
23
27
|
DefaultExiting,
|
|
24
28
|
DefaultLayout,
|
|
25
29
|
} from './reanimated2/layoutReanimation/defaultAnimations/Default';
|
|
26
|
-
import {
|
|
30
|
+
import {
|
|
31
|
+
isJest,
|
|
32
|
+
isChromeDebugger,
|
|
33
|
+
shouldBeUseWeb,
|
|
34
|
+
} from './reanimated2/PlatformChecker';
|
|
27
35
|
import { initialUpdaterRun } from './reanimated2/animation';
|
|
28
36
|
import {
|
|
29
37
|
BaseAnimationBuilder,
|
|
30
38
|
EntryExitAnimationFunction,
|
|
31
|
-
|
|
39
|
+
ILayoutAnimationBuilder,
|
|
32
40
|
} from './reanimated2/layoutReanimation';
|
|
33
41
|
import { SharedValue, StyleProps } from './reanimated2/commonTypes';
|
|
34
42
|
import {
|
|
@@ -88,6 +96,21 @@ function flattenArray<T>(array: NestedArray<T>): T[] {
|
|
|
88
96
|
return resultArr;
|
|
89
97
|
}
|
|
90
98
|
|
|
99
|
+
function onlyAnimatedStyles(styles: StyleProps[]) {
|
|
100
|
+
return styles.filter((style) => style?.viewDescriptors);
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
function isSameAnimatedStyle(
|
|
104
|
+
style1?: StyleProps,
|
|
105
|
+
style2?: StyleProps
|
|
106
|
+
): boolean {
|
|
107
|
+
// We cannot use equality check to compare useAnimatedStyle outputs directly.
|
|
108
|
+
// Instead, we can compare its viewsRefs.
|
|
109
|
+
return style1?.viewsRef === style2?.viewsRef;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
const isSameAnimatedProps = isSameAnimatedStyle;
|
|
113
|
+
|
|
91
114
|
const has = <K extends string>(
|
|
92
115
|
key: K,
|
|
93
116
|
x: unknown
|
|
@@ -115,7 +138,7 @@ export type AnimatedComponentProps<P extends Record<string, unknown>> = P & {
|
|
|
115
138
|
animatedStyle?: StyleProps;
|
|
116
139
|
layout?:
|
|
117
140
|
| BaseAnimationBuilder
|
|
118
|
-
|
|
|
141
|
+
| ILayoutAnimationBuilder
|
|
119
142
|
| typeof BaseAnimationBuilder;
|
|
120
143
|
entering?:
|
|
121
144
|
| BaseAnimationBuilder
|
|
@@ -167,6 +190,7 @@ export default function createAnimatedComponent(
|
|
|
167
190
|
> {
|
|
168
191
|
_invokeAnimatedPropsCallbackOnMount = false;
|
|
169
192
|
_styles: StyleProps[] | null = null;
|
|
193
|
+
_animatedProps?: Partial<AnimatedComponentProps<AnimatedProps>>;
|
|
170
194
|
_viewTag = -1;
|
|
171
195
|
_isFirstRender = true;
|
|
172
196
|
animatedStyle: { value: StyleProps } = { value: {} };
|
|
@@ -255,9 +279,7 @@ export default function createAnimatedComponent(
|
|
|
255
279
|
}
|
|
256
280
|
} else if (this._viewTag !== -1 && this._styles !== null) {
|
|
257
281
|
for (const style of this._styles) {
|
|
258
|
-
|
|
259
|
-
style.viewDescriptors.remove(this._viewTag);
|
|
260
|
-
}
|
|
282
|
+
style.viewDescriptors.remove(this._viewTag);
|
|
261
283
|
}
|
|
262
284
|
if (this.props.animatedProps?.viewDescriptors) {
|
|
263
285
|
this.props.animatedProps.viewDescriptors.remove(this._viewTag);
|
|
@@ -387,8 +409,15 @@ export default function createAnimatedComponent(
|
|
|
387
409
|
}
|
|
388
410
|
|
|
389
411
|
_attachAnimatedStyles() {
|
|
390
|
-
const styles =
|
|
412
|
+
const styles = this.props.style
|
|
413
|
+
? onlyAnimatedStyles(flattenArray<StyleProps>(this.props.style))
|
|
414
|
+
: [];
|
|
415
|
+
const prevStyles = this._styles;
|
|
391
416
|
this._styles = styles;
|
|
417
|
+
|
|
418
|
+
const prevAnimatedProps = this._animatedProps;
|
|
419
|
+
this._animatedProps = this.props.animatedProps;
|
|
420
|
+
|
|
392
421
|
let viewTag: number | null;
|
|
393
422
|
let viewName: string | null;
|
|
394
423
|
if (Platform.OS === 'web') {
|
|
@@ -410,34 +439,60 @@ export default function createAnimatedComponent(
|
|
|
410
439
|
*/
|
|
411
440
|
viewName = hostInstance?.viewConfig?.uiViewClassName;
|
|
412
441
|
// update UI props whitelist for this view
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
hostInstance.viewConfig
|
|
417
|
-
) {
|
|
442
|
+
const hasReanimated2Props =
|
|
443
|
+
this.props.animatedProps?.viewDescriptors || styles.length;
|
|
444
|
+
if (hasReanimated2Props && hostInstance?.viewConfig) {
|
|
418
445
|
adaptViewConfig(hostInstance.viewConfig);
|
|
419
446
|
}
|
|
420
447
|
}
|
|
421
448
|
this._viewTag = viewTag as number;
|
|
422
449
|
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
450
|
+
// remove old styles
|
|
451
|
+
if (prevStyles) {
|
|
452
|
+
// in most of the cases, views have only a single animated style and it remains unchanged
|
|
453
|
+
const hasOneSameStyle =
|
|
454
|
+
styles.length === 1 &&
|
|
455
|
+
prevStyles.length === 1 &&
|
|
456
|
+
isSameAnimatedStyle(styles[0], prevStyles[0]);
|
|
457
|
+
|
|
458
|
+
if (!hasOneSameStyle) {
|
|
459
|
+
// otherwise, remove each style that is not present in new styles
|
|
460
|
+
for (const prevStyle of prevStyles) {
|
|
461
|
+
const isPresent = styles.some((style) =>
|
|
462
|
+
isSameAnimatedStyle(style, prevStyle)
|
|
463
|
+
);
|
|
464
|
+
if (!isPresent) {
|
|
465
|
+
prevStyle.viewDescriptors.remove(viewTag);
|
|
466
|
+
}
|
|
438
467
|
}
|
|
439
468
|
}
|
|
469
|
+
}
|
|
470
|
+
|
|
471
|
+
styles.forEach((style) => {
|
|
472
|
+
style.viewDescriptors.add({ tag: viewTag, name: viewName });
|
|
473
|
+
if (isJest()) {
|
|
474
|
+
/**
|
|
475
|
+
* We need to connect Jest's TestObject instance whose contains just props object
|
|
476
|
+
* with the updateProps() function where we update the properties of the component.
|
|
477
|
+
* We can't update props object directly because TestObject contains a copy of props - look at render function:
|
|
478
|
+
* const props = this._filterNonAnimatedProps(this.props);
|
|
479
|
+
*/
|
|
480
|
+
this.animatedStyle.value = {
|
|
481
|
+
...this.animatedStyle.value,
|
|
482
|
+
...style.initial.value,
|
|
483
|
+
};
|
|
484
|
+
style.animatedStyle.current = this.animatedStyle;
|
|
485
|
+
}
|
|
440
486
|
});
|
|
487
|
+
|
|
488
|
+
// detach old animatedProps
|
|
489
|
+
if (
|
|
490
|
+
prevAnimatedProps &&
|
|
491
|
+
!isSameAnimatedProps(prevAnimatedProps, this.props.animatedProps)
|
|
492
|
+
) {
|
|
493
|
+
prevAnimatedProps.viewDescriptors!.remove(viewTag as number);
|
|
494
|
+
}
|
|
495
|
+
|
|
441
496
|
// attach animatedProps property
|
|
442
497
|
if (this.props.animatedProps?.viewDescriptors) {
|
|
443
498
|
this.props.animatedProps.viewDescriptors.add({
|
|
@@ -449,21 +504,6 @@ export default function createAnimatedComponent(
|
|
|
449
504
|
}
|
|
450
505
|
}
|
|
451
506
|
|
|
452
|
-
_hasReanimated2Props(flattenStyles: StyleProps[]) {
|
|
453
|
-
if (this.props.animatedProps?.viewDescriptors) {
|
|
454
|
-
return true;
|
|
455
|
-
}
|
|
456
|
-
if (this.props.style) {
|
|
457
|
-
for (const style of flattenStyles) {
|
|
458
|
-
// eslint-disable-next-line no-prototype-builtins
|
|
459
|
-
if (style?.hasOwnProperty('viewDescriptors')) {
|
|
460
|
-
return true;
|
|
461
|
-
}
|
|
462
|
-
}
|
|
463
|
-
}
|
|
464
|
-
return false;
|
|
465
|
-
}
|
|
466
|
-
|
|
467
507
|
_detachPropUpdater() {
|
|
468
508
|
const viewTag = findNodeHandle(this);
|
|
469
509
|
NODE_MAPPING.delete(viewTag);
|
|
@@ -496,6 +536,9 @@ export default function createAnimatedComponent(
|
|
|
496
536
|
(this.props.layout || this.props.entering || this.props.exiting) &&
|
|
497
537
|
tag != null
|
|
498
538
|
) {
|
|
539
|
+
if (!shouldBeUseWeb()) {
|
|
540
|
+
enableLayoutAnimations(true, false);
|
|
541
|
+
}
|
|
499
542
|
let layout = this.props.layout ? this.props.layout : DefaultLayout;
|
|
500
543
|
let entering = this.props.entering
|
|
501
544
|
? this.props.entering
|
|
@@ -5,7 +5,7 @@ import renderer from 'react-test-renderer';
|
|
|
5
5
|
|
|
6
6
|
jest.mock('../../ReanimatedEventEmitter');
|
|
7
7
|
jest.mock('../../ReanimatedModule');
|
|
8
|
-
jest.mock('../../reanimated2/NativeReanimated');
|
|
8
|
+
jest.mock('../../reanimated2/NativeReanimated/NativeReanimated');
|
|
9
9
|
|
|
10
10
|
describe('Core Animated components', () => {
|
|
11
11
|
xit('fails if something other then a node or function that returns a node is passed to Animated.Code exec prop', () => {
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
/* global _WORKLET _measure _scrollTo */
|
|
1
|
+
/* global _WORKLET _measure _scrollTo _setGestureState */
|
|
2
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
3
|
+
// @ts-nocheck
|
|
2
4
|
import { Component } from 'react';
|
|
3
5
|
import { findNodeHandle } from 'react-native';
|
|
4
6
|
import { RefObjectFunction } from './hook/useAnimatedRef';
|
|
@@ -47,3 +49,13 @@ export function scrollTo(
|
|
|
47
49
|
const viewTag = animatedRef();
|
|
48
50
|
_scrollTo(viewTag, x, y, animated);
|
|
49
51
|
}
|
|
52
|
+
|
|
53
|
+
export function setGestureState(handlerTag: number, newState: number): void {
|
|
54
|
+
'worklet';
|
|
55
|
+
if (!_WORKLET && !isChromeDebugger()) {
|
|
56
|
+
console.warn(
|
|
57
|
+
'[Reanimated] You can not use setGestureState in non-worklet function.'
|
|
58
|
+
);
|
|
59
|
+
}
|
|
60
|
+
_setGestureState(handlerTag, newState);
|
|
61
|
+
}
|
|
@@ -26,7 +26,7 @@ export const colorProps = [
|
|
|
26
26
|
'overlayColor',
|
|
27
27
|
];
|
|
28
28
|
|
|
29
|
-
const ColorProperties = !isConfigured() ? [] : makeShareable(colorProps);
|
|
29
|
+
export const ColorProperties = !isConfigured() ? [] : makeShareable(colorProps);
|
|
30
30
|
|
|
31
31
|
let updatePropsByPlatform;
|
|
32
32
|
if (shouldBeUseWeb()) {
|
|
@@ -2,6 +2,7 @@ import { useRef } from 'react';
|
|
|
2
2
|
import { makeMutable } from './core';
|
|
3
3
|
import { SharedValue } from './commonTypes';
|
|
4
4
|
import { Descriptor } from './hook/commonTypes';
|
|
5
|
+
import { Platform } from 'react-native';
|
|
5
6
|
|
|
6
7
|
export interface ViewRefSet<T> {
|
|
7
8
|
items: Set<T>;
|
|
@@ -23,6 +24,9 @@ export interface ViewDescriptorsSet {
|
|
|
23
24
|
) => void;
|
|
24
25
|
}
|
|
25
26
|
|
|
27
|
+
const scheduleUpdates =
|
|
28
|
+
Platform.OS === 'web' ? requestAnimationFrame : setImmediate;
|
|
29
|
+
|
|
26
30
|
export function makeViewDescriptorsSet(): ViewDescriptorsSet {
|
|
27
31
|
const ref = useRef<ViewDescriptorsSet | null>(null);
|
|
28
32
|
if (ref.current === null) {
|
|
@@ -44,7 +48,7 @@ export function makeViewDescriptorsSet(): ViewDescriptorsSet {
|
|
|
44
48
|
if (!data.waitForInsertSync) {
|
|
45
49
|
data.waitForInsertSync = true;
|
|
46
50
|
|
|
47
|
-
|
|
51
|
+
scheduleUpdates(() => {
|
|
48
52
|
data.sharableViewDescriptors.value = data.items;
|
|
49
53
|
data.waitForInsertSync = false;
|
|
50
54
|
});
|
|
@@ -57,7 +61,7 @@ export function makeViewDescriptorsSet(): ViewDescriptorsSet {
|
|
|
57
61
|
if (!data.waitForRemoveSync) {
|
|
58
62
|
data.waitForRemoveSync = true;
|
|
59
63
|
|
|
60
|
-
|
|
64
|
+
scheduleUpdates(() => {
|
|
61
65
|
const items = [];
|
|
62
66
|
for (const item of data.items) {
|
|
63
67
|
if (data.batchToRemove.has(item.tag)) {
|
|
@@ -14,6 +14,8 @@ import {
|
|
|
14
14
|
StyleProps,
|
|
15
15
|
} from '../commonTypes';
|
|
16
16
|
import { withTiming } from './timing';
|
|
17
|
+
import { ColorProperties } from '../UpdateProps';
|
|
18
|
+
import { processColor } from '../Colors';
|
|
17
19
|
|
|
18
20
|
export interface StyleLayoutAnimation extends HigherOrderAnimation {
|
|
19
21
|
current: StyleProps;
|
|
@@ -134,6 +136,13 @@ export function withStyleAnimation(
|
|
|
134
136
|
} else {
|
|
135
137
|
stillGoing = true;
|
|
136
138
|
}
|
|
139
|
+
|
|
140
|
+
if (ColorProperties.includes(currentEntry.path[0] as string)) {
|
|
141
|
+
currentStyleAnimation.current = processColor(
|
|
142
|
+
currentStyleAnimation.current
|
|
143
|
+
) as number;
|
|
144
|
+
}
|
|
145
|
+
|
|
137
146
|
setPath(
|
|
138
147
|
animation.current,
|
|
139
148
|
currentEntry.path,
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { FlatList, FlatListProps, LayoutChangeEvent } from 'react-native';
|
|
3
|
+
import WrappedComponents from './WrappedComponents';
|
|
4
|
+
import createAnimatedComponent from '../../createAnimatedComponent';
|
|
5
|
+
import { ILayoutAnimationBuilder } from '../layoutReanimation/animationBuilder/commonTypes';
|
|
6
|
+
|
|
7
|
+
const AnimatedFlatList = createAnimatedComponent(FlatList as any) as any;
|
|
8
|
+
|
|
9
|
+
const createCellRenderer = (itemLayoutAnimation?: ILayoutAnimationBuilder) => {
|
|
10
|
+
const cellRenderer: React.FC<{
|
|
11
|
+
onLayout: (event: LayoutChangeEvent) => void;
|
|
12
|
+
}> = (props) => {
|
|
13
|
+
return (
|
|
14
|
+
<WrappedComponents.View
|
|
15
|
+
layout={itemLayoutAnimation}
|
|
16
|
+
onLayout={props.onLayout}>
|
|
17
|
+
{props.children}
|
|
18
|
+
</WrappedComponents.View>
|
|
19
|
+
);
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
return cellRenderer;
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
interface ReanimatedFlatlistProps<ItemT> extends FlatListProps<ItemT> {
|
|
26
|
+
itemLayoutAnimation?: ILayoutAnimationBuilder;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
type ReanimatedFlatListFC<T = any> = React.FC<ReanimatedFlatlistProps<T>>;
|
|
30
|
+
|
|
31
|
+
const ReanimatedFlatlist: ReanimatedFlatListFC = ({
|
|
32
|
+
itemLayoutAnimation,
|
|
33
|
+
...restProps
|
|
34
|
+
}) => {
|
|
35
|
+
const cellRenderer = React.useMemo(
|
|
36
|
+
() => createCellRenderer(itemLayoutAnimation),
|
|
37
|
+
[]
|
|
38
|
+
);
|
|
39
|
+
return (
|
|
40
|
+
<AnimatedFlatList {...restProps} CellRendererComponent={cellRenderer} />
|
|
41
|
+
);
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
export default ReanimatedFlatlist;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Image, ScrollView, Text, View } from 'react-native';
|
|
2
|
+
import createAnimatedComponent from '../../createAnimatedComponent';
|
|
3
|
+
|
|
4
|
+
const WrappedComponents = {
|
|
5
|
+
View: createAnimatedComponent(View),
|
|
6
|
+
Text: createAnimatedComponent(Text as any),
|
|
7
|
+
Image: createAnimatedComponent(Image as any),
|
|
8
|
+
ScrollView: createAnimatedComponent(ScrollView),
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
export default WrappedComponents;
|
package/src/reanimated2/core.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/* global _WORKLET _getCurrentTime _frameTimestamp _eventTimestamp, _setGlobalConsole */
|
|
2
2
|
import NativeReanimatedModule from './NativeReanimated';
|
|
3
3
|
import { Platform } from 'react-native';
|
|
4
|
-
import { nativeShouldBeMock, shouldBeUseWeb } from './PlatformChecker';
|
|
4
|
+
import { nativeShouldBeMock, shouldBeUseWeb, isWeb } from './PlatformChecker';
|
|
5
5
|
import {
|
|
6
6
|
BasicWorkletFunction,
|
|
7
7
|
WorkletFunction,
|
|
@@ -371,8 +371,8 @@ if (!NativeReanimatedModule.useOnlyV1) {
|
|
|
371
371
|
: (workletValueSetterJS as <T>(value: T) => void)
|
|
372
372
|
);
|
|
373
373
|
|
|
374
|
-
|
|
375
|
-
|
|
374
|
+
if (!isWeb() && isConfigured()) {
|
|
375
|
+
const capturableConsole = console;
|
|
376
376
|
runOnUI(() => {
|
|
377
377
|
'worklet';
|
|
378
378
|
const console = {
|
|
@@ -383,5 +383,40 @@ if (!NativeReanimatedModule.useOnlyV1) {
|
|
|
383
383
|
info: runOnJS(capturableConsole.info),
|
|
384
384
|
};
|
|
385
385
|
_setGlobalConsole(console);
|
|
386
|
+
if (global.performance == null) {
|
|
387
|
+
global.performance = {
|
|
388
|
+
now: global._chronoNow,
|
|
389
|
+
};
|
|
390
|
+
}
|
|
386
391
|
})();
|
|
392
|
+
}
|
|
393
|
+
}
|
|
394
|
+
|
|
395
|
+
type FeaturesConfig = {
|
|
396
|
+
enableLayoutAnimations: boolean;
|
|
397
|
+
setByUser: boolean;
|
|
398
|
+
};
|
|
399
|
+
|
|
400
|
+
let featuresConfig: FeaturesConfig = {
|
|
401
|
+
enableLayoutAnimations: false,
|
|
402
|
+
setByUser: false,
|
|
403
|
+
};
|
|
404
|
+
|
|
405
|
+
export function enableLayoutAnimations(
|
|
406
|
+
flag: boolean,
|
|
407
|
+
isCallByUser = true
|
|
408
|
+
): void {
|
|
409
|
+
if (isCallByUser) {
|
|
410
|
+
featuresConfig = {
|
|
411
|
+
enableLayoutAnimations: flag,
|
|
412
|
+
setByUser: true,
|
|
413
|
+
};
|
|
414
|
+
NativeReanimatedModule.enableLayoutAnimations(flag);
|
|
415
|
+
} else if (
|
|
416
|
+
!featuresConfig.setByUser &&
|
|
417
|
+
featuresConfig.enableLayoutAnimations !== flag
|
|
418
|
+
) {
|
|
419
|
+
featuresConfig.enableLayoutAnimations = flag;
|
|
420
|
+
NativeReanimatedModule.enableLayoutAnimations(flag);
|
|
421
|
+
}
|
|
387
422
|
}
|
|
@@ -13,6 +13,7 @@ declare global {
|
|
|
13
13
|
tag: number,
|
|
14
14
|
flag: { value: boolean; _value: boolean }
|
|
15
15
|
) => void;
|
|
16
|
+
const _setGestureState: (handlerTag: number, newState: number) => void;
|
|
16
17
|
const _updateProps: (
|
|
17
18
|
tag: number,
|
|
18
19
|
name: string,
|
|
@@ -25,16 +26,20 @@ declare global {
|
|
|
25
26
|
y: number,
|
|
26
27
|
animated: boolean
|
|
27
28
|
) => void;
|
|
29
|
+
const _chronoNow: () => number;
|
|
28
30
|
namespace NodeJS {
|
|
29
31
|
interface Global {
|
|
30
32
|
__reanimatedWorkletInit: (worklet: WorkletFunction) => void;
|
|
31
33
|
_setGlobalConsole: (console?: ReanimatedConsole) => void;
|
|
32
34
|
_log: (s: string) => void;
|
|
35
|
+
_setGestureState: () => void;
|
|
33
36
|
_WORKLET: boolean;
|
|
34
37
|
__reanimatedModuleProxy: NativeReanimated;
|
|
35
38
|
_frameTimestamp: number | null;
|
|
36
39
|
_measure: () => MeasuredDimensions;
|
|
37
40
|
_scrollTo: () => void;
|
|
41
|
+
_chronoNow: () => number;
|
|
42
|
+
performance: { now: () => number };
|
|
38
43
|
LayoutAnimationRepository: {
|
|
39
44
|
configs: Record<string, unknown>;
|
|
40
45
|
registerConfig(tag: number, config: Record<string, unknown>): void;
|
|
@@ -98,4 +98,10 @@ export default class JSReanimated extends NativeReanimated {
|
|
|
98
98
|
unregisterEventHandler(_: string): void {
|
|
99
99
|
// noop
|
|
100
100
|
}
|
|
101
|
+
|
|
102
|
+
enableLayoutAnimations() {
|
|
103
|
+
console.warn(
|
|
104
|
+
'[Reanimated] enableLayoutAnimations is not available for WEB yet'
|
|
105
|
+
);
|
|
106
|
+
}
|
|
101
107
|
}
|
|
@@ -43,7 +43,9 @@ export default class Mapper<T> {
|
|
|
43
43
|
const res: MutableValue<T>[] = [];
|
|
44
44
|
|
|
45
45
|
function extractMutables(value: NestedObjectValues<MutableValue<T>>) {
|
|
46
|
-
if (value
|
|
46
|
+
if (value == null) {
|
|
47
|
+
// return;
|
|
48
|
+
} else if (value instanceof MutableValue) {
|
|
47
49
|
res.push(value);
|
|
48
50
|
} else if (Array.isArray(value)) {
|
|
49
51
|
value.forEach((v) => extractMutables(v));
|
|
@@ -36,6 +36,11 @@ if (shouldBeUseWeb()) {
|
|
|
36
36
|
"[Reanimated] You can't use 'scrollTo' method with Chrome Debugger or with web version"
|
|
37
37
|
);
|
|
38
38
|
};
|
|
39
|
+
global._setGestureState = () => {
|
|
40
|
+
console.warn(
|
|
41
|
+
"[Reanimated] You can't use 'setGestureState' method with Chrome Debugger or with web version"
|
|
42
|
+
);
|
|
43
|
+
};
|
|
39
44
|
}
|
|
40
45
|
|
|
41
46
|
export const _updatePropsJS = (
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
/* global _stopObservingProgress, _startObservingProgress */
|
|
2
2
|
import { runOnUI } from '../core';
|
|
3
3
|
import { withStyleAnimation } from '../animation/styleAnimation';
|
|
4
|
+
import { ColorProperties } from '../UpdateProps';
|
|
5
|
+
import { processColor } from '../Colors';
|
|
4
6
|
|
|
5
7
|
runOnUI(() => {
|
|
6
8
|
'worklet';
|
|
@@ -36,13 +38,22 @@ runOnUI(() => {
|
|
|
36
38
|
for (const key in layoutAnimation) {
|
|
37
39
|
currentAnimation[key] = layoutAnimation[key];
|
|
38
40
|
}
|
|
39
|
-
enteringAnimationForTag[tag] = null;
|
|
40
41
|
}
|
|
41
42
|
|
|
42
43
|
const sv: { value: boolean; _value: boolean } = configs[tag].sv;
|
|
43
44
|
_stopObservingProgress(tag, false);
|
|
44
45
|
_startObservingProgress(tag, sv);
|
|
45
|
-
|
|
46
|
+
|
|
47
|
+
const backupColor: Record<string, string> = {};
|
|
48
|
+
for (const key in style.initialValues) {
|
|
49
|
+
if (ColorProperties.includes(key)) {
|
|
50
|
+
const value = style.initialValues[key];
|
|
51
|
+
backupColor[key] = value;
|
|
52
|
+
style.initialValues[key] = processColor(value);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
sv.value = Object.assign({}, sv._value, style.initialValues);
|
|
46
57
|
_stopObservingProgress(tag, false);
|
|
47
58
|
const animation = withStyleAnimation(currentAnimation);
|
|
48
59
|
|
|
@@ -51,10 +62,12 @@ runOnUI(() => {
|
|
|
51
62
|
_stopObservingProgress(tag, finished);
|
|
52
63
|
}
|
|
53
64
|
style.callback && style.callback(finished);
|
|
54
|
-
if (type === 'entering') {
|
|
55
|
-
enteringAnimationForTag[tag] = null;
|
|
56
|
-
}
|
|
57
65
|
};
|
|
66
|
+
|
|
67
|
+
if (backupColor) {
|
|
68
|
+
configs[tag].sv._value = { ...configs[tag].sv.value, ...backupColor };
|
|
69
|
+
}
|
|
70
|
+
|
|
58
71
|
configs[tag].sv.value = animation;
|
|
59
72
|
_startObservingProgress(tag, sv);
|
|
60
73
|
},
|
|
@@ -14,32 +14,43 @@ export type LayoutAnimation = {
|
|
|
14
14
|
|
|
15
15
|
export type AnimationFunction = (a?: any, b?: any, c?: any) => any; // this is just a temporary mock
|
|
16
16
|
|
|
17
|
-
export interface
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
17
|
+
export interface EntryAnimationsValues {
|
|
18
|
+
targetOriginX: number;
|
|
19
|
+
targetOriginY: number;
|
|
20
|
+
targetWidth: number;
|
|
21
|
+
targetHeight: number;
|
|
22
|
+
targetGlobalOriginX: number;
|
|
23
|
+
targetGlobalOriginY: number;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export interface ExitAnimationsValues {
|
|
27
|
+
currentOriginX: number;
|
|
28
|
+
currentOriginY: number;
|
|
29
|
+
currentWidth: number;
|
|
30
|
+
currentHeight: number;
|
|
31
|
+
currentGlobalOriginX: number;
|
|
32
|
+
currentGlobalOriginY: number;
|
|
24
33
|
}
|
|
25
34
|
|
|
26
35
|
export type EntryExitAnimationFunction = (
|
|
27
|
-
targetValues:
|
|
36
|
+
targetValues: EntryAnimationsValues | ExitAnimationsValues
|
|
28
37
|
) => LayoutAnimation;
|
|
29
38
|
|
|
39
|
+
export type AnimationConfigFunction<T> = (targetValues: T) => LayoutAnimation;
|
|
40
|
+
|
|
30
41
|
export interface LayoutAnimationsValues {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
42
|
+
currentOriginX: number;
|
|
43
|
+
currentOriginY: number;
|
|
44
|
+
currentWidth: number;
|
|
45
|
+
currentHeight: number;
|
|
46
|
+
currentGlobalOriginX: number;
|
|
47
|
+
currentGlobalOriginY: number;
|
|
48
|
+
targetOriginX: number;
|
|
49
|
+
targetOriginY: number;
|
|
50
|
+
targetWidth: number;
|
|
51
|
+
targetHeight: number;
|
|
52
|
+
targetGlobalOriginX: number;
|
|
53
|
+
targetGlobalOriginY: number;
|
|
43
54
|
windowWidth: number;
|
|
44
55
|
windowHeight: number;
|
|
45
56
|
}
|
|
@@ -76,3 +87,11 @@ export type LayoutAnimationAndConfig = [
|
|
|
76
87
|
export interface IEntryExitAnimationBuilder {
|
|
77
88
|
build: () => EntryExitAnimationFunction;
|
|
78
89
|
}
|
|
90
|
+
|
|
91
|
+
export interface IEntryAnimationBuilder {
|
|
92
|
+
build: () => AnimationConfigFunction<EntryAnimationsValues>;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
export interface IExitAnimationBuilder {
|
|
96
|
+
build: () => AnimationConfigFunction<ExitAnimationsValues>;
|
|
97
|
+
}
|
|
@@ -4,8 +4,12 @@ export { Keyframe } from './Keyframe';
|
|
|
4
4
|
export {
|
|
5
5
|
LayoutAnimation,
|
|
6
6
|
AnimationFunction,
|
|
7
|
-
|
|
7
|
+
EntryAnimationsValues,
|
|
8
|
+
ExitAnimationsValues,
|
|
8
9
|
EntryExitAnimationFunction,
|
|
10
|
+
AnimationConfigFunction,
|
|
11
|
+
IEntryAnimationBuilder,
|
|
12
|
+
IExitAnimationBuilder,
|
|
9
13
|
LayoutAnimationsValues,
|
|
10
14
|
LayoutAnimationFunction,
|
|
11
15
|
ILayoutAnimationBuilder,
|