react-native-reanimated 3.8.0 → 3.9.0-layout-animation-experimental
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/Fabric/ShadowTreeCloner.cpp +5 -2
- package/Common/cpp/LayoutAnimations/LayoutAnimationsManager.cpp +42 -32
- package/Common/cpp/LayoutAnimations/LayoutAnimationsManager.h +5 -7
- package/Common/cpp/LayoutAnimations/LayoutAnimationsProxy.cpp +565 -0
- package/Common/cpp/LayoutAnimations/LayoutAnimationsProxy.h +74 -0
- package/Common/cpp/LayoutAnimations/LayoutAnimationsUtils.h +140 -0
- package/Common/cpp/NativeModules/NativeReanimatedModule.cpp +216 -58
- package/Common/cpp/NativeModules/NativeReanimatedModule.h +32 -11
- package/Common/cpp/NativeModules/NativeReanimatedModuleSpec.cpp +2 -17
- package/Common/cpp/NativeModules/NativeReanimatedModuleSpec.h +6 -8
- package/Common/cpp/ReanimatedRuntime/RNRuntimeDecorator.cpp +3 -0
- package/Common/cpp/ReanimatedRuntime/WorkletRuntime.cpp +3 -4
- package/Common/cpp/ReanimatedRuntime/WorkletRuntimeDecorator.cpp +8 -3
- package/Common/cpp/SharedItems/Shareables.cpp +31 -5
- package/Common/cpp/SharedItems/Shareables.h +18 -2
- package/Common/cpp/Tools/JSScheduler.cpp +29 -5
- package/Common/cpp/Tools/JSScheduler.h +21 -4
- package/Common/cpp/Tools/PlatformDepMethodsHolder.h +6 -2
- package/Common/cpp/Tools/UIRuntimeDecorator.cpp +6 -0
- package/Common/cpp/Tools/UIRuntimeDecorator.h +1 -0
- package/android/CMakeLists.txt +3 -0
- package/android/build.gradle +17 -5
- package/android/src/main/cpp/NativeProxy.cpp +77 -12
- package/android/src/main/cpp/NativeProxy.h +35 -1
- package/android/src/main/java/com/swmansion/reanimated/NodesManager.java +58 -19
- package/android/src/main/java/com/swmansion/reanimated/ReanimatedPackage.java +7 -2
- package/android/src/{reactNativeVersionPatch/ReanimatedUIManager/latest → main/java}/com/swmansion/reanimated/ReanimatedUIManagerFactory.java +5 -5
- package/android/src/main/java/com/swmansion/reanimated/layoutReanimation/AnimationsManager.java +10 -6
- package/android/src/main/java/com/swmansion/reanimated/layoutReanimation/ReanimatedNativeHierarchyManager.java +18 -1
- package/android/src/main/java/com/swmansion/reanimated/layoutReanimation/SharedTransitionManager.java +105 -17
- package/android/src/main/java/com/swmansion/reanimated/sensor/ReanimatedSensor.java +2 -1
- package/android/src/paper/java/com/swmansion/reanimated/NativeReanimatedModuleSpec.java +37 -0
- package/android/src/{main/java/com/swmansion/reanimated → reactNativeVersionPatch/ReanimatedUIManager/73/com/swmansion}/ReanimatedModule.java +4 -3
- package/android/src/reactNativeVersionPatch/ReanimatedUIManager/{70 → 73}/com/swmansion/reanimated/layoutReanimation/ReanimatedUIManager.java +1 -22
- package/android/src/reactNativeVersionPatch/ReanimatedUIManager/latest/com/swmansion/reanimated/ReanimatedModule.java +176 -0
- package/android/src/reactNativeVersionPatch/ReanimatedUIManager/latest/com/swmansion/reanimated/layoutReanimation/ReanimatedUIManager.java +0 -26
- package/android/src/{fabric/java → reactNativeVersionPatch/RuntimeExecutor/73}/com/swmansion/reanimated/NativeProxy.java +16 -4
- package/android/src/reactNativeVersionPatch/RuntimeExecutor/latest/com/swmansion/reanimated/NativeProxy.java +143 -0
- package/apple/LayoutReanimation/REAAnimationsManager.h +3 -0
- package/apple/LayoutReanimation/REAAnimationsManager.m +11 -0
- package/apple/LayoutReanimation/REASharedTransitionManager.m +99 -23
- package/apple/LayoutReanimation/REASnapshot.h +1 -0
- package/apple/LayoutReanimation/REASnapshot.m +78 -37
- package/apple/REAModule.h +22 -2
- package/apple/REAModule.mm +97 -46
- package/apple/REANodesManager.h +3 -3
- package/apple/REANodesManager.mm +46 -22
- package/apple/native/NativeProxy.h +28 -2
- package/apple/native/NativeProxy.mm +65 -195
- package/apple/native/PlatformDepMethodsHolderImpl.h +59 -0
- package/apple/native/PlatformDepMethodsHolderImpl.mm +429 -0
- package/apple/sensor/ReanimatedSensor.m +5 -5
- package/lib/module/Animated.js.map +1 -1
- package/lib/module/ConfigHelper.js +1 -1
- package/lib/module/ConfigHelper.js.map +1 -1
- package/lib/module/animationBuilder.js +1 -0
- package/lib/module/animationBuilder.js.map +1 -1
- package/lib/module/createAnimatedComponent/InlinePropManager.js +4 -4
- package/lib/module/createAnimatedComponent/InlinePropManager.js.map +1 -1
- package/lib/module/createAnimatedComponent/JSPropsUpdater.js +9 -6
- package/lib/module/createAnimatedComponent/JSPropsUpdater.js.map +1 -1
- package/lib/module/createAnimatedComponent/JSPropsUpdater.web.js +11 -0
- package/lib/module/createAnimatedComponent/JSPropsUpdater.web.js.map +1 -0
- package/lib/module/createAnimatedComponent/PropsFilter.js +25 -9
- package/lib/module/createAnimatedComponent/PropsFilter.js.map +1 -1
- package/lib/module/createAnimatedComponent/commonTypes.js.map +1 -1
- package/lib/module/createAnimatedComponent/createAnimatedComponent.js +83 -52
- package/lib/module/createAnimatedComponent/createAnimatedComponent.js.map +1 -1
- package/lib/module/createAnimatedComponent/getViewInfo.js +37 -0
- package/lib/module/createAnimatedComponent/getViewInfo.js.map +1 -0
- package/lib/module/createAnimatedComponent/index.js.map +1 -1
- package/lib/module/createAnimatedComponent/setAndForwardRef.js +4 -5
- package/lib/module/createAnimatedComponent/setAndForwardRef.js.map +1 -1
- package/lib/module/createAnimatedComponent/utils.js.map +1 -1
- package/lib/module/index.js.map +1 -1
- package/lib/module/index.web.js +1 -2
- package/lib/module/index.web.js.map +1 -1
- package/lib/module/mock.js +12 -12
- package/lib/module/mock.js.map +1 -1
- package/lib/module/propsAllowlists.js.map +1 -1
- package/lib/module/reanimated2/Bezier.js.map +1 -1
- package/lib/module/reanimated2/Colors.js +4 -11
- package/lib/module/reanimated2/Colors.js.map +1 -1
- package/lib/module/reanimated2/Easing.js +3 -7
- package/lib/module/reanimated2/Easing.js.map +1 -1
- package/lib/module/reanimated2/NativeReanimated/NativeReanimated.js +16 -13
- package/lib/module/reanimated2/NativeReanimated/NativeReanimated.js.map +1 -1
- package/lib/module/reanimated2/NativeReanimated/index.js.map +1 -1
- package/lib/module/reanimated2/NativeReanimated/index.web.js.map +1 -1
- package/lib/module/reanimated2/PlatformChecker.js +2 -1
- package/lib/module/reanimated2/PlatformChecker.js.map +1 -1
- package/lib/module/reanimated2/PropAdapters.js +1 -1
- package/lib/module/reanimated2/PropAdapters.js.map +1 -1
- package/lib/module/reanimated2/PropsRegistry.js +1 -2
- package/lib/module/reanimated2/PropsRegistry.js.map +1 -1
- package/lib/module/reanimated2/Sensor.js +2 -2
- package/lib/module/reanimated2/Sensor.js.map +1 -1
- package/lib/module/reanimated2/SensorContainer.js +2 -2
- package/lib/module/reanimated2/SensorContainer.js.map +1 -1
- package/lib/module/reanimated2/UpdateLayoutAnimations.js +30 -8
- package/lib/module/reanimated2/UpdateLayoutAnimations.js.map +1 -1
- package/lib/module/reanimated2/UpdateProps.js.map +1 -1
- package/lib/module/reanimated2/ViewDescriptorsSet.js.map +1 -1
- package/lib/module/reanimated2/WorkletEventHandler.js +74 -31
- package/lib/module/reanimated2/WorkletEventHandler.js.map +1 -1
- package/lib/module/reanimated2/animation/clamp.js.map +1 -1
- package/lib/module/reanimated2/animation/commonTypes.js.map +1 -1
- package/lib/module/reanimated2/animation/decay/decay.js.map +1 -1
- package/lib/module/reanimated2/animation/decay/index.js.map +1 -1
- package/lib/module/reanimated2/animation/decay/rigidDecay.js.map +1 -1
- package/lib/module/reanimated2/animation/decay/rubberBandDecay.js.map +1 -1
- package/lib/module/reanimated2/animation/decay/utils.js.map +1 -1
- package/lib/module/reanimated2/animation/delay.js.map +1 -1
- package/lib/module/reanimated2/animation/index.js.map +1 -1
- package/lib/module/reanimated2/animation/repeat.js +1 -6
- package/lib/module/reanimated2/animation/repeat.js.map +1 -1
- package/lib/module/reanimated2/animation/sequence.js +1 -5
- package/lib/module/reanimated2/animation/sequence.js.map +1 -1
- package/lib/module/reanimated2/animation/spring.js.map +1 -1
- package/lib/module/reanimated2/animation/springUtils.js +8 -10
- package/lib/module/reanimated2/animation/springUtils.js.map +1 -1
- package/lib/module/reanimated2/animation/styleAnimation.js +5 -4
- package/lib/module/reanimated2/animation/styleAnimation.js.map +1 -1
- package/lib/module/reanimated2/animation/timing.js +4 -1
- package/lib/module/reanimated2/animation/timing.js.map +1 -1
- package/lib/module/reanimated2/animation/transformationMatrix/matrixUtils.js +1 -2
- package/lib/module/reanimated2/animation/transformationMatrix/matrixUtils.js.map +1 -1
- package/lib/module/reanimated2/animation/util.js +22 -2
- package/lib/module/reanimated2/animation/util.js.map +1 -1
- package/lib/module/reanimated2/commonTypes.js +3 -1
- package/lib/module/reanimated2/commonTypes.js.map +1 -1
- package/lib/module/reanimated2/component/FlatList.js +1 -0
- package/lib/module/reanimated2/component/FlatList.js.map +1 -1
- package/lib/module/reanimated2/component/Image.js +1 -0
- package/lib/module/reanimated2/component/Image.js.map +1 -1
- package/lib/module/reanimated2/component/LayoutAnimationConfig.js +1 -0
- package/lib/module/reanimated2/component/LayoutAnimationConfig.js.map +1 -1
- package/lib/module/reanimated2/component/PerformanceMonitor.js +169 -0
- package/lib/module/reanimated2/component/PerformanceMonitor.js.map +1 -0
- package/lib/module/reanimated2/component/ScrollView.js +1 -0
- package/lib/module/reanimated2/component/ScrollView.js.map +1 -1
- package/lib/module/reanimated2/component/Text.js +1 -0
- package/lib/module/reanimated2/component/Text.js.map +1 -1
- package/lib/module/reanimated2/component/View.js +1 -0
- package/lib/module/reanimated2/component/View.js.map +1 -1
- package/lib/module/reanimated2/core.js +6 -15
- package/lib/module/reanimated2/core.js.map +1 -1
- package/lib/module/reanimated2/errors.js +8 -8
- package/lib/module/reanimated2/errors.js.map +1 -1
- package/lib/module/reanimated2/fabricUtils.js +33 -8
- package/lib/module/reanimated2/fabricUtils.js.map +1 -1
- package/lib/module/reanimated2/fabricUtils.web.js.map +1 -1
- package/lib/module/reanimated2/frameCallback/FrameCallbackRegistryJS.js +2 -2
- package/lib/module/reanimated2/frameCallback/FrameCallbackRegistryJS.js.map +1 -1
- package/lib/module/reanimated2/frameCallback/FrameCallbackRegistryUI.js.map +1 -1
- package/lib/module/reanimated2/frameCallback/index.js.map +1 -1
- package/lib/module/reanimated2/globals.d.js.map +1 -1
- package/lib/module/reanimated2/helperTypes.js.map +1 -1
- package/lib/module/reanimated2/hook/commonTypes.js.map +1 -1
- package/lib/module/reanimated2/hook/index.js.map +1 -1
- package/lib/module/reanimated2/hook/useAnimatedGestureHandler.js +1 -0
- package/lib/module/reanimated2/hook/useAnimatedGestureHandler.js.map +1 -1
- package/lib/module/reanimated2/hook/useAnimatedKeyboard.js +3 -4
- package/lib/module/reanimated2/hook/useAnimatedKeyboard.js.map +1 -1
- package/lib/module/reanimated2/hook/useAnimatedProps.js.map +1 -1
- package/lib/module/reanimated2/hook/useAnimatedReaction.js +1 -0
- package/lib/module/reanimated2/hook/useAnimatedReaction.js.map +1 -1
- package/lib/module/reanimated2/hook/useAnimatedRef.js +12 -7
- package/lib/module/reanimated2/hook/useAnimatedRef.js.map +1 -1
- package/lib/module/reanimated2/hook/useAnimatedScrollHandler.js +3 -1
- package/lib/module/reanimated2/hook/useAnimatedScrollHandler.js.map +1 -1
- package/lib/module/reanimated2/hook/useAnimatedSensor.js.map +1 -1
- package/lib/module/reanimated2/hook/useAnimatedStyle.js +3 -6
- package/lib/module/reanimated2/hook/useAnimatedStyle.js.map +1 -1
- package/lib/module/reanimated2/hook/useDerivedValue.js +3 -1
- package/lib/module/reanimated2/hook/useDerivedValue.js.map +1 -1
- package/lib/module/reanimated2/hook/useEvent.js +4 -5
- package/lib/module/reanimated2/hook/useEvent.js.map +1 -1
- package/lib/module/reanimated2/hook/useFrameCallback.js +1 -2
- package/lib/module/reanimated2/hook/useFrameCallback.js.map +1 -1
- package/lib/module/reanimated2/hook/useHandler.js +3 -1
- package/lib/module/reanimated2/hook/useHandler.js.map +1 -1
- package/lib/module/reanimated2/hook/useReducedMotion.js.map +1 -1
- package/lib/module/reanimated2/hook/useScrollViewOffset.js +60 -16
- package/lib/module/reanimated2/hook/useScrollViewOffset.js.map +1 -1
- package/lib/module/reanimated2/hook/useSharedValue.js.map +1 -1
- package/lib/module/reanimated2/hook/useWorkletCallback.js.map +1 -1
- package/lib/module/reanimated2/hook/utils.js.map +1 -1
- package/lib/module/reanimated2/index.js +2 -0
- package/lib/module/reanimated2/index.js.map +1 -1
- package/lib/module/reanimated2/initializers.js +1 -5
- package/lib/module/reanimated2/initializers.js.map +1 -1
- package/lib/module/reanimated2/interpolateColor.js +2 -6
- package/lib/module/reanimated2/interpolateColor.js.map +1 -1
- package/lib/module/reanimated2/interpolation.js +1 -1
- package/lib/module/reanimated2/interpolation.js.map +1 -1
- package/lib/module/reanimated2/isSharedValue.js.map +1 -1
- package/lib/module/reanimated2/jestUtils.js +3 -6
- package/lib/module/reanimated2/jestUtils.js.map +1 -1
- package/lib/module/reanimated2/jestUtils.web.js.map +1 -1
- package/lib/module/reanimated2/js-reanimated/JSReanimated.js +5 -9
- package/lib/module/reanimated2/js-reanimated/JSReanimated.js.map +1 -1
- package/lib/module/reanimated2/js-reanimated/WebSensor.js.map +1 -1
- package/lib/module/reanimated2/js-reanimated/index.js +2 -2
- package/lib/module/reanimated2/js-reanimated/index.js.map +1 -1
- package/lib/module/reanimated2/js-reanimated/react-native-web.d.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/animationBuilder/BaseAnimationBuilder.js +4 -2
- package/lib/module/reanimated2/layoutReanimation/animationBuilder/BaseAnimationBuilder.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/animationBuilder/ComplexAnimationBuilder.js +12 -11
- package/lib/module/reanimated2/layoutReanimation/animationBuilder/ComplexAnimationBuilder.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/animationBuilder/Keyframe.js +12 -10
- package/lib/module/reanimated2/layoutReanimation/animationBuilder/Keyframe.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/animationBuilder/commonTypes.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/animationBuilder/index.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/animationsManager.js +11 -4
- package/lib/module/reanimated2/layoutReanimation/animationsManager.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Bounce.js +22 -22
- package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Bounce.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Fade.js +22 -22
- package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Fade.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Flip.js +26 -26
- package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Flip.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Lightspeed.js +10 -10
- package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Lightspeed.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Pinwheel.js +6 -6
- package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Pinwheel.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Roll.js +10 -10
- package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Roll.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Rotate.js +18 -18
- package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Rotate.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Slide.js +18 -18
- package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Slide.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Stretch.js +10 -10
- package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Stretch.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Zoom.js +34 -34
- package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Zoom.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/defaultAnimations/index.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/defaultTransitions/CurvedTransition.js +17 -4
- package/lib/module/reanimated2/layoutReanimation/defaultTransitions/CurvedTransition.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/defaultTransitions/EntryExitTransition.js +4 -4
- package/lib/module/reanimated2/layoutReanimation/defaultTransitions/EntryExitTransition.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/defaultTransitions/FadingTransition.js +4 -4
- package/lib/module/reanimated2/layoutReanimation/defaultTransitions/FadingTransition.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/defaultTransitions/JumpingTransition.js +4 -4
- package/lib/module/reanimated2/layoutReanimation/defaultTransitions/JumpingTransition.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/defaultTransitions/LinearTransition.js +4 -4
- package/lib/module/reanimated2/layoutReanimation/defaultTransitions/LinearTransition.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/defaultTransitions/SequencedTransition.js +4 -4
- package/lib/module/reanimated2/layoutReanimation/defaultTransitions/SequencedTransition.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/defaultTransitions/index.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/index.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/sharedTransitions/ProgressTransitionManager.js +16 -12
- package/lib/module/reanimated2/layoutReanimation/sharedTransitions/ProgressTransitionManager.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/sharedTransitions/SharedTransition.js +13 -7
- package/lib/module/reanimated2/layoutReanimation/sharedTransitions/SharedTransition.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/sharedTransitions/SharedTransition.web.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/sharedTransitions/index.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/web/animation/Bounce.web.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/web/animation/Fade.web.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/web/animation/Flip.web.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/web/animation/Lightspeed.web.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/web/animation/Pinwheel.web.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/web/animation/Roll.web.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/web/animation/Rotate.web.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/web/animation/Slide.web.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/web/animation/Stretch.web.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/web/animation/Zoom.web.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/web/animationParser.js +0 -2
- package/lib/module/reanimated2/layoutReanimation/web/animationParser.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/web/animationsManager.js +1 -2
- package/lib/module/reanimated2/layoutReanimation/web/animationsManager.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/web/componentStyle.js +3 -1
- package/lib/module/reanimated2/layoutReanimation/web/componentStyle.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/web/componentUtils.js +6 -7
- package/lib/module/reanimated2/layoutReanimation/web/componentUtils.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/web/config.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/web/createAnimation.js +2 -2
- package/lib/module/reanimated2/layoutReanimation/web/createAnimation.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/web/domUtils.js +4 -4
- package/lib/module/reanimated2/layoutReanimation/web/domUtils.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/web/index.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/web/transition/Fading.web.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/web/transition/Linear.web.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/web/transition/Sequenced.web.js.map +1 -1
- package/lib/module/reanimated2/mappers.js +2 -4
- package/lib/module/reanimated2/mappers.js.map +1 -1
- package/lib/module/reanimated2/mockedRequestAnimationFrame.js.map +1 -1
- package/lib/module/reanimated2/mutables.js +2 -4
- package/lib/module/reanimated2/mutables.js.map +1 -1
- package/lib/module/reanimated2/platform-specific/RNRenderer.js.map +1 -1
- package/lib/module/reanimated2/platform-specific/RNRenderer.web.js.map +1 -1
- package/lib/module/reanimated2/platform-specific/checkCppVersion.js.map +1 -1
- package/lib/module/reanimated2/platform-specific/jsVersion.js +1 -1
- package/lib/module/reanimated2/platform-specific/jsVersion.js.map +1 -1
- package/lib/module/reanimated2/platformFunctions/dispatchCommand.js +2 -4
- package/lib/module/reanimated2/platformFunctions/dispatchCommand.js.map +1 -1
- package/lib/module/reanimated2/platformFunctions/dispatchCommand.web.js.map +1 -1
- package/lib/module/reanimated2/platformFunctions/getRelativeCoords.js +2 -2
- package/lib/module/reanimated2/platformFunctions/getRelativeCoords.js.map +1 -1
- package/lib/module/reanimated2/platformFunctions/index.js.map +1 -1
- package/lib/module/reanimated2/platformFunctions/measure.js.map +1 -1
- package/lib/module/reanimated2/platformFunctions/measure.web.js.map +1 -1
- package/lib/module/reanimated2/platformFunctions/scrollTo.js.map +1 -1
- package/lib/module/reanimated2/platformFunctions/scrollTo.web.js +1 -1
- package/lib/module/reanimated2/platformFunctions/scrollTo.web.js.map +1 -1
- package/lib/module/reanimated2/platformFunctions/setGestureState.js.map +1 -1
- package/lib/module/reanimated2/platformFunctions/setGestureState.web.js.map +1 -1
- package/lib/module/reanimated2/platformFunctions/setNativeProps.js.map +1 -1
- package/lib/module/reanimated2/platformFunctions/setNativeProps.web.js.map +1 -1
- package/lib/module/reanimated2/pluginUtils.js.map +1 -1
- package/lib/module/reanimated2/publicGlobals.js.map +1 -1
- package/lib/module/reanimated2/runtimes.js +11 -19
- package/lib/module/reanimated2/runtimes.js.map +1 -1
- package/lib/module/reanimated2/screenTransition/RNScreensTurboModule.js +20 -0
- package/lib/module/reanimated2/screenTransition/RNScreensTurboModule.js.map +1 -0
- package/lib/module/reanimated2/screenTransition/animationManager.js +41 -0
- package/lib/module/reanimated2/screenTransition/animationManager.js.map +1 -0
- package/lib/module/reanimated2/screenTransition/commonTypes.js +4 -0
- package/lib/module/reanimated2/screenTransition/commonTypes.js.map +1 -0
- package/lib/module/reanimated2/screenTransition/index.js +5 -0
- package/lib/module/reanimated2/screenTransition/index.js.map +1 -0
- package/lib/module/reanimated2/screenTransition/presets.js +157 -0
- package/lib/module/reanimated2/screenTransition/presets.js.map +1 -0
- package/lib/module/reanimated2/screenTransition/styleUpdater.js +62 -0
- package/lib/module/reanimated2/screenTransition/styleUpdater.js.map +1 -0
- package/lib/module/reanimated2/screenTransition/swipeSimulator.js +190 -0
- package/lib/module/reanimated2/screenTransition/swipeSimulator.js.map +1 -0
- package/lib/module/reanimated2/shareableMappingCache.js.map +1 -1
- package/lib/module/reanimated2/shareables.js +27 -10
- package/lib/module/reanimated2/shareables.js.map +1 -1
- package/lib/module/reanimated2/threads.js +9 -34
- package/lib/module/reanimated2/threads.js.map +1 -1
- package/lib/module/reanimated2/valueSetter.js +1 -2
- package/lib/module/reanimated2/valueSetter.js.map +1 -1
- package/lib/module/reanimated2/valueUnpacker.js +4 -3
- package/lib/module/reanimated2/valueUnpacker.js.map +1 -1
- package/lib/module/specs/NativeReanimatedModule.js +5 -0
- package/lib/module/specs/NativeReanimatedModule.js.map +1 -0
- package/lib/typescript/ConfigHelper.d.ts +1 -0
- package/lib/typescript/createAnimatedComponent/InlinePropManager.d.ts +1 -1
- package/lib/typescript/createAnimatedComponent/JSPropsUpdater.web.d.ts +6 -0
- package/lib/typescript/createAnimatedComponent/PropsFilter.d.ts +3 -0
- package/lib/typescript/createAnimatedComponent/getViewInfo.d.ts +9 -0
- package/lib/typescript/reanimated2/NativeReanimated/NativeReanimated.d.ts +8 -13
- package/lib/typescript/reanimated2/UpdateLayoutAnimations.d.ts +12 -1
- package/lib/typescript/reanimated2/WorkletEventHandler.d.ts +16 -9
- package/lib/typescript/reanimated2/animation/util.d.ts +2 -0
- package/lib/typescript/reanimated2/component/LayoutAnimationConfig.d.ts +1 -1
- package/lib/typescript/reanimated2/component/PerformanceMonitor.d.ts +2 -0
- package/lib/typescript/reanimated2/core.d.ts +3 -4
- package/lib/typescript/reanimated2/hook/commonTypes.d.ts +6 -0
- package/lib/typescript/reanimated2/hook/useEvent.d.ts +2 -3
- package/lib/typescript/reanimated2/hook/useScrollViewOffset.d.ts +3 -1
- package/lib/typescript/reanimated2/index.d.ts +3 -0
- package/lib/typescript/reanimated2/js-reanimated/JSReanimated.d.ts +2 -2
- package/lib/typescript/reanimated2/layoutReanimation/animationBuilder/commonTypes.d.ts +2 -1
- package/lib/typescript/reanimated2/layoutReanimation/sharedTransitions/ProgressTransitionManager.d.ts +2 -2
- package/lib/typescript/reanimated2/layoutReanimation/sharedTransitions/SharedTransition.d.ts +2 -2
- package/lib/typescript/reanimated2/platform-specific/jsVersion.d.ts +1 -1
- package/lib/typescript/reanimated2/screenTransition/RNScreensTurboModule.d.ts +2 -0
- package/lib/typescript/reanimated2/screenTransition/animationManager.d.ts +3 -0
- package/lib/typescript/reanimated2/screenTransition/commonTypes.d.ts +38 -0
- package/lib/typescript/reanimated2/screenTransition/index.d.ts +3 -0
- package/lib/typescript/reanimated2/screenTransition/presets.d.ts +11 -0
- package/lib/typescript/reanimated2/screenTransition/styleUpdater.d.ts +3 -0
- package/lib/typescript/reanimated2/screenTransition/swipeSimulator.d.ts +2 -0
- package/lib/typescript/specs/NativeReanimatedModule.d.ts +6 -0
- package/package.json +29 -17
- package/plugin/build/plugin.js +7 -2
- package/src/ConfigHelper.ts +1 -1
- package/src/animationBuilder.tsx +2 -0
- package/src/createAnimatedComponent/InlinePropManager.ts +2 -2
- package/src/createAnimatedComponent/JSPropsUpdater.ts +7 -6
- package/src/createAnimatedComponent/JSPropsUpdater.web.ts +26 -0
- package/src/createAnimatedComponent/PropsFilter.tsx +31 -6
- package/src/createAnimatedComponent/createAnimatedComponent.tsx +108 -60
- package/src/createAnimatedComponent/getViewInfo.ts +39 -0
- package/src/mock.ts +13 -1
- package/src/reanimated2/NativeReanimated/NativeReanimated.ts +33 -35
- package/src/reanimated2/PlatformChecker.ts +3 -2
- package/src/reanimated2/PropsRegistry.ts +1 -3
- package/src/reanimated2/UpdateLayoutAnimations.ts +53 -13
- package/src/reanimated2/WorkletEventHandler.ts +98 -39
- package/src/reanimated2/animation/styleAnimation.ts +8 -6
- package/src/reanimated2/animation/timing.ts +9 -1
- package/src/reanimated2/animation/util.ts +28 -3
- package/src/reanimated2/commonTypes.ts +4 -1
- package/src/reanimated2/component/PerformanceMonitor.tsx +216 -0
- package/src/reanimated2/core.ts +9 -31
- package/src/reanimated2/errors.ts +1 -0
- package/src/reanimated2/fabricUtils.ts +43 -18
- package/src/reanimated2/globals.d.ts +11 -1
- package/src/reanimated2/hook/commonTypes.ts +10 -0
- package/src/reanimated2/hook/useAnimatedRef.ts +20 -11
- package/src/reanimated2/hook/useEvent.ts +4 -4
- package/src/reanimated2/hook/useScrollViewOffset.ts +94 -23
- package/src/reanimated2/index.ts +11 -0
- package/src/reanimated2/js-reanimated/JSReanimated.ts +7 -7
- package/src/reanimated2/layoutReanimation/animationBuilder/ComplexAnimationBuilder.ts +4 -0
- package/src/reanimated2/layoutReanimation/animationBuilder/Keyframe.ts +9 -1
- package/src/reanimated2/layoutReanimation/animationBuilder/commonTypes.ts +9 -1
- package/src/reanimated2/layoutReanimation/animationsManager.ts +10 -2
- package/src/reanimated2/layoutReanimation/defaultTransitions/CurvedTransition.ts +13 -0
- package/src/reanimated2/layoutReanimation/sharedTransitions/ProgressTransitionManager.ts +17 -8
- package/src/reanimated2/layoutReanimation/sharedTransitions/SharedTransition.ts +26 -7
- package/src/reanimated2/layoutReanimation/web/animationsManager.ts +1 -1
- package/src/reanimated2/layoutReanimation/web/componentStyle.ts +3 -1
- package/src/reanimated2/layoutReanimation/web/componentUtils.ts +1 -1
- package/src/reanimated2/layoutReanimation/web/createAnimation.ts +2 -2
- package/src/reanimated2/platform-specific/jsVersion.ts +1 -1
- package/src/reanimated2/platformFunctions/getRelativeCoords.ts +2 -2
- package/src/reanimated2/screenTransition/RNScreensTurboModule.ts +29 -0
- package/src/reanimated2/screenTransition/animationManager.ts +45 -0
- package/src/reanimated2/screenTransition/commonTypes.ts +63 -0
- package/src/reanimated2/screenTransition/index.ts +12 -0
- package/src/reanimated2/screenTransition/presets.ts +137 -0
- package/src/reanimated2/screenTransition/styleUpdater.ts +73 -0
- package/src/reanimated2/screenTransition/swipeSimulator.ts +238 -0
- package/src/reanimated2/shareables.ts +29 -6
- package/src/reanimated2/valueUnpacker.ts +10 -3
- package/src/specs/NativeReanimatedModule.ts +9 -0
- package/android/src/reactNativeVersionPatch/ReanimatedUIManager/70/com/swmansion/reanimated/ReanimatedUIManagerFactory.java +0 -16
- package/android/src/reactNativeVersionPatch/messageQueueThread/67/com/swmansion/reanimated/ReanimatedMessageQueueThread.java +0 -12
|
@@ -18,6 +18,7 @@ import type { ProgressTransitionRegister } from './layoutReanimation/sharedTrans
|
|
|
18
18
|
import type { UpdatePropsManager } from './UpdateProps';
|
|
19
19
|
import type { callGuardDEV } from './initializers';
|
|
20
20
|
import type { WorkletRuntime } from './runtimes';
|
|
21
|
+
import type { RNScreensTurboModuleType } from './screenTransition/commonTypes';
|
|
21
22
|
|
|
22
23
|
declare global {
|
|
23
24
|
var _REANIMATED_IS_REDUCED_MOTION: boolean | undefined;
|
|
@@ -39,7 +40,10 @@ declare global {
|
|
|
39
40
|
) => void;
|
|
40
41
|
var _notifyAboutEnd: (tag: number, removeView: boolean) => void;
|
|
41
42
|
var _setGestureState: (handlerTag: number, newState: number) => void;
|
|
42
|
-
var _makeShareableClone: <T>(
|
|
43
|
+
var _makeShareableClone: <T>(
|
|
44
|
+
value: T,
|
|
45
|
+
nativeStateSource?: object
|
|
46
|
+
) => FlatShareableRef<T>;
|
|
43
47
|
var _scheduleOnJS: (fun: (...args: A) => R, args?: A) => void;
|
|
44
48
|
var _scheduleOnRuntime: (
|
|
45
49
|
runtime: WorkletRuntime,
|
|
@@ -102,4 +106,10 @@ declare global {
|
|
|
102
106
|
var UpdatePropsManager: UpdatePropsManager;
|
|
103
107
|
var ProgressTransitionRegister: ProgressTransitionRegister;
|
|
104
108
|
var updateJSProps: (viewTag: number, props: Record<string, unknown>) => void;
|
|
109
|
+
var RNScreensTurboModule: RNScreensTurboModuleType | undefined;
|
|
110
|
+
var _obtainPropPaper: (viewTag: number, propName: string) => string;
|
|
111
|
+
var _obtainPropFabric: (
|
|
112
|
+
shadowNodeWrapper: ShadowNodeWrapper,
|
|
113
|
+
propName: string
|
|
114
|
+
) => string;
|
|
105
115
|
}
|
|
@@ -30,6 +30,7 @@ export interface AnimatedRef<T extends Component> {
|
|
|
30
30
|
| ShadowNodeWrapper // Fabric
|
|
31
31
|
| HTMLElement; // web
|
|
32
32
|
current: T | null;
|
|
33
|
+
getTag: () => number;
|
|
33
34
|
}
|
|
34
35
|
|
|
35
36
|
// Might make that type generic if it's ever needed.
|
|
@@ -78,6 +79,15 @@ export type RNNativeScrollEvent = NativeSyntheticEvent<NativeScrollEvent>;
|
|
|
78
79
|
|
|
79
80
|
export type ReanimatedScrollEvent = ReanimatedEvent<RNNativeScrollEvent>;
|
|
80
81
|
|
|
82
|
+
export interface IWorkletEventHandler<Event extends object> {
|
|
83
|
+
updateEventHandler: (
|
|
84
|
+
newWorklet: (event: ReanimatedEvent<Event>) => void,
|
|
85
|
+
newEvents: string[]
|
|
86
|
+
) => void;
|
|
87
|
+
registerForEvents: (viewTag: number, fallbackEventName?: string) => void;
|
|
88
|
+
unregisterFromEvents: (viewTag: number) => void;
|
|
89
|
+
}
|
|
90
|
+
|
|
81
91
|
export interface AnimatedStyleHandle<
|
|
82
92
|
Style extends DefaultStyle = DefaultStyle
|
|
83
93
|
> {
|
|
@@ -11,7 +11,6 @@ import { Platform, findNodeHandle } from 'react-native';
|
|
|
11
11
|
import type { ScrollView, FlatList } from 'react-native';
|
|
12
12
|
import { isFabric, isWeb } from '../PlatformChecker';
|
|
13
13
|
|
|
14
|
-
const IS_FABRIC = isFabric();
|
|
15
14
|
const IS_WEB = isWeb();
|
|
16
15
|
|
|
17
16
|
interface MaybeScrollableComponent extends Component {
|
|
@@ -25,18 +24,14 @@ interface MaybeScrollableComponent extends Component {
|
|
|
25
24
|
}
|
|
26
25
|
|
|
27
26
|
function getComponentOrScrollable(component: MaybeScrollableComponent) {
|
|
28
|
-
if (
|
|
27
|
+
if (isFabric() && component.getNativeScrollRef) {
|
|
29
28
|
return component.getNativeScrollRef();
|
|
30
|
-
} else if (!
|
|
29
|
+
} else if (!isFabric() && component.getScrollableNode) {
|
|
31
30
|
return component.getScrollableNode();
|
|
32
31
|
}
|
|
33
32
|
return component;
|
|
34
33
|
}
|
|
35
34
|
|
|
36
|
-
const getTagValueFunction = IS_FABRIC
|
|
37
|
-
? getShadowNodeWrapperFromRef
|
|
38
|
-
: findNodeHandle;
|
|
39
|
-
|
|
40
35
|
/**
|
|
41
36
|
* Lets you get a reference of a view that you can use inside a worklet.
|
|
42
37
|
*
|
|
@@ -57,12 +52,26 @@ export function useAnimatedRef<
|
|
|
57
52
|
) => {
|
|
58
53
|
// enters when ref is set by attaching to a component
|
|
59
54
|
if (component) {
|
|
60
|
-
|
|
61
|
-
?
|
|
62
|
-
:
|
|
55
|
+
const getTagValueFunction = isFabric()
|
|
56
|
+
? getShadowNodeWrapperFromRef
|
|
57
|
+
: findNodeHandle;
|
|
58
|
+
|
|
59
|
+
const getTagOrShadowNodeWrapper = () => {
|
|
60
|
+
return IS_WEB
|
|
61
|
+
? getComponentOrScrollable(component)
|
|
62
|
+
: getTagValueFunction(getComponentOrScrollable(component));
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
tag.value = getTagOrShadowNodeWrapper();
|
|
66
|
+
|
|
67
|
+
// On Fabric we have to unwrap the tag from the shadow node wrapper
|
|
68
|
+
fun.getTag = isFabric()
|
|
69
|
+
? () => findNodeHandle(getComponentOrScrollable(component))
|
|
70
|
+
: getTagOrShadowNodeWrapper;
|
|
71
|
+
|
|
63
72
|
fun.current = component;
|
|
64
73
|
// viewName is required only on iOS with Paper
|
|
65
|
-
if (Platform.OS === 'ios' && !
|
|
74
|
+
if (Platform.OS === 'ios' && !isFabric()) {
|
|
66
75
|
viewName.value =
|
|
67
76
|
(component as MaybeScrollableComponent)?.viewConfig
|
|
68
77
|
?.uiViewClassName || 'RCTView';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
import { useRef } from 'react';
|
|
3
|
-
import WorkletEventHandler from '../WorkletEventHandler';
|
|
4
|
-
import type { ReanimatedEvent } from './commonTypes';
|
|
3
|
+
import { WorkletEventHandler } from '../WorkletEventHandler';
|
|
4
|
+
import type { IWorkletEventHandler, ReanimatedEvent } from './commonTypes';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* Worklet to provide as an argument to `useEvent` hook.
|
|
@@ -17,7 +17,7 @@ export type EventHandlerProcessed<
|
|
|
17
17
|
> = (event: Event, context?: Context) => void;
|
|
18
18
|
|
|
19
19
|
export type EventHandlerInternal<Event extends object> = {
|
|
20
|
-
workletEventHandler:
|
|
20
|
+
workletEventHandler: IWorkletEventHandler<Event>;
|
|
21
21
|
};
|
|
22
22
|
|
|
23
23
|
/**
|
|
@@ -57,7 +57,7 @@ export function useEvent<Event extends object, Context = never>(
|
|
|
57
57
|
initRef.current = { workletEventHandler };
|
|
58
58
|
} else if (rebuild) {
|
|
59
59
|
const workletEventHandler = initRef.current.workletEventHandler;
|
|
60
|
-
workletEventHandler.
|
|
60
|
+
workletEventHandler.updateEventHandler(handler, eventNames);
|
|
61
61
|
initRef.current = { workletEventHandler };
|
|
62
62
|
}
|
|
63
63
|
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
|
-
import { useEffect, useRef } from 'react';
|
|
2
|
+
import { useEffect, useRef, useCallback } from 'react';
|
|
3
3
|
import type { SharedValue } from '../commonTypes';
|
|
4
|
-
import { findNodeHandle } from 'react-native';
|
|
5
4
|
import type { EventHandlerInternal } from './useEvent';
|
|
6
5
|
import { useEvent } from './useEvent';
|
|
7
6
|
import { useSharedValue } from './useSharedValue';
|
|
@@ -15,14 +14,6 @@ import { isWeb } from '../PlatformChecker';
|
|
|
15
14
|
|
|
16
15
|
const IS_WEB = isWeb();
|
|
17
16
|
|
|
18
|
-
const scrollEventNames = [
|
|
19
|
-
'onScroll',
|
|
20
|
-
'onScrollBeginDrag',
|
|
21
|
-
'onScrollEndDrag',
|
|
22
|
-
'onMomentumScrollBegin',
|
|
23
|
-
'onMomentumScrollEnd',
|
|
24
|
-
];
|
|
25
|
-
|
|
26
17
|
/**
|
|
27
18
|
* Lets you synchronously get the current offset of a `ScrollView`.
|
|
28
19
|
*
|
|
@@ -30,36 +21,99 @@ const scrollEventNames = [
|
|
|
30
21
|
* @returns A shared value which holds the current offset of the `ScrollView`.
|
|
31
22
|
* @see https://docs.swmansion.com/react-native-reanimated/docs/scroll/useScrollViewOffset
|
|
32
23
|
*/
|
|
33
|
-
export
|
|
24
|
+
export const useScrollViewOffset = IS_WEB
|
|
25
|
+
? useScrollViewOffsetWeb
|
|
26
|
+
: useScrollViewOffsetNative;
|
|
27
|
+
|
|
28
|
+
function useScrollViewOffsetWeb(
|
|
34
29
|
animatedRef: AnimatedRef<AnimatedScrollView>,
|
|
35
|
-
|
|
30
|
+
providedOffset?: SharedValue<number>
|
|
36
31
|
): SharedValue<number> {
|
|
37
|
-
const
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
32
|
+
const internalOffset = useSharedValue(0);
|
|
33
|
+
const offset = useRef(providedOffset ?? internalOffset).current;
|
|
34
|
+
const scrollRef = useRef<AnimatedScrollView | null>(null);
|
|
35
|
+
|
|
36
|
+
const eventHandler = useCallback(() => {
|
|
37
|
+
'worklet';
|
|
38
|
+
const element = getWebScrollableElement(animatedRef.current);
|
|
39
|
+
// scrollLeft is the X axis scrolled offset, works properly also with RTL layout
|
|
40
|
+
offset.value =
|
|
41
|
+
element.scrollLeft === 0 ? element.scrollTop : element.scrollLeft;
|
|
42
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
43
|
+
}, [animatedRef, animatedRef.current]);
|
|
44
|
+
|
|
45
|
+
useEffect(() => {
|
|
46
|
+
// We need to make sure that listener for old animatedRef value is removed
|
|
47
|
+
if (scrollRef.current !== null) {
|
|
48
|
+
getWebScrollableElement(scrollRef.current).removeEventListener(
|
|
49
|
+
'scroll',
|
|
50
|
+
eventHandler
|
|
51
|
+
);
|
|
52
|
+
}
|
|
53
|
+
scrollRef.current = animatedRef.current;
|
|
54
|
+
|
|
55
|
+
const element = getWebScrollableElement(animatedRef.current);
|
|
56
|
+
element.addEventListener('scroll', eventHandler);
|
|
57
|
+
return () => {
|
|
58
|
+
element.removeEventListener('scroll', eventHandler);
|
|
59
|
+
};
|
|
60
|
+
// React here has a problem with `animatedRef.current` since a Ref .current
|
|
61
|
+
// field shouldn't be used as a dependency. However, in this case we have
|
|
62
|
+
// to do it this way.
|
|
63
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
64
|
+
}, [animatedRef, animatedRef.current, eventHandler]);
|
|
65
|
+
|
|
66
|
+
return offset;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
function useScrollViewOffsetNative(
|
|
70
|
+
animatedRef: AnimatedRef<AnimatedScrollView>,
|
|
71
|
+
providedOffset?: SharedValue<number>
|
|
72
|
+
): SharedValue<number> {
|
|
73
|
+
const internalOffset = useSharedValue(0);
|
|
74
|
+
const offset = useRef(providedOffset ?? internalOffset).current;
|
|
75
|
+
const scrollRef = useRef<AnimatedScrollView | null>(null);
|
|
76
|
+
const scrollRefTag = useRef<number | null>(null);
|
|
41
77
|
|
|
42
78
|
const eventHandler = useEvent<RNNativeScrollEvent>(
|
|
43
79
|
(event: ReanimatedScrollEvent) => {
|
|
44
80
|
'worklet';
|
|
45
|
-
|
|
81
|
+
offset.value =
|
|
46
82
|
event.contentOffset.x === 0
|
|
47
83
|
? event.contentOffset.y
|
|
48
84
|
: event.contentOffset.x;
|
|
49
85
|
},
|
|
50
|
-
|
|
86
|
+
scrollNativeEventNames
|
|
51
87
|
// Read https://github.com/software-mansion/react-native-reanimated/pull/5056
|
|
52
88
|
// for more information about this cast.
|
|
53
89
|
) as unknown as EventHandlerInternal<ReanimatedScrollEvent>;
|
|
54
90
|
|
|
55
91
|
useEffect(() => {
|
|
56
|
-
|
|
57
|
-
|
|
92
|
+
// We need to make sure that listener for old animatedRef value is removed
|
|
93
|
+
if (scrollRef.current !== null && scrollRefTag.current !== null) {
|
|
94
|
+
eventHandler.workletEventHandler.unregisterFromEvents(
|
|
95
|
+
scrollRefTag.current
|
|
96
|
+
);
|
|
97
|
+
}
|
|
58
98
|
|
|
59
|
-
|
|
99
|
+
// Store the ref and viewTag for future cleanup
|
|
100
|
+
scrollRef.current = animatedRef.current;
|
|
101
|
+
scrollRefTag.current = animatedRef.getTag();
|
|
102
|
+
|
|
103
|
+
if (scrollRefTag === null) {
|
|
104
|
+
console.warn(
|
|
105
|
+
'[Reanimated] ScrollViewOffset failed to resolve the view tag from animated ref. Did you forget to attach the ref to a component?'
|
|
106
|
+
);
|
|
107
|
+
} else {
|
|
108
|
+
eventHandler.workletEventHandler.registerForEvents(scrollRefTag.current);
|
|
109
|
+
}
|
|
60
110
|
|
|
61
111
|
return () => {
|
|
62
|
-
|
|
112
|
+
if (scrollRefTag.current !== null) {
|
|
113
|
+
eventHandler.workletEventHandler.unregisterFromEvents(
|
|
114
|
+
scrollRefTag.current
|
|
115
|
+
);
|
|
116
|
+
}
|
|
63
117
|
};
|
|
64
118
|
// React here has a problem with `animatedRef.current` since a Ref .current
|
|
65
119
|
// field shouldn't be used as a dependency. However, in this case we have
|
|
@@ -67,5 +121,22 @@ export function useScrollViewOffset(
|
|
|
67
121
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
68
122
|
}, [animatedRef, animatedRef.current, eventHandler]);
|
|
69
123
|
|
|
70
|
-
return
|
|
124
|
+
return offset;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
function getWebScrollableElement(
|
|
128
|
+
scrollComponent: AnimatedScrollView | null
|
|
129
|
+
): HTMLElement {
|
|
130
|
+
return (
|
|
131
|
+
(scrollComponent?.getScrollableNode() as unknown as HTMLElement) ??
|
|
132
|
+
scrollComponent
|
|
133
|
+
);
|
|
71
134
|
}
|
|
135
|
+
|
|
136
|
+
const scrollNativeEventNames = [
|
|
137
|
+
'onScroll',
|
|
138
|
+
'onScrollBeginDrag',
|
|
139
|
+
'onScrollEndDrag',
|
|
140
|
+
'onMomentumScrollBegin',
|
|
141
|
+
'onMomentumScrollEnd',
|
|
142
|
+
];
|
package/src/reanimated2/index.ts
CHANGED
|
@@ -257,6 +257,7 @@ export {
|
|
|
257
257
|
getAnimatedStyle,
|
|
258
258
|
} from './jestUtils';
|
|
259
259
|
export { LayoutAnimationConfig } from './component/LayoutAnimationConfig';
|
|
260
|
+
export { PerformanceMonitor } from './component/PerformanceMonitor';
|
|
260
261
|
export type {
|
|
261
262
|
Adaptable,
|
|
262
263
|
AdaptTransforms,
|
|
@@ -273,3 +274,13 @@ export type {
|
|
|
273
274
|
export type { AnimatedScrollViewProps } from './component/ScrollView';
|
|
274
275
|
export type { FlatListPropsWithLayout } from './component/FlatList';
|
|
275
276
|
export { startMapper, stopMapper } from './mappers';
|
|
277
|
+
export {
|
|
278
|
+
startScreenTransition,
|
|
279
|
+
finishScreenTransition,
|
|
280
|
+
ScreenTransition,
|
|
281
|
+
} from './screenTransition';
|
|
282
|
+
export type {
|
|
283
|
+
AnimatedScreenTransition,
|
|
284
|
+
GoBackGesture,
|
|
285
|
+
ScreenTransitionConfig,
|
|
286
|
+
} from './screenTransition';
|
|
@@ -55,12 +55,15 @@ export default class JSReanimated {
|
|
|
55
55
|
_eventName: string,
|
|
56
56
|
_emitterReactTag: number
|
|
57
57
|
): number {
|
|
58
|
-
|
|
59
|
-
|
|
58
|
+
throw new Error(
|
|
59
|
+
'[Reanimated] registerEventHandler is not available in JSReanimated.'
|
|
60
|
+
);
|
|
60
61
|
}
|
|
61
62
|
|
|
62
63
|
unregisterEventHandler(_: number): void {
|
|
63
|
-
|
|
64
|
+
throw new Error(
|
|
65
|
+
'[Reanimated] unregisterEventHandler is not available in JSReanimated.'
|
|
66
|
+
);
|
|
64
67
|
}
|
|
65
68
|
|
|
66
69
|
enableLayoutAnimations() {
|
|
@@ -83,10 +86,6 @@ export default class JSReanimated {
|
|
|
83
86
|
}
|
|
84
87
|
}
|
|
85
88
|
|
|
86
|
-
configureLayoutAnimation() {
|
|
87
|
-
// no-op
|
|
88
|
-
}
|
|
89
|
-
|
|
90
89
|
configureLayoutAnimationBatch() {
|
|
91
90
|
// no-op
|
|
92
91
|
}
|
|
@@ -282,6 +281,7 @@ export default class JSReanimated {
|
|
|
282
281
|
getViewProp<T>(
|
|
283
282
|
_viewTag: number,
|
|
284
283
|
_propName: string,
|
|
284
|
+
_component?: React.Component,
|
|
285
285
|
_callback?: (result: T) => void
|
|
286
286
|
): Promise<T> {
|
|
287
287
|
throw new Error(
|
|
@@ -8,6 +8,7 @@ import type {
|
|
|
8
8
|
import type { EasingFunction } from '../../Easing';
|
|
9
9
|
import { BaseAnimationBuilder } from './BaseAnimationBuilder';
|
|
10
10
|
import type { StyleProps } from '../../commonTypes';
|
|
11
|
+
import { assertEasingIsWorklet } from '../../animation/util';
|
|
11
12
|
|
|
12
13
|
export class ComplexAnimationBuilder extends BaseAnimationBuilder {
|
|
13
14
|
easingV?: EasingFunction;
|
|
@@ -40,6 +41,9 @@ export class ComplexAnimationBuilder extends BaseAnimationBuilder {
|
|
|
40
41
|
}
|
|
41
42
|
|
|
42
43
|
easing(easingFunction: EasingFunction): this {
|
|
44
|
+
if (__DEV__) {
|
|
45
|
+
assertEasingIsWorklet(easingFunction);
|
|
46
|
+
}
|
|
43
47
|
this.easingV = easingFunction;
|
|
44
48
|
return this;
|
|
45
49
|
}
|
|
@@ -12,7 +12,10 @@ import type {
|
|
|
12
12
|
import type { StyleProps } from '../../commonTypes';
|
|
13
13
|
import type { TransformArrayItem } from '../../helperTypes';
|
|
14
14
|
import { ReduceMotion } from '../../commonTypes';
|
|
15
|
-
import {
|
|
15
|
+
import {
|
|
16
|
+
assertEasingIsWorklet,
|
|
17
|
+
getReduceMotionFromConfig,
|
|
18
|
+
} from '../../animation/util';
|
|
16
19
|
|
|
17
20
|
interface KeyframePoint {
|
|
18
21
|
duration: number;
|
|
@@ -129,6 +132,11 @@ class InnerKeyframe implements IEntryExitAnimationBuilder {
|
|
|
129
132
|
"[Reanimated] Keyframe can contain only that set of properties that were provide with initial values (keyframe 0 or 'from')"
|
|
130
133
|
);
|
|
131
134
|
}
|
|
135
|
+
|
|
136
|
+
if (__DEV__ && easing) {
|
|
137
|
+
assertEasingIsWorklet(easing);
|
|
138
|
+
}
|
|
139
|
+
|
|
132
140
|
parsedKeyframes[key].push({
|
|
133
141
|
duration: getAnimationDuration(key, currentKeyPoint),
|
|
134
142
|
value,
|
|
@@ -157,5 +157,13 @@ export type StylePropsWithArrayTransform = StyleProps & {
|
|
|
157
157
|
export interface LayoutAnimationBatchItem {
|
|
158
158
|
viewTag: number;
|
|
159
159
|
type: LayoutAnimationType;
|
|
160
|
-
config:
|
|
160
|
+
config:
|
|
161
|
+
| ShareableRef<
|
|
162
|
+
| Keyframe
|
|
163
|
+
| LayoutAnimationFunction
|
|
164
|
+
| SharedTransitionAnimationsFunction
|
|
165
|
+
| ProgressAnimationCallback
|
|
166
|
+
>
|
|
167
|
+
| undefined;
|
|
168
|
+
sharedTransitionTag?: string;
|
|
161
169
|
}
|
|
@@ -8,9 +8,12 @@ import type {
|
|
|
8
8
|
SharedTransitionAnimationsValues,
|
|
9
9
|
LayoutAnimation,
|
|
10
10
|
} from './animationBuilder/commonTypes';
|
|
11
|
+
import { isFabric } from '../PlatformChecker';
|
|
11
12
|
|
|
12
13
|
const TAG_OFFSET = 1e9;
|
|
13
14
|
|
|
15
|
+
const IS_FABRIC = isFabric();
|
|
16
|
+
|
|
14
17
|
function startObservingProgress(
|
|
15
18
|
tag: number,
|
|
16
19
|
sharedValue: SharedValue<Record<string, unknown>>,
|
|
@@ -55,8 +58,10 @@ function createLayoutAnimationManager() {
|
|
|
55
58
|
global.ProgressTransitionRegister.onTransitionStart(tag, yogaValues);
|
|
56
59
|
return;
|
|
57
60
|
}
|
|
61
|
+
// console.log('start', tag, type, yogaValues, config);
|
|
58
62
|
|
|
59
63
|
const style = config(yogaValues);
|
|
64
|
+
// console.log(style);
|
|
60
65
|
let currentAnimation = style.animations;
|
|
61
66
|
|
|
62
67
|
// When layout animation is requested, but a previous one is still running, we merge
|
|
@@ -72,7 +77,9 @@ function createLayoutAnimationManager() {
|
|
|
72
77
|
value = makeUIMutable(style.initialValues);
|
|
73
78
|
mutableValuesForTag.set(tag, value);
|
|
74
79
|
} else {
|
|
75
|
-
|
|
80
|
+
if (!IS_FABRIC) {
|
|
81
|
+
stopObservingProgress(tag, value);
|
|
82
|
+
}
|
|
76
83
|
value._value = style.initialValues;
|
|
77
84
|
}
|
|
78
85
|
|
|
@@ -98,7 +105,8 @@ function createLayoutAnimationManager() {
|
|
|
98
105
|
if (!value) {
|
|
99
106
|
return;
|
|
100
107
|
}
|
|
101
|
-
|
|
108
|
+
value.removeListener(tag + TAG_OFFSET);
|
|
109
|
+
// stopObservingProgress(tag, value);
|
|
102
110
|
},
|
|
103
111
|
};
|
|
104
112
|
}
|
|
@@ -7,6 +7,7 @@ import { BaseAnimationBuilder } from '../animationBuilder';
|
|
|
7
7
|
import type { EasingFunction } from '../../Easing';
|
|
8
8
|
import { Easing } from '../../Easing';
|
|
9
9
|
import { withTiming } from '../../animation';
|
|
10
|
+
import { assertEasingIsWorklet } from '../../animation/util';
|
|
10
11
|
|
|
11
12
|
/**
|
|
12
13
|
* Layout transitions with a curved animation. You can modify the behavior by chaining methods like `.duration(500)` or `.delay(500)`.
|
|
@@ -36,6 +37,9 @@ export class CurvedTransition
|
|
|
36
37
|
}
|
|
37
38
|
|
|
38
39
|
easingX(easing: EasingFunction): CurvedTransition {
|
|
40
|
+
if (__DEV__) {
|
|
41
|
+
assertEasingIsWorklet(easing);
|
|
42
|
+
}
|
|
39
43
|
this.easingXV = easing;
|
|
40
44
|
return this;
|
|
41
45
|
}
|
|
@@ -46,6 +50,9 @@ export class CurvedTransition
|
|
|
46
50
|
}
|
|
47
51
|
|
|
48
52
|
easingY(easing: EasingFunction): CurvedTransition {
|
|
53
|
+
if (__DEV__) {
|
|
54
|
+
assertEasingIsWorklet(easing);
|
|
55
|
+
}
|
|
49
56
|
this.easingYV = easing;
|
|
50
57
|
return this;
|
|
51
58
|
}
|
|
@@ -56,6 +63,9 @@ export class CurvedTransition
|
|
|
56
63
|
}
|
|
57
64
|
|
|
58
65
|
easingWidth(easing: EasingFunction): CurvedTransition {
|
|
66
|
+
if (__DEV__) {
|
|
67
|
+
assertEasingIsWorklet(easing);
|
|
68
|
+
}
|
|
59
69
|
this.easingWidthV = easing;
|
|
60
70
|
return this;
|
|
61
71
|
}
|
|
@@ -66,6 +76,9 @@ export class CurvedTransition
|
|
|
66
76
|
}
|
|
67
77
|
|
|
68
78
|
easingHeight(easing: EasingFunction): CurvedTransition {
|
|
79
|
+
if (__DEV__) {
|
|
80
|
+
assertEasingIsWorklet(easing);
|
|
81
|
+
}
|
|
69
82
|
this.easingHeightV = easing;
|
|
70
83
|
return this;
|
|
71
84
|
}
|
|
@@ -39,14 +39,18 @@ export class ProgressTransitionManager {
|
|
|
39
39
|
progressAnimation
|
|
40
40
|
);
|
|
41
41
|
})();
|
|
42
|
+
|
|
42
43
|
this.registerEventHandlers();
|
|
43
44
|
}
|
|
44
45
|
|
|
45
|
-
public removeProgressAnimation(viewTag: number) {
|
|
46
|
+
public removeProgressAnimation(viewTag: number, isUnmounting = true) {
|
|
46
47
|
this.unregisterEventHandlers();
|
|
47
48
|
runOnUIImmediately(() => {
|
|
48
49
|
'worklet';
|
|
49
|
-
global.ProgressTransitionRegister.removeProgressAnimation(
|
|
50
|
+
global.ProgressTransitionRegister.removeProgressAnimation(
|
|
51
|
+
viewTag,
|
|
52
|
+
isUnmounting
|
|
53
|
+
);
|
|
50
54
|
})();
|
|
51
55
|
}
|
|
52
56
|
|
|
@@ -141,19 +145,24 @@ function createProgressTransitionRegister() {
|
|
|
141
145
|
viewTag: number,
|
|
142
146
|
progressAnimation: ProgressAnimation
|
|
143
147
|
) => {
|
|
144
|
-
if (currentTransitions.size > 0) {
|
|
148
|
+
if (currentTransitions.size > 0 && !progressAnimations.has(viewTag)) {
|
|
145
149
|
// there is no need to prevent cleaning on android
|
|
146
150
|
isTransitionRestart = !IS_ANDROID;
|
|
147
151
|
}
|
|
148
152
|
progressAnimations.set(viewTag, progressAnimation);
|
|
149
153
|
},
|
|
150
|
-
removeProgressAnimation: (viewTag: number) => {
|
|
154
|
+
removeProgressAnimation: (viewTag: number, isUnmounting: boolean) => {
|
|
151
155
|
if (currentTransitions.size > 0) {
|
|
152
156
|
// there is no need to prevent cleaning on android
|
|
153
157
|
isTransitionRestart = !IS_ANDROID;
|
|
154
158
|
}
|
|
155
|
-
|
|
156
|
-
|
|
159
|
+
if (isUnmounting) {
|
|
160
|
+
// Remove the animation config after the transition is finished
|
|
161
|
+
toRemove.add(viewTag);
|
|
162
|
+
} else {
|
|
163
|
+
// if the animation is removed, without ever being started, it can be removed immediately
|
|
164
|
+
progressAnimations.delete(viewTag);
|
|
165
|
+
}
|
|
157
166
|
},
|
|
158
167
|
onTransitionStart: (
|
|
159
168
|
viewTag: number,
|
|
@@ -194,7 +203,7 @@ function createProgressTransitionRegister() {
|
|
|
194
203
|
return;
|
|
195
204
|
}
|
|
196
205
|
for (const viewTag of currentTransitions) {
|
|
197
|
-
global._notifyAboutEnd(viewTag, removeViews);
|
|
206
|
+
// global._notifyAboutEnd(viewTag, removeViews);
|
|
198
207
|
}
|
|
199
208
|
currentTransitions.clear();
|
|
200
209
|
if (isTransitionRestart) {
|
|
@@ -206,7 +215,7 @@ function createProgressTransitionRegister() {
|
|
|
206
215
|
if (toRemove.size > 0) {
|
|
207
216
|
for (const viewTag of toRemove) {
|
|
208
217
|
progressAnimations.delete(viewTag);
|
|
209
|
-
global._notifyAboutEnd(viewTag, removeViews);
|
|
218
|
+
// global._notifyAboutEnd(viewTag, removeViews);
|
|
210
219
|
}
|
|
211
220
|
toRemove.clear();
|
|
212
221
|
}
|
|
@@ -13,8 +13,9 @@ import {
|
|
|
13
13
|
} from '../animationBuilder/commonTypes';
|
|
14
14
|
import type { StyleProps } from '../../commonTypes';
|
|
15
15
|
import { ReduceMotion } from '../../commonTypes';
|
|
16
|
-
import { configureLayoutAnimations } from '../../core';
|
|
17
16
|
import { ProgressTransitionManager } from './ProgressTransitionManager';
|
|
17
|
+
import { updateLayoutAnimations } from '../../UpdateLayoutAnimations';
|
|
18
|
+
import { getReduceMotionFromConfig } from '../../animation/util';
|
|
18
19
|
|
|
19
20
|
const SUPPORTED_PROPS = [
|
|
20
21
|
'width',
|
|
@@ -80,8 +81,13 @@ export class SharedTransition {
|
|
|
80
81
|
|
|
81
82
|
public registerTransition(
|
|
82
83
|
viewTag: number,
|
|
83
|
-
sharedTransitionTag: string
|
|
84
|
-
|
|
84
|
+
sharedTransitionTag: string,
|
|
85
|
+
isUnmounting = false
|
|
86
|
+
) {
|
|
87
|
+
if (getReduceMotionFromConfig(this.getReduceMotion())) {
|
|
88
|
+
return;
|
|
89
|
+
}
|
|
90
|
+
|
|
85
91
|
const transitionAnimation = this.getTransitionAnimation();
|
|
86
92
|
const progressAnimation = this.getProgressAnimation();
|
|
87
93
|
if (!this._defaultTransitionType) {
|
|
@@ -95,11 +101,12 @@ export class SharedTransition {
|
|
|
95
101
|
this._defaultTransitionType === SharedTransitionType.ANIMATION
|
|
96
102
|
? LayoutAnimationType.SHARED_ELEMENT_TRANSITION
|
|
97
103
|
: LayoutAnimationType.SHARED_ELEMENT_TRANSITION_PROGRESS;
|
|
98
|
-
|
|
104
|
+
updateLayoutAnimations(
|
|
99
105
|
viewTag,
|
|
100
106
|
layoutAnimationType,
|
|
101
107
|
transitionAnimation,
|
|
102
|
-
sharedTransitionTag
|
|
108
|
+
sharedTransitionTag,
|
|
109
|
+
isUnmounting
|
|
103
110
|
);
|
|
104
111
|
SharedTransition._progressTransitionManager.addProgressAnimation(
|
|
105
112
|
viewTag,
|
|
@@ -107,9 +114,21 @@ export class SharedTransition {
|
|
|
107
114
|
);
|
|
108
115
|
}
|
|
109
116
|
|
|
110
|
-
public unregisterTransition(viewTag: number): void {
|
|
117
|
+
public unregisterTransition(viewTag: number, isUnmounting = false): void {
|
|
118
|
+
const layoutAnimationType =
|
|
119
|
+
this._defaultTransitionType === SharedTransitionType.ANIMATION
|
|
120
|
+
? LayoutAnimationType.SHARED_ELEMENT_TRANSITION
|
|
121
|
+
: LayoutAnimationType.SHARED_ELEMENT_TRANSITION_PROGRESS;
|
|
122
|
+
updateLayoutAnimations(
|
|
123
|
+
viewTag,
|
|
124
|
+
layoutAnimationType,
|
|
125
|
+
undefined,
|
|
126
|
+
undefined,
|
|
127
|
+
isUnmounting
|
|
128
|
+
);
|
|
111
129
|
SharedTransition._progressTransitionManager.removeProgressAnimation(
|
|
112
|
-
viewTag
|
|
130
|
+
viewTag,
|
|
131
|
+
isUnmounting
|
|
113
132
|
);
|
|
114
133
|
}
|
|
115
134
|
|
|
@@ -48,7 +48,7 @@ function checkUndefinedAnimationFail(
|
|
|
48
48
|
}
|
|
49
49
|
|
|
50
50
|
console.warn(
|
|
51
|
-
"[Reanimated] Couldn't load entering/exiting animation. Current version supports only predefined animations with modifiers: duration, delay, easing, randomizeDelay,
|
|
51
|
+
"[Reanimated] Couldn't load entering/exiting animation. Current version supports only predefined animations with modifiers: duration, delay, easing, randomizeDelay, withCallback, reducedMotion."
|
|
52
52
|
);
|
|
53
53
|
|
|
54
54
|
return true;
|
|
@@ -78,5 +78,7 @@ export function setDummyPosition(
|
|
|
78
78
|
dummy.style.height = `${snapshot.height}px`;
|
|
79
79
|
dummy.style.margin = '0px'; // tmpElement has absolute position, so margin is not necessary
|
|
80
80
|
|
|
81
|
-
|
|
81
|
+
if (dummy.parentElement) {
|
|
82
|
+
fixElementPosition(dummy, dummy.parentElement, snapshot);
|
|
83
|
+
}
|
|
82
84
|
}
|
|
@@ -276,7 +276,7 @@ export function handleExitingAnimation(
|
|
|
276
276
|
|
|
277
277
|
const scrollOffsets = getElementScrollValue(element);
|
|
278
278
|
|
|
279
|
-
// Scroll does not trigger
|
|
279
|
+
// Scroll does not trigger snapshotting, therefore if we start exiting animation after
|
|
280
280
|
// scrolling through parent component, dummy will end up in wrong place. In order to fix that
|
|
281
281
|
// we keep last known scroll position in snapshot and then adjust dummy position based on
|
|
282
282
|
// last known scroll offset and current scroll offset
|