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
|
@@ -8,7 +8,7 @@ import type {
|
|
|
8
8
|
} from 'react';
|
|
9
9
|
import React from 'react';
|
|
10
10
|
import { findNodeHandle, Platform } from 'react-native';
|
|
11
|
-
import WorkletEventHandler from '../reanimated2/WorkletEventHandler';
|
|
11
|
+
import { WorkletEventHandler } from '../reanimated2/WorkletEventHandler';
|
|
12
12
|
import '../reanimated2/layoutReanimation/animationsManager';
|
|
13
13
|
import invariant from 'invariant';
|
|
14
14
|
import { adaptViewConfig } from '../ConfigHelper';
|
|
@@ -55,9 +55,9 @@ import { updateLayoutAnimations } from '../reanimated2/UpdateLayoutAnimations';
|
|
|
55
55
|
import type { CustomConfig } from '../reanimated2/layoutReanimation/web/config';
|
|
56
56
|
import type { FlatList, FlatListProps } from 'react-native';
|
|
57
57
|
import { addHTMLMutationObserver } from '../reanimated2/layoutReanimation/web/domUtils';
|
|
58
|
+
import { getViewInfo } from './getViewInfo';
|
|
58
59
|
|
|
59
60
|
const IS_WEB = isWeb();
|
|
60
|
-
const IS_FABRIC = isFabric();
|
|
61
61
|
|
|
62
62
|
if (IS_WEB) {
|
|
63
63
|
configureWebLayoutAnimations();
|
|
@@ -106,6 +106,8 @@ export function createAnimatedComponent(
|
|
|
106
106
|
options?: Options<any>
|
|
107
107
|
): ComponentClass<AnimateProps<FlatListProps<unknown>>>;
|
|
108
108
|
|
|
109
|
+
let id = 0;
|
|
110
|
+
|
|
109
111
|
export function createAnimatedComponent(
|
|
110
112
|
Component: ComponentType<InitialComponentProps>,
|
|
111
113
|
options?: Options<InitialComponentProps>
|
|
@@ -134,15 +136,25 @@ export function createAnimatedComponent(
|
|
|
134
136
|
static displayName: string;
|
|
135
137
|
static contextType = SkipEnteringContext;
|
|
136
138
|
context!: React.ContextType<typeof SkipEnteringContext>;
|
|
139
|
+
nativeID = id++;
|
|
137
140
|
|
|
138
141
|
constructor(props: AnimatedComponentProps<InitialComponentProps>) {
|
|
139
142
|
super(props);
|
|
140
143
|
if (isJest()) {
|
|
141
144
|
this.jestAnimatedStyle = { value: {} };
|
|
142
145
|
}
|
|
146
|
+
const entering = this.props.entering;
|
|
147
|
+
if (entering) {
|
|
148
|
+
updateLayoutAnimations(
|
|
149
|
+
this.nativeID,
|
|
150
|
+
LayoutAnimationType.ENTERING,
|
|
151
|
+
maybeBuild(entering, this.props?.style, AnimatedComponent.displayName)
|
|
152
|
+
);
|
|
153
|
+
}
|
|
143
154
|
}
|
|
144
155
|
|
|
145
156
|
componentDidMount() {
|
|
157
|
+
this._viewTag = this._getViewInfo().viewTag as number;
|
|
146
158
|
this._attachNativeEvents();
|
|
147
159
|
this._jsPropsUpdater.addOnJSPropsChangeListener(this);
|
|
148
160
|
this._attachAnimatedStyles();
|
|
@@ -181,11 +193,15 @@ export function createAnimatedComponent(
|
|
|
181
193
|
this._jsPropsUpdater.removeOnJSPropsChangeListener(this);
|
|
182
194
|
this._detachStyles();
|
|
183
195
|
this._InlinePropManager.detachInlineProps();
|
|
184
|
-
|
|
196
|
+
if (this.props.sharedTransitionTag) {
|
|
197
|
+
this._configureSharedTransition(true);
|
|
198
|
+
}
|
|
199
|
+
this._sharedElementTransition?.unregisterTransition(this._viewTag, true);
|
|
185
200
|
|
|
186
201
|
const exiting = this.props.exiting;
|
|
187
202
|
if (
|
|
188
203
|
IS_WEB &&
|
|
204
|
+
this._component &&
|
|
189
205
|
this.props.exiting &&
|
|
190
206
|
!getReducedMotionFromConfig(this.props.exiting as CustomConfig)
|
|
191
207
|
) {
|
|
@@ -225,21 +241,13 @@ export function createAnimatedComponent(
|
|
|
225
241
|
}
|
|
226
242
|
|
|
227
243
|
_attachNativeEvents() {
|
|
228
|
-
const node = this._getEventViewRef() as AnimatedComponentRef;
|
|
229
|
-
let viewTag = null; // We set it only if needed
|
|
230
|
-
|
|
231
244
|
for (const key in this.props) {
|
|
232
245
|
const prop = this.props[key];
|
|
233
246
|
if (
|
|
234
247
|
has('workletEventHandler', prop) &&
|
|
235
248
|
prop.workletEventHandler instanceof WorkletEventHandler
|
|
236
249
|
) {
|
|
237
|
-
|
|
238
|
-
viewTag = IS_WEB
|
|
239
|
-
? this._component
|
|
240
|
-
: findNodeHandle(options?.setNativeProps ? this : node);
|
|
241
|
-
}
|
|
242
|
-
prop.workletEventHandler.registerForEvents(viewTag as number, key);
|
|
250
|
+
prop.workletEventHandler.registerForEvents(this._viewTag, key);
|
|
243
251
|
}
|
|
244
252
|
}
|
|
245
253
|
}
|
|
@@ -251,7 +259,7 @@ export function createAnimatedComponent(
|
|
|
251
259
|
has('workletEventHandler', prop) &&
|
|
252
260
|
prop.workletEventHandler instanceof WorkletEventHandler
|
|
253
261
|
) {
|
|
254
|
-
prop.workletEventHandler.unregisterFromEvents();
|
|
262
|
+
prop.workletEventHandler.unregisterFromEvents(this._viewTag);
|
|
255
263
|
}
|
|
256
264
|
}
|
|
257
265
|
}
|
|
@@ -268,44 +276,46 @@ export function createAnimatedComponent(
|
|
|
268
276
|
if (this.props.animatedProps?.viewDescriptors) {
|
|
269
277
|
this.props.animatedProps.viewDescriptors.remove(this._viewTag);
|
|
270
278
|
}
|
|
271
|
-
if (
|
|
279
|
+
if (isFabric()) {
|
|
272
280
|
removeFromPropsRegistry(this._viewTag);
|
|
273
281
|
}
|
|
274
282
|
}
|
|
275
283
|
}
|
|
276
284
|
|
|
277
|
-
|
|
285
|
+
_updateNativeEvents(
|
|
278
286
|
prevProps: AnimatedComponentProps<InitialComponentProps>
|
|
279
287
|
) {
|
|
280
288
|
for (const key in prevProps) {
|
|
281
|
-
const
|
|
289
|
+
const prevProp = prevProps[key];
|
|
282
290
|
if (
|
|
283
|
-
has('workletEventHandler',
|
|
284
|
-
|
|
285
|
-
prop.workletEventHandler.reattachNeeded
|
|
291
|
+
has('workletEventHandler', prevProp) &&
|
|
292
|
+
prevProp.workletEventHandler instanceof WorkletEventHandler
|
|
286
293
|
) {
|
|
287
|
-
|
|
294
|
+
const newProp = this.props[key];
|
|
295
|
+
if (!newProp) {
|
|
296
|
+
// Prop got deleted
|
|
297
|
+
prevProp.workletEventHandler.unregisterFromEvents(this._viewTag);
|
|
298
|
+
} else if (
|
|
299
|
+
has('workletEventHandler', newProp) &&
|
|
300
|
+
newProp.workletEventHandler instanceof WorkletEventHandler &&
|
|
301
|
+
newProp.workletEventHandler !== prevProp.workletEventHandler
|
|
302
|
+
) {
|
|
303
|
+
// Prop got changed
|
|
304
|
+
prevProp.workletEventHandler.unregisterFromEvents(this._viewTag);
|
|
305
|
+
newProp.workletEventHandler.registerForEvents(this._viewTag);
|
|
306
|
+
}
|
|
288
307
|
}
|
|
289
308
|
}
|
|
290
309
|
|
|
291
|
-
let viewTag = null;
|
|
292
|
-
|
|
293
310
|
for (const key in this.props) {
|
|
294
|
-
const
|
|
311
|
+
const newProp = this.props[key];
|
|
295
312
|
if (
|
|
296
|
-
has('workletEventHandler',
|
|
297
|
-
|
|
298
|
-
|
|
313
|
+
has('workletEventHandler', newProp) &&
|
|
314
|
+
newProp.workletEventHandler instanceof WorkletEventHandler &&
|
|
315
|
+
!prevProps[key]
|
|
299
316
|
) {
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
viewTag = IS_WEB
|
|
304
|
-
? this._component
|
|
305
|
-
: findNodeHandle(options?.setNativeProps ? this : node);
|
|
306
|
-
}
|
|
307
|
-
prop.workletEventHandler.registerForEvents(viewTag as number, key);
|
|
308
|
-
prop.workletEventHandler.reattachNeeded = false;
|
|
317
|
+
// Prop got added
|
|
318
|
+
newProp.workletEventHandler.registerForEvents(this._viewTag);
|
|
309
319
|
}
|
|
310
320
|
}
|
|
311
321
|
}
|
|
@@ -349,19 +359,14 @@ export function createAnimatedComponent(
|
|
|
349
359
|
'[Reanimated] Cannot find host instance for this component. Maybe it renders nothing?'
|
|
350
360
|
);
|
|
351
361
|
}
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
viewConfig = hostInstance?.viewConfig;
|
|
361
|
-
|
|
362
|
-
if (IS_FABRIC) {
|
|
363
|
-
shadowNodeWrapper = getShadowNodeWrapperFromRef(this);
|
|
364
|
-
}
|
|
362
|
+
|
|
363
|
+
const viewInfo = getViewInfo(hostInstance);
|
|
364
|
+
viewTag = viewInfo.viewTag;
|
|
365
|
+
viewName = viewInfo.viewName;
|
|
366
|
+
viewConfig = viewInfo.viewConfig;
|
|
367
|
+
shadowNodeWrapper = isFabric()
|
|
368
|
+
? getShadowNodeWrapperFromRef(this)
|
|
369
|
+
: null;
|
|
365
370
|
}
|
|
366
371
|
this._viewInfo = { viewTag, viewName, shadowNodeWrapper, viewConfig };
|
|
367
372
|
return this._viewInfo;
|
|
@@ -456,7 +461,13 @@ export function createAnimatedComponent(
|
|
|
456
461
|
if (layout !== oldLayout) {
|
|
457
462
|
this._configureLayoutTransition();
|
|
458
463
|
}
|
|
459
|
-
|
|
464
|
+
if (
|
|
465
|
+
this.props.sharedTransitionTag !== undefined ||
|
|
466
|
+
prevProps.sharedTransitionTag !== undefined
|
|
467
|
+
) {
|
|
468
|
+
this._configureSharedTransition();
|
|
469
|
+
}
|
|
470
|
+
this._updateNativeEvents(prevProps);
|
|
460
471
|
this._attachAnimatedStyles();
|
|
461
472
|
this._InlinePropManager.attachInlineProps(this, this._getViewInfo());
|
|
462
473
|
|
|
@@ -490,6 +501,31 @@ export function createAnimatedComponent(
|
|
|
490
501
|
updateLayoutAnimations(this._viewTag, LayoutAnimationType.LAYOUT, layout);
|
|
491
502
|
}
|
|
492
503
|
|
|
504
|
+
_configureSharedTransition(isUnmounting = false) {
|
|
505
|
+
if (IS_WEB) {
|
|
506
|
+
return;
|
|
507
|
+
}
|
|
508
|
+
const { sharedTransitionTag } = this.props;
|
|
509
|
+
if (!sharedTransitionTag) {
|
|
510
|
+
this._sharedElementTransition?.unregisterTransition(
|
|
511
|
+
this._viewTag,
|
|
512
|
+
isUnmounting
|
|
513
|
+
);
|
|
514
|
+
this._sharedElementTransition = null;
|
|
515
|
+
return;
|
|
516
|
+
}
|
|
517
|
+
const sharedElementTransition =
|
|
518
|
+
this.props.sharedTransitionStyle ??
|
|
519
|
+
this._sharedElementTransition ??
|
|
520
|
+
new SharedTransition();
|
|
521
|
+
sharedElementTransition.registerTransition(
|
|
522
|
+
this._viewTag,
|
|
523
|
+
sharedTransitionTag,
|
|
524
|
+
isUnmounting
|
|
525
|
+
);
|
|
526
|
+
this._sharedElementTransition = sharedElementTransition;
|
|
527
|
+
}
|
|
528
|
+
|
|
493
529
|
_setComponentRef = setAndForwardRef<Component | HTMLElement>({
|
|
494
530
|
getForwardedRef: () =>
|
|
495
531
|
this.props.forwardedRef as MutableRefObject<
|
|
@@ -502,6 +538,8 @@ export function createAnimatedComponent(
|
|
|
502
538
|
? (ref as HTMLElement)
|
|
503
539
|
: findNodeHandle(ref as Component);
|
|
504
540
|
|
|
541
|
+
this._viewTag = tag as number;
|
|
542
|
+
|
|
505
543
|
const { layout, entering, exiting, sharedTransitionTag } = this.props;
|
|
506
544
|
if (
|
|
507
545
|
(layout || entering || exiting || sharedTransitionTag) &&
|
|
@@ -511,17 +549,8 @@ export function createAnimatedComponent(
|
|
|
511
549
|
enableLayoutAnimations(true, false);
|
|
512
550
|
}
|
|
513
551
|
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
updateLayoutAnimations(
|
|
517
|
-
tag as number,
|
|
518
|
-
LayoutAnimationType.ENTERING,
|
|
519
|
-
maybeBuild(
|
|
520
|
-
entering,
|
|
521
|
-
this.props?.style,
|
|
522
|
-
AnimatedComponent.displayName
|
|
523
|
-
)
|
|
524
|
-
);
|
|
552
|
+
if (sharedTransitionTag) {
|
|
553
|
+
this._configureSharedTransition();
|
|
525
554
|
}
|
|
526
555
|
if (sharedTransitionTag && !IS_WEB) {
|
|
527
556
|
const sharedElementTransition =
|
|
@@ -537,6 +566,24 @@ export function createAnimatedComponent(
|
|
|
537
566
|
this._sharedElementTransition = sharedElementTransition;
|
|
538
567
|
}
|
|
539
568
|
}
|
|
569
|
+
if (exiting) {
|
|
570
|
+
const reduceMotionInExiting =
|
|
571
|
+
'getReduceMotion' in exiting &&
|
|
572
|
+
typeof exiting.getReduceMotion === 'function'
|
|
573
|
+
? getReduceMotionFromConfig(exiting.getReduceMotion())
|
|
574
|
+
: getReduceMotionFromConfig();
|
|
575
|
+
if (!reduceMotionInExiting) {
|
|
576
|
+
updateLayoutAnimations(
|
|
577
|
+
tag as number,
|
|
578
|
+
LayoutAnimationType.EXITING,
|
|
579
|
+
maybeBuild(
|
|
580
|
+
exiting,
|
|
581
|
+
this.props?.style,
|
|
582
|
+
AnimatedComponent.displayName
|
|
583
|
+
)
|
|
584
|
+
);
|
|
585
|
+
}
|
|
586
|
+
}
|
|
540
587
|
}
|
|
541
588
|
|
|
542
589
|
if (ref !== this._component) {
|
|
@@ -589,6 +636,7 @@ export function createAnimatedComponent(
|
|
|
589
636
|
|
|
590
637
|
return (
|
|
591
638
|
<Component
|
|
639
|
+
nativeID={`${this.nativeID}`}
|
|
592
640
|
{...filteredProps}
|
|
593
641
|
// Casting is used here, because ref can be null - in that case it cannot be assigned to HTMLElement.
|
|
594
642
|
// After spending some time trying to figure out what to do with this problem, we decided to leave it this way
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
3
|
+
|
|
4
|
+
// This is a makeshift solution to handle both 0.73 and 0.74 versions of React Native.
|
|
5
|
+
|
|
6
|
+
export let getViewInfo = (element: any) => {
|
|
7
|
+
if (element._nativeTag !== undefined && element.__nativeTag !== null) {
|
|
8
|
+
getViewInfo = getViewInfo73;
|
|
9
|
+
return getViewInfo73(element);
|
|
10
|
+
} else if (
|
|
11
|
+
element.__nativeTag !== undefined &&
|
|
12
|
+
element.__nativeTag !== null
|
|
13
|
+
) {
|
|
14
|
+
getViewInfo = getViewInfoLatest;
|
|
15
|
+
return getViewInfoLatest(element);
|
|
16
|
+
}
|
|
17
|
+
return getViewInfo73(element);
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
function getViewInfo73(element: any) {
|
|
21
|
+
return {
|
|
22
|
+
// we can access view tag in the same way it's accessed here https://github.com/facebook/react/blob/e3f4eb7272d4ca0ee49f27577156b57eeb07cf73/packages/react-native-renderer/src/ReactFabric.js#L146
|
|
23
|
+
viewName: element?.viewConfig?.uiViewClassName,
|
|
24
|
+
/**
|
|
25
|
+
* RN uses viewConfig for components for storing different properties of the component(example: https://github.com/facebook/react-native/blob/main/packages/react-native/Libraries/Components/ScrollView/ScrollViewNativeComponent.js#L24).
|
|
26
|
+
* The name we're looking for is in the field named uiViewClassName.
|
|
27
|
+
*/
|
|
28
|
+
viewTag: element?._nativeTag,
|
|
29
|
+
viewConfig: element?.viewConfig,
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
function getViewInfoLatest(element: any) {
|
|
34
|
+
return {
|
|
35
|
+
viewName: element?._viewConfig?.uiViewClassName,
|
|
36
|
+
viewTag: element?.__nativeTag,
|
|
37
|
+
viewConfig: element?._viewConfig,
|
|
38
|
+
};
|
|
39
|
+
}
|
package/src/mock.ts
CHANGED
|
@@ -17,6 +17,11 @@ import {
|
|
|
17
17
|
ColorSpace,
|
|
18
18
|
Extrapolation,
|
|
19
19
|
SharedTransitionType,
|
|
20
|
+
withReanimatedTimer,
|
|
21
|
+
advanceAnimationByTime,
|
|
22
|
+
advanceAnimationByFrame,
|
|
23
|
+
setUpTests,
|
|
24
|
+
getAnimatedStyle,
|
|
20
25
|
} from './reanimated2';
|
|
21
26
|
import {
|
|
22
27
|
View as ViewRN,
|
|
@@ -391,7 +396,13 @@ const pluginUtils = {
|
|
|
391
396
|
// getUseOfValueInStyleWarning: ADD ME IF NEEDED
|
|
392
397
|
};
|
|
393
398
|
|
|
394
|
-
|
|
399
|
+
const jestUtils = {
|
|
400
|
+
withReanimatedTimer,
|
|
401
|
+
advanceAnimationByTime,
|
|
402
|
+
advanceAnimationByFrame,
|
|
403
|
+
setUpTests,
|
|
404
|
+
getAnimatedStyle,
|
|
405
|
+
};
|
|
395
406
|
|
|
396
407
|
const LayoutAnimationConfig = {
|
|
397
408
|
// LayoutAnimationConfig: ADD ME IF NEEDED
|
|
@@ -431,6 +442,7 @@ const Reanimated = {
|
|
|
431
442
|
...isSharedValue,
|
|
432
443
|
...commonTypes,
|
|
433
444
|
...pluginUtils,
|
|
445
|
+
...jestUtils,
|
|
434
446
|
...LayoutAnimationConfig,
|
|
435
447
|
...mappers,
|
|
436
448
|
};
|
|
@@ -1,21 +1,26 @@
|
|
|
1
1
|
'use strict';
|
|
2
|
-
import { NativeModules } from 'react-native';
|
|
3
|
-
import type { ShareableRef, Value3D, ValueRotation } from '../commonTypes';
|
|
4
2
|
import type {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
3
|
+
ShadowNodeWrapper,
|
|
4
|
+
Value3D,
|
|
5
|
+
ValueRotation,
|
|
6
|
+
ShareableRef,
|
|
7
|
+
} from '../commonTypes';
|
|
8
8
|
import { checkCppVersion } from '../platform-specific/checkCppVersion';
|
|
9
9
|
import { jsVersion } from '../platform-specific/jsVersion';
|
|
10
10
|
import type { WorkletRuntime } from '../runtimes';
|
|
11
11
|
import { getValueUnpackerCode } from '../valueUnpacker';
|
|
12
|
+
import { isFabric } from '../PlatformChecker';
|
|
13
|
+
import type React from 'react';
|
|
14
|
+
import { getShadowNodeWrapperFromRef } from '../fabricUtils';
|
|
12
15
|
import type { LayoutAnimationBatchItem } from '../layoutReanimation/animationBuilder/commonTypes';
|
|
16
|
+
import ReanimatedModule from '../../specs/NativeReanimatedModule';
|
|
13
17
|
|
|
14
18
|
// this is the type of `__reanimatedModuleProxy` which is injected using JSI
|
|
15
19
|
export interface NativeReanimatedModule {
|
|
16
20
|
makeShareableClone<T>(
|
|
17
21
|
value: T,
|
|
18
|
-
shouldPersistRemote: boolean
|
|
22
|
+
shouldPersistRemote: boolean,
|
|
23
|
+
nativeStateSource?: object
|
|
19
24
|
): ShareableRef<T>;
|
|
20
25
|
scheduleOnUI<T>(shareable: ShareableRef<T>): void;
|
|
21
26
|
executeOnUIRuntimeSync<T, R>(shareable: ShareableRef<T>): R;
|
|
@@ -34,7 +39,7 @@ export interface NativeReanimatedModule {
|
|
|
34
39
|
): number;
|
|
35
40
|
unregisterEventHandler(id: number): void;
|
|
36
41
|
getViewProp<T>(
|
|
37
|
-
|
|
42
|
+
viewTagOrShadowNodeWrapper: number | ShadowNodeWrapper,
|
|
38
43
|
propName: string,
|
|
39
44
|
callback?: (result: T) => void
|
|
40
45
|
): Promise<T>;
|
|
@@ -52,18 +57,8 @@ export interface NativeReanimatedModule {
|
|
|
52
57
|
isStatusBarTranslucent: boolean
|
|
53
58
|
): number;
|
|
54
59
|
unsubscribeFromKeyboardEvents(listenerId: number): void;
|
|
55
|
-
configureLayoutAnimation(
|
|
56
|
-
viewTag: number,
|
|
57
|
-
type: LayoutAnimationType,
|
|
58
|
-
sharedTransitionTag: string,
|
|
59
|
-
config: ShareableRef<Keyframe | LayoutAnimationFunction>
|
|
60
|
-
): void;
|
|
61
60
|
configureLayoutAnimationBatch(
|
|
62
|
-
layoutAnimationsBatch:
|
|
63
|
-
viewTag: number;
|
|
64
|
-
type: LayoutAnimationType;
|
|
65
|
-
config: ShareableRef<Keyframe | LayoutAnimationFunction> | undefined;
|
|
66
|
-
}[]
|
|
61
|
+
layoutAnimationsBatch: LayoutAnimationBatchItem[]
|
|
67
62
|
): void;
|
|
68
63
|
setShouldAnimateExitingForTag(viewTag: number, shouldAnimate: boolean): void;
|
|
69
64
|
}
|
|
@@ -90,7 +85,6 @@ export class NativeReanimated {
|
|
|
90
85
|
}
|
|
91
86
|
global._REANIMATED_VERSION_JS = jsVersion;
|
|
92
87
|
if (global.__reanimatedModuleProxy === undefined) {
|
|
93
|
-
const { ReanimatedModule } = NativeModules;
|
|
94
88
|
const valueUnpackerCode = getValueUnpackerCode();
|
|
95
89
|
ReanimatedModule?.installTurboModule(valueUnpackerCode);
|
|
96
90
|
}
|
|
@@ -106,10 +100,15 @@ See https://docs.swmansion.com/react-native-reanimated/docs/guides/troubleshooti
|
|
|
106
100
|
this.InnerNativeModule = global.__reanimatedModuleProxy;
|
|
107
101
|
}
|
|
108
102
|
|
|
109
|
-
makeShareableClone<T>(
|
|
103
|
+
makeShareableClone<T>(
|
|
104
|
+
value: T,
|
|
105
|
+
shouldPersistRemote: boolean,
|
|
106
|
+
nativeStateSource?: object
|
|
107
|
+
) {
|
|
110
108
|
return this.InnerNativeModule.makeShareableClone(
|
|
111
109
|
value,
|
|
112
|
-
shouldPersistRemote
|
|
110
|
+
shouldPersistRemote,
|
|
111
|
+
nativeStateSource
|
|
113
112
|
);
|
|
114
113
|
}
|
|
115
114
|
|
|
@@ -172,23 +171,22 @@ See https://docs.swmansion.com/react-native-reanimated/docs/guides/troubleshooti
|
|
|
172
171
|
getViewProp<T>(
|
|
173
172
|
viewTag: number,
|
|
174
173
|
propName: string,
|
|
174
|
+
component: React.Component | undefined, // required on Fabric
|
|
175
175
|
callback?: (result: T) => void
|
|
176
176
|
) {
|
|
177
|
-
|
|
178
|
-
|
|
177
|
+
let shadowNodeWrapper;
|
|
178
|
+
if (isFabric()) {
|
|
179
|
+
shadowNodeWrapper = getShadowNodeWrapperFromRef(
|
|
180
|
+
component as React.Component
|
|
181
|
+
);
|
|
182
|
+
return this.InnerNativeModule.getViewProp(
|
|
183
|
+
shadowNodeWrapper,
|
|
184
|
+
propName,
|
|
185
|
+
callback
|
|
186
|
+
);
|
|
187
|
+
}
|
|
179
188
|
|
|
180
|
-
|
|
181
|
-
viewTag: number,
|
|
182
|
-
type: LayoutAnimationType,
|
|
183
|
-
sharedTransitionTag: string,
|
|
184
|
-
config: ShareableRef<Keyframe | LayoutAnimationFunction>
|
|
185
|
-
) {
|
|
186
|
-
this.InnerNativeModule.configureLayoutAnimation(
|
|
187
|
-
viewTag,
|
|
188
|
-
type,
|
|
189
|
-
sharedTransitionTag,
|
|
190
|
-
config
|
|
191
|
-
);
|
|
189
|
+
return this.InnerNativeModule.getViewProp(viewTag, propName, callback);
|
|
192
190
|
}
|
|
193
191
|
|
|
194
192
|
configureLayoutAnimationBatch(
|
|
@@ -12,8 +12,9 @@ export function isJest(): boolean {
|
|
|
12
12
|
// `isChromeDebugger` also returns true in Jest environment, so `isJest()` check should always be performed first
|
|
13
13
|
export function isChromeDebugger(): boolean {
|
|
14
14
|
return (
|
|
15
|
-
!(global as localGlobal).nativeCallSyncHook ||
|
|
16
|
-
|
|
15
|
+
(!(global as localGlobal).nativeCallSyncHook ||
|
|
16
|
+
!!(global as localGlobal).__REMOTEDEV__) &&
|
|
17
|
+
!(global as localGlobal).RN$Bridgeless
|
|
17
18
|
);
|
|
18
19
|
}
|
|
19
20
|
|
|
@@ -2,8 +2,6 @@
|
|
|
2
2
|
import { isFabric } from './PlatformChecker';
|
|
3
3
|
import { runOnUI } from './threads';
|
|
4
4
|
|
|
5
|
-
const IS_FABRIC = isFabric();
|
|
6
|
-
|
|
7
5
|
let VIEW_TAGS: number[] = [];
|
|
8
6
|
|
|
9
7
|
export function removeFromPropsRegistry(viewTag: number) {
|
|
@@ -14,7 +12,7 @@ export function removeFromPropsRegistry(viewTag: number) {
|
|
|
14
12
|
}
|
|
15
13
|
|
|
16
14
|
function flush() {
|
|
17
|
-
if (__DEV__ && !
|
|
15
|
+
if (__DEV__ && !isFabric()) {
|
|
18
16
|
throw new Error('[Reanimated] PropsRegistry is only available on Fabric.');
|
|
19
17
|
}
|
|
20
18
|
runOnUI(removeFromPropsRegistryOnUI)(VIEW_TAGS);
|
|
@@ -8,29 +8,59 @@ import type {
|
|
|
8
8
|
LayoutAnimationFunction,
|
|
9
9
|
LayoutAnimationType,
|
|
10
10
|
} from './layoutReanimation';
|
|
11
|
-
import type {
|
|
11
|
+
import type {
|
|
12
|
+
LayoutAnimationBatchItem,
|
|
13
|
+
ProgressAnimationCallback,
|
|
14
|
+
SharedTransitionAnimationsFunction,
|
|
15
|
+
} from './layoutReanimation/animationBuilder/commonTypes';
|
|
12
16
|
|
|
13
17
|
function createUpdateManager() {
|
|
14
18
|
const animations: LayoutAnimationBatchItem[] = [];
|
|
19
|
+
// When a stack is rerendered we reconfigure all the shared elements.
|
|
20
|
+
// To do that we want them to appear in our batch in the correct order,
|
|
21
|
+
// so we defer some of the updates to appear at the end of the batch.
|
|
22
|
+
const deferredAnimations: LayoutAnimationBatchItem[] = [];
|
|
15
23
|
|
|
16
24
|
return {
|
|
17
|
-
update(batchItem: LayoutAnimationBatchItem) {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
25
|
+
update(batchItem: LayoutAnimationBatchItem, isUnmounting?: boolean) {
|
|
26
|
+
if (isUnmounting) {
|
|
27
|
+
deferredAnimations.push(batchItem);
|
|
28
|
+
} else {
|
|
29
|
+
animations.push(batchItem);
|
|
30
|
+
}
|
|
31
|
+
if (animations.length + deferredAnimations.length === 1) {
|
|
32
|
+
// setImmediate(this.flush);
|
|
33
|
+
this.flush();
|
|
21
34
|
}
|
|
22
35
|
},
|
|
23
36
|
flush(this: void) {
|
|
24
|
-
configureLayoutAnimationBatch(animations);
|
|
37
|
+
configureLayoutAnimationBatch(animations.concat(deferredAnimations));
|
|
25
38
|
animations.length = 0;
|
|
39
|
+
deferredAnimations.length = 0;
|
|
26
40
|
},
|
|
27
41
|
};
|
|
28
42
|
}
|
|
29
43
|
|
|
44
|
+
/**
|
|
45
|
+
* Lets you update the current configuration of the layout animation or shared element transition for a given component.
|
|
46
|
+
* Configurations are batched and applied at the end of the current execution block, right before sending the response back to native.
|
|
47
|
+
*
|
|
48
|
+
* @param viewTag - The tag of the component you'd like to configure.
|
|
49
|
+
* @param type - The type of the animation you'd like to configure - {@link LayoutAnimationType}.
|
|
50
|
+
* @param config - The animation configuration - {@link LayoutAnimationFunction}, {@link SharedTransitionAnimationsFunction}, {@link ProgressAnimationCallback} or {@link Keyframe}. Passing `undefined` will remove the animation.
|
|
51
|
+
* @param sharedTransitionTag - The tag of the shared element transition you'd like to configure. Passing `undefined` will remove the transition.
|
|
52
|
+
* @param isUnmounting - Determines whether the configuration should be included at the end of the batch, after all the non-deferred configurations (even those that were updated later). This is used to retain the correct ordering of shared elements. Defaults to `false`.
|
|
53
|
+
*/
|
|
30
54
|
export let updateLayoutAnimations: (
|
|
31
55
|
viewTag: number,
|
|
32
56
|
type: LayoutAnimationType,
|
|
33
|
-
config?:
|
|
57
|
+
config?:
|
|
58
|
+
| Keyframe
|
|
59
|
+
| LayoutAnimationFunction
|
|
60
|
+
| SharedTransitionAnimationsFunction
|
|
61
|
+
| ProgressAnimationCallback,
|
|
62
|
+
sharedTransitionTag?: string,
|
|
63
|
+
isUnmounting?: boolean
|
|
34
64
|
) => void;
|
|
35
65
|
|
|
36
66
|
if (shouldBeUseWeb()) {
|
|
@@ -39,10 +69,20 @@ if (shouldBeUseWeb()) {
|
|
|
39
69
|
};
|
|
40
70
|
} else {
|
|
41
71
|
const updateLayoutAnimationsManager = createUpdateManager();
|
|
42
|
-
updateLayoutAnimations = (
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
72
|
+
updateLayoutAnimations = (
|
|
73
|
+
viewTag,
|
|
74
|
+
type,
|
|
75
|
+
config,
|
|
76
|
+
sharedTransitionTag,
|
|
77
|
+
isUnmounting
|
|
78
|
+
) =>
|
|
79
|
+
updateLayoutAnimationsManager.update(
|
|
80
|
+
{
|
|
81
|
+
viewTag,
|
|
82
|
+
type,
|
|
83
|
+
config: config ? makeShareableCloneRecursive(config) : undefined,
|
|
84
|
+
sharedTransitionTag,
|
|
85
|
+
},
|
|
86
|
+
isUnmounting
|
|
87
|
+
);
|
|
48
88
|
}
|