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
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import {
|
|
2
|
+
ILayoutAnimationBuilder,
|
|
3
|
+
LayoutAnimationFunction,
|
|
4
|
+
} from '../animationBuilder/commonTypes';
|
|
5
|
+
import { withSequence, withTiming } from '../../animation';
|
|
6
|
+
import { Easing } from '../../Easing';
|
|
7
|
+
import { BaseAnimationBuilder } from '../animationBuilder';
|
|
8
|
+
export class JumpingTransition
|
|
9
|
+
extends BaseAnimationBuilder
|
|
10
|
+
implements ILayoutAnimationBuilder {
|
|
11
|
+
static createInstance(): JumpingTransition {
|
|
12
|
+
return new JumpingTransition();
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
build = (): LayoutAnimationFunction => {
|
|
16
|
+
const delayFunction = this.getDelayFunction();
|
|
17
|
+
const callback = this.callbackV;
|
|
18
|
+
const delay = this.getDelay();
|
|
19
|
+
const duration = (this.durationV ?? 300) / 2;
|
|
20
|
+
const config = { duration: duration * 2 };
|
|
21
|
+
|
|
22
|
+
return (values) => {
|
|
23
|
+
'worklet';
|
|
24
|
+
const d = Math.max(
|
|
25
|
+
Math.abs(values.originX - values.boriginX),
|
|
26
|
+
Math.abs(values.originY - values.boriginY)
|
|
27
|
+
);
|
|
28
|
+
return {
|
|
29
|
+
initialValues: {
|
|
30
|
+
originX: values.boriginX,
|
|
31
|
+
originY: values.boriginY,
|
|
32
|
+
width: values.bwidth,
|
|
33
|
+
height: values.bheight,
|
|
34
|
+
},
|
|
35
|
+
animations: {
|
|
36
|
+
originX: delayFunction(delay, withTiming(values.originX, config)),
|
|
37
|
+
originY: delayFunction(
|
|
38
|
+
delay,
|
|
39
|
+
withSequence(
|
|
40
|
+
withTiming(Math.min(values.originY, values.boriginY) - d, {
|
|
41
|
+
duration,
|
|
42
|
+
easing: Easing.out(Easing.exp),
|
|
43
|
+
}),
|
|
44
|
+
withTiming(values.originY, {
|
|
45
|
+
...config,
|
|
46
|
+
duration,
|
|
47
|
+
easing: Easing.bounce,
|
|
48
|
+
})
|
|
49
|
+
)
|
|
50
|
+
),
|
|
51
|
+
width: delayFunction(delay, withTiming(values.width, config)),
|
|
52
|
+
height: delayFunction(delay, withTiming(values.height, config)),
|
|
53
|
+
},
|
|
54
|
+
callback: callback,
|
|
55
|
+
};
|
|
56
|
+
};
|
|
57
|
+
};
|
|
58
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { ComplexAnimationBuilder } from '../animationBuilder/ComplexAnimationBuilder';
|
|
2
|
+
import {
|
|
3
|
+
ILayoutAnimationBuilder,
|
|
4
|
+
LayoutAnimationFunction,
|
|
5
|
+
} from '../animationBuilder/commonTypes';
|
|
6
|
+
|
|
7
|
+
export class LinearTransition
|
|
8
|
+
extends ComplexAnimationBuilder
|
|
9
|
+
implements ILayoutAnimationBuilder {
|
|
10
|
+
static createInstance(): LinearTransition {
|
|
11
|
+
return new LinearTransition();
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
build = (): LayoutAnimationFunction => {
|
|
15
|
+
const delayFunction = this.getDelayFunction();
|
|
16
|
+
const [animation, config] = this.getAnimationAndConfig();
|
|
17
|
+
const callback = this.callbackV;
|
|
18
|
+
const delay = this.getDelay();
|
|
19
|
+
|
|
20
|
+
return (values) => {
|
|
21
|
+
'worklet';
|
|
22
|
+
return {
|
|
23
|
+
initialValues: {
|
|
24
|
+
originX: values.boriginX,
|
|
25
|
+
originY: values.boriginY,
|
|
26
|
+
width: values.bwidth,
|
|
27
|
+
height: values.bheight,
|
|
28
|
+
},
|
|
29
|
+
animations: {
|
|
30
|
+
originX: delayFunction(delay, animation(values.originX, config)),
|
|
31
|
+
originY: delayFunction(delay, animation(values.originY, config)),
|
|
32
|
+
width: delayFunction(delay, animation(values.width, config)),
|
|
33
|
+
height: delayFunction(delay, animation(values.height, config)),
|
|
34
|
+
},
|
|
35
|
+
callback: callback,
|
|
36
|
+
};
|
|
37
|
+
};
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export const Layout = LinearTransition;
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { withSequence, withTiming } from '../../animation';
|
|
2
|
+
import {
|
|
3
|
+
ILayoutAnimationBuilder,
|
|
4
|
+
LayoutAnimationFunction,
|
|
5
|
+
} from '../animationBuilder/commonTypes';
|
|
6
|
+
import { BaseAnimationBuilder } from '../animationBuilder';
|
|
7
|
+
|
|
8
|
+
export class SequencedTransition
|
|
9
|
+
extends BaseAnimationBuilder
|
|
10
|
+
implements ILayoutAnimationBuilder {
|
|
11
|
+
reversed = false;
|
|
12
|
+
|
|
13
|
+
static createInstance(): SequencedTransition {
|
|
14
|
+
return new SequencedTransition();
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
static reverse(): SequencedTransition {
|
|
18
|
+
const instance = SequencedTransition.createInstance();
|
|
19
|
+
return instance.reverse();
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
reverse(): SequencedTransition {
|
|
23
|
+
this.reversed = !this.reversed;
|
|
24
|
+
return this;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
build = (): LayoutAnimationFunction => {
|
|
28
|
+
const delayFunction = this.getDelayFunction();
|
|
29
|
+
const callback = this.callbackV;
|
|
30
|
+
const delay = this.getDelay();
|
|
31
|
+
const sequenceDuration = (this.durationV ?? 500) / 2;
|
|
32
|
+
const config = { duration: sequenceDuration };
|
|
33
|
+
const reverse = this.reversed;
|
|
34
|
+
|
|
35
|
+
return (values) => {
|
|
36
|
+
'worklet';
|
|
37
|
+
return {
|
|
38
|
+
initialValues: {
|
|
39
|
+
originX: values.boriginX,
|
|
40
|
+
originY: values.boriginY,
|
|
41
|
+
width: values.bwidth,
|
|
42
|
+
height: values.bheight,
|
|
43
|
+
},
|
|
44
|
+
animations: {
|
|
45
|
+
originX: delayFunction(
|
|
46
|
+
delay,
|
|
47
|
+
withSequence(
|
|
48
|
+
withTiming(reverse ? values.boriginX : values.originX, config),
|
|
49
|
+
withTiming(values.originX, config)
|
|
50
|
+
)
|
|
51
|
+
),
|
|
52
|
+
originY: delayFunction(
|
|
53
|
+
delay,
|
|
54
|
+
withSequence(
|
|
55
|
+
withTiming(reverse ? values.originY : values.boriginY, config),
|
|
56
|
+
withTiming(values.originY, config)
|
|
57
|
+
)
|
|
58
|
+
),
|
|
59
|
+
width: delayFunction(
|
|
60
|
+
delay,
|
|
61
|
+
withSequence(
|
|
62
|
+
withTiming(reverse ? values.bwidth : values.width, config),
|
|
63
|
+
withTiming(values.width, config)
|
|
64
|
+
)
|
|
65
|
+
),
|
|
66
|
+
height: delayFunction(
|
|
67
|
+
delay,
|
|
68
|
+
withSequence(
|
|
69
|
+
withTiming(reverse ? values.height : values.bheight, config),
|
|
70
|
+
withTiming(values.height, config)
|
|
71
|
+
)
|
|
72
|
+
),
|
|
73
|
+
},
|
|
74
|
+
callback: callback,
|
|
75
|
+
};
|
|
76
|
+
};
|
|
77
|
+
};
|
|
78
|
+
}
|
package/src/reanimated2/mock.ts
CHANGED
|
@@ -5,15 +5,17 @@ const NOOP = () => {
|
|
|
5
5
|
// noop
|
|
6
6
|
};
|
|
7
7
|
const ID = (t) => t;
|
|
8
|
+
const IMMEDIATE_CB_INVOCATION = (cb: () => unknown) => cb();
|
|
8
9
|
|
|
9
10
|
const ReanimatedV2 = {
|
|
10
11
|
useSharedValue: (v) => ({ value: v }),
|
|
11
12
|
useDerivedValue: (a) => ({ value: a() }),
|
|
12
13
|
useAnimatedScrollHandler: () => NOOP,
|
|
13
14
|
useAnimatedGestureHandler: () => NOOP,
|
|
14
|
-
useAnimatedStyle:
|
|
15
|
+
useAnimatedStyle: IMMEDIATE_CB_INVOCATION,
|
|
15
16
|
useAnimatedRef: () => ({ current: null }),
|
|
16
17
|
useAnimatedReaction: NOOP,
|
|
18
|
+
useAnimatedProps: IMMEDIATE_CB_INVOCATION,
|
|
17
19
|
|
|
18
20
|
withTiming: (toValue, _, cb) => {
|
|
19
21
|
cb && cb(true);
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { Component } from 'react';
|
|
2
|
+
import { measure } from './NativeMethods';
|
|
3
|
+
import { RefObjectFunction } from './hook/useAnimatedRef';
|
|
4
|
+
|
|
5
|
+
export interface ComponentCoords {
|
|
6
|
+
x: number;
|
|
7
|
+
y: number;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export function getRelativeCoords(
|
|
11
|
+
parentRef: RefObjectFunction<Component>,
|
|
12
|
+
x: number,
|
|
13
|
+
y: number
|
|
14
|
+
): ComponentCoords {
|
|
15
|
+
'worklet';
|
|
16
|
+
const parentCoords = measure(parentRef);
|
|
17
|
+
return {
|
|
18
|
+
x: x - parentCoords.x,
|
|
19
|
+
y: y - parentCoords.y,
|
|
20
|
+
};
|
|
21
|
+
}
|
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
* imported from react-native
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
|
+
import { MutableRefObject } from 'react';
|
|
6
|
+
|
|
5
7
|
/**
|
|
6
8
|
* This is a helper function for when a component needs to be able to forward a ref
|
|
7
9
|
* to a child component, but still needs to have access to that component as part of
|
|
@@ -33,8 +35,16 @@
|
|
|
33
35
|
* module.exports = MyViewWithRef;
|
|
34
36
|
*/
|
|
35
37
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
+
export type ForwardedRef<T> = () => MutableRefObject<T> | ((ref: T) => void);
|
|
39
|
+
|
|
40
|
+
function setAndForwardRef<T>({
|
|
41
|
+
getForwardedRef,
|
|
42
|
+
setLocalRef,
|
|
43
|
+
}: {
|
|
44
|
+
getForwardedRef: ForwardedRef<T>;
|
|
45
|
+
setLocalRef: (ref: T) => void;
|
|
46
|
+
}): (ref: T) => void {
|
|
47
|
+
return function forwardRef(ref: T) {
|
|
38
48
|
const forwardedRef = getForwardedRef();
|
|
39
49
|
|
|
40
50
|
setLocalRef(ref);
|
|
Binary file
|
|
Binary file
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
2
|
-
// @ts-nocheck
|
|
3
|
-
import { Platform } from 'react-native';
|
|
4
|
-
import reanimatedJS from './js-reanimated';
|
|
5
|
-
import { nativeShouldBeMock } from './PlatformChecker';
|
|
6
|
-
let exportedModule;
|
|
7
|
-
if (nativeShouldBeMock()) {
|
|
8
|
-
exportedModule = reanimatedJS;
|
|
9
|
-
}
|
|
10
|
-
else {
|
|
11
|
-
const InnerNativeModule = global.__reanimatedModuleProxy;
|
|
12
|
-
const NativeReanimated = {
|
|
13
|
-
native: true,
|
|
14
|
-
useOnlyV1: InnerNativeModule == null,
|
|
15
|
-
installCoreFunctions(valueSetter) {
|
|
16
|
-
return InnerNativeModule.installCoreFunctions(valueSetter);
|
|
17
|
-
},
|
|
18
|
-
makeShareable(value) {
|
|
19
|
-
return InnerNativeModule.makeShareable(value);
|
|
20
|
-
},
|
|
21
|
-
makeMutable(value) {
|
|
22
|
-
return InnerNativeModule.makeMutable(value);
|
|
23
|
-
},
|
|
24
|
-
makeRemote(object) {
|
|
25
|
-
return InnerNativeModule.makeRemote(object);
|
|
26
|
-
},
|
|
27
|
-
startMapper(mapper, inputs = [], outputs = [], updater, tag, name) {
|
|
28
|
-
return InnerNativeModule.startMapper(mapper, inputs, outputs, updater, tag, name);
|
|
29
|
-
},
|
|
30
|
-
stopMapper(mapperId) {
|
|
31
|
-
return InnerNativeModule.stopMapper(mapperId);
|
|
32
|
-
},
|
|
33
|
-
registerEventHandler(eventHash, eventHandler) {
|
|
34
|
-
return InnerNativeModule.registerEventHandler(eventHash, eventHandler);
|
|
35
|
-
},
|
|
36
|
-
unregisterEventHandler(registrationId) {
|
|
37
|
-
return InnerNativeModule.unregisterEventHandler(registrationId);
|
|
38
|
-
},
|
|
39
|
-
getViewProp(viewTag, propName, callback) {
|
|
40
|
-
return InnerNativeModule.getViewProp(viewTag, propName, callback);
|
|
41
|
-
},
|
|
42
|
-
};
|
|
43
|
-
if (NativeReanimated.useOnlyV1 && Platform.OS === 'android') {
|
|
44
|
-
console.warn(`If you want to use Reanimated 2 then go through our installation steps https://docs.swmansion.com/react-native-reanimated/docs/installation`);
|
|
45
|
-
}
|
|
46
|
-
exportedModule = NativeReanimated;
|
|
47
|
-
}
|
|
48
|
-
export default exportedModule; // TODO: just temporary type
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
import { withDelay, withTiming } from '../../animation';
|
|
2
|
-
export class BaseBounceAnimationBuilder {
|
|
3
|
-
constructor() {
|
|
4
|
-
this.build = () => {
|
|
5
|
-
throw Error('Unimplemented method in child class.');
|
|
6
|
-
};
|
|
7
|
-
}
|
|
8
|
-
static duration(durationMs) {
|
|
9
|
-
const instance = this.createInstance();
|
|
10
|
-
return instance.duration(durationMs);
|
|
11
|
-
}
|
|
12
|
-
duration(durationMs) {
|
|
13
|
-
this.durationV = durationMs;
|
|
14
|
-
return this;
|
|
15
|
-
}
|
|
16
|
-
static delay(delayMs) {
|
|
17
|
-
const instance = this.createInstance();
|
|
18
|
-
return instance.delay(delayMs);
|
|
19
|
-
}
|
|
20
|
-
delay(delayMs) {
|
|
21
|
-
this.delayV = delayMs;
|
|
22
|
-
return this;
|
|
23
|
-
}
|
|
24
|
-
static withCallback(callback) {
|
|
25
|
-
const instance = this.createInstance();
|
|
26
|
-
return instance.withCallback(callback);
|
|
27
|
-
}
|
|
28
|
-
withCallback(callback) {
|
|
29
|
-
this.callbackV = callback;
|
|
30
|
-
return this;
|
|
31
|
-
}
|
|
32
|
-
getDelayFunction() {
|
|
33
|
-
const delay = this.delayV;
|
|
34
|
-
return delay
|
|
35
|
-
? withDelay
|
|
36
|
-
: (_, animation) => {
|
|
37
|
-
'worklet';
|
|
38
|
-
return animation;
|
|
39
|
-
};
|
|
40
|
-
}
|
|
41
|
-
getAnimationAndConfig() {
|
|
42
|
-
const duration = this.durationV;
|
|
43
|
-
const type = withTiming;
|
|
44
|
-
const animation = type;
|
|
45
|
-
const config = {};
|
|
46
|
-
if (duration) {
|
|
47
|
-
config.duration = duration;
|
|
48
|
-
}
|
|
49
|
-
return [animation, config];
|
|
50
|
-
}
|
|
51
|
-
static build() {
|
|
52
|
-
const instance = this.createInstance();
|
|
53
|
-
return instance.build();
|
|
54
|
-
}
|
|
55
|
-
}
|
|
@@ -1,165 +0,0 @@
|
|
|
1
|
-
import { withDelay, withTiming, withSpring } from '../../animation';
|
|
2
|
-
export class LayoutAnimationBuilder {
|
|
3
|
-
constructor() {
|
|
4
|
-
this.build = () => {
|
|
5
|
-
const duration = this.durationV;
|
|
6
|
-
const easing = this.easingV;
|
|
7
|
-
const delay = this.delayV;
|
|
8
|
-
const type = this.type ? this.type : withTiming;
|
|
9
|
-
const damping = this.dampingV;
|
|
10
|
-
const mass = this.massV;
|
|
11
|
-
const stiffness = this.stiffnessV;
|
|
12
|
-
const overshootClamping = this.overshootClampingV;
|
|
13
|
-
const restDisplacementThreshold = this.restDisplacementThresholdV;
|
|
14
|
-
const restSpeedThreshold = this.restSpeedThresholdV;
|
|
15
|
-
const callback = this.callbackV;
|
|
16
|
-
const delayFunction = delay
|
|
17
|
-
? withDelay
|
|
18
|
-
: (_, animation) => {
|
|
19
|
-
'worklet';
|
|
20
|
-
return animation;
|
|
21
|
-
};
|
|
22
|
-
const animation = type;
|
|
23
|
-
const config = {};
|
|
24
|
-
if (type === withTiming) {
|
|
25
|
-
if (easing) {
|
|
26
|
-
config.easing = easing;
|
|
27
|
-
}
|
|
28
|
-
if (duration) {
|
|
29
|
-
config.duration = duration;
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
else {
|
|
33
|
-
if (damping) {
|
|
34
|
-
config.damping = damping;
|
|
35
|
-
}
|
|
36
|
-
if (mass) {
|
|
37
|
-
config.mass = mass;
|
|
38
|
-
}
|
|
39
|
-
if (stiffness) {
|
|
40
|
-
config.stiffness = stiffness;
|
|
41
|
-
}
|
|
42
|
-
if (overshootClamping) {
|
|
43
|
-
config.overshootClamping = overshootClamping;
|
|
44
|
-
}
|
|
45
|
-
if (restDisplacementThreshold) {
|
|
46
|
-
config.restDisplacementThreshold = restDisplacementThreshold;
|
|
47
|
-
}
|
|
48
|
-
if (restSpeedThreshold) {
|
|
49
|
-
config.restSpeedThreshold = restSpeedThreshold;
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
return (values) => {
|
|
53
|
-
'worklet';
|
|
54
|
-
return {
|
|
55
|
-
initialValues: {
|
|
56
|
-
originX: values.boriginX,
|
|
57
|
-
originY: values.boriginY,
|
|
58
|
-
width: values.bwidth,
|
|
59
|
-
height: values.bheight,
|
|
60
|
-
},
|
|
61
|
-
animations: {
|
|
62
|
-
originX: delayFunction(delay, animation(values.originX, config)),
|
|
63
|
-
originY: delayFunction(delay, animation(values.originY, config)),
|
|
64
|
-
width: delayFunction(delay, animation(values.width, config)),
|
|
65
|
-
height: delayFunction(delay, animation(values.height, config)),
|
|
66
|
-
},
|
|
67
|
-
callback: callback,
|
|
68
|
-
};
|
|
69
|
-
};
|
|
70
|
-
};
|
|
71
|
-
}
|
|
72
|
-
static duration(durationMs) {
|
|
73
|
-
const instance = new LayoutAnimationBuilder();
|
|
74
|
-
return instance.duration(durationMs);
|
|
75
|
-
}
|
|
76
|
-
duration(durationMs) {
|
|
77
|
-
this.durationV = durationMs;
|
|
78
|
-
return this;
|
|
79
|
-
}
|
|
80
|
-
static easing(easingFunction) {
|
|
81
|
-
const instance = new LayoutAnimationBuilder();
|
|
82
|
-
return instance.easing(easingFunction);
|
|
83
|
-
}
|
|
84
|
-
easing(easingFunction) {
|
|
85
|
-
this.easingV = easingFunction;
|
|
86
|
-
return this;
|
|
87
|
-
}
|
|
88
|
-
static delay(durationMs) {
|
|
89
|
-
const instance = new LayoutAnimationBuilder();
|
|
90
|
-
return instance.delay(durationMs);
|
|
91
|
-
}
|
|
92
|
-
delay(durationMs) {
|
|
93
|
-
this.delayV = durationMs;
|
|
94
|
-
return this;
|
|
95
|
-
}
|
|
96
|
-
static springify() {
|
|
97
|
-
const instance = new LayoutAnimationBuilder();
|
|
98
|
-
return instance.springify();
|
|
99
|
-
}
|
|
100
|
-
springify() {
|
|
101
|
-
this.type = withSpring;
|
|
102
|
-
return this;
|
|
103
|
-
}
|
|
104
|
-
static damping(damping) {
|
|
105
|
-
const instance = new LayoutAnimationBuilder();
|
|
106
|
-
return instance.damping(damping);
|
|
107
|
-
}
|
|
108
|
-
damping(damping) {
|
|
109
|
-
this.dampingV = damping;
|
|
110
|
-
return this;
|
|
111
|
-
}
|
|
112
|
-
static mass(mass) {
|
|
113
|
-
const instance = new LayoutAnimationBuilder();
|
|
114
|
-
return instance.mass(mass);
|
|
115
|
-
}
|
|
116
|
-
mass(mass) {
|
|
117
|
-
this.massV = mass;
|
|
118
|
-
return this;
|
|
119
|
-
}
|
|
120
|
-
static stiffness(stiffness) {
|
|
121
|
-
const instance = new LayoutAnimationBuilder();
|
|
122
|
-
return instance.stiffness(stiffness);
|
|
123
|
-
}
|
|
124
|
-
stiffness(stiffness) {
|
|
125
|
-
this.stiffnessV = stiffness;
|
|
126
|
-
return this;
|
|
127
|
-
}
|
|
128
|
-
static overshootClamping(overshootClamping) {
|
|
129
|
-
const instance = new LayoutAnimationBuilder();
|
|
130
|
-
return instance.overshootClamping(overshootClamping);
|
|
131
|
-
}
|
|
132
|
-
overshootClamping(overshootClamping) {
|
|
133
|
-
this.overshootClampingV = overshootClamping;
|
|
134
|
-
return this;
|
|
135
|
-
}
|
|
136
|
-
static restDisplacementThreshold(restDisplacementThreshold) {
|
|
137
|
-
const instance = new LayoutAnimationBuilder();
|
|
138
|
-
return instance.restDisplacementThreshold(restDisplacementThreshold);
|
|
139
|
-
}
|
|
140
|
-
restDisplacementThreshold(restDisplacementThreshold) {
|
|
141
|
-
this.restDisplacementThresholdV = restDisplacementThreshold;
|
|
142
|
-
return this;
|
|
143
|
-
}
|
|
144
|
-
static restSpeedThreshold(r) {
|
|
145
|
-
const instance = new LayoutAnimationBuilder();
|
|
146
|
-
return instance.restSpeedThreshold(r);
|
|
147
|
-
}
|
|
148
|
-
restSpeedThreshold(restSpeedThreshold) {
|
|
149
|
-
this.restSpeedThresholdV = restSpeedThreshold;
|
|
150
|
-
return this;
|
|
151
|
-
}
|
|
152
|
-
static withCallback(callback) {
|
|
153
|
-
const instance = new LayoutAnimationBuilder();
|
|
154
|
-
return instance.withCallback(callback);
|
|
155
|
-
}
|
|
156
|
-
withCallback(callback) {
|
|
157
|
-
this.callbackV = callback;
|
|
158
|
-
return this;
|
|
159
|
-
}
|
|
160
|
-
static build() {
|
|
161
|
-
const instance = new LayoutAnimationBuilder();
|
|
162
|
-
return instance.build();
|
|
163
|
-
}
|
|
164
|
-
}
|
|
165
|
-
export const Layout = LayoutAnimationBuilder;
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
export default {
|
|
2
|
-
async disconnectNodeFromView() {
|
|
3
|
-
// noop
|
|
4
|
-
},
|
|
5
|
-
async attachEvent(_viewTag, _eventName, _nodeID) {
|
|
6
|
-
// noop
|
|
7
|
-
},
|
|
8
|
-
async detachEvent(_viewTag, _eventName, _nodeID) {
|
|
9
|
-
// noop
|
|
10
|
-
},
|
|
11
|
-
async createNode(_nodeID, _config) {
|
|
12
|
-
// noop
|
|
13
|
-
},
|
|
14
|
-
async dropNode(_nodeID) {
|
|
15
|
-
// noop
|
|
16
|
-
},
|
|
17
|
-
async configureProps() {
|
|
18
|
-
// noop
|
|
19
|
-
},
|
|
20
|
-
async disconnectNodes() {
|
|
21
|
-
// noop
|
|
22
|
-
},
|
|
23
|
-
async addListener() {
|
|
24
|
-
// noop
|
|
25
|
-
},
|
|
26
|
-
async removeListeners() {
|
|
27
|
-
// noop
|
|
28
|
-
},
|
|
29
|
-
async removeAllListeners() {
|
|
30
|
-
// noop
|
|
31
|
-
},
|
|
32
|
-
async animateNextTransition() {
|
|
33
|
-
console.warn(
|
|
34
|
-
'Reanimated: animateNextTransition is unimplemented on current platform'
|
|
35
|
-
);
|
|
36
|
-
},
|
|
37
|
-
};
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
2
|
-
// @ts-nocheck
|
|
3
|
-
import { Platform } from 'react-native';
|
|
4
|
-
import reanimatedJS from './js-reanimated';
|
|
5
|
-
import { nativeShouldBeMock } from './PlatformChecker';
|
|
6
|
-
|
|
7
|
-
let exportedModule;
|
|
8
|
-
if (nativeShouldBeMock()) {
|
|
9
|
-
exportedModule = reanimatedJS;
|
|
10
|
-
} else {
|
|
11
|
-
const InnerNativeModule = global.__reanimatedModuleProxy;
|
|
12
|
-
|
|
13
|
-
const NativeReanimated = {
|
|
14
|
-
native: true,
|
|
15
|
-
useOnlyV1: InnerNativeModule == null,
|
|
16
|
-
|
|
17
|
-
installCoreFunctions(valueSetter) {
|
|
18
|
-
return InnerNativeModule.installCoreFunctions(valueSetter);
|
|
19
|
-
},
|
|
20
|
-
|
|
21
|
-
makeShareable(value) {
|
|
22
|
-
return InnerNativeModule.makeShareable(value);
|
|
23
|
-
},
|
|
24
|
-
|
|
25
|
-
makeMutable(value) {
|
|
26
|
-
return InnerNativeModule.makeMutable(value);
|
|
27
|
-
},
|
|
28
|
-
|
|
29
|
-
makeRemote(object) {
|
|
30
|
-
return InnerNativeModule.makeRemote(object);
|
|
31
|
-
},
|
|
32
|
-
|
|
33
|
-
startMapper(mapper, inputs = [], outputs = [], updater, tag, name) {
|
|
34
|
-
return InnerNativeModule.startMapper(
|
|
35
|
-
mapper,
|
|
36
|
-
inputs,
|
|
37
|
-
outputs,
|
|
38
|
-
updater,
|
|
39
|
-
tag,
|
|
40
|
-
name
|
|
41
|
-
);
|
|
42
|
-
},
|
|
43
|
-
|
|
44
|
-
stopMapper(mapperId) {
|
|
45
|
-
return InnerNativeModule.stopMapper(mapperId);
|
|
46
|
-
},
|
|
47
|
-
|
|
48
|
-
registerEventHandler(eventHash, eventHandler) {
|
|
49
|
-
return InnerNativeModule.registerEventHandler(eventHash, eventHandler);
|
|
50
|
-
},
|
|
51
|
-
|
|
52
|
-
unregisterEventHandler(registrationId) {
|
|
53
|
-
return InnerNativeModule.unregisterEventHandler(registrationId);
|
|
54
|
-
},
|
|
55
|
-
|
|
56
|
-
getViewProp(viewTag, propName, callback) {
|
|
57
|
-
return InnerNativeModule.getViewProp(viewTag, propName, callback);
|
|
58
|
-
},
|
|
59
|
-
};
|
|
60
|
-
|
|
61
|
-
if (NativeReanimated.useOnlyV1 && Platform.OS === 'android') {
|
|
62
|
-
console.warn(
|
|
63
|
-
`If you want to use Reanimated 2 then go through our installation steps https://docs.swmansion.com/react-native-reanimated/docs/installation`
|
|
64
|
-
);
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
exportedModule = NativeReanimated;
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
export default exportedModule as any; // TODO: just temporary type
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
/* global _stopObservingProgress, _startObservingProgress */
|
|
2
|
-
import { runOnUI } from '../core';
|
|
3
|
-
import { withStyleAnimation } from '../animation/styleAnimation';
|
|
4
|
-
|
|
5
|
-
runOnUI(() => {
|
|
6
|
-
'worklet';
|
|
7
|
-
|
|
8
|
-
const configs: Record<string, any> = {};
|
|
9
|
-
|
|
10
|
-
global.LayoutAnimationRepository = {
|
|
11
|
-
configs,
|
|
12
|
-
registerConfig(tag, config) {
|
|
13
|
-
configs[tag] = config;
|
|
14
|
-
},
|
|
15
|
-
removeConfig(tag) {
|
|
16
|
-
delete configs[tag];
|
|
17
|
-
},
|
|
18
|
-
startAnimationForTag(tag, type, yogaValues) {
|
|
19
|
-
if (configs[tag] == null) {
|
|
20
|
-
return; // :(
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
const style = configs[tag][type](yogaValues);
|
|
24
|
-
const sv: { value: boolean; _value: boolean } = configs[tag].sv;
|
|
25
|
-
_stopObservingProgress(tag, false);
|
|
26
|
-
_startObservingProgress(tag, sv);
|
|
27
|
-
sv._value = Object.assign({}, sv._value, style.initialValues);
|
|
28
|
-
_stopObservingProgress(tag, false);
|
|
29
|
-
const animation = withStyleAnimation(style.animations);
|
|
30
|
-
|
|
31
|
-
animation.callback = (finished?: boolean) => {
|
|
32
|
-
if (finished) {
|
|
33
|
-
_stopObservingProgress(tag, finished);
|
|
34
|
-
}
|
|
35
|
-
style.callback && style.callback(finished);
|
|
36
|
-
};
|
|
37
|
-
configs[tag].sv.value = animation;
|
|
38
|
-
_startObservingProgress(tag, sv);
|
|
39
|
-
},
|
|
40
|
-
};
|
|
41
|
-
})();
|