react-native-reanimated 2.3.0-alpha.3 → 2.3.0-beta.4
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/LayoutAnimations/LayoutAnimationsProxy.cpp +15 -8
- package/Common/cpp/NativeModules/NativeReanimatedModule.cpp +176 -154
- package/Common/cpp/NativeModules/NativeReanimatedModuleSpec.cpp +49 -33
- package/Common/cpp/Registries/EventHandlerRegistry.cpp +14 -7
- package/Common/cpp/Registries/MapperRegistry.cpp +24 -20
- package/Common/cpp/Registries/WorkletsCache.cpp +19 -9
- package/Common/cpp/SharedItems/FrozenObject.cpp +17 -8
- package/Common/cpp/SharedItems/MutableValue.cpp +38 -25
- package/Common/cpp/SharedItems/MutableValueSetterProxy.cpp +11 -7
- package/Common/cpp/SharedItems/RemoteObject.cpp +9 -5
- package/Common/cpp/SharedItems/ShareableValue.cpp +211 -160
- package/Common/cpp/Tools/FeaturesConfig.cpp +5 -0
- package/Common/cpp/Tools/JSIStoreValueUser.cpp +25 -6
- package/Common/cpp/Tools/Mapper.cpp +30 -30
- package/Common/cpp/Tools/RuntimeDecorator.cpp +124 -86
- package/Common/cpp/Tools/Scheduler.cpp +6 -5
- package/Common/cpp/Tools/WorkletEventHandler.cpp +4 -2
- package/Common/cpp/headers/LayoutAnimations/LayoutAnimationsProxy.h +12 -11
- package/Common/cpp/headers/NativeModules/NativeReanimatedModule.h +50 -31
- package/Common/cpp/headers/NativeModules/NativeReanimatedModuleSpec.h +34 -16
- package/Common/cpp/headers/Registries/EventHandlerRegistry.h +15 -8
- package/Common/cpp/headers/Registries/MapperRegistry.h +5 -4
- package/Common/cpp/headers/Registries/WorkletsCache.h +9 -7
- package/Common/cpp/headers/SharedItems/FrozenObject.h +19 -11
- package/Common/cpp/headers/SharedItems/HostFunctionHandler.h +8 -4
- package/Common/cpp/headers/SharedItems/MutableValue.h +23 -12
- package/Common/cpp/headers/SharedItems/MutableValueSetterProxy.h +12 -7
- package/Common/cpp/headers/SharedItems/RemoteObject.h +19 -8
- package/Common/cpp/headers/SharedItems/RuntimeManager.h +26 -25
- package/Common/cpp/headers/SharedItems/ShareableValue.h +32 -27
- package/Common/cpp/headers/SharedItems/SharedParent.h +10 -7
- package/Common/cpp/headers/SharedItems/ValueWrapper.h +95 -72
- package/Common/cpp/headers/SpecTools/ErrorHandler.h +18 -19
- package/Common/cpp/headers/Tools/FeaturesConfig.h +19 -0
- package/Common/cpp/headers/Tools/JSIStoreValueUser.h +13 -16
- package/Common/cpp/headers/Tools/Mapper.h +19 -16
- package/Common/cpp/headers/Tools/PlatformDepMethodsHolder.h +17 -7
- package/Common/cpp/headers/Tools/ReanimatedHiddenHeaders.h +7 -11
- package/Common/cpp/headers/Tools/RuntimeDecorator.h +36 -27
- package/Common/cpp/headers/Tools/Scheduler.h +30 -35
- package/Common/cpp/headers/Tools/WorkletEventHandler.h +11 -8
- package/Common/cpp/hidden_headers/Logger.h +14 -14
- package/Common/cpp/hidden_headers/LoggerInterface.h +8 -9
- package/Common/cpp/hidden_headers/SpeedChecker.h +7 -8
- package/README.md +1 -1
- package/RNReanimated.podspec +24 -6
- package/android/build.gradle +38 -29
- 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/ios/LayoutReanimation/REAAnimationsManager.h +10 -8
- package/ios/LayoutReanimation/REAAnimationsManager.m +91 -87
- package/ios/LayoutReanimation/REASnapshot.h +2 -2
- package/ios/LayoutReanimation/REASnapshot.m +8 -7
- package/ios/LayoutReanimation/REAUIManager.h +4 -4
- package/ios/LayoutReanimation/REAUIManager.mm +116 -70
- package/ios/Nodes/REAAlwaysNode.m +14 -15
- package/ios/Nodes/REABezierNode.m +8 -7
- package/ios/Nodes/REABlockNode.m +1 -1
- package/ios/Nodes/REACallFuncNode.h +0 -1
- package/ios/Nodes/REACallFuncNode.m +10 -8
- package/ios/Nodes/REAClockNodes.m +22 -20
- package/ios/Nodes/REAConcatNode.h +0 -1
- package/ios/Nodes/REAConcatNode.m +2 -2
- package/ios/Nodes/REACondNode.m +7 -5
- package/ios/Nodes/READebugNode.m +5 -4
- package/ios/Nodes/REAEventNode.m +1 -1
- package/ios/Nodes/REAFunctionNode.h +0 -1
- package/ios/Nodes/REAFunctionNode.m +2 -2
- package/ios/Nodes/REAJSCallNode.m +4 -5
- package/ios/Nodes/REANode.h +3 -4
- package/ios/Nodes/REANode.m +9 -11
- package/ios/Nodes/REAOperatorNode.m +68 -67
- package/ios/Nodes/REAParamNode.h +1 -3
- package/ios/Nodes/REAParamNode.m +15 -17
- package/ios/Nodes/REAPropsNode.h +1 -3
- package/ios/Nodes/REAPropsNode.m +19 -22
- package/ios/Nodes/REASetNode.h +0 -1
- package/ios/Nodes/REASetNode.m +7 -5
- package/ios/Nodes/REAStyleNode.h +0 -1
- package/ios/Nodes/REAStyleNode.m +2 -4
- package/ios/Nodes/REATransformNode.h +0 -1
- package/ios/Nodes/REATransformNode.m +3 -5
- package/ios/Nodes/REAValueNode.m +5 -7
- package/ios/REAEventDispatcher.m +4 -4
- package/ios/REAModule.h +0 -2
- package/ios/REAModule.m +29 -38
- package/ios/REANodesManager.h +11 -19
- package/ios/REANodesManager.m +106 -130
- package/ios/REAUtils.h +5 -3
- package/ios/RNGestureHandlerStateManager.h +5 -0
- package/ios/Transitioning/RCTConvert+REATransition.m +45 -29
- package/ios/Transitioning/REAAllTransitions.h +2 -2
- package/ios/Transitioning/REAAllTransitions.m +14 -25
- package/ios/Transitioning/REATransition.h +8 -7
- package/ios/Transitioning/REATransition.m +19 -16
- package/ios/Transitioning/REATransitionAnimation.h +1 -1
- package/ios/Transitioning/REATransitionAnimation.m +2 -3
- package/ios/Transitioning/REATransitionManager.m +3 -3
- package/ios/native/NativeMethods.h +20 -5
- package/ios/native/NativeMethods.mm +14 -6
- package/ios/native/NativeProxy.h +4 -2
- package/ios/native/NativeProxy.mm +84 -63
- package/ios/native/REAIOSErrorHandler.h +13 -10
- package/ios/native/REAIOSErrorHandler.mm +19 -15
- package/ios/native/REAIOSLogger.h +8 -8
- package/ios/native/REAIOSLogger.mm +10 -6
- package/ios/native/REAIOSScheduler.h +5 -5
- package/ios/native/REAIOSScheduler.mm +17 -10
- package/ios/native/REAInitializer.h +5 -7
- package/ios/native/REAInitializer.mm +43 -31
- package/ios/native/UIResponder+Reanimated.mm +2 -2
- package/lib/Animated.js +9 -1
- package/lib/ConfigHelper.js +121 -138
- package/lib/ReanimatedEventEmitter.js +0 -1
- package/lib/ReanimatedModule.js +0 -1
- package/lib/ReanimatedModule.macos.js +0 -1
- package/lib/ReanimatedModule.native.js +5 -6
- package/lib/ReanimatedModule.windows.js +0 -1
- package/lib/ReanimatedModuleCompat.js +64 -35
- package/lib/createAnimatedComponent.js +468 -487
- package/lib/index.js +9 -1
- package/lib/reanimated2/NativeMethods.js +7 -12
- package/lib/reanimated2/NativeReanimated/NativeReanimated.js +37 -0
- package/lib/reanimated2/NativeReanimated/index.js +15 -0
- package/lib/reanimated2/PropAdapters.js +0 -1
- package/lib/reanimated2/UpdateProps.js +6 -7
- package/lib/reanimated2/ViewDescriptorsSet.js +4 -4
- package/lib/reanimated2/WorkletEventHandler.js +15 -13
- package/lib/reanimated2/animation/delay.js +8 -2
- package/lib/reanimated2/animation/spring.js +2 -0
- package/lib/reanimated2/animation/styleAnimation.js +7 -3
- package/lib/reanimated2/animation/util.js +25 -2
- package/lib/reanimated2/core.js +41 -17
- package/lib/reanimated2/globals.d.ts +21 -1
- package/lib/reanimated2/hook/useAnimatedRef.js +1 -1
- package/lib/reanimated2/hook/useAnimatedStyle.js +3 -3
- package/lib/reanimated2/index.js +1 -0
- package/lib/reanimated2/interpolation.js +95 -87
- package/lib/reanimated2/js-reanimated/JSReanimated.js +13 -10
- package/lib/reanimated2/js-reanimated/Mapper.js +4 -3
- package/lib/reanimated2/js-reanimated/MapperRegistry.js +3 -6
- package/lib/reanimated2/js-reanimated/MutableValue.js +0 -2
- package/lib/reanimated2/js-reanimated/index.js +10 -8
- package/lib/reanimated2/layoutReanimation/LayoutAnimationRepository.js +33 -2
- package/lib/reanimated2/layoutReanimation/animationBuilder/BaseAnimationBuilder.js +27 -124
- package/lib/reanimated2/layoutReanimation/animationBuilder/ComplexAnimationBuilder.js +125 -0
- package/lib/reanimated2/layoutReanimation/animationBuilder/index.js +1 -2
- package/lib/reanimated2/layoutReanimation/defaultAnimations/Bounce.js +115 -45
- package/lib/reanimated2/layoutReanimation/defaultAnimations/Default.js +7 -2
- package/lib/reanimated2/layoutReanimation/defaultAnimations/Fade.js +21 -21
- package/lib/reanimated2/layoutReanimation/defaultAnimations/Flip.js +25 -25
- package/lib/reanimated2/layoutReanimation/defaultAnimations/Lightspeed.js +19 -17
- package/lib/reanimated2/layoutReanimation/defaultAnimations/Pinwheel.js +5 -5
- package/lib/reanimated2/layoutReanimation/defaultAnimations/Roll.js +9 -9
- package/lib/reanimated2/layoutReanimation/defaultAnimations/Rotate.js +17 -17
- package/lib/reanimated2/layoutReanimation/defaultAnimations/Slide.js +19 -19
- package/lib/reanimated2/layoutReanimation/defaultAnimations/Stretch.js +9 -9
- package/lib/reanimated2/layoutReanimation/defaultAnimations/Zoom.js +33 -33
- package/lib/reanimated2/layoutReanimation/defaultTransitions/CurvedTransition.js +78 -0
- package/lib/reanimated2/layoutReanimation/defaultTransitions/EntryExitTransition.js +128 -0
- package/lib/reanimated2/layoutReanimation/defaultTransitions/FadingTransition.js +37 -0
- package/lib/reanimated2/layoutReanimation/defaultTransitions/JumpingTransition.js +41 -0
- package/lib/reanimated2/layoutReanimation/defaultTransitions/LinearTransition.js +34 -0
- package/lib/reanimated2/layoutReanimation/defaultTransitions/SequencedTransition.js +46 -0
- package/lib/reanimated2/layoutReanimation/defaultTransitions/index.js +6 -0
- package/lib/reanimated2/layoutReanimation/index.js +1 -0
- package/lib/reanimated2/mock.js +3 -1
- package/lib/reanimated2/utils.js +9 -0
- package/lib/setAndForwardRef.js +14 -48
- package/libSo/fbjni/jni/arm64-v8a/libfbjni.so +0 -0
- package/libSo/fbjni/jni/armeabi-v7a/libfbjni.so +0 -0
- package/libSo/fbjni/jni/x86/libfbjni.so +0 -0
- package/libSo/fbjni/jni/x86_64/libfbjni.so +0 -0
- package/mock.js +1 -1
- package/package.json +28 -17
- package/plugin.js +220 -39
- package/react-native-reanimated.d.ts +542 -547
- package/src/Animated.js +9 -1
- package/src/{ConfigHelper.js → ConfigHelper.ts} +15 -7
- package/src/{ReanimatedEventEmitter.js → ReanimatedEventEmitter.ts} +0 -0
- package/src/{ReanimatedModule.js → ReanimatedModule.macos.ts} +0 -0
- package/src/{ReanimatedModule.native.js → ReanimatedModule.native.ts} +0 -0
- package/src/{ReanimatedModule.macos.js → ReanimatedModule.ts} +0 -0
- package/src/{ReanimatedModule.windows.js → ReanimatedModule.windows.ts} +0 -0
- package/src/ReanimatedModuleCompat.ts +51 -0
- package/src/{createAnimatedComponent.js → createAnimatedComponent.tsx} +285 -126
- package/src/reanimated2/NativeMethods.ts +34 -13
- package/src/reanimated2/NativeReanimated/NativeReanimated.ts +72 -0
- package/src/reanimated2/NativeReanimated/index.ts +18 -0
- package/src/reanimated2/PropAdapters.ts +0 -1
- package/src/reanimated2/UpdateProps.ts +31 -15
- package/src/reanimated2/ViewDescriptorsSet.ts +15 -12
- package/src/reanimated2/WorkletEventHandler.ts +41 -23
- package/src/reanimated2/animation/commonTypes.ts +4 -4
- package/src/reanimated2/animation/decay.ts +2 -2
- package/src/reanimated2/animation/delay.ts +11 -5
- package/src/reanimated2/animation/index.ts +7 -7
- package/src/reanimated2/animation/repeat.ts +4 -4
- package/src/reanimated2/animation/sequence.ts +2 -2
- package/src/reanimated2/animation/spring.ts +6 -5
- package/src/reanimated2/animation/styleAnimation.ts +27 -15
- package/src/reanimated2/animation/timing.ts +5 -5
- package/src/reanimated2/animation/util.ts +47 -8
- package/src/reanimated2/commonTypes.ts +3 -0
- package/src/reanimated2/core.ts +80 -34
- package/src/reanimated2/globals.d.ts +21 -1
- package/src/reanimated2/hook/useAnimatedGestureHandler.ts +1 -1
- package/src/reanimated2/hook/useAnimatedRef.ts +13 -15
- package/src/reanimated2/hook/useAnimatedScrollHandler.ts +3 -3
- package/src/reanimated2/hook/useAnimatedStyle.ts +7 -7
- package/src/reanimated2/hook/utils.ts +4 -3
- package/src/reanimated2/index.ts +1 -0
- package/src/reanimated2/interpolation.ts +170 -103
- package/src/reanimated2/js-reanimated/JSReanimated.ts +37 -23
- package/src/reanimated2/js-reanimated/Mapper.ts +22 -9
- package/src/reanimated2/js-reanimated/MapperRegistry.ts +22 -19
- package/src/reanimated2/js-reanimated/MutableValue.ts +11 -11
- package/src/reanimated2/js-reanimated/index.ts +31 -14
- package/src/reanimated2/layoutReanimation/LayoutAnimationRepository.ts +75 -0
- package/src/reanimated2/layoutReanimation/animationBuilder/BaseAnimationBuilder.ts +29 -159
- package/src/reanimated2/layoutReanimation/animationBuilder/ComplexAnimationBuilder.ts +169 -0
- package/src/reanimated2/layoutReanimation/animationBuilder/Keyframe.ts +2 -2
- package/src/reanimated2/layoutReanimation/animationBuilder/commonTypes.ts +3 -9
- package/src/reanimated2/layoutReanimation/animationBuilder/index.ts +1 -5
- package/src/reanimated2/layoutReanimation/defaultAnimations/Bounce.ts +162 -82
- package/src/reanimated2/layoutReanimation/defaultAnimations/Default.ts +7 -2
- package/src/reanimated2/layoutReanimation/defaultAnimations/Fade.ts +32 -32
- package/src/reanimated2/layoutReanimation/defaultAnimations/Flip.ts +38 -38
- package/src/reanimated2/layoutReanimation/defaultAnimations/Lightspeed.ts +34 -32
- package/src/reanimated2/layoutReanimation/defaultAnimations/Pinwheel.ts +8 -8
- package/src/reanimated2/layoutReanimation/defaultAnimations/Roll.ts +14 -14
- package/src/reanimated2/layoutReanimation/defaultAnimations/Rotate.ts +26 -26
- package/src/reanimated2/layoutReanimation/defaultAnimations/Slide.ts +28 -28
- package/src/reanimated2/layoutReanimation/defaultAnimations/Stretch.ts +14 -14
- package/src/reanimated2/layoutReanimation/defaultAnimations/Zoom.ts +50 -50
- package/src/reanimated2/layoutReanimation/defaultTransitions/CurvedTransition.ts +104 -0
- package/src/reanimated2/layoutReanimation/defaultTransitions/EntryExitTransition.ts +213 -0
- package/src/reanimated2/layoutReanimation/defaultTransitions/FadingTransition.ts +60 -0
- package/src/reanimated2/layoutReanimation/defaultTransitions/JumpingTransition.ts +58 -0
- package/src/reanimated2/layoutReanimation/defaultTransitions/LinearTransition.ts +41 -0
- package/src/reanimated2/layoutReanimation/defaultTransitions/SequencedTransition.ts +78 -0
- package/src/reanimated2/layoutReanimation/defaultTransitions/index.ts +6 -0
- package/src/reanimated2/layoutReanimation/index.ts +1 -0
- package/src/reanimated2/mock.ts +3 -1
- package/src/reanimated2/utils.ts +21 -0
- package/src/{setAndForwardRef.js → setAndForwardRef.ts} +12 -2
- package/android/react-native-reanimated-62-hermes.aar +0 -0
- package/android/react-native-reanimated-62-jsc.aar +0 -0
- package/lib/reanimated2/NativeReanimated.js +0 -48
- package/lib/reanimated2/layoutReanimation/animationBuilder/BaseBounceAnimationBuilder.js +0 -55
- package/lib/reanimated2/layoutReanimation/animationBuilder/LayoutAnimationBuilder.js +0 -165
- package/src/ReanimatedModuleCompat.js +0 -37
- package/src/reanimated2/NativeReanimated.ts +0 -70
- package/src/reanimated2/layoutReanimation/LayoutAnimationRepository.tsx +0 -41
- package/src/reanimated2/layoutReanimation/animationBuilder/BaseBounceAnimationBuilder.ts +0 -82
- package/src/reanimated2/layoutReanimation/animationBuilder/LayoutAnimationBuilder.ts +0 -217
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
import { withDelay, withTiming } from '../../animation';
|
|
2
|
-
import {
|
|
3
|
-
EntryExitAnimationFunction,
|
|
4
|
-
AnimationFunction,
|
|
5
|
-
LayoutAnimationAndConfig,
|
|
6
|
-
BounceBuilderAnimationConfig,
|
|
7
|
-
EntryExitAnimationBuild,
|
|
8
|
-
} from './commonTypes';
|
|
9
|
-
|
|
10
|
-
export class BaseBounceAnimationBuilder {
|
|
11
|
-
durationV?: number;
|
|
12
|
-
delayV?: number;
|
|
13
|
-
callbackV?: (finished: boolean) => void;
|
|
14
|
-
|
|
15
|
-
static createInstance: () => BaseBounceAnimationBuilder;
|
|
16
|
-
build: EntryExitAnimationBuild = () => {
|
|
17
|
-
throw Error('Unimplemented method in child class.');
|
|
18
|
-
};
|
|
19
|
-
|
|
20
|
-
static duration(durationMs: number): BaseBounceAnimationBuilder {
|
|
21
|
-
const instance = this.createInstance();
|
|
22
|
-
return instance.duration(durationMs);
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
duration(durationMs: number): BaseBounceAnimationBuilder {
|
|
26
|
-
this.durationV = durationMs;
|
|
27
|
-
return this;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
static delay(delayMs: number): BaseBounceAnimationBuilder {
|
|
31
|
-
const instance = this.createInstance();
|
|
32
|
-
return instance.delay(delayMs);
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
delay(delayMs: number): BaseBounceAnimationBuilder {
|
|
36
|
-
this.delayV = delayMs;
|
|
37
|
-
return this;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
static withCallback(
|
|
41
|
-
callback: (finished: boolean) => void
|
|
42
|
-
): BaseBounceAnimationBuilder {
|
|
43
|
-
const instance = this.createInstance();
|
|
44
|
-
return instance.withCallback(callback);
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
withCallback(
|
|
48
|
-
callback: (finsihed: boolean) => void
|
|
49
|
-
): BaseBounceAnimationBuilder {
|
|
50
|
-
this.callbackV = callback;
|
|
51
|
-
return this;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
getDelayFunction(): AnimationFunction {
|
|
55
|
-
const delay = this.delayV;
|
|
56
|
-
return delay
|
|
57
|
-
? withDelay
|
|
58
|
-
: (_, animation) => {
|
|
59
|
-
'worklet';
|
|
60
|
-
return animation;
|
|
61
|
-
};
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
getAnimationAndConfig(): LayoutAnimationAndConfig {
|
|
65
|
-
const duration = this.durationV;
|
|
66
|
-
const type = withTiming;
|
|
67
|
-
const animation = type;
|
|
68
|
-
|
|
69
|
-
const config: BounceBuilderAnimationConfig = {};
|
|
70
|
-
|
|
71
|
-
if (duration) {
|
|
72
|
-
config.duration = duration;
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
return [animation, config];
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
static build(): EntryExitAnimationFunction {
|
|
79
|
-
const instance = this.createInstance();
|
|
80
|
-
return instance.build();
|
|
81
|
-
}
|
|
82
|
-
}
|
|
@@ -1,217 +0,0 @@
|
|
|
1
|
-
import { withDelay, withTiming, withSpring } from '../../animation';
|
|
2
|
-
import {
|
|
3
|
-
AnimationFunction,
|
|
4
|
-
ILayoutAnimationBuilder,
|
|
5
|
-
LayoutAnimationFunction,
|
|
6
|
-
BaseLayoutAnimationConfig,
|
|
7
|
-
LayoutAnimationBuild,
|
|
8
|
-
} from './commonTypes';
|
|
9
|
-
import { EasingFn } from '../../Easing';
|
|
10
|
-
|
|
11
|
-
export class LayoutAnimationBuilder implements ILayoutAnimationBuilder {
|
|
12
|
-
durationV?: number;
|
|
13
|
-
easingV?: EasingFn;
|
|
14
|
-
delayV?: number;
|
|
15
|
-
type?: AnimationFunction;
|
|
16
|
-
dampingV?: number;
|
|
17
|
-
massV?: number;
|
|
18
|
-
stiffnessV?: number;
|
|
19
|
-
overshootClampingV?: number;
|
|
20
|
-
restDisplacementThresholdV?: number;
|
|
21
|
-
restSpeedThresholdV?: number;
|
|
22
|
-
callbackV?: (finished: boolean) => void;
|
|
23
|
-
|
|
24
|
-
static duration(durationMs: number): LayoutAnimationBuilder {
|
|
25
|
-
const instance = new LayoutAnimationBuilder();
|
|
26
|
-
return instance.duration(durationMs);
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
duration(durationMs: number): LayoutAnimationBuilder {
|
|
30
|
-
this.durationV = durationMs;
|
|
31
|
-
return this;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
static easing(easingFunction: EasingFn): LayoutAnimationBuilder {
|
|
35
|
-
const instance = new LayoutAnimationBuilder();
|
|
36
|
-
return instance.easing(easingFunction);
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
easing(easingFunction: EasingFn): LayoutAnimationBuilder {
|
|
40
|
-
this.easingV = easingFunction;
|
|
41
|
-
return this;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
static delay(durationMs: number): LayoutAnimationBuilder {
|
|
45
|
-
const instance = new LayoutAnimationBuilder();
|
|
46
|
-
return instance.delay(durationMs);
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
delay(durationMs: number): LayoutAnimationBuilder {
|
|
50
|
-
this.delayV = durationMs;
|
|
51
|
-
return this;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
static springify(): LayoutAnimationBuilder {
|
|
55
|
-
const instance = new LayoutAnimationBuilder();
|
|
56
|
-
return instance.springify();
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
springify(): LayoutAnimationBuilder {
|
|
60
|
-
this.type = withSpring as AnimationFunction;
|
|
61
|
-
return this;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
static damping(damping: number): LayoutAnimationBuilder {
|
|
65
|
-
const instance = new LayoutAnimationBuilder();
|
|
66
|
-
return instance.damping(damping);
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
damping(damping: number): LayoutAnimationBuilder {
|
|
70
|
-
this.dampingV = damping;
|
|
71
|
-
return this;
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
static mass(mass: number): LayoutAnimationBuilder {
|
|
75
|
-
const instance = new LayoutAnimationBuilder();
|
|
76
|
-
return instance.mass(mass);
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
mass(mass: number): LayoutAnimationBuilder {
|
|
80
|
-
this.massV = mass;
|
|
81
|
-
return this;
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
static stiffness(stiffness: number): LayoutAnimationBuilder {
|
|
85
|
-
const instance = new LayoutAnimationBuilder();
|
|
86
|
-
return instance.stiffness(stiffness);
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
stiffness(stiffness: number): LayoutAnimationBuilder {
|
|
90
|
-
this.stiffnessV = stiffness;
|
|
91
|
-
return this;
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
static overshootClamping(overshootClamping: number): LayoutAnimationBuilder {
|
|
95
|
-
const instance = new LayoutAnimationBuilder();
|
|
96
|
-
return instance.overshootClamping(overshootClamping);
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
overshootClamping(overshootClamping: number): LayoutAnimationBuilder {
|
|
100
|
-
this.overshootClampingV = overshootClamping;
|
|
101
|
-
return this;
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
static restDisplacementThreshold(
|
|
105
|
-
restDisplacementThreshold: number
|
|
106
|
-
): LayoutAnimationBuilder {
|
|
107
|
-
const instance = new LayoutAnimationBuilder();
|
|
108
|
-
return instance.restDisplacementThreshold(restDisplacementThreshold);
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
restDisplacementThreshold(
|
|
112
|
-
restDisplacementThreshold: number
|
|
113
|
-
): LayoutAnimationBuilder {
|
|
114
|
-
this.restDisplacementThresholdV = restDisplacementThreshold;
|
|
115
|
-
return this;
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
static restSpeedThreshold(r: number): LayoutAnimationBuilder {
|
|
119
|
-
const instance = new LayoutAnimationBuilder();
|
|
120
|
-
return instance.restSpeedThreshold(r);
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
restSpeedThreshold(restSpeedThreshold: number): LayoutAnimationBuilder {
|
|
124
|
-
this.restSpeedThresholdV = restSpeedThreshold;
|
|
125
|
-
return this;
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
static withCallback(
|
|
129
|
-
callback: (finished: boolean) => void
|
|
130
|
-
): LayoutAnimationBuilder {
|
|
131
|
-
const instance = new LayoutAnimationBuilder();
|
|
132
|
-
return instance.withCallback(callback);
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
withCallback(callback: (finished: boolean) => void): LayoutAnimationBuilder {
|
|
136
|
-
this.callbackV = callback;
|
|
137
|
-
return this;
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
static build(): LayoutAnimationFunction {
|
|
141
|
-
const instance = new LayoutAnimationBuilder();
|
|
142
|
-
return instance.build();
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
build: LayoutAnimationBuild = () => {
|
|
146
|
-
const duration = this.durationV;
|
|
147
|
-
const easing = this.easingV;
|
|
148
|
-
const delay = this.delayV;
|
|
149
|
-
const type = this.type ? this.type : (withTiming as AnimationFunction);
|
|
150
|
-
const damping = this.dampingV;
|
|
151
|
-
const mass = this.massV;
|
|
152
|
-
const stiffness = this.stiffnessV;
|
|
153
|
-
const overshootClamping = this.overshootClampingV;
|
|
154
|
-
const restDisplacementThreshold = this.restDisplacementThresholdV;
|
|
155
|
-
const restSpeedThreshold = this.restSpeedThresholdV;
|
|
156
|
-
const callback = this.callbackV;
|
|
157
|
-
|
|
158
|
-
const delayFunction: AnimationFunction = delay
|
|
159
|
-
? withDelay
|
|
160
|
-
: (_, animation: AnimationFunction) => {
|
|
161
|
-
'worklet';
|
|
162
|
-
return animation;
|
|
163
|
-
};
|
|
164
|
-
|
|
165
|
-
const animation = type;
|
|
166
|
-
|
|
167
|
-
const config: BaseLayoutAnimationConfig = {};
|
|
168
|
-
|
|
169
|
-
if (type === withTiming) {
|
|
170
|
-
if (easing) {
|
|
171
|
-
config.easing = easing;
|
|
172
|
-
}
|
|
173
|
-
if (duration) {
|
|
174
|
-
config.duration = duration;
|
|
175
|
-
}
|
|
176
|
-
} else {
|
|
177
|
-
if (damping) {
|
|
178
|
-
config.damping = damping;
|
|
179
|
-
}
|
|
180
|
-
if (mass) {
|
|
181
|
-
config.mass = mass;
|
|
182
|
-
}
|
|
183
|
-
if (stiffness) {
|
|
184
|
-
config.stiffness = stiffness;
|
|
185
|
-
}
|
|
186
|
-
if (overshootClamping) {
|
|
187
|
-
config.overshootClamping = overshootClamping;
|
|
188
|
-
}
|
|
189
|
-
if (restDisplacementThreshold) {
|
|
190
|
-
config.restDisplacementThreshold = restDisplacementThreshold;
|
|
191
|
-
}
|
|
192
|
-
if (restSpeedThreshold) {
|
|
193
|
-
config.restSpeedThreshold = restSpeedThreshold;
|
|
194
|
-
}
|
|
195
|
-
}
|
|
196
|
-
|
|
197
|
-
return (values) => {
|
|
198
|
-
'worklet';
|
|
199
|
-
return {
|
|
200
|
-
initialValues: {
|
|
201
|
-
originX: values.boriginX,
|
|
202
|
-
originY: values.boriginY,
|
|
203
|
-
width: values.bwidth,
|
|
204
|
-
height: values.bheight,
|
|
205
|
-
},
|
|
206
|
-
animations: {
|
|
207
|
-
originX: delayFunction(delay, animation(values.originX, config)),
|
|
208
|
-
originY: delayFunction(delay, animation(values.originY, config)),
|
|
209
|
-
width: delayFunction(delay, animation(values.width, config)),
|
|
210
|
-
height: delayFunction(delay, animation(values.height, config)),
|
|
211
|
-
},
|
|
212
|
-
callback: callback,
|
|
213
|
-
};
|
|
214
|
-
};
|
|
215
|
-
};
|
|
216
|
-
}
|
|
217
|
-
export const Layout = LayoutAnimationBuilder;
|