react-native-reanimated 3.0.0-rc.9 → 3.0.0
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/AnimatedSensor/AnimatedSensorModule.cpp +30 -12
- package/Common/cpp/AnimatedSensor/AnimatedSensorModule.h +2 -0
- package/Common/cpp/Fabric/FabricUtils.cpp +3 -107
- package/Common/cpp/Fabric/FabricUtils.h +3 -24
- package/Common/cpp/Fabric/ReanimatedUIManagerBinding.cpp +54 -37
- package/Common/cpp/LayoutAnimations/LayoutAnimationType.h +8 -0
- package/Common/cpp/LayoutAnimations/LayoutAnimationsManager.cpp +81 -26
- package/Common/cpp/LayoutAnimations/LayoutAnimationsManager.h +20 -3
- package/Common/cpp/NativeModules/NativeReanimatedModule.cpp +105 -109
- package/Common/cpp/NativeModules/NativeReanimatedModule.h +19 -12
- package/Common/cpp/NativeModules/NativeReanimatedModuleSpec.cpp +15 -7
- package/Common/cpp/NativeModules/NativeReanimatedModuleSpec.h +6 -2
- package/Common/cpp/ReanimatedRuntime/ReanimatedHermesRuntime.cpp +20 -1
- package/Common/cpp/ReanimatedRuntime/ReanimatedHermesRuntime.h +9 -0
- package/Common/cpp/ReanimatedRuntime/ReanimatedRuntime.cpp +5 -1
- package/Common/cpp/Registries/EventHandlerRegistry.cpp +8 -34
- package/Common/cpp/Registries/EventHandlerRegistry.h +7 -13
- package/Common/cpp/SharedItems/Shareables.cpp +9 -63
- package/Common/cpp/SharedItems/Shareables.h +77 -72
- package/Common/cpp/Tools/CollectionUtils.h +14 -0
- package/Common/cpp/Tools/JsiUtils.cpp +26 -0
- package/Common/cpp/Tools/JsiUtils.h +176 -0
- package/Common/cpp/Tools/PlatformDepMethodsHolder.h +5 -5
- package/Common/cpp/Tools/ReanimatedVersion.cpp +17 -0
- package/Common/cpp/Tools/ReanimatedVersion.h +11 -0
- package/Common/cpp/Tools/RuntimeDecorator.cpp +49 -230
- package/Common/cpp/Tools/RuntimeDecorator.h +0 -2
- package/Common/cpp/Tools/WorkletEventHandler.cpp +3 -2
- package/Common/cpp/Tools/WorkletEventHandler.h +14 -6
- package/RNReanimated.podspec +2 -1
- package/android/CMakeLists.txt +188 -181
- package/android/build.gradle +362 -311
- package/android/proguard-rules.pro +2 -0
- package/android/src/fabric/java/com/swmansion/reanimated/NativeProxy.java +63 -295
- package/android/src/main/cpp/LayoutAnimations.cpp +35 -5
- package/android/src/main/cpp/LayoutAnimations.h +23 -6
- package/android/src/main/cpp/NativeProxy.cpp +143 -98
- package/android/src/main/cpp/NativeProxy.h +22 -28
- package/android/src/main/java/com/swmansion/reanimated/ReanimatedPackage.java +5 -4
- package/android/src/main/java/com/swmansion/reanimated/Utils.java +7 -1
- package/android/src/main/java/com/swmansion/reanimated/keyboardObserver/ReanimatedKeyboardEventListener.java +10 -3
- package/android/src/main/java/com/swmansion/reanimated/layoutReanimation/AnimationsManager.java +218 -35
- package/android/src/main/java/com/swmansion/reanimated/layoutReanimation/LayoutAnimations.java +43 -17
- package/android/src/main/java/com/swmansion/reanimated/layoutReanimation/NativeMethodsHolder.java +6 -2
- package/android/src/main/java/com/swmansion/reanimated/layoutReanimation/SharedElement.java +19 -0
- package/android/src/main/java/com/swmansion/reanimated/layoutReanimation/SharedTransitionManager.java +610 -0
- package/android/src/main/java/com/swmansion/reanimated/layoutReanimation/Snapshot.java +93 -23
- package/android/src/main/java/com/swmansion/reanimated/nativeProxy/AnimationFrameCallback.java +19 -0
- package/android/src/main/java/com/swmansion/reanimated/nativeProxy/EventHandler.java +35 -0
- package/android/src/main/java/com/swmansion/reanimated/nativeProxy/KeyboardEventDataUpdater.java +16 -0
- package/android/src/main/java/com/swmansion/reanimated/nativeProxy/NativeProxyCommon.java +206 -0
- package/android/src/main/java/com/swmansion/reanimated/nativeProxy/SensorSetter.java +17 -0
- package/android/src/main/java/com/swmansion/reanimated/sensor/ReanimatedSensor.java +9 -3
- package/android/src/main/java/com/swmansion/reanimated/sensor/ReanimatedSensorContainer.java +3 -4
- package/android/src/main/java/com/swmansion/reanimated/sensor/ReanimatedSensorListener.java +31 -7
- package/android/src/paper/java/com/swmansion/reanimated/NativeProxy.java +90 -307
- package/android/src/reactNativeVersionPatch/ReanimatedUIManager/70/com/swmansion/reanimated/ReanimatedUIManagerFactory.java +16 -0
- package/android/src/reactNativeVersionPatch/ReanimatedUIManager/latest/com/swmansion/reanimated/ReanimatedUIManagerFactory.java +63 -0
- package/android/src/reactNativeVersionPatch/ReanimatedUIManager/latest/com/swmansion/reanimated/layoutReanimation/ReanimatedUIManager.java +271 -0
- package/android/src/reactNativeVersionPatch/nativeHierarchyManager/latest/com/swmansion/reanimated/layoutReanimation/ReanimatedNativeHierarchyManager.java +76 -20
- package/ios/LayoutReanimation/REAAnimationsManager.h +28 -4
- package/ios/LayoutReanimation/REAAnimationsManager.m +216 -61
- package/ios/LayoutReanimation/REAFrame.h +10 -0
- package/ios/LayoutReanimation/REAFrame.m +15 -0
- package/ios/LayoutReanimation/REAScreensHelper.h +19 -0
- package/ios/LayoutReanimation/REAScreensHelper.m +106 -0
- package/ios/LayoutReanimation/REASharedElement.h +15 -0
- package/ios/LayoutReanimation/REASharedElement.m +16 -0
- package/ios/LayoutReanimation/REASharedTransitionManager.h +17 -0
- package/ios/LayoutReanimation/REASharedTransitionManager.m +632 -0
- package/ios/LayoutReanimation/REASnapshot.h +1 -0
- package/ios/LayoutReanimation/REASnapshot.m +96 -11
- package/ios/LayoutReanimation/REAUIManager.mm +64 -17
- package/ios/REAModule.mm +2 -7
- package/ios/REANodesManager.mm +1 -21
- package/ios/keyboardObserver/REAKeyboardEventObserver.m +72 -36
- package/ios/native/NativeProxy.mm +75 -114
- package/ios/native/REAInitializer.mm +2 -7
- package/ios/native/REAJSIUtils.h +60 -2
- package/ios/sensor/ReanimatedSensor.h +6 -2
- package/ios/sensor/ReanimatedSensor.m +43 -7
- package/ios/sensor/ReanimatedSensorContainer.h +4 -1
- package/ios/sensor/ReanimatedSensorContainer.m +8 -2
- package/lib/commonjs/createAnimatedComponent.js +232 -28
- package/lib/commonjs/createAnimatedComponent.js.map +1 -1
- package/lib/commonjs/reanimated2/Colors.js +43 -22
- package/lib/commonjs/reanimated2/Colors.js.map +1 -1
- package/lib/commonjs/reanimated2/NativeReanimated/NativeReanimated.js +16 -33
- package/lib/commonjs/reanimated2/NativeReanimated/NativeReanimated.js.map +1 -1
- package/lib/commonjs/reanimated2/animation/styleAnimation.js +5 -1
- package/lib/commonjs/reanimated2/animation/styleAnimation.js.map +1 -1
- package/lib/commonjs/reanimated2/animation/util.js +17 -15
- package/lib/commonjs/reanimated2/animation/util.js.map +1 -1
- package/lib/commonjs/reanimated2/commonTypes.js +33 -1
- package/lib/commonjs/reanimated2/commonTypes.js.map +1 -1
- package/lib/commonjs/reanimated2/core.js +33 -14
- package/lib/commonjs/reanimated2/core.js.map +1 -1
- package/lib/commonjs/reanimated2/frameCallback/FrameCallbackRegistryUI.js +2 -2
- package/lib/commonjs/reanimated2/frameCallback/FrameCallbackRegistryUI.js.map +1 -1
- package/lib/commonjs/reanimated2/globals.d.js.map +1 -1
- package/lib/commonjs/reanimated2/hook/index.js +0 -6
- package/lib/commonjs/reanimated2/hook/index.js.map +1 -1
- package/lib/commonjs/reanimated2/hook/useAnimatedKeyboard.js +5 -2
- package/lib/commonjs/reanimated2/hook/useAnimatedKeyboard.js.map +1 -1
- package/lib/commonjs/reanimated2/hook/useAnimatedReaction.js +13 -1
- package/lib/commonjs/reanimated2/hook/useAnimatedReaction.js.map +1 -1
- package/lib/commonjs/reanimated2/hook/useAnimatedRef.js +1 -1
- package/lib/commonjs/reanimated2/hook/useAnimatedRef.js.map +1 -1
- package/lib/commonjs/reanimated2/hook/useAnimatedSensor.js +89 -16
- package/lib/commonjs/reanimated2/hook/useAnimatedSensor.js.map +1 -1
- package/lib/commonjs/reanimated2/hook/useAnimatedStyle.js +43 -40
- package/lib/commonjs/reanimated2/hook/useAnimatedStyle.js.map +1 -1
- package/lib/commonjs/reanimated2/hook/useDerivedValue.js +13 -1
- package/lib/commonjs/reanimated2/hook/useDerivedValue.js.map +1 -1
- package/lib/commonjs/reanimated2/hook/useScrollViewOffset.js +2 -2
- package/lib/commonjs/reanimated2/hook/useScrollViewOffset.js.map +1 -1
- package/lib/commonjs/reanimated2/hook/utils.js +18 -65
- package/lib/commonjs/reanimated2/hook/utils.js.map +1 -1
- package/lib/commonjs/reanimated2/index.js +13 -0
- package/lib/commonjs/reanimated2/index.js.map +1 -1
- package/lib/commonjs/reanimated2/initializers.js +71 -32
- package/lib/commonjs/reanimated2/initializers.js.map +1 -1
- package/lib/commonjs/reanimated2/interpolateColor.js +96 -19
- package/lib/commonjs/reanimated2/interpolateColor.js.map +1 -1
- package/lib/commonjs/reanimated2/jestUtils.js +1 -1
- package/lib/commonjs/reanimated2/jestUtils.js.map +1 -1
- package/lib/commonjs/reanimated2/js-reanimated/JSReanimated.js +103 -13
- package/lib/commonjs/reanimated2/js-reanimated/JSReanimated.js.map +1 -1
- package/lib/commonjs/reanimated2/js-reanimated/Mapper.js +22 -0
- package/lib/commonjs/reanimated2/js-reanimated/Mapper.js.map +1 -1
- package/lib/commonjs/reanimated2/js-reanimated/WebSensor.js +2 -0
- package/lib/commonjs/reanimated2/js-reanimated/WebSensor.js.map +1 -0
- package/lib/commonjs/reanimated2/js-reanimated/commonTypes.js.map +1 -1
- package/lib/commonjs/reanimated2/js-reanimated/global.js +0 -2
- package/lib/commonjs/reanimated2/js-reanimated/global.js.map +1 -1
- package/lib/commonjs/reanimated2/js-reanimated/index.js +0 -1
- package/lib/commonjs/reanimated2/js-reanimated/index.js.map +1 -1
- package/lib/commonjs/reanimated2/layoutReanimation/animationBuilder/commonTypes.js +11 -0
- package/lib/commonjs/reanimated2/layoutReanimation/animationBuilder/commonTypes.js.map +1 -1
- package/lib/commonjs/reanimated2/layoutReanimation/animationBuilder/index.js +8 -0
- package/lib/commonjs/reanimated2/layoutReanimation/animationBuilder/index.js.map +1 -1
- package/lib/commonjs/reanimated2/layoutReanimation/animationsManager.js +17 -9
- package/lib/commonjs/reanimated2/layoutReanimation/animationsManager.js.map +1 -1
- package/lib/commonjs/reanimated2/layoutReanimation/defaultAnimations/Bounce.js +16 -23
- package/lib/commonjs/reanimated2/layoutReanimation/defaultAnimations/Bounce.js.map +1 -1
- package/lib/commonjs/reanimated2/layoutReanimation/defaultAnimations/Lightspeed.js +8 -14
- package/lib/commonjs/reanimated2/layoutReanimation/defaultAnimations/Lightspeed.js.map +1 -1
- package/lib/commonjs/reanimated2/layoutReanimation/defaultAnimations/Roll.js +8 -14
- package/lib/commonjs/reanimated2/layoutReanimation/defaultAnimations/Roll.js.map +1 -1
- package/lib/commonjs/reanimated2/layoutReanimation/defaultAnimations/Slide.js +8 -15
- package/lib/commonjs/reanimated2/layoutReanimation/defaultAnimations/Slide.js.map +1 -1
- package/lib/commonjs/reanimated2/layoutReanimation/defaultAnimations/Zoom.js +16 -23
- package/lib/commonjs/reanimated2/layoutReanimation/defaultAnimations/Zoom.js.map +1 -1
- package/lib/commonjs/reanimated2/layoutReanimation/index.js +13 -0
- package/lib/commonjs/reanimated2/layoutReanimation/index.js.map +1 -1
- package/lib/commonjs/reanimated2/layoutReanimation/sharedTransitions/index.js +94 -0
- package/lib/commonjs/reanimated2/layoutReanimation/sharedTransitions/index.js.map +1 -0
- package/lib/commonjs/reanimated2/mappers.js +18 -6
- package/lib/commonjs/reanimated2/mappers.js.map +1 -1
- package/lib/commonjs/reanimated2/mock.js +20 -1
- package/lib/commonjs/reanimated2/mock.js.map +1 -1
- package/lib/commonjs/reanimated2/mutables.js +4 -2
- package/lib/commonjs/reanimated2/mutables.js.map +1 -1
- package/lib/commonjs/reanimated2/platform-specific/checkVersion.js +42 -0
- package/lib/commonjs/reanimated2/platform-specific/checkVersion.js.map +1 -0
- package/lib/commonjs/reanimated2/platform-specific/checkVersion.web.js +15 -0
- package/lib/commonjs/reanimated2/platform-specific/checkVersion.web.js.map +1 -0
- package/lib/commonjs/reanimated2/pluginUtils.js +11 -0
- package/lib/commonjs/reanimated2/pluginUtils.js.map +1 -0
- package/lib/commonjs/reanimated2/shareables.js +36 -15
- package/lib/commonjs/reanimated2/shareables.js.map +1 -1
- package/lib/commonjs/reanimated2/threads.js +114 -4
- package/lib/commonjs/reanimated2/threads.js.map +1 -1
- package/lib/commonjs/reanimated2/utils.js +7 -0
- package/lib/commonjs/reanimated2/utils.js.map +1 -1
- package/lib/commonjs/reanimated2/valueSetter.js +1 -3
- package/lib/commonjs/reanimated2/valueSetter.js.map +1 -1
- package/lib/module/createAnimatedComponent.js +229 -29
- package/lib/module/createAnimatedComponent.js.map +1 -1
- package/lib/module/reanimated2/Colors.js +35 -19
- package/lib/module/reanimated2/Colors.js.map +1 -1
- package/lib/module/reanimated2/NativeReanimated/NativeReanimated.js +16 -32
- package/lib/module/reanimated2/NativeReanimated/NativeReanimated.js.map +1 -1
- package/lib/module/reanimated2/animation/styleAnimation.js +5 -1
- package/lib/module/reanimated2/animation/styleAnimation.js.map +1 -1
- package/lib/module/reanimated2/animation/util.js +17 -16
- package/lib/module/reanimated2/animation/util.js.map +1 -1
- package/lib/module/reanimated2/commonTypes.js +29 -0
- package/lib/module/reanimated2/commonTypes.js.map +1 -1
- package/lib/module/reanimated2/core.js +32 -7
- package/lib/module/reanimated2/core.js.map +1 -1
- package/lib/module/reanimated2/frameCallback/FrameCallbackRegistryUI.js +2 -2
- package/lib/module/reanimated2/frameCallback/FrameCallbackRegistryUI.js.map +1 -1
- package/lib/module/reanimated2/globals.d.js.map +1 -1
- package/lib/module/reanimated2/hook/index.js +1 -1
- package/lib/module/reanimated2/hook/index.js.map +1 -1
- package/lib/module/reanimated2/hook/useAnimatedKeyboard.js +5 -2
- package/lib/module/reanimated2/hook/useAnimatedKeyboard.js.map +1 -1
- package/lib/module/reanimated2/hook/useAnimatedReaction.js +12 -1
- package/lib/module/reanimated2/hook/useAnimatedReaction.js.map +1 -1
- package/lib/module/reanimated2/hook/useAnimatedRef.js +2 -2
- package/lib/module/reanimated2/hook/useAnimatedRef.js.map +1 -1
- package/lib/module/reanimated2/hook/useAnimatedSensor.js +88 -13
- package/lib/module/reanimated2/hook/useAnimatedSensor.js.map +1 -1
- package/lib/module/reanimated2/hook/useAnimatedStyle.js +46 -43
- package/lib/module/reanimated2/hook/useAnimatedStyle.js.map +1 -1
- package/lib/module/reanimated2/hook/useDerivedValue.js +12 -1
- package/lib/module/reanimated2/hook/useDerivedValue.js.map +1 -1
- package/lib/module/reanimated2/hook/useScrollViewOffset.js +2 -2
- package/lib/module/reanimated2/hook/useScrollViewOffset.js.map +1 -1
- package/lib/module/reanimated2/hook/utils.js +17 -60
- package/lib/module/reanimated2/hook/utils.js.map +1 -1
- package/lib/module/reanimated2/index.js +1 -0
- package/lib/module/reanimated2/index.js.map +1 -1
- package/lib/module/reanimated2/initializers.js +72 -33
- package/lib/module/reanimated2/initializers.js.map +1 -1
- package/lib/module/reanimated2/interpolateColor.js +96 -19
- package/lib/module/reanimated2/interpolateColor.js.map +1 -1
- package/lib/module/reanimated2/jestUtils.js +1 -1
- package/lib/module/reanimated2/jestUtils.js.map +1 -1
- package/lib/module/reanimated2/js-reanimated/JSReanimated.js +103 -13
- package/lib/module/reanimated2/js-reanimated/JSReanimated.js.map +1 -1
- package/lib/module/reanimated2/js-reanimated/Mapper.js +21 -0
- package/lib/module/reanimated2/js-reanimated/Mapper.js.map +1 -1
- package/lib/module/reanimated2/js-reanimated/WebSensor.js +2 -0
- package/lib/module/reanimated2/js-reanimated/WebSensor.js.map +1 -0
- package/lib/module/reanimated2/js-reanimated/commonTypes.js.map +1 -1
- package/lib/module/reanimated2/js-reanimated/global.js +0 -2
- package/lib/module/reanimated2/js-reanimated/global.js.map +1 -1
- package/lib/module/reanimated2/js-reanimated/index.js +0 -1
- package/lib/module/reanimated2/js-reanimated/index.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/animationBuilder/commonTypes.js +9 -1
- package/lib/module/reanimated2/layoutReanimation/animationBuilder/commonTypes.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/animationBuilder/index.js +1 -0
- package/lib/module/reanimated2/layoutReanimation/animationBuilder/index.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/animationsManager.js +15 -8
- package/lib/module/reanimated2/layoutReanimation/animationsManager.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Bounce.js +16 -21
- package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Bounce.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Lightspeed.js +8 -12
- package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Lightspeed.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Roll.js +8 -12
- package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Roll.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Slide.js +8 -13
- package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Slide.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Zoom.js +16 -21
- package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Zoom.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/index.js +1 -0
- package/lib/module/reanimated2/layoutReanimation/index.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/sharedTransitions/index.js +82 -0
- package/lib/module/reanimated2/layoutReanimation/sharedTransitions/index.js.map +1 -0
- package/lib/module/reanimated2/mappers.js +16 -6
- package/lib/module/reanimated2/mappers.js.map +1 -1
- package/lib/module/reanimated2/mock.js +20 -1
- package/lib/module/reanimated2/mock.js.map +1 -1
- package/lib/module/reanimated2/mutables.js +4 -2
- package/lib/module/reanimated2/mutables.js.map +1 -1
- package/lib/module/reanimated2/platform-specific/checkVersion.js +35 -0
- package/lib/module/reanimated2/platform-specific/checkVersion.js.map +1 -0
- package/lib/module/reanimated2/platform-specific/checkVersion.web.js +8 -0
- package/lib/module/reanimated2/platform-specific/checkVersion.web.js.map +1 -0
- package/lib/module/reanimated2/pluginUtils.js +4 -0
- package/lib/module/reanimated2/pluginUtils.js.map +1 -0
- package/lib/module/reanimated2/shareables.js +36 -12
- package/lib/module/reanimated2/shareables.js.map +1 -1
- package/lib/module/reanimated2/threads.js +105 -4
- package/lib/module/reanimated2/threads.js.map +1 -1
- package/lib/module/reanimated2/utils.js +5 -0
- package/lib/module/reanimated2/utils.js.map +1 -1
- package/lib/module/reanimated2/valueSetter.js +1 -2
- package/lib/module/reanimated2/valueSetter.js.map +1 -1
- package/package.json +10 -10
- package/{plugin.js → plugin/index.js} +128 -249
- package/react-native-reanimated.d.ts +57 -10
- package/scripts/reanimated_utils.rb +15 -2
- package/src/createAnimatedComponent.tsx +238 -28
- package/src/reanimated2/Colors.ts +38 -11
- package/src/reanimated2/NativeReanimated/NativeReanimated.ts +52 -39
- package/src/reanimated2/animation/styleAnimation.ts +8 -1
- package/src/reanimated2/animation/util.ts +29 -16
- package/src/reanimated2/commonTypes.ts +28 -1
- package/src/reanimated2/core.ts +42 -9
- package/src/reanimated2/frameCallback/FrameCallbackRegistryUI.ts +2 -2
- package/src/reanimated2/globals.d.ts +12 -15
- package/src/reanimated2/hook/index.ts +1 -1
- package/src/reanimated2/hook/useAnimatedKeyboard.ts +10 -4
- package/src/reanimated2/hook/useAnimatedReaction.ts +12 -5
- package/src/reanimated2/hook/useAnimatedRef.ts +1 -4
- package/src/reanimated2/hook/useAnimatedSensor.ts +88 -11
- package/src/reanimated2/hook/useAnimatedStyle.ts +44 -36
- package/src/reanimated2/hook/useDerivedValue.ts +8 -1
- package/src/reanimated2/hook/useScrollViewOffset.ts +2 -2
- package/src/reanimated2/hook/utils.ts +15 -61
- package/src/reanimated2/index.ts +1 -0
- package/src/reanimated2/initializers.ts +76 -35
- package/src/reanimated2/interpolateColor.ts +104 -20
- package/src/reanimated2/jestUtils.ts +1 -1
- package/src/reanimated2/js-reanimated/JSReanimated.ts +98 -15
- package/src/reanimated2/js-reanimated/Mapper.ts +32 -0
- package/src/reanimated2/js-reanimated/WebSensor.ts +34 -0
- package/src/reanimated2/js-reanimated/commonTypes.ts +0 -1
- package/src/reanimated2/js-reanimated/global.ts +0 -1
- package/src/reanimated2/js-reanimated/index.ts +0 -1
- package/src/reanimated2/layoutReanimation/animationBuilder/commonTypes.ts +13 -1
- package/src/reanimated2/layoutReanimation/animationBuilder/index.ts +1 -0
- package/src/reanimated2/layoutReanimation/animationsManager.ts +17 -9
- package/src/reanimated2/layoutReanimation/defaultAnimations/Bounce.ts +16 -19
- package/src/reanimated2/layoutReanimation/defaultAnimations/Lightspeed.ts +14 -11
- package/src/reanimated2/layoutReanimation/defaultAnimations/Roll.ts +21 -11
- package/src/reanimated2/layoutReanimation/defaultAnimations/Slide.ts +32 -11
- package/src/reanimated2/layoutReanimation/defaultAnimations/Zoom.ts +36 -19
- package/src/reanimated2/layoutReanimation/index.ts +1 -0
- package/src/reanimated2/layoutReanimation/sharedTransitions/index.ts +87 -0
- package/src/reanimated2/mappers.ts +17 -6
- package/src/reanimated2/mock.ts +24 -1
- package/src/reanimated2/mutables.ts +2 -0
- package/src/reanimated2/platform-specific/checkVersion.ts +39 -0
- package/src/reanimated2/platform-specific/checkVersion.web.ts +6 -0
- package/src/reanimated2/pluginUtils.ts +8 -0
- package/src/reanimated2/shareables.ts +45 -16
- package/src/reanimated2/threads.ts +103 -1
- package/src/reanimated2/utils.ts +6 -0
- package/src/reanimated2/valueSetter.ts +1 -2
- package/lib/commonjs/reanimated2/time.js +0 -55
- package/lib/commonjs/reanimated2/time.js.map +0 -1
- package/lib/module/reanimated2/time.js +0 -37
- package/lib/module/reanimated2/time.js.map +0 -1
- package/src/reanimated2/time.ts +0 -30
- /package/android/src/{main/java → reactNativeVersionPatch/ReanimatedUIManager/70}/com/swmansion/reanimated/layoutReanimation/ReanimatedUIManager.java +0 -0
|
@@ -3,11 +3,8 @@ import {
|
|
|
3
3
|
IEntryExitAnimationBuilder,
|
|
4
4
|
} from '../animationBuilder/commonTypes';
|
|
5
5
|
import { withSequence, withTiming } from '../../animation';
|
|
6
|
-
import { Dimensions } from 'react-native';
|
|
7
6
|
import { ComplexAnimationBuilder } from '../animationBuilder/ComplexAnimationBuilder';
|
|
8
7
|
|
|
9
|
-
const { width, height } = Dimensions.get('window');
|
|
10
|
-
|
|
11
8
|
export class BounceIn
|
|
12
9
|
extends ComplexAnimationBuilder
|
|
13
10
|
implements IEntryExitAnimationBuilder
|
|
@@ -82,7 +79,7 @@ export class BounceInDown
|
|
|
82
79
|
const callback = this.callbackV;
|
|
83
80
|
const initialValues = this.initialValues;
|
|
84
81
|
|
|
85
|
-
return () => {
|
|
82
|
+
return (values) => {
|
|
86
83
|
'worklet';
|
|
87
84
|
return {
|
|
88
85
|
animations: {
|
|
@@ -103,7 +100,7 @@ export class BounceInDown
|
|
|
103
100
|
initialValues: {
|
|
104
101
|
transform: [
|
|
105
102
|
{
|
|
106
|
-
translateY:
|
|
103
|
+
translateY: values.windowHeight,
|
|
107
104
|
},
|
|
108
105
|
],
|
|
109
106
|
...initialValues,
|
|
@@ -137,7 +134,7 @@ export class BounceInUp
|
|
|
137
134
|
const callback = this.callbackV;
|
|
138
135
|
const initialValues = this.initialValues;
|
|
139
136
|
|
|
140
|
-
return () => {
|
|
137
|
+
return (values) => {
|
|
141
138
|
'worklet';
|
|
142
139
|
return {
|
|
143
140
|
animations: {
|
|
@@ -156,7 +153,7 @@ export class BounceInUp
|
|
|
156
153
|
],
|
|
157
154
|
},
|
|
158
155
|
initialValues: {
|
|
159
|
-
transform: [{ translateY: -
|
|
156
|
+
transform: [{ translateY: -values.windowHeight }],
|
|
160
157
|
...initialValues,
|
|
161
158
|
},
|
|
162
159
|
callback: callback,
|
|
@@ -188,7 +185,7 @@ export class BounceInLeft
|
|
|
188
185
|
const callback = this.callbackV;
|
|
189
186
|
const initialValues = this.initialValues;
|
|
190
187
|
|
|
191
|
-
return () => {
|
|
188
|
+
return (values) => {
|
|
192
189
|
'worklet';
|
|
193
190
|
return {
|
|
194
191
|
animations: {
|
|
@@ -207,7 +204,7 @@ export class BounceInLeft
|
|
|
207
204
|
],
|
|
208
205
|
},
|
|
209
206
|
initialValues: {
|
|
210
|
-
transform: [{ translateX: -
|
|
207
|
+
transform: [{ translateX: -values.windowWidth }],
|
|
211
208
|
...initialValues,
|
|
212
209
|
},
|
|
213
210
|
callback: callback,
|
|
@@ -239,7 +236,7 @@ export class BounceInRight
|
|
|
239
236
|
const callback = this.callbackV;
|
|
240
237
|
const initialValues = this.initialValues;
|
|
241
238
|
|
|
242
|
-
return () => {
|
|
239
|
+
return (values) => {
|
|
243
240
|
'worklet';
|
|
244
241
|
return {
|
|
245
242
|
animations: {
|
|
@@ -258,7 +255,7 @@ export class BounceInRight
|
|
|
258
255
|
],
|
|
259
256
|
},
|
|
260
257
|
initialValues: {
|
|
261
|
-
transform: [{ translateX:
|
|
258
|
+
transform: [{ translateX: values.windowWidth }],
|
|
262
259
|
...initialValues,
|
|
263
260
|
},
|
|
264
261
|
callback: callback,
|
|
@@ -341,7 +338,7 @@ export class BounceOutDown
|
|
|
341
338
|
const callback = this.callbackV;
|
|
342
339
|
const initialValues = this.initialValues;
|
|
343
340
|
|
|
344
|
-
return () => {
|
|
341
|
+
return (values) => {
|
|
345
342
|
'worklet';
|
|
346
343
|
return {
|
|
347
344
|
animations: {
|
|
@@ -353,7 +350,7 @@ export class BounceOutDown
|
|
|
353
350
|
withTiming(-10, { duration: duration * 0.15 }),
|
|
354
351
|
withTiming(10, { duration: duration * 0.15 }),
|
|
355
352
|
withTiming(-20, { duration: duration * 0.15 }),
|
|
356
|
-
withTiming(
|
|
353
|
+
withTiming(values.windowHeight, {
|
|
357
354
|
duration: duration * 0.55,
|
|
358
355
|
})
|
|
359
356
|
)
|
|
@@ -394,7 +391,7 @@ export class BounceOutUp
|
|
|
394
391
|
const callback = this.callbackV;
|
|
395
392
|
const initialValues = this.initialValues;
|
|
396
393
|
|
|
397
|
-
return () => {
|
|
394
|
+
return (values) => {
|
|
398
395
|
'worklet';
|
|
399
396
|
return {
|
|
400
397
|
animations: {
|
|
@@ -406,7 +403,7 @@ export class BounceOutUp
|
|
|
406
403
|
withTiming(10, { duration: duration * 0.15 }),
|
|
407
404
|
withTiming(-10, { duration: duration * 0.15 }),
|
|
408
405
|
withTiming(20, { duration: duration * 0.15 }),
|
|
409
|
-
withTiming(-
|
|
406
|
+
withTiming(-values.windowHeight, {
|
|
410
407
|
duration: duration * 0.55,
|
|
411
408
|
})
|
|
412
409
|
)
|
|
@@ -447,7 +444,7 @@ export class BounceOutLeft
|
|
|
447
444
|
const callback = this.callbackV;
|
|
448
445
|
const initialValues = this.initialValues;
|
|
449
446
|
|
|
450
|
-
return () => {
|
|
447
|
+
return (values) => {
|
|
451
448
|
'worklet';
|
|
452
449
|
return {
|
|
453
450
|
animations: {
|
|
@@ -459,7 +456,7 @@ export class BounceOutLeft
|
|
|
459
456
|
withTiming(10, { duration: duration * 0.15 }),
|
|
460
457
|
withTiming(-10, { duration: duration * 0.15 }),
|
|
461
458
|
withTiming(20, { duration: duration * 0.15 }),
|
|
462
|
-
withTiming(-
|
|
459
|
+
withTiming(-values.windowWidth, {
|
|
463
460
|
duration: duration * 0.55,
|
|
464
461
|
})
|
|
465
462
|
)
|
|
@@ -500,7 +497,7 @@ export class BounceOutRight
|
|
|
500
497
|
const callback = this.callbackV;
|
|
501
498
|
const initialValues = this.initialValues;
|
|
502
499
|
|
|
503
|
-
return () => {
|
|
500
|
+
return (values) => {
|
|
504
501
|
'worklet';
|
|
505
502
|
return {
|
|
506
503
|
animations: {
|
|
@@ -512,7 +509,7 @@ export class BounceOutRight
|
|
|
512
509
|
withTiming(-10, { duration: duration * 0.15 }),
|
|
513
510
|
withTiming(10, { duration: duration * 0.15 }),
|
|
514
511
|
withTiming(-20, { duration: duration * 0.15 }),
|
|
515
|
-
withTiming(
|
|
512
|
+
withTiming(values.windowWidth, {
|
|
516
513
|
duration: duration * 0.55,
|
|
517
514
|
})
|
|
518
515
|
)
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { Dimensions } from 'react-native';
|
|
2
1
|
import { withSequence, withTiming } from '../../animation';
|
|
3
2
|
import { ComplexAnimationBuilder } from '../animationBuilder';
|
|
4
3
|
import {
|
|
@@ -6,8 +5,6 @@ import {
|
|
|
6
5
|
IEntryExitAnimationBuilder,
|
|
7
6
|
} from '../animationBuilder/commonTypes';
|
|
8
7
|
|
|
9
|
-
const { width } = Dimensions.get('window');
|
|
10
|
-
|
|
11
8
|
export class LightSpeedInRight
|
|
12
9
|
extends ComplexAnimationBuilder
|
|
13
10
|
implements IEntryExitAnimationBuilder
|
|
@@ -24,7 +21,7 @@ export class LightSpeedInRight
|
|
|
24
21
|
const callback = this.callbackV;
|
|
25
22
|
const initialValues = this.initialValues;
|
|
26
23
|
|
|
27
|
-
return () => {
|
|
24
|
+
return (values) => {
|
|
28
25
|
'worklet';
|
|
29
26
|
return {
|
|
30
27
|
animations: {
|
|
@@ -50,7 +47,7 @@ export class LightSpeedInRight
|
|
|
50
47
|
},
|
|
51
48
|
initialValues: {
|
|
52
49
|
opacity: 0,
|
|
53
|
-
transform: [{ translateX:
|
|
50
|
+
transform: [{ translateX: values.windowWidth }, { skewX: '-45deg' }],
|
|
54
51
|
...initialValues,
|
|
55
52
|
},
|
|
56
53
|
callback: callback,
|
|
@@ -75,7 +72,7 @@ export class LightSpeedInLeft
|
|
|
75
72
|
const callback = this.callbackV;
|
|
76
73
|
const initialValues = this.initialValues;
|
|
77
74
|
|
|
78
|
-
return () => {
|
|
75
|
+
return (values) => {
|
|
79
76
|
'worklet';
|
|
80
77
|
return {
|
|
81
78
|
animations: {
|
|
@@ -101,7 +98,7 @@ export class LightSpeedInLeft
|
|
|
101
98
|
},
|
|
102
99
|
initialValues: {
|
|
103
100
|
opacity: 0,
|
|
104
|
-
transform: [{ translateX: -
|
|
101
|
+
transform: [{ translateX: -values.windowWidth }, { skewX: '45deg' }],
|
|
105
102
|
...initialValues,
|
|
106
103
|
},
|
|
107
104
|
callback: callback,
|
|
@@ -125,14 +122,17 @@ export class LightSpeedOutRight
|
|
|
125
122
|
const callback = this.callbackV;
|
|
126
123
|
const initialValues = this.initialValues;
|
|
127
124
|
|
|
128
|
-
return () => {
|
|
125
|
+
return (values) => {
|
|
129
126
|
'worklet';
|
|
130
127
|
return {
|
|
131
128
|
animations: {
|
|
132
129
|
opacity: delayFunction(delay, animation(0, config)),
|
|
133
130
|
transform: [
|
|
134
131
|
{
|
|
135
|
-
translateX: delayFunction(
|
|
132
|
+
translateX: delayFunction(
|
|
133
|
+
delay,
|
|
134
|
+
animation(values.windowWidth, config)
|
|
135
|
+
),
|
|
136
136
|
},
|
|
137
137
|
{
|
|
138
138
|
skewX: delayFunction(delay, animation('-45deg', config)),
|
|
@@ -165,14 +165,17 @@ export class LightSpeedOutLeft
|
|
|
165
165
|
const callback = this.callbackV;
|
|
166
166
|
const initialValues = this.initialValues;
|
|
167
167
|
|
|
168
|
-
return () => {
|
|
168
|
+
return (values) => {
|
|
169
169
|
'worklet';
|
|
170
170
|
return {
|
|
171
171
|
animations: {
|
|
172
172
|
opacity: delayFunction(delay, animation(0, config)),
|
|
173
173
|
transform: [
|
|
174
174
|
{
|
|
175
|
-
translateX: delayFunction(
|
|
175
|
+
translateX: delayFunction(
|
|
176
|
+
delay,
|
|
177
|
+
animation(-values.windowWidth, config)
|
|
178
|
+
),
|
|
176
179
|
},
|
|
177
180
|
{
|
|
178
181
|
skewX: delayFunction(delay, animation('45deg', config)),
|
|
@@ -1,12 +1,9 @@
|
|
|
1
|
-
import { Dimensions } from 'react-native';
|
|
2
1
|
import { ComplexAnimationBuilder } from '../animationBuilder';
|
|
3
2
|
import {
|
|
4
3
|
EntryExitAnimationFunction,
|
|
5
4
|
IEntryExitAnimationBuilder,
|
|
6
5
|
} from '../animationBuilder/commonTypes';
|
|
7
6
|
|
|
8
|
-
const { width } = Dimensions.get('window');
|
|
9
|
-
|
|
10
7
|
export class RollInLeft
|
|
11
8
|
extends ComplexAnimationBuilder
|
|
12
9
|
implements IEntryExitAnimationBuilder
|
|
@@ -22,7 +19,7 @@ export class RollInLeft
|
|
|
22
19
|
const callback = this.callbackV;
|
|
23
20
|
const initialValues = this.initialValues;
|
|
24
21
|
|
|
25
|
-
return () => {
|
|
22
|
+
return (values) => {
|
|
26
23
|
'worklet';
|
|
27
24
|
return {
|
|
28
25
|
animations: {
|
|
@@ -32,7 +29,10 @@ export class RollInLeft
|
|
|
32
29
|
],
|
|
33
30
|
},
|
|
34
31
|
initialValues: {
|
|
35
|
-
transform: [
|
|
32
|
+
transform: [
|
|
33
|
+
{ translateX: -values.windowWidth },
|
|
34
|
+
{ rotate: '-180deg' },
|
|
35
|
+
],
|
|
36
36
|
...initialValues,
|
|
37
37
|
},
|
|
38
38
|
callback: callback,
|
|
@@ -56,7 +56,7 @@ export class RollInRight
|
|
|
56
56
|
const callback = this.callbackV;
|
|
57
57
|
const initialValues = this.initialValues;
|
|
58
58
|
|
|
59
|
-
return () => {
|
|
59
|
+
return (values) => {
|
|
60
60
|
'worklet';
|
|
61
61
|
return {
|
|
62
62
|
animations: {
|
|
@@ -66,7 +66,7 @@ export class RollInRight
|
|
|
66
66
|
],
|
|
67
67
|
},
|
|
68
68
|
initialValues: {
|
|
69
|
-
transform: [{ translateX:
|
|
69
|
+
transform: [{ translateX: values.windowWidth }, { rotate: '180deg' }],
|
|
70
70
|
...initialValues,
|
|
71
71
|
},
|
|
72
72
|
callback: callback,
|
|
@@ -90,12 +90,17 @@ export class RollOutLeft
|
|
|
90
90
|
const callback = this.callbackV;
|
|
91
91
|
const initialValues = this.initialValues;
|
|
92
92
|
|
|
93
|
-
return () => {
|
|
93
|
+
return (values) => {
|
|
94
94
|
'worklet';
|
|
95
95
|
return {
|
|
96
96
|
animations: {
|
|
97
97
|
transform: [
|
|
98
|
-
{
|
|
98
|
+
{
|
|
99
|
+
translateX: delayFunction(
|
|
100
|
+
delay,
|
|
101
|
+
animation(-values.windowWidth, config)
|
|
102
|
+
),
|
|
103
|
+
},
|
|
99
104
|
{ rotate: delayFunction(delay, animation('-180deg', config)) },
|
|
100
105
|
],
|
|
101
106
|
},
|
|
@@ -124,12 +129,17 @@ export class RollOutRight
|
|
|
124
129
|
const callback = this.callbackV;
|
|
125
130
|
const initialValues = this.initialValues;
|
|
126
131
|
|
|
127
|
-
return () => {
|
|
132
|
+
return (values) => {
|
|
128
133
|
'worklet';
|
|
129
134
|
return {
|
|
130
135
|
animations: {
|
|
131
136
|
transform: [
|
|
132
|
-
{
|
|
137
|
+
{
|
|
138
|
+
translateX: delayFunction(
|
|
139
|
+
delay,
|
|
140
|
+
animation(values.windowWidth, config)
|
|
141
|
+
),
|
|
142
|
+
},
|
|
133
143
|
{ rotate: delayFunction(delay, animation('180deg', config)) },
|
|
134
144
|
],
|
|
135
145
|
},
|
|
@@ -5,11 +5,8 @@ import {
|
|
|
5
5
|
IEntryAnimationBuilder,
|
|
6
6
|
IExitAnimationBuilder,
|
|
7
7
|
} from '../animationBuilder/commonTypes';
|
|
8
|
-
import { Dimensions } from 'react-native';
|
|
9
8
|
import { ComplexAnimationBuilder } from '../animationBuilder';
|
|
10
9
|
|
|
11
|
-
const { width, height } = Dimensions.get('window');
|
|
12
|
-
|
|
13
10
|
export class SlideInRight
|
|
14
11
|
extends ComplexAnimationBuilder
|
|
15
12
|
implements IEntryAnimationBuilder
|
|
@@ -35,7 +32,7 @@ export class SlideInRight
|
|
|
35
32
|
),
|
|
36
33
|
},
|
|
37
34
|
initialValues: {
|
|
38
|
-
originX: values.targetOriginX +
|
|
35
|
+
originX: values.targetOriginX + values.windowWidth,
|
|
39
36
|
...initialValues,
|
|
40
37
|
},
|
|
41
38
|
callback: callback,
|
|
@@ -69,7 +66,7 @@ export class SlideInLeft
|
|
|
69
66
|
),
|
|
70
67
|
},
|
|
71
68
|
initialValues: {
|
|
72
|
-
originX: values.targetOriginX -
|
|
69
|
+
originX: values.targetOriginX - values.windowWidth,
|
|
73
70
|
...initialValues,
|
|
74
71
|
},
|
|
75
72
|
callback: callback,
|
|
@@ -99,7 +96,13 @@ export class SlideOutRight
|
|
|
99
96
|
animations: {
|
|
100
97
|
originX: delayFunction(
|
|
101
98
|
delay,
|
|
102
|
-
animation(
|
|
99
|
+
animation(
|
|
100
|
+
Math.max(
|
|
101
|
+
values.currentOriginX + values.windowWidth,
|
|
102
|
+
values.windowWidth
|
|
103
|
+
),
|
|
104
|
+
config
|
|
105
|
+
)
|
|
103
106
|
),
|
|
104
107
|
},
|
|
105
108
|
initialValues: {
|
|
@@ -133,7 +136,13 @@ export class SlideOutLeft
|
|
|
133
136
|
animations: {
|
|
134
137
|
originX: delayFunction(
|
|
135
138
|
delay,
|
|
136
|
-
animation(
|
|
139
|
+
animation(
|
|
140
|
+
Math.min(
|
|
141
|
+
values.currentOriginX - values.windowWidth,
|
|
142
|
+
-values.windowWidth
|
|
143
|
+
),
|
|
144
|
+
config
|
|
145
|
+
)
|
|
137
146
|
),
|
|
138
147
|
},
|
|
139
148
|
initialValues: {
|
|
@@ -171,7 +180,7 @@ export class SlideInUp
|
|
|
171
180
|
),
|
|
172
181
|
},
|
|
173
182
|
initialValues: {
|
|
174
|
-
originY: -
|
|
183
|
+
originY: -values.windowHeight,
|
|
175
184
|
...initialValues,
|
|
176
185
|
},
|
|
177
186
|
callback: callback,
|
|
@@ -205,7 +214,7 @@ export class SlideInDown
|
|
|
205
214
|
),
|
|
206
215
|
},
|
|
207
216
|
initialValues: {
|
|
208
|
-
originY: values.targetOriginY +
|
|
217
|
+
originY: values.targetOriginY + values.windowHeight,
|
|
209
218
|
...initialValues,
|
|
210
219
|
},
|
|
211
220
|
callback: callback,
|
|
@@ -235,7 +244,13 @@ export class SlideOutUp
|
|
|
235
244
|
animations: {
|
|
236
245
|
originY: delayFunction(
|
|
237
246
|
delay,
|
|
238
|
-
animation(
|
|
247
|
+
animation(
|
|
248
|
+
Math.min(
|
|
249
|
+
values.currentOriginY - values.windowHeight,
|
|
250
|
+
-values.windowHeight
|
|
251
|
+
),
|
|
252
|
+
config
|
|
253
|
+
)
|
|
239
254
|
),
|
|
240
255
|
},
|
|
241
256
|
initialValues: { originY: values.currentOriginY, ...initialValues },
|
|
@@ -266,7 +281,13 @@ export class SlideOutDown
|
|
|
266
281
|
animations: {
|
|
267
282
|
originY: delayFunction(
|
|
268
283
|
delay,
|
|
269
|
-
animation(
|
|
284
|
+
animation(
|
|
285
|
+
Math.max(
|
|
286
|
+
values.currentOriginY + values.windowHeight,
|
|
287
|
+
values.windowHeight
|
|
288
|
+
),
|
|
289
|
+
config
|
|
290
|
+
)
|
|
270
291
|
),
|
|
271
292
|
},
|
|
272
293
|
initialValues: { originY: values.currentOriginY, ...initialValues },
|
|
@@ -7,11 +7,8 @@ import {
|
|
|
7
7
|
IEntryAnimationBuilder,
|
|
8
8
|
IExitAnimationBuilder,
|
|
9
9
|
} from '../animationBuilder/commonTypes';
|
|
10
|
-
import { Dimensions } from 'react-native';
|
|
11
10
|
import { ComplexAnimationBuilder } from '../animationBuilder';
|
|
12
11
|
|
|
13
|
-
const { width, height } = Dimensions.get('window');
|
|
14
|
-
|
|
15
12
|
export class ZoomIn
|
|
16
13
|
extends ComplexAnimationBuilder
|
|
17
14
|
implements IEntryExitAnimationBuilder
|
|
@@ -93,7 +90,7 @@ export class ZoomInLeft
|
|
|
93
90
|
const callback = this.callbackV;
|
|
94
91
|
const initialValues = this.initialValues;
|
|
95
92
|
|
|
96
|
-
return () => {
|
|
93
|
+
return (values) => {
|
|
97
94
|
'worklet';
|
|
98
95
|
return {
|
|
99
96
|
animations: {
|
|
@@ -103,7 +100,7 @@ export class ZoomInLeft
|
|
|
103
100
|
],
|
|
104
101
|
},
|
|
105
102
|
initialValues: {
|
|
106
|
-
transform: [{ translateX: -
|
|
103
|
+
transform: [{ translateX: -values.windowWidth }, { scale: 0 }],
|
|
107
104
|
...initialValues,
|
|
108
105
|
},
|
|
109
106
|
callback: callback,
|
|
@@ -127,7 +124,7 @@ export class ZoomInRight
|
|
|
127
124
|
const callback = this.callbackV;
|
|
128
125
|
const initialValues = this.initialValues;
|
|
129
126
|
|
|
130
|
-
return () => {
|
|
127
|
+
return (values) => {
|
|
131
128
|
'worklet';
|
|
132
129
|
return {
|
|
133
130
|
animations: {
|
|
@@ -137,7 +134,7 @@ export class ZoomInRight
|
|
|
137
134
|
],
|
|
138
135
|
},
|
|
139
136
|
initialValues: {
|
|
140
|
-
transform: [{ translateX:
|
|
137
|
+
transform: [{ translateX: values.windowWidth }, { scale: 0 }],
|
|
141
138
|
...initialValues,
|
|
142
139
|
},
|
|
143
140
|
callback: callback,
|
|
@@ -161,7 +158,7 @@ export class ZoomInUp
|
|
|
161
158
|
const callback = this.callbackV;
|
|
162
159
|
const initialValues = this.initialValues;
|
|
163
160
|
|
|
164
|
-
return () => {
|
|
161
|
+
return (values) => {
|
|
165
162
|
'worklet';
|
|
166
163
|
return {
|
|
167
164
|
animations: {
|
|
@@ -171,7 +168,7 @@ export class ZoomInUp
|
|
|
171
168
|
],
|
|
172
169
|
},
|
|
173
170
|
initialValues: {
|
|
174
|
-
transform: [{ translateY: -
|
|
171
|
+
transform: [{ translateY: -values.windowHeight }, { scale: 0 }],
|
|
175
172
|
...initialValues,
|
|
176
173
|
},
|
|
177
174
|
callback: callback,
|
|
@@ -195,7 +192,7 @@ export class ZoomInDown
|
|
|
195
192
|
const callback = this.callbackV;
|
|
196
193
|
const initialValues = this.initialValues;
|
|
197
194
|
|
|
198
|
-
return () => {
|
|
195
|
+
return (values) => {
|
|
199
196
|
'worklet';
|
|
200
197
|
return {
|
|
201
198
|
animations: {
|
|
@@ -205,7 +202,7 @@ export class ZoomInDown
|
|
|
205
202
|
],
|
|
206
203
|
},
|
|
207
204
|
initialValues: {
|
|
208
|
-
transform: [{ translateY:
|
|
205
|
+
transform: [{ translateY: values.windowHeight }, { scale: 0 }],
|
|
209
206
|
...initialValues,
|
|
210
207
|
},
|
|
211
208
|
callback: callback,
|
|
@@ -363,12 +360,17 @@ export class ZoomOutLeft
|
|
|
363
360
|
const callback = this.callbackV;
|
|
364
361
|
const initialValues = this.initialValues;
|
|
365
362
|
|
|
366
|
-
return () => {
|
|
363
|
+
return (values) => {
|
|
367
364
|
'worklet';
|
|
368
365
|
return {
|
|
369
366
|
animations: {
|
|
370
367
|
transform: [
|
|
371
|
-
{
|
|
368
|
+
{
|
|
369
|
+
translateX: delayFunction(
|
|
370
|
+
delay,
|
|
371
|
+
animation(-values.windowWidth, config)
|
|
372
|
+
),
|
|
373
|
+
},
|
|
372
374
|
{ scale: delayFunction(delay, animation(0, config)) },
|
|
373
375
|
],
|
|
374
376
|
},
|
|
@@ -397,12 +399,17 @@ export class ZoomOutRight
|
|
|
397
399
|
const callback = this.callbackV;
|
|
398
400
|
const initialValues = this.initialValues;
|
|
399
401
|
|
|
400
|
-
return () => {
|
|
402
|
+
return (values) => {
|
|
401
403
|
'worklet';
|
|
402
404
|
return {
|
|
403
405
|
animations: {
|
|
404
406
|
transform: [
|
|
405
|
-
{
|
|
407
|
+
{
|
|
408
|
+
translateX: delayFunction(
|
|
409
|
+
delay,
|
|
410
|
+
animation(values.windowWidth, config)
|
|
411
|
+
),
|
|
412
|
+
},
|
|
406
413
|
{ scale: delayFunction(delay, animation(0, config)) },
|
|
407
414
|
],
|
|
408
415
|
},
|
|
@@ -431,12 +438,17 @@ export class ZoomOutUp
|
|
|
431
438
|
const callback = this.callbackV;
|
|
432
439
|
const initialValues = this.initialValues;
|
|
433
440
|
|
|
434
|
-
return () => {
|
|
441
|
+
return (values) => {
|
|
435
442
|
'worklet';
|
|
436
443
|
return {
|
|
437
444
|
animations: {
|
|
438
445
|
transform: [
|
|
439
|
-
{
|
|
446
|
+
{
|
|
447
|
+
translateY: delayFunction(
|
|
448
|
+
delay,
|
|
449
|
+
animation(-values.windowHeight, config)
|
|
450
|
+
),
|
|
451
|
+
},
|
|
440
452
|
{ scale: delayFunction(delay, animation(0, config)) },
|
|
441
453
|
],
|
|
442
454
|
},
|
|
@@ -465,12 +477,17 @@ export class ZoomOutDown
|
|
|
465
477
|
const callback = this.callbackV;
|
|
466
478
|
const initialValues = this.initialValues;
|
|
467
479
|
|
|
468
|
-
return () => {
|
|
480
|
+
return (values) => {
|
|
469
481
|
'worklet';
|
|
470
482
|
return {
|
|
471
483
|
animations: {
|
|
472
484
|
transform: [
|
|
473
|
-
{
|
|
485
|
+
{
|
|
486
|
+
translateY: delayFunction(
|
|
487
|
+
delay,
|
|
488
|
+
animation(values.windowHeight, config)
|
|
489
|
+
),
|
|
490
|
+
},
|
|
474
491
|
{ scale: delayFunction(delay, animation(0, config)) },
|
|
475
492
|
],
|
|
476
493
|
},
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import { withTiming } from '../../animation';
|
|
2
|
+
import {
|
|
3
|
+
ILayoutAnimationBuilder,
|
|
4
|
+
LayoutAnimationFunction,
|
|
5
|
+
LayoutAnimationsValues,
|
|
6
|
+
} from '../animationBuilder/commonTypes';
|
|
7
|
+
import { StyleProps } from '../../commonTypes';
|
|
8
|
+
|
|
9
|
+
const supportedProps = ['width', 'height', 'originX', 'originY', 'transform'];
|
|
10
|
+
|
|
11
|
+
type AnimationFactoryType = (values: LayoutAnimationsValues) => StyleProps;
|
|
12
|
+
|
|
13
|
+
export class SharedTransition implements ILayoutAnimationBuilder {
|
|
14
|
+
animationFactory: AnimationFactoryType | null = null;
|
|
15
|
+
defaultDuration = 500;
|
|
16
|
+
|
|
17
|
+
static createInstance(): SharedTransition {
|
|
18
|
+
return new SharedTransition();
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
static custom(animationFactory: AnimationFactoryType): SharedTransition {
|
|
22
|
+
return this.createInstance().custom(animationFactory);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
custom(animationFactory: AnimationFactoryType): SharedTransition {
|
|
26
|
+
this.animationFactory = animationFactory;
|
|
27
|
+
return this;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
static build(): LayoutAnimationFunction {
|
|
31
|
+
return this.createInstance().build();
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
build(): LayoutAnimationFunction {
|
|
35
|
+
const animationFactory = this.animationFactory;
|
|
36
|
+
const animationDuration = this.defaultDuration;
|
|
37
|
+
return (values: LayoutAnimationsValues) => {
|
|
38
|
+
'worklet';
|
|
39
|
+
let animations: {
|
|
40
|
+
[key: string]: any;
|
|
41
|
+
} = {};
|
|
42
|
+
const initialValues: {
|
|
43
|
+
[key: string]: any;
|
|
44
|
+
} = {};
|
|
45
|
+
|
|
46
|
+
if (animationFactory) {
|
|
47
|
+
animations = animationFactory(values);
|
|
48
|
+
for (const key in animations) {
|
|
49
|
+
if (!supportedProps.includes(key)) {
|
|
50
|
+
throw Error(`The prop '${key}' is not supported yet.`);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
} else {
|
|
54
|
+
for (const propName of supportedProps) {
|
|
55
|
+
if (propName === 'transform') {
|
|
56
|
+
const matrix = values.targetTransformMatrix;
|
|
57
|
+
animations.transformMatrix = withTiming(matrix, {
|
|
58
|
+
// native screen transition takes around 500ms
|
|
59
|
+
duration: animationDuration,
|
|
60
|
+
});
|
|
61
|
+
} else {
|
|
62
|
+
const keyToTargetValue =
|
|
63
|
+
'target' + propName.charAt(0).toUpperCase() + propName.slice(1);
|
|
64
|
+
animations[propName] = withTiming(values[keyToTargetValue], {
|
|
65
|
+
// native screen transition takes around 500ms
|
|
66
|
+
duration: animationDuration,
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
for (const propName in animations) {
|
|
73
|
+
if (propName === 'transform') {
|
|
74
|
+
initialValues.transformMatrix = values.currentTransformMatrix;
|
|
75
|
+
} else {
|
|
76
|
+
const keyToCurrentValue =
|
|
77
|
+
'current' + propName.charAt(0).toUpperCase() + propName.slice(1);
|
|
78
|
+
initialValues[propName] = values[keyToCurrentValue];
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
return { initialValues, animations };
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
export const DefaultSharedTransition = SharedTransition;
|