react-native-reanimated 3.8.1 → 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.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 +3 -8
- 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/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/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
|
@@ -1,16 +1,19 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
4
|
-
function _toPropertyKey(
|
|
5
|
-
function _toPrimitive(
|
|
6
|
-
import { NativeEventEmitter,
|
|
4
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
5
|
+
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
6
|
+
import { NativeEventEmitter, Platform, findNodeHandle } from 'react-native';
|
|
7
7
|
import { shouldBeUseWeb } from '../reanimated2/PlatformChecker';
|
|
8
8
|
import { runOnJS, runOnUIImmediately } from '../reanimated2/threads';
|
|
9
|
+
import NativeReanimatedModule from '../specs/NativeReanimatedModule';
|
|
9
10
|
const SHOULD_BE_USE_WEB = shouldBeUseWeb();
|
|
10
11
|
class JSPropsUpdaterPaper {
|
|
11
12
|
constructor() {
|
|
12
13
|
_defineProperty(this, "_reanimatedEventEmitter", void 0);
|
|
13
|
-
this._reanimatedEventEmitter = new NativeEventEmitter(
|
|
14
|
+
this._reanimatedEventEmitter = new NativeEventEmitter(
|
|
15
|
+
// NativeEventEmitter only uses this parameter on iOS.
|
|
16
|
+
Platform.OS === 'ios' ? NativeReanimatedModule : undefined);
|
|
14
17
|
}
|
|
15
18
|
addOnJSPropsChangeListener(animatedComponent) {
|
|
16
19
|
const viewTag = findNodeHandle(animatedComponent);
|
|
@@ -18,7 +21,7 @@ class JSPropsUpdaterPaper {
|
|
|
18
21
|
if (JSPropsUpdaterPaper._tagToComponentMapping.size === 1) {
|
|
19
22
|
const listener = data => {
|
|
20
23
|
const component = JSPropsUpdaterPaper._tagToComponentMapping.get(data.viewTag);
|
|
21
|
-
component === null || component === void 0
|
|
24
|
+
component === null || component === void 0 || component._updateFromNative(data.props);
|
|
22
25
|
};
|
|
23
26
|
this._reanimatedEventEmitter.addListener('onReanimatedPropsChange', listener);
|
|
24
27
|
}
|
|
@@ -37,7 +40,7 @@ class JSPropsUpdaterFabric {
|
|
|
37
40
|
if (!JSPropsUpdaterFabric.isInitialized) {
|
|
38
41
|
const updater = (viewTag, props) => {
|
|
39
42
|
const component = JSPropsUpdaterFabric._tagToComponentMapping.get(viewTag);
|
|
40
|
-
component === null || component === void 0
|
|
43
|
+
component === null || component === void 0 || component._updateFromNative(props);
|
|
41
44
|
};
|
|
42
45
|
runOnUIImmediately(() => {
|
|
43
46
|
'worklet';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_defineProperty","obj","key","value","_toPropertyKey","Object","defineProperty","enumerable","configurable","writable","
|
|
1
|
+
{"version":3,"names":["_defineProperty","obj","key","value","_toPropertyKey","Object","defineProperty","enumerable","configurable","writable","t","i","_toPrimitive","r","e","Symbol","toPrimitive","call","TypeError","String","Number","NativeEventEmitter","Platform","findNodeHandle","shouldBeUseWeb","runOnJS","runOnUIImmediately","NativeReanimatedModule","SHOULD_BE_USE_WEB","JSPropsUpdaterPaper","constructor","_reanimatedEventEmitter","OS","undefined","addOnJSPropsChangeListener","animatedComponent","viewTag","_tagToComponentMapping","set","size","listener","data","component","get","_updateFromNative","props","addListener","removeOnJSPropsChangeListener","delete","removeAllListeners","Map","JSPropsUpdaterFabric","isInitialized","updater","global","updateJSProps","JSPropsUpdaterWeb","_animatedComponent","JSPropsUpdater","_IS_FABRIC"],"sources":["JSPropsUpdater.ts"],"sourcesContent":["'use strict';\nimport { NativeEventEmitter, Platform, findNodeHandle } from 'react-native';\nimport type { NativeModule } from 'react-native';\nimport { shouldBeUseWeb } from '../reanimated2/PlatformChecker';\nimport type { StyleProps } from '../reanimated2';\nimport { runOnJS, runOnUIImmediately } from '../reanimated2/threads';\nimport type {\n AnimatedComponentProps,\n IAnimatedComponentInternal,\n IJSPropsUpdater,\n InitialComponentProps,\n} from './commonTypes';\nimport NativeReanimatedModule from '../specs/NativeReanimatedModule';\n\ninterface ListenerData {\n viewTag: number;\n props: StyleProps;\n}\n\nconst SHOULD_BE_USE_WEB = shouldBeUseWeb();\n\nclass JSPropsUpdaterPaper implements IJSPropsUpdater {\n private static _tagToComponentMapping = new Map();\n private _reanimatedEventEmitter: NativeEventEmitter;\n\n constructor() {\n this._reanimatedEventEmitter = new NativeEventEmitter(\n // NativeEventEmitter only uses this parameter on iOS.\n Platform.OS === 'ios'\n ? (NativeReanimatedModule as unknown as NativeModule)\n : undefined\n );\n }\n\n public addOnJSPropsChangeListener(\n animatedComponent: React.Component<\n AnimatedComponentProps<InitialComponentProps>\n > &\n IAnimatedComponentInternal\n ) {\n const viewTag = findNodeHandle(animatedComponent);\n JSPropsUpdaterPaper._tagToComponentMapping.set(viewTag, animatedComponent);\n if (JSPropsUpdaterPaper._tagToComponentMapping.size === 1) {\n const listener = (data: ListenerData) => {\n const component = JSPropsUpdaterPaper._tagToComponentMapping.get(\n data.viewTag\n );\n component?._updateFromNative(data.props);\n };\n this._reanimatedEventEmitter.addListener(\n 'onReanimatedPropsChange',\n listener\n );\n }\n }\n\n public removeOnJSPropsChangeListener(\n animatedComponent: React.Component<\n AnimatedComponentProps<InitialComponentProps>\n > &\n IAnimatedComponentInternal\n ) {\n const viewTag = findNodeHandle(animatedComponent);\n JSPropsUpdaterPaper._tagToComponentMapping.delete(viewTag);\n if (JSPropsUpdaterPaper._tagToComponentMapping.size === 0) {\n this._reanimatedEventEmitter.removeAllListeners(\n 'onReanimatedPropsChange'\n );\n }\n }\n}\n\nclass JSPropsUpdaterFabric implements IJSPropsUpdater {\n private static _tagToComponentMapping = new Map();\n private static isInitialized = false;\n\n constructor() {\n if (!JSPropsUpdaterFabric.isInitialized) {\n const updater = (viewTag: number, props: unknown) => {\n const component =\n JSPropsUpdaterFabric._tagToComponentMapping.get(viewTag);\n component?._updateFromNative(props);\n };\n runOnUIImmediately(() => {\n 'worklet';\n global.updateJSProps = (viewTag: number, props: unknown) => {\n runOnJS(updater)(viewTag, props);\n };\n })();\n JSPropsUpdaterFabric.isInitialized = true;\n }\n }\n\n public addOnJSPropsChangeListener(\n animatedComponent: React.Component<\n AnimatedComponentProps<InitialComponentProps>\n > &\n IAnimatedComponentInternal\n ) {\n if (!JSPropsUpdaterFabric.isInitialized) {\n return;\n }\n const viewTag = findNodeHandle(animatedComponent);\n JSPropsUpdaterFabric._tagToComponentMapping.set(viewTag, animatedComponent);\n }\n\n public removeOnJSPropsChangeListener(\n animatedComponent: React.Component<\n AnimatedComponentProps<InitialComponentProps>\n > &\n IAnimatedComponentInternal\n ) {\n if (!JSPropsUpdaterFabric.isInitialized) {\n return;\n }\n const viewTag = findNodeHandle(animatedComponent);\n JSPropsUpdaterFabric._tagToComponentMapping.delete(viewTag);\n }\n}\n\nclass JSPropsUpdaterWeb implements IJSPropsUpdater {\n public addOnJSPropsChangeListener(\n _animatedComponent: React.Component<\n AnimatedComponentProps<InitialComponentProps>\n > &\n IAnimatedComponentInternal\n ) {\n // noop\n }\n\n public removeOnJSPropsChangeListener(\n _animatedComponent: React.Component<\n AnimatedComponentProps<InitialComponentProps>\n > &\n IAnimatedComponentInternal\n ) {\n // noop\n }\n}\n\ntype JSPropsUpdaterOptions =\n | typeof JSPropsUpdaterWeb\n | typeof JSPropsUpdaterFabric\n | typeof JSPropsUpdaterPaper;\n\nlet JSPropsUpdater: JSPropsUpdaterOptions;\nif (SHOULD_BE_USE_WEB) {\n JSPropsUpdater = JSPropsUpdaterWeb;\n} else if (global._IS_FABRIC) {\n JSPropsUpdater = JSPropsUpdaterFabric;\n} else {\n JSPropsUpdater = JSPropsUpdaterPaper;\n}\n\nexport default JSPropsUpdater;\n"],"mappings":"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","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["JSPropsUpdaterWeb","addOnJSPropsChangeListener","_animatedComponent","removeOnJSPropsChangeListener"],"sources":["JSPropsUpdater.web.ts"],"sourcesContent":["'use strict';\nimport type {\n AnimatedComponentProps,\n IAnimatedComponentInternal,\n InitialComponentProps,\n} from './commonTypes';\n\nexport default class JSPropsUpdaterWeb {\n public addOnJSPropsChangeListener(\n _animatedComponent: React.Component<\n AnimatedComponentProps<InitialComponentProps>\n > &\n IAnimatedComponentInternal\n ) {\n // noop\n }\n\n public removeOnJSPropsChangeListener(\n _animatedComponent: React.Component<\n AnimatedComponentProps<InitialComponentProps>\n > &\n IAnimatedComponentInternal\n ) {\n // noop\n }\n}\n"],"mappings":"AAAA,YAAY;;AAOZ,eAAe,MAAMA,iBAAiB,CAAC;EAC9BC,0BAA0BA,CAC/BC,kBAG4B,EAC5B;IACA;EAAA;EAGKC,6BAA6BA,CAClCD,kBAG4B,EAC5B;IACA;EAAA;AAEJ","ignoreList":[]}
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
4
|
-
function _toPropertyKey(
|
|
5
|
-
function _toPrimitive(
|
|
6
|
-
import {
|
|
4
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
5
|
+
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
6
|
+
import { shallowEqual } from '../reanimated2/hook/utils';
|
|
7
|
+
import { isSharedValue } from '../reanimated2/isSharedValue';
|
|
7
8
|
import { isChromeDebugger } from '../reanimated2/PlatformChecker';
|
|
8
|
-
import WorkletEventHandler from '../reanimated2/WorkletEventHandler';
|
|
9
|
+
import { WorkletEventHandler } from '../reanimated2/WorkletEventHandler';
|
|
9
10
|
import { initialUpdaterRun } from '../reanimated2/animation';
|
|
10
11
|
import { hasInlineStyles, getInlineStyle } from './InlinePropManager';
|
|
11
12
|
import { flattenArray, has } from './utils';
|
|
@@ -17,21 +18,28 @@ function dummyListener() {
|
|
|
17
18
|
export class PropsFilter {
|
|
18
19
|
constructor() {
|
|
19
20
|
_defineProperty(this, "_initialStyle", {});
|
|
21
|
+
_defineProperty(this, "_previousProps", null);
|
|
22
|
+
_defineProperty(this, "_requiresNewInitials", true);
|
|
20
23
|
}
|
|
21
24
|
filterNonAnimatedProps(component) {
|
|
22
25
|
const inputProps = component.props;
|
|
26
|
+
this._maybePrepareForNewInitials(inputProps);
|
|
23
27
|
const props = {};
|
|
24
28
|
for (const key in inputProps) {
|
|
25
29
|
const value = inputProps[key];
|
|
26
30
|
if (key === 'style') {
|
|
27
31
|
const styleProp = inputProps.style;
|
|
28
32
|
const styles = flattenArray(styleProp ?? []);
|
|
33
|
+
if (this._requiresNewInitials) {
|
|
34
|
+
this._initialStyle = {};
|
|
35
|
+
}
|
|
29
36
|
const processedStyle = styles.map(style => {
|
|
30
37
|
if (style && style.viewDescriptors) {
|
|
31
38
|
var _style$viewsRef;
|
|
32
39
|
// this is how we recognize styles returned by useAnimatedStyle
|
|
33
|
-
|
|
34
|
-
|
|
40
|
+
// TODO - refactor, since `viewsRef` is only present on Web
|
|
41
|
+
(_style$viewsRef = style.viewsRef) === null || _style$viewsRef === void 0 || _style$viewsRef.add(component);
|
|
42
|
+
if (this._requiresNewInitials) {
|
|
35
43
|
this._initialStyle = {
|
|
36
44
|
...style.initial.value,
|
|
37
45
|
...this._initialStyle,
|
|
@@ -40,7 +48,7 @@ export class PropsFilter {
|
|
|
40
48
|
}
|
|
41
49
|
return this._initialStyle;
|
|
42
50
|
} else if (hasInlineStyles(style)) {
|
|
43
|
-
return getInlineStyle(style,
|
|
51
|
+
return getInlineStyle(style, this._requiresNewInitials);
|
|
44
52
|
} else {
|
|
45
53
|
return style;
|
|
46
54
|
}
|
|
@@ -52,7 +60,8 @@ export class PropsFilter {
|
|
|
52
60
|
Object.keys(animatedProp.initial.value).forEach(initialValueKey => {
|
|
53
61
|
var _animatedProp$initial, _animatedProp$viewsRe;
|
|
54
62
|
props[initialValueKey] = (_animatedProp$initial = animatedProp.initial) === null || _animatedProp$initial === void 0 ? void 0 : _animatedProp$initial.value[initialValueKey];
|
|
55
|
-
|
|
63
|
+
// TODO - refacotr, since `viewsRef` is only present on Web
|
|
64
|
+
(_animatedProp$viewsRe = animatedProp.viewsRef) === null || _animatedProp$viewsRe === void 0 || _animatedProp$viewsRe.add(component);
|
|
56
65
|
});
|
|
57
66
|
}
|
|
58
67
|
} else if (has('workletEventHandler', value) && value.workletEventHandler instanceof WorkletEventHandler) {
|
|
@@ -64,14 +73,21 @@ export class PropsFilter {
|
|
|
64
73
|
props[key] = dummyListener;
|
|
65
74
|
}
|
|
66
75
|
} else if (isSharedValue(value)) {
|
|
67
|
-
if (
|
|
76
|
+
if (this._requiresNewInitials) {
|
|
68
77
|
props[key] = value.value;
|
|
69
78
|
}
|
|
70
79
|
} else if (key !== 'onGestureHandlerStateChange' || !isChromeDebugger()) {
|
|
71
80
|
props[key] = value;
|
|
72
81
|
}
|
|
73
82
|
}
|
|
83
|
+
this._requiresNewInitials = false;
|
|
74
84
|
return props;
|
|
75
85
|
}
|
|
86
|
+
_maybePrepareForNewInitials(inputProps) {
|
|
87
|
+
if (this._previousProps && inputProps.style) {
|
|
88
|
+
this._requiresNewInitials = !shallowEqual(this._previousProps, inputProps);
|
|
89
|
+
}
|
|
90
|
+
this._previousProps = inputProps;
|
|
91
|
+
}
|
|
76
92
|
}
|
|
77
93
|
//# sourceMappingURL=PropsFilter.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_defineProperty","obj","key","value","_toPropertyKey","Object","defineProperty","enumerable","configurable","writable","
|
|
1
|
+
{"version":3,"names":["_defineProperty","obj","key","value","_toPropertyKey","Object","defineProperty","enumerable","configurable","writable","t","i","_toPrimitive","r","e","Symbol","toPrimitive","call","TypeError","String","Number","shallowEqual","isSharedValue","isChromeDebugger","WorkletEventHandler","initialUpdaterRun","hasInlineStyles","getInlineStyle","flattenArray","has","StyleSheet","dummyListener","PropsFilter","constructor","filterNonAnimatedProps","component","inputProps","props","_maybePrepareForNewInitials","styleProp","style","styles","_requiresNewInitials","_initialStyle","processedStyle","map","viewDescriptors","_style$viewsRef","viewsRef","add","initial","updater","flatten","animatedProp","animatedProps","undefined","keys","forEach","initialValueKey","_animatedProp$initial","_animatedProp$viewsRe","workletEventHandler","eventNames","length","eventName","listeners","_previousProps"],"sources":["PropsFilter.tsx"],"sourcesContent":["'use strict';\n\nimport { shallowEqual } from '../reanimated2/hook/utils';\nimport type { StyleProps } from '../reanimated2/commonTypes';\nimport { isSharedValue } from '../reanimated2/isSharedValue';\nimport { isChromeDebugger } from '../reanimated2/PlatformChecker';\nimport { WorkletEventHandler } from '../reanimated2/WorkletEventHandler';\nimport { initialUpdaterRun } from '../reanimated2/animation';\nimport { hasInlineStyles, getInlineStyle } from './InlinePropManager';\nimport type {\n AnimatedComponentProps,\n AnimatedProps,\n InitialComponentProps,\n IAnimatedComponentInternal,\n IPropsFilter,\n} from './commonTypes';\nimport { flattenArray, has } from './utils';\nimport { StyleSheet } from 'react-native';\n\nfunction dummyListener() {\n // empty listener we use to assign to listener properties for which animated\n // event is used.\n}\n\nexport class PropsFilter implements IPropsFilter {\n private _initialStyle = {};\n private _previousProps: React.Component['props'] | null = null;\n private _requiresNewInitials = true;\n\n public filterNonAnimatedProps(\n component: React.Component<unknown, unknown> & IAnimatedComponentInternal\n ): Record<string, unknown> {\n const inputProps =\n component.props as AnimatedComponentProps<InitialComponentProps>;\n\n this._maybePrepareForNewInitials(inputProps);\n\n const props: Record<string, unknown> = {};\n for (const key in inputProps) {\n const value = inputProps[key];\n if (key === 'style') {\n const styleProp = inputProps.style;\n const styles = flattenArray<StyleProps>(styleProp ?? []);\n if (this._requiresNewInitials) {\n this._initialStyle = {};\n }\n const processedStyle: StyleProps = styles.map((style) => {\n if (style && style.viewDescriptors) {\n // this is how we recognize styles returned by useAnimatedStyle\n // TODO - refactor, since `viewsRef` is only present on Web\n style.viewsRef?.add(component);\n if (this._requiresNewInitials) {\n this._initialStyle = {\n ...style.initial.value,\n ...this._initialStyle,\n ...initialUpdaterRun<StyleProps>(style.initial.updater),\n };\n }\n return this._initialStyle;\n } else if (hasInlineStyles(style)) {\n return getInlineStyle(style, this._requiresNewInitials);\n } else {\n return style;\n }\n });\n props[key] = StyleSheet.flatten(processedStyle);\n } else if (key === 'animatedProps') {\n const animatedProp = inputProps.animatedProps as Partial<\n AnimatedComponentProps<AnimatedProps>\n >;\n if (animatedProp.initial !== undefined) {\n Object.keys(animatedProp.initial.value).forEach((initialValueKey) => {\n props[initialValueKey] =\n animatedProp.initial?.value[initialValueKey];\n // TODO - refacotr, since `viewsRef` is only present on Web\n animatedProp.viewsRef?.add(component);\n });\n }\n } else if (\n has('workletEventHandler', value) &&\n value.workletEventHandler instanceof WorkletEventHandler\n ) {\n if (value.workletEventHandler.eventNames.length > 0) {\n value.workletEventHandler.eventNames.forEach((eventName) => {\n props[eventName] = has('listeners', value.workletEventHandler)\n ? (\n value.workletEventHandler.listeners as Record<string, unknown>\n )[eventName]\n : dummyListener;\n });\n } else {\n props[key] = dummyListener;\n }\n } else if (isSharedValue(value)) {\n if (this._requiresNewInitials) {\n props[key] = value.value;\n }\n } else if (key !== 'onGestureHandlerStateChange' || !isChromeDebugger()) {\n props[key] = value;\n }\n }\n this._requiresNewInitials = false;\n return props;\n }\n\n private _maybePrepareForNewInitials(\n inputProps: AnimatedComponentProps<InitialComponentProps>\n ) {\n if (this._previousProps && inputProps.style) {\n this._requiresNewInitials = !shallowEqual(\n this._previousProps,\n inputProps\n );\n }\n this._previousProps = inputProps;\n }\n}\n"],"mappings":"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","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["commonTypes.ts"],"sourcesContent":["'use strict';\nimport type { Ref, Component } from 'react';\nimport type {\n StyleProps,\n BaseAnimationBuilder,\n ILayoutAnimationBuilder,\n EntryExitAnimationFunction,\n SharedTransition,\n SharedValue,\n} from '../reanimated2';\nimport type {\n ViewDescriptorsSet,\n ViewRefSet,\n} from '../reanimated2/ViewDescriptorsSet';\nimport type { SkipEnteringContext } from '../reanimated2/component/LayoutAnimationConfig';\nimport type { ShadowNodeWrapper } from '../reanimated2/commonTypes';\nimport type { ViewConfig } from '../ConfigHelper';\n\nexport interface AnimatedProps extends Record<string, unknown> {\n viewDescriptors?: ViewDescriptorsSet;\n viewsRef?: ViewRefSet<unknown>;\n initial?: SharedValue<StyleProps>;\n}\n\nexport interface ViewInfo {\n viewTag: number | HTMLElement | null;\n viewName: string | null;\n shadowNodeWrapper: ShadowNodeWrapper | null;\n viewConfig: ViewConfig;\n}\n\nexport interface IInlinePropManager {\n attachInlineProps(\n animatedComponent: React.Component<unknown, unknown>,\n viewInfo: ViewInfo\n ): void;\n detachInlineProps(): void;\n}\n\nexport interface IPropsFilter {\n filterNonAnimatedProps: (\n component: React.Component<unknown, unknown> & IAnimatedComponentInternal\n ) => Record<string, unknown>;\n}\n\nexport interface IJSPropsUpdater {\n addOnJSPropsChangeListener(\n animatedComponent: React.Component<unknown, unknown> &\n IAnimatedComponentInternal\n ): void;\n removeOnJSPropsChangeListener(\n animatedComponent: React.Component<unknown, unknown> &\n IAnimatedComponentInternal\n ): void;\n}\n\nexport type LayoutAnimationStaticContext = {\n presetName: string;\n};\n\nexport type AnimatedComponentProps<P extends Record<string, unknown>> = P & {\n forwardedRef?: Ref<Component>;\n style?: NestedArray<StyleProps>;\n animatedProps?: Partial<AnimatedComponentProps<AnimatedProps>>;\n animatedStyle?: StyleProps;\n layout?: (\n | BaseAnimationBuilder\n | ILayoutAnimationBuilder\n | typeof BaseAnimationBuilder\n ) &\n LayoutAnimationStaticContext;\n entering?: (\n | BaseAnimationBuilder\n | typeof BaseAnimationBuilder\n | EntryExitAnimationFunction\n | Keyframe\n ) &\n LayoutAnimationStaticContext;\n exiting?: (\n | BaseAnimationBuilder\n | typeof BaseAnimationBuilder\n | EntryExitAnimationFunction\n | Keyframe\n ) &\n LayoutAnimationStaticContext;\n sharedTransitionTag?: string;\n sharedTransitionStyle?: SharedTransition;\n};\n\nexport interface AnimatedComponentRef extends Component {\n setNativeProps?: (props: Record<string, unknown>) => void;\n getScrollableNode?: () => AnimatedComponentRef;\n getAnimatableRef?: () => AnimatedComponentRef;\n}\n\nexport interface IAnimatedComponentInternal {\n _styles: StyleProps[] | null;\n _animatedProps?: Partial<AnimatedComponentProps<AnimatedProps>>;\n _viewTag: number;\n _isFirstRender: boolean;\n jestAnimatedStyle: { value: StyleProps };\n _component: AnimatedComponentRef | HTMLElement | null;\n _sharedElementTransition: SharedTransition | null;\n _jsPropsUpdater: IJSPropsUpdater;\n _InlinePropManager: IInlinePropManager;\n _PropsFilter: IPropsFilter;\n _viewInfo?: ViewInfo;\n context: React.ContextType<typeof SkipEnteringContext>;\n}\n\nexport type NestedArray<T> = T | NestedArray<T>[];\n\nexport interface InitialComponentProps extends Record<string, unknown> {\n ref?: Ref<Component>;\n collapsable?: boolean;\n}\n"],"mappings":"AAAA,YAAY;;AAAC"}
|
|
1
|
+
{"version":3,"names":[],"sources":["commonTypes.ts"],"sourcesContent":["'use strict';\nimport type { Ref, Component } from 'react';\nimport type {\n StyleProps,\n BaseAnimationBuilder,\n ILayoutAnimationBuilder,\n EntryExitAnimationFunction,\n SharedTransition,\n SharedValue,\n} from '../reanimated2';\nimport type {\n ViewDescriptorsSet,\n ViewRefSet,\n} from '../reanimated2/ViewDescriptorsSet';\nimport type { SkipEnteringContext } from '../reanimated2/component/LayoutAnimationConfig';\nimport type { ShadowNodeWrapper } from '../reanimated2/commonTypes';\nimport type { ViewConfig } from '../ConfigHelper';\n\nexport interface AnimatedProps extends Record<string, unknown> {\n viewDescriptors?: ViewDescriptorsSet;\n viewsRef?: ViewRefSet<unknown>;\n initial?: SharedValue<StyleProps>;\n}\n\nexport interface ViewInfo {\n viewTag: number | HTMLElement | null;\n viewName: string | null;\n shadowNodeWrapper: ShadowNodeWrapper | null;\n viewConfig: ViewConfig;\n}\n\nexport interface IInlinePropManager {\n attachInlineProps(\n animatedComponent: React.Component<unknown, unknown>,\n viewInfo: ViewInfo\n ): void;\n detachInlineProps(): void;\n}\n\nexport interface IPropsFilter {\n filterNonAnimatedProps: (\n component: React.Component<unknown, unknown> & IAnimatedComponentInternal\n ) => Record<string, unknown>;\n}\n\nexport interface IJSPropsUpdater {\n addOnJSPropsChangeListener(\n animatedComponent: React.Component<unknown, unknown> &\n IAnimatedComponentInternal\n ): void;\n removeOnJSPropsChangeListener(\n animatedComponent: React.Component<unknown, unknown> &\n IAnimatedComponentInternal\n ): void;\n}\n\nexport type LayoutAnimationStaticContext = {\n presetName: string;\n};\n\nexport type AnimatedComponentProps<P extends Record<string, unknown>> = P & {\n forwardedRef?: Ref<Component>;\n style?: NestedArray<StyleProps>;\n animatedProps?: Partial<AnimatedComponentProps<AnimatedProps>>;\n animatedStyle?: StyleProps;\n layout?: (\n | BaseAnimationBuilder\n | ILayoutAnimationBuilder\n | typeof BaseAnimationBuilder\n ) &\n LayoutAnimationStaticContext;\n entering?: (\n | BaseAnimationBuilder\n | typeof BaseAnimationBuilder\n | EntryExitAnimationFunction\n | Keyframe\n ) &\n LayoutAnimationStaticContext;\n exiting?: (\n | BaseAnimationBuilder\n | typeof BaseAnimationBuilder\n | EntryExitAnimationFunction\n | Keyframe\n ) &\n LayoutAnimationStaticContext;\n sharedTransitionTag?: string;\n sharedTransitionStyle?: SharedTransition;\n};\n\nexport interface AnimatedComponentRef extends Component {\n setNativeProps?: (props: Record<string, unknown>) => void;\n getScrollableNode?: () => AnimatedComponentRef;\n getAnimatableRef?: () => AnimatedComponentRef;\n}\n\nexport interface IAnimatedComponentInternal {\n _styles: StyleProps[] | null;\n _animatedProps?: Partial<AnimatedComponentProps<AnimatedProps>>;\n _viewTag: number;\n _isFirstRender: boolean;\n jestAnimatedStyle: { value: StyleProps };\n _component: AnimatedComponentRef | HTMLElement | null;\n _sharedElementTransition: SharedTransition | null;\n _jsPropsUpdater: IJSPropsUpdater;\n _InlinePropManager: IInlinePropManager;\n _PropsFilter: IPropsFilter;\n _viewInfo?: ViewInfo;\n context: React.ContextType<typeof SkipEnteringContext>;\n}\n\nexport type NestedArray<T> = T | NestedArray<T>[];\n\nexport interface InitialComponentProps extends Record<string, unknown> {\n ref?: Ref<Component>;\n collapsable?: boolean;\n}\n"],"mappings":"AAAA,YAAY;;AAAC","ignoreList":[]}
|
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
4
4
|
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
5
|
-
function _toPropertyKey(
|
|
6
|
-
function _toPrimitive(
|
|
5
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
6
|
+
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
7
7
|
import React from 'react';
|
|
8
8
|
import { findNodeHandle, Platform } from 'react-native';
|
|
9
|
-
import WorkletEventHandler from '../reanimated2/WorkletEventHandler';
|
|
9
|
+
import { WorkletEventHandler } from '../reanimated2/WorkletEventHandler';
|
|
10
10
|
import '../reanimated2/layoutReanimation/animationsManager';
|
|
11
11
|
import invariant from 'invariant';
|
|
12
12
|
import { adaptViewConfig } from '../ConfigHelper';
|
|
@@ -27,8 +27,8 @@ import { PropsFilter } from './PropsFilter';
|
|
|
27
27
|
import { startWebLayoutAnimation, tryActivateLayoutTransition, configureWebLayoutAnimations, getReducedMotionFromConfig, saveSnapshot } from '../reanimated2/layoutReanimation/web';
|
|
28
28
|
import { updateLayoutAnimations } from '../reanimated2/UpdateLayoutAnimations';
|
|
29
29
|
import { addHTMLMutationObserver } from '../reanimated2/layoutReanimation/web/domUtils';
|
|
30
|
+
import { getViewInfo } from './getViewInfo';
|
|
30
31
|
const IS_WEB = isWeb();
|
|
31
|
-
const IS_FABRIC = isFabric();
|
|
32
32
|
if (IS_WEB) {
|
|
33
33
|
configureWebLayoutAnimations();
|
|
34
34
|
}
|
|
@@ -42,11 +42,16 @@ function onlyAnimatedStyles(styles) {
|
|
|
42
42
|
* @param component - The component you want to make animatable.
|
|
43
43
|
* @returns A component that Reanimated is capable of animating.
|
|
44
44
|
* @see https://docs.swmansion.com/react-native-reanimated/docs/core/createAnimatedComponent
|
|
45
|
-
*/
|
|
45
|
+
*/
|
|
46
|
+
|
|
47
|
+
// Don't change the order of overloads, since such a change breaks current behavior
|
|
48
|
+
|
|
46
49
|
/**
|
|
47
50
|
* @deprecated Please use `Animated.FlatList` component instead of calling `Animated.createAnimatedComponent(FlatList)` manually.
|
|
48
51
|
*/
|
|
49
52
|
// @ts-ignore This is required to create this overload, since type of createAnimatedComponent is incorrect and doesn't include typeof FlatList
|
|
53
|
+
|
|
54
|
+
let id = 0;
|
|
50
55
|
export function createAnimatedComponent(Component, options) {
|
|
51
56
|
invariant(typeof Component !== 'function' || Component.prototype && Component.prototype.isReactComponent, `Looks like you're passing a function component \`${Component.name}\` to \`createAnimatedComponent\` function which supports only class components. Please wrap your function component with \`React.forwardRef()\` or use a class component instead.`);
|
|
52
57
|
class AnimatedComponent extends React.Component {
|
|
@@ -66,12 +71,14 @@ export function createAnimatedComponent(Component, options) {
|
|
|
66
71
|
_defineProperty(this, "_PropsFilter", new PropsFilter());
|
|
67
72
|
_defineProperty(this, "_viewInfo", void 0);
|
|
68
73
|
_defineProperty(this, "context", void 0);
|
|
74
|
+
_defineProperty(this, "nativeID", id++);
|
|
69
75
|
_defineProperty(this, "_setComponentRef", setAndForwardRef({
|
|
70
76
|
getForwardedRef: () => this.props.forwardedRef,
|
|
71
77
|
setLocalRef: ref => {
|
|
72
78
|
// TODO update config
|
|
73
79
|
|
|
74
80
|
const tag = IS_WEB ? ref : findNodeHandle(ref);
|
|
81
|
+
this._viewTag = tag;
|
|
75
82
|
const {
|
|
76
83
|
layout,
|
|
77
84
|
entering,
|
|
@@ -79,14 +86,11 @@ export function createAnimatedComponent(Component, options) {
|
|
|
79
86
|
sharedTransitionTag
|
|
80
87
|
} = this.props;
|
|
81
88
|
if ((layout || entering || exiting || sharedTransitionTag) && tag != null) {
|
|
82
|
-
var _this$context;
|
|
83
89
|
if (!shouldBeUseWeb()) {
|
|
84
90
|
enableLayoutAnimations(true, false);
|
|
85
91
|
}
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
var _this$props;
|
|
89
|
-
updateLayoutAnimations(tag, LayoutAnimationType.ENTERING, maybeBuild(entering, (_this$props = this.props) === null || _this$props === void 0 ? void 0 : _this$props.style, AnimatedComponent.displayName));
|
|
92
|
+
if (sharedTransitionTag) {
|
|
93
|
+
this._configureSharedTransition();
|
|
90
94
|
}
|
|
91
95
|
if (sharedTransitionTag && !IS_WEB) {
|
|
92
96
|
const sharedElementTransition = this.props.sharedTransitionStyle ?? new SharedTransition();
|
|
@@ -96,6 +100,13 @@ export function createAnimatedComponent(Component, options) {
|
|
|
96
100
|
this._sharedElementTransition = sharedElementTransition;
|
|
97
101
|
}
|
|
98
102
|
}
|
|
103
|
+
if (exiting) {
|
|
104
|
+
const reduceMotionInExiting = 'getReduceMotion' in exiting && typeof exiting.getReduceMotion === 'function' ? getReduceMotionFromConfig(exiting.getReduceMotion()) : getReduceMotionFromConfig();
|
|
105
|
+
if (!reduceMotionInExiting) {
|
|
106
|
+
var _this$props;
|
|
107
|
+
updateLayoutAnimations(tag, LayoutAnimationType.EXITING, maybeBuild(exiting, (_this$props = this.props) === null || _this$props === void 0 ? void 0 : _this$props.style, AnimatedComponent.displayName));
|
|
108
|
+
}
|
|
109
|
+
}
|
|
99
110
|
}
|
|
100
111
|
if (ref !== this._component) {
|
|
101
112
|
this._component = ref;
|
|
@@ -107,8 +118,14 @@ export function createAnimatedComponent(Component, options) {
|
|
|
107
118
|
value: {}
|
|
108
119
|
};
|
|
109
120
|
}
|
|
121
|
+
const _entering = this.props.entering;
|
|
122
|
+
if (_entering) {
|
|
123
|
+
var _this$props2;
|
|
124
|
+
updateLayoutAnimations(this.nativeID, LayoutAnimationType.ENTERING, maybeBuild(_entering, (_this$props2 = this.props) === null || _this$props2 === void 0 ? void 0 : _this$props2.style, AnimatedComponent.displayName));
|
|
125
|
+
}
|
|
110
126
|
}
|
|
111
127
|
componentDidMount() {
|
|
128
|
+
this._viewTag = this._getViewInfo().viewTag;
|
|
112
129
|
this._attachNativeEvents();
|
|
113
130
|
this._jsPropsUpdater.addOnJSPropsChangeListener(this);
|
|
114
131
|
this._attachAnimatedStyles();
|
|
@@ -135,16 +152,19 @@ export function createAnimatedComponent(Component, options) {
|
|
|
135
152
|
this._jsPropsUpdater.removeOnJSPropsChangeListener(this);
|
|
136
153
|
this._detachStyles();
|
|
137
154
|
this._InlinePropManager.detachInlineProps();
|
|
138
|
-
(
|
|
155
|
+
if (this.props.sharedTransitionTag) {
|
|
156
|
+
this._configureSharedTransition(true);
|
|
157
|
+
}
|
|
158
|
+
(_this$_sharedElementT = this._sharedElementTransition) === null || _this$_sharedElementT === void 0 || _this$_sharedElementT.unregisterTransition(this._viewTag, true);
|
|
139
159
|
const exiting = this.props.exiting;
|
|
140
|
-
if (IS_WEB && this.props.exiting && !getReducedMotionFromConfig(this.props.exiting)) {
|
|
160
|
+
if (IS_WEB && this._component && this.props.exiting && !getReducedMotionFromConfig(this.props.exiting)) {
|
|
141
161
|
addHTMLMutationObserver();
|
|
142
162
|
startWebLayoutAnimation(this.props, this._component, LayoutAnimationType.EXITING);
|
|
143
163
|
} else if (exiting) {
|
|
144
164
|
const reduceMotionInExiting = 'getReduceMotion' in exiting && typeof exiting.getReduceMotion === 'function' ? getReduceMotionFromConfig(exiting.getReduceMotion()) : getReduceMotionFromConfig();
|
|
145
165
|
if (!reduceMotionInExiting) {
|
|
146
|
-
var _this$
|
|
147
|
-
updateLayoutAnimations(this._viewTag, LayoutAnimationType.EXITING, maybeBuild(exiting, (_this$
|
|
166
|
+
var _this$props3;
|
|
167
|
+
updateLayoutAnimations(this._viewTag, LayoutAnimationType.EXITING, maybeBuild(exiting, (_this$props3 = this.props) === null || _this$props3 === void 0 ? void 0 : _this$props3.style, AnimatedComponent.displayName));
|
|
148
168
|
}
|
|
149
169
|
}
|
|
150
170
|
}
|
|
@@ -155,16 +175,10 @@ export function createAnimatedComponent(Component, options) {
|
|
|
155
175
|
return (_this$_component = this._component) !== null && _this$_component !== void 0 && _this$_component.getScrollableNode ? (_getScrollableNode = (_ref = this._component).getScrollableNode) === null || _getScrollableNode === void 0 ? void 0 : _getScrollableNode.call(_ref) : this._component;
|
|
156
176
|
}
|
|
157
177
|
_attachNativeEvents() {
|
|
158
|
-
const node = this._getEventViewRef();
|
|
159
|
-
let viewTag = null; // We set it only if needed
|
|
160
|
-
|
|
161
178
|
for (const key in this.props) {
|
|
162
179
|
const prop = this.props[key];
|
|
163
180
|
if (has('workletEventHandler', prop) && prop.workletEventHandler instanceof WorkletEventHandler) {
|
|
164
|
-
|
|
165
|
-
viewTag = IS_WEB ? this._component : findNodeHandle(options !== null && options !== void 0 && options.setNativeProps ? this : node);
|
|
166
|
-
}
|
|
167
|
-
prop.workletEventHandler.registerForEvents(viewTag, key);
|
|
181
|
+
prop.workletEventHandler.registerForEvents(this._viewTag, key);
|
|
168
182
|
}
|
|
169
183
|
}
|
|
170
184
|
}
|
|
@@ -172,7 +186,7 @@ export function createAnimatedComponent(Component, options) {
|
|
|
172
186
|
for (const key in this.props) {
|
|
173
187
|
const prop = this.props[key];
|
|
174
188
|
if (has('workletEventHandler', prop) && prop.workletEventHandler instanceof WorkletEventHandler) {
|
|
175
|
-
prop.workletEventHandler.unregisterFromEvents();
|
|
189
|
+
prop.workletEventHandler.unregisterFromEvents(this._viewTag);
|
|
176
190
|
}
|
|
177
191
|
}
|
|
178
192
|
}
|
|
@@ -189,28 +203,31 @@ export function createAnimatedComponent(Component, options) {
|
|
|
189
203
|
if ((_this$props$animatedP = this.props.animatedProps) !== null && _this$props$animatedP !== void 0 && _this$props$animatedP.viewDescriptors) {
|
|
190
204
|
this.props.animatedProps.viewDescriptors.remove(this._viewTag);
|
|
191
205
|
}
|
|
192
|
-
if (
|
|
206
|
+
if (isFabric()) {
|
|
193
207
|
removeFromPropsRegistry(this._viewTag);
|
|
194
208
|
}
|
|
195
209
|
}
|
|
196
210
|
}
|
|
197
|
-
|
|
211
|
+
_updateNativeEvents(prevProps) {
|
|
198
212
|
for (const key in prevProps) {
|
|
199
|
-
const
|
|
200
|
-
if (has('workletEventHandler',
|
|
201
|
-
|
|
213
|
+
const prevProp = prevProps[key];
|
|
214
|
+
if (has('workletEventHandler', prevProp) && prevProp.workletEventHandler instanceof WorkletEventHandler) {
|
|
215
|
+
const newProp = this.props[key];
|
|
216
|
+
if (!newProp) {
|
|
217
|
+
// Prop got deleted
|
|
218
|
+
prevProp.workletEventHandler.unregisterFromEvents(this._viewTag);
|
|
219
|
+
} else if (has('workletEventHandler', newProp) && newProp.workletEventHandler instanceof WorkletEventHandler && newProp.workletEventHandler !== prevProp.workletEventHandler) {
|
|
220
|
+
// Prop got changed
|
|
221
|
+
prevProp.workletEventHandler.unregisterFromEvents(this._viewTag);
|
|
222
|
+
newProp.workletEventHandler.registerForEvents(this._viewTag);
|
|
223
|
+
}
|
|
202
224
|
}
|
|
203
225
|
}
|
|
204
|
-
let viewTag = null;
|
|
205
226
|
for (const key in this.props) {
|
|
206
|
-
const
|
|
207
|
-
if (has('workletEventHandler',
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
viewTag = IS_WEB ? this._component : findNodeHandle(options !== null && options !== void 0 && options.setNativeProps ? this : node);
|
|
211
|
-
}
|
|
212
|
-
prop.workletEventHandler.registerForEvents(viewTag, key);
|
|
213
|
-
prop.workletEventHandler.reattachNeeded = false;
|
|
227
|
+
const newProp = this.props[key];
|
|
228
|
+
if (has('workletEventHandler', newProp) && newProp.workletEventHandler instanceof WorkletEventHandler && !prevProps[key]) {
|
|
229
|
+
// Prop got added
|
|
230
|
+
newProp.workletEventHandler.registerForEvents(this._viewTag);
|
|
214
231
|
}
|
|
215
232
|
}
|
|
216
233
|
}
|
|
@@ -219,7 +236,7 @@ export function createAnimatedComponent(Component, options) {
|
|
|
219
236
|
options.setNativeProps(this._component, props);
|
|
220
237
|
} else {
|
|
221
238
|
var _this$_component2, _this$_component2$set;
|
|
222
|
-
(_this$_component2 = this._component) === null || _this$_component2 === void 0
|
|
239
|
+
(_this$_component2 = this._component) === null || _this$_component2 === void 0 || (_this$_component2$set = _this$_component2.setNativeProps) === null || _this$_component2$set === void 0 || _this$_component2$set.call(_this$_component2, props);
|
|
223
240
|
}
|
|
224
241
|
}
|
|
225
242
|
_getViewInfo() {
|
|
@@ -242,23 +259,16 @@ export function createAnimatedComponent(Component, options) {
|
|
|
242
259
|
shadowNodeWrapper = null;
|
|
243
260
|
viewConfig = null;
|
|
244
261
|
} else {
|
|
245
|
-
var _hostInstance$viewCon;
|
|
246
262
|
// hostInstance can be null for a component that doesn't render anything (render function returns null). Example: svg Stop: https://github.com/react-native-svg/react-native-svg/blob/develop/src/elements/Stop.tsx
|
|
247
263
|
const hostInstance = RNRenderer.findHostInstance_DEPRECATED(component);
|
|
248
264
|
if (!hostInstance) {
|
|
249
265
|
throw new Error('[Reanimated] Cannot find host instance for this component. Maybe it renders nothing?');
|
|
250
266
|
}
|
|
251
|
-
|
|
252
|
-
viewTag =
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
*/
|
|
257
|
-
viewName = hostInstance === null || hostInstance === void 0 ? void 0 : (_hostInstance$viewCon = hostInstance.viewConfig) === null || _hostInstance$viewCon === void 0 ? void 0 : _hostInstance$viewCon.uiViewClassName;
|
|
258
|
-
viewConfig = hostInstance === null || hostInstance === void 0 ? void 0 : hostInstance.viewConfig;
|
|
259
|
-
if (IS_FABRIC) {
|
|
260
|
-
shadowNodeWrapper = getShadowNodeWrapperFromRef(this);
|
|
261
|
-
}
|
|
267
|
+
const viewInfo = getViewInfo(hostInstance);
|
|
268
|
+
viewTag = viewInfo.viewTag;
|
|
269
|
+
viewName = viewInfo.viewName;
|
|
270
|
+
viewConfig = viewInfo.viewConfig;
|
|
271
|
+
shadowNodeWrapper = isFabric() ? getShadowNodeWrapperFromRef(this) : null;
|
|
262
272
|
}
|
|
263
273
|
this._viewInfo = {
|
|
264
274
|
viewTag,
|
|
@@ -347,7 +357,10 @@ export function createAnimatedComponent(Component, options) {
|
|
|
347
357
|
if (layout !== oldLayout) {
|
|
348
358
|
this._configureLayoutTransition();
|
|
349
359
|
}
|
|
350
|
-
this.
|
|
360
|
+
if (this.props.sharedTransitionTag !== undefined || prevProps.sharedTransitionTag !== undefined) {
|
|
361
|
+
this._configureSharedTransition();
|
|
362
|
+
}
|
|
363
|
+
this._updateNativeEvents(prevProps);
|
|
351
364
|
this._attachAnimatedStyles();
|
|
352
365
|
this._InlinePropManager.attachInlineProps(this, this._getViewInfo());
|
|
353
366
|
if (IS_WEB && this.props.exiting) {
|
|
@@ -363,6 +376,23 @@ export function createAnimatedComponent(Component, options) {
|
|
|
363
376
|
const layout = this.props.layout ? maybeBuild(this.props.layout, undefined /* We don't have to warn user if style has common properties with animation for LAYOUT */, AnimatedComponent.displayName) : undefined;
|
|
364
377
|
updateLayoutAnimations(this._viewTag, LayoutAnimationType.LAYOUT, layout);
|
|
365
378
|
}
|
|
379
|
+
_configureSharedTransition(isUnmounting = false) {
|
|
380
|
+
if (IS_WEB) {
|
|
381
|
+
return;
|
|
382
|
+
}
|
|
383
|
+
const {
|
|
384
|
+
sharedTransitionTag
|
|
385
|
+
} = this.props;
|
|
386
|
+
if (!sharedTransitionTag) {
|
|
387
|
+
var _this$_sharedElementT2;
|
|
388
|
+
(_this$_sharedElementT2 = this._sharedElementTransition) === null || _this$_sharedElementT2 === void 0 || _this$_sharedElementT2.unregisterTransition(this._viewTag, isUnmounting);
|
|
389
|
+
this._sharedElementTransition = null;
|
|
390
|
+
return;
|
|
391
|
+
}
|
|
392
|
+
const sharedElementTransition = this.props.sharedTransitionStyle ?? this._sharedElementTransition ?? new SharedTransition();
|
|
393
|
+
sharedElementTransition.registerTransition(this._viewTag, sharedTransitionTag, isUnmounting);
|
|
394
|
+
this._sharedElementTransition = sharedElementTransition;
|
|
395
|
+
}
|
|
366
396
|
// This is a component lifecycle method from React, therefore we are not calling it directly.
|
|
367
397
|
// It is called before the component gets rerendered. This way we can access components' position before it changed
|
|
368
398
|
// and later on, in componentDidUpdate, calculate translation for layout transition.
|
|
@@ -389,14 +419,15 @@ export function createAnimatedComponent(Component, options) {
|
|
|
389
419
|
visibility: 'hidden' // Hide component until `componentDidMount` triggers
|
|
390
420
|
};
|
|
391
421
|
}
|
|
392
|
-
|
|
393
422
|
const platformProps = Platform.select({
|
|
394
423
|
web: {},
|
|
395
424
|
default: {
|
|
396
425
|
collapsable: false
|
|
397
426
|
}
|
|
398
427
|
});
|
|
399
|
-
return /*#__PURE__*/React.createElement(Component, _extends({
|
|
428
|
+
return /*#__PURE__*/React.createElement(Component, _extends({
|
|
429
|
+
nativeID: `${this.nativeID}`
|
|
430
|
+
}, filteredProps, {
|
|
400
431
|
// Casting is used here, because ref can be null - in that case it cannot be assigned to HTMLElement.
|
|
401
432
|
// After spending some time trying to figure out what to do with this problem, we decided to leave it this way
|
|
402
433
|
ref: this._setComponentRef
|