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
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
#pragma once
|
|
2
|
+
|
|
3
|
+
struct Window{
|
|
4
|
+
double width, height;
|
|
5
|
+
};
|
|
6
|
+
|
|
7
|
+
struct Frame{
|
|
8
|
+
std::optional<double> x, y, width, height;
|
|
9
|
+
Frame(jsi::Runtime& runtime, const jsi::Object &newStyle){
|
|
10
|
+
if (newStyle.hasProperty(runtime, "originX")){
|
|
11
|
+
x = newStyle.getProperty(runtime, "originX").asNumber();
|
|
12
|
+
}
|
|
13
|
+
if (newStyle.hasProperty(runtime, "originY")){
|
|
14
|
+
y = newStyle.getProperty(runtime, "originY").asNumber();
|
|
15
|
+
}
|
|
16
|
+
if (newStyle.hasProperty(runtime, "width")){
|
|
17
|
+
width = newStyle.getProperty(runtime, "width").asNumber();
|
|
18
|
+
}
|
|
19
|
+
if (newStyle.hasProperty(runtime, "height")){
|
|
20
|
+
height = newStyle.getProperty(runtime, "height").asNumber();
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
struct UpdateValues{
|
|
26
|
+
Props::Shared newProps;
|
|
27
|
+
Frame frame;
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
struct Snapshot{
|
|
31
|
+
double x, y, width, height, windowWidth, windowHeight;
|
|
32
|
+
Snapshot(ShadowView& shadowView, Window window){
|
|
33
|
+
auto& frame = shadowView.layoutMetrics.frame;
|
|
34
|
+
x = frame.origin.x;
|
|
35
|
+
y = frame.origin.y;
|
|
36
|
+
width = frame.size.width;
|
|
37
|
+
height = frame.size.height;
|
|
38
|
+
windowWidth = window.width;
|
|
39
|
+
windowHeight = window.height;
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
struct MutationNode;
|
|
44
|
+
|
|
45
|
+
struct Node {
|
|
46
|
+
std::vector<std::shared_ptr<MutationNode>> children;
|
|
47
|
+
std::shared_ptr<Node> parent;
|
|
48
|
+
Tag tag;
|
|
49
|
+
void removeChild(std::shared_ptr<MutationNode> child);
|
|
50
|
+
void addChild(std::shared_ptr<MutationNode> child);
|
|
51
|
+
Node(Tag tag): tag(tag){}
|
|
52
|
+
Node(Node&& node):children(std::move(node.children)), tag(node.tag){}
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
struct MutationNode: public Node{
|
|
56
|
+
ShadowViewMutation mutation;
|
|
57
|
+
std::unordered_set<Tag> animatedChildren;
|
|
58
|
+
bool isAnimatingExit = false;
|
|
59
|
+
bool isDone = false;
|
|
60
|
+
bool isExiting = false;
|
|
61
|
+
MutationNode(ShadowViewMutation& mutation): mutation(mutation), Node(mutation.oldChildShadowView.tag){}
|
|
62
|
+
MutationNode(ShadowViewMutation& mutation, Node&& node): mutation(mutation), Node(std::move(node)){}
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
void Node::removeChild(std::shared_ptr<MutationNode> child){
|
|
66
|
+
for (int i=0; i<children.size(); i++){
|
|
67
|
+
if (children[i]->tag == child->tag){
|
|
68
|
+
children.erase(children.begin()+i);
|
|
69
|
+
break;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
void Node::addChild(std::shared_ptr<MutationNode> child){
|
|
74
|
+
bool done = false;
|
|
75
|
+
for (auto it = children.begin(); it != children.end(); it++){
|
|
76
|
+
if ((*it)->mutation.index >child->mutation.index){
|
|
77
|
+
children.insert(it, child);
|
|
78
|
+
done = true;
|
|
79
|
+
break;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
if (!done){
|
|
83
|
+
children.push_back(child);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
struct SurfaceManager {
|
|
88
|
+
mutable std::unordered_map<SurfaceId, std::shared_ptr<std::unordered_map<Tag, UpdateValues>>> props_;
|
|
89
|
+
mutable std::unordered_map<SurfaceId, ShadowViewMutationList> cleanups_;
|
|
90
|
+
mutable std::unordered_map<SurfaceId, Window> windows_;
|
|
91
|
+
|
|
92
|
+
std::unordered_map<Tag, UpdateValues>& getUpdateMap(SurfaceId surfaceId){
|
|
93
|
+
auto props = props_.find(surfaceId);
|
|
94
|
+
if (props != props_.end()){
|
|
95
|
+
return *props->second;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
auto newProps = std::make_shared<std::unordered_map<Tag, UpdateValues>>();
|
|
99
|
+
props_.insert_or_assign(surfaceId, newProps);
|
|
100
|
+
return *newProps;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
void updateWindow(SurfaceId surfaceId, double windowWidth, double windowHeight){
|
|
104
|
+
windows_.insert_or_assign(surfaceId, Window{windowWidth, windowHeight});
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
Window getWindow(SurfaceId surfaceId){
|
|
108
|
+
auto windowIt = windows_.find(surfaceId);
|
|
109
|
+
if (windowIt != windows_.end()){
|
|
110
|
+
return windowIt->second;
|
|
111
|
+
}
|
|
112
|
+
return Window{0,0};
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
void consumeCleanupMutations(SurfaceId surfaceId, ShadowViewMutationList& mutations){
|
|
116
|
+
for (auto& mutation: cleanups_[surfaceId]){
|
|
117
|
+
mutations.push_back(mutation);
|
|
118
|
+
}
|
|
119
|
+
cleanups_.erase(surfaceId);
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
ShadowViewMutationList& getCleanupMutations(SurfaceId surfaceId){
|
|
123
|
+
return cleanups_[surfaceId];
|
|
124
|
+
}
|
|
125
|
+
};
|
|
126
|
+
|
|
127
|
+
static inline void updateLayoutMetrics(LayoutMetrics& layoutMetrics, Frame& frame){
|
|
128
|
+
if (frame.width) {
|
|
129
|
+
layoutMetrics.frame.size.width = *frame.width;
|
|
130
|
+
}
|
|
131
|
+
if (frame.height) {
|
|
132
|
+
layoutMetrics.frame.size.height = *frame.height;
|
|
133
|
+
}
|
|
134
|
+
if (frame.x) {
|
|
135
|
+
layoutMetrics.frame.origin.x = *frame.x;
|
|
136
|
+
}
|
|
137
|
+
if (frame.y) {
|
|
138
|
+
layoutMetrics.frame.origin.y = *frame.y;
|
|
139
|
+
}
|
|
140
|
+
}
|
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
#include "NativeReanimatedModule.h"
|
|
2
2
|
|
|
3
3
|
#ifdef RCT_NEW_ARCH_ENABLED
|
|
4
|
-
#if REACT_NATIVE_MINOR_VERSION >= 72
|
|
5
|
-
#include <react/renderer/core/TraitCast.h>
|
|
6
|
-
#endif
|
|
7
4
|
#include <react/renderer/uimanager/UIManagerBinding.h>
|
|
8
5
|
#include <react/renderer/uimanager/primitives.h>
|
|
9
6
|
#if REACT_NATIVE_MINOR_VERSION >= 73 && defined(RCT_NEW_ARCH_ENABLED)
|
|
@@ -12,11 +9,15 @@
|
|
|
12
9
|
#endif
|
|
13
10
|
|
|
14
11
|
#include <functional>
|
|
12
|
+
#include <iomanip>
|
|
15
13
|
#include <memory>
|
|
14
|
+
#include <sstream>
|
|
15
|
+
#include <string>
|
|
16
16
|
#include <thread>
|
|
17
17
|
#include <unordered_map>
|
|
18
18
|
|
|
19
19
|
#ifdef RCT_NEW_ARCH_ENABLED
|
|
20
|
+
#include <react/renderer/scheduler/Scheduler.h>
|
|
20
21
|
#include "ReanimatedCommitMarker.h"
|
|
21
22
|
#include "ShadowTreeCloner.h"
|
|
22
23
|
#endif
|
|
@@ -26,6 +27,7 @@
|
|
|
26
27
|
#include "EventHandlerRegistry.h"
|
|
27
28
|
#include "FeaturesConfig.h"
|
|
28
29
|
#include "JSScheduler.h"
|
|
30
|
+
#include "NativeReanimatedModule.h"
|
|
29
31
|
#include "ReanimatedHiddenHeaders.h"
|
|
30
32
|
#include "Shareables.h"
|
|
31
33
|
#include "UIRuntimeDecorator.h"
|
|
@@ -37,7 +39,7 @@
|
|
|
37
39
|
|
|
38
40
|
using namespace facebook;
|
|
39
41
|
|
|
40
|
-
#if REACT_NATIVE_MINOR_VERSION
|
|
42
|
+
#if REACT_NATIVE_MINOR_VERSION == 73 && defined(RCT_NEW_ARCH_ENABLED)
|
|
41
43
|
// Android can't find the definition of this static field
|
|
42
44
|
bool CoreFeatures::useNativeState;
|
|
43
45
|
#endif
|
|
@@ -46,14 +48,17 @@ namespace reanimated {
|
|
|
46
48
|
|
|
47
49
|
NativeReanimatedModule::NativeReanimatedModule(
|
|
48
50
|
jsi::Runtime &rnRuntime,
|
|
49
|
-
const std::shared_ptr<
|
|
51
|
+
const std::shared_ptr<JSScheduler> &jsScheduler,
|
|
50
52
|
const std::shared_ptr<MessageQueueThread> &jsQueue,
|
|
51
53
|
const std::shared_ptr<UIScheduler> &uiScheduler,
|
|
52
54
|
const PlatformDepMethodsHolder &platformDepMethodsHolder,
|
|
53
|
-
const std::string &valueUnpackerCode
|
|
54
|
-
|
|
55
|
+
const std::string &valueUnpackerCode,
|
|
56
|
+
const bool isBridgeless)
|
|
57
|
+
: NativeReanimatedModuleSpec(
|
|
58
|
+
isBridgeless ? nullptr : jsScheduler->getJSCallInvoker()),
|
|
59
|
+
isBridgeless_(isBridgeless),
|
|
55
60
|
jsQueue_(jsQueue),
|
|
56
|
-
jsScheduler_(
|
|
61
|
+
jsScheduler_(jsScheduler),
|
|
57
62
|
uiScheduler_(uiScheduler),
|
|
58
63
|
uiWorkletRuntime_(std::make_shared<WorkletRuntime>(
|
|
59
64
|
rnRuntime,
|
|
@@ -71,7 +76,7 @@ NativeReanimatedModule::NativeReanimatedModule(
|
|
|
71
76
|
}),
|
|
72
77
|
animatedSensorModule_(platformDepMethodsHolder),
|
|
73
78
|
jsLogger_(std::make_shared<JSLogger>(jsScheduler_)),
|
|
74
|
-
layoutAnimationsManager_(jsLogger_),
|
|
79
|
+
layoutAnimationsManager_(std::make_shared<LayoutAnimationsManager>(jsLogger_)),
|
|
75
80
|
#ifdef RCT_NEW_ARCH_ENABLED
|
|
76
81
|
synchronouslyUpdateUIPropsFunction_(
|
|
77
82
|
platformDepMethodsHolder.synchronouslyUpdateUIPropsFunction),
|
|
@@ -86,6 +91,11 @@ NativeReanimatedModule::NativeReanimatedModule(
|
|
|
86
91
|
platformDepMethodsHolder.subscribeForKeyboardEvents),
|
|
87
92
|
unsubscribeFromKeyboardEventsFunction_(
|
|
88
93
|
platformDepMethodsHolder.unsubscribeFromKeyboardEvents) {
|
|
94
|
+
commonInit(platformDepMethodsHolder);
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
void NativeReanimatedModule::commonInit(
|
|
98
|
+
const PlatformDepMethodsHolder &platformDepMethodsHolder) {
|
|
89
99
|
auto requestAnimationFrame =
|
|
90
100
|
[this](jsi::Runtime &rt, const jsi::Value &callback) {
|
|
91
101
|
this->requestAnimationFrame(rt, callback);
|
|
@@ -112,6 +122,42 @@ NativeReanimatedModule::NativeReanimatedModule(
|
|
|
112
122
|
const jsi::Value &argsValue) {
|
|
113
123
|
this->dispatchCommand(rt, shadowNodeValue, commandNameValue, argsValue);
|
|
114
124
|
};
|
|
125
|
+
ProgressLayoutAnimationFunction progressLayoutAnimation =
|
|
126
|
+
[this](jsi::Runtime &rt, int tag, const jsi::Object &newStyle, bool) {
|
|
127
|
+
|
|
128
|
+
auto surfaceId = layoutAnimationsProxy_->progressLayoutAnimation(tag, newStyle);
|
|
129
|
+
if (!surfaceId){
|
|
130
|
+
return;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
uiManager_->getShadowTreeRegistry().enumerate(
|
|
134
|
+
[surfaceId](const ShadowTree &shadowTree, bool &stop) {
|
|
135
|
+
if (shadowTree.getSurfaceId() == surfaceId){
|
|
136
|
+
shadowTree.notifyDelegatesOfUpdates();
|
|
137
|
+
stop = true;
|
|
138
|
+
}
|
|
139
|
+
});
|
|
140
|
+
};
|
|
141
|
+
|
|
142
|
+
EndLayoutAnimationFunction endLayoutAnimation =
|
|
143
|
+
[this](int tag, bool shouldRemove) {
|
|
144
|
+
auto surfaceId = layoutAnimationsProxy_->endLayoutAnimation(tag, shouldRemove);
|
|
145
|
+
uiManager_->getShadowTreeRegistry().enumerate(
|
|
146
|
+
[surfaceId](const ShadowTree &shadowTree, bool &stop) {
|
|
147
|
+
if (shadowTree.getSurfaceId() == surfaceId){
|
|
148
|
+
shadowTree.notifyDelegatesOfUpdates();
|
|
149
|
+
stop = true;
|
|
150
|
+
}
|
|
151
|
+
});
|
|
152
|
+
};
|
|
153
|
+
|
|
154
|
+
|
|
155
|
+
auto obtainProp = [this](
|
|
156
|
+
jsi::Runtime &rt,
|
|
157
|
+
const jsi::Value &shadowNodeWrapper,
|
|
158
|
+
const jsi::Value &propName) {
|
|
159
|
+
return this->obtainProp(rt, shadowNodeWrapper, propName);
|
|
160
|
+
};
|
|
115
161
|
#endif
|
|
116
162
|
|
|
117
163
|
jsi::Runtime &uiRuntime = uiWorkletRuntime_->getJSIRuntime();
|
|
@@ -119,11 +165,13 @@ NativeReanimatedModule::NativeReanimatedModule(
|
|
|
119
165
|
uiRuntime,
|
|
120
166
|
#ifdef RCT_NEW_ARCH_ENABLED
|
|
121
167
|
removeFromPropsRegistry,
|
|
168
|
+
obtainProp,
|
|
122
169
|
updateProps,
|
|
123
170
|
measure,
|
|
124
171
|
dispatchCommand,
|
|
125
172
|
#else
|
|
126
173
|
platformDepMethodsHolder.scrollToFunction,
|
|
174
|
+
platformDepMethodsHolder.obtainPropFunction,
|
|
127
175
|
platformDepMethodsHolder.updatePropsFunction,
|
|
128
176
|
platformDepMethodsHolder.measureFunction,
|
|
129
177
|
platformDepMethodsHolder.dispatchCommandFunction,
|
|
@@ -131,8 +179,13 @@ NativeReanimatedModule::NativeReanimatedModule(
|
|
|
131
179
|
requestAnimationFrame,
|
|
132
180
|
platformDepMethodsHolder.getAnimationTimestamp,
|
|
133
181
|
platformDepMethodsHolder.setGestureStateFunction,
|
|
182
|
+
#ifdef RCT_NEW_ARCH_ENABLED
|
|
183
|
+
progressLayoutAnimation,
|
|
184
|
+
endLayoutAnimation,
|
|
185
|
+
#else
|
|
134
186
|
platformDepMethodsHolder.progressLayoutAnimation,
|
|
135
187
|
platformDepMethodsHolder.endLayoutAnimation,
|
|
188
|
+
#endif
|
|
136
189
|
platformDepMethodsHolder.maybeFlushUIUpdatesQueueFunction);
|
|
137
190
|
}
|
|
138
191
|
|
|
@@ -196,8 +249,10 @@ jsi::Value NativeReanimatedModule::scheduleOnRuntime(
|
|
|
196
249
|
jsi::Value NativeReanimatedModule::makeShareableClone(
|
|
197
250
|
jsi::Runtime &rt,
|
|
198
251
|
const jsi::Value &value,
|
|
199
|
-
const jsi::Value &shouldRetainRemote
|
|
200
|
-
|
|
252
|
+
const jsi::Value &shouldRetainRemote,
|
|
253
|
+
const jsi::Value &nativeStateSource) {
|
|
254
|
+
return reanimated::makeShareableClone(
|
|
255
|
+
rt, value, shouldRetainRemote, nativeStateSource);
|
|
201
256
|
}
|
|
202
257
|
|
|
203
258
|
jsi::Value NativeReanimatedModule::registerEventHandler(
|
|
@@ -230,23 +285,102 @@ void NativeReanimatedModule::unregisterEventHandler(
|
|
|
230
285
|
[=] { eventHandlerRegistry_->unregisterEventHandler(id); });
|
|
231
286
|
}
|
|
232
287
|
|
|
288
|
+
#ifdef RCT_NEW_ARCH_ENABLED
|
|
289
|
+
static inline std::string intColorToHex(const int val) {
|
|
290
|
+
std::stringstream
|
|
291
|
+
invertedHexColorStream; // By default transparency is first, color second
|
|
292
|
+
invertedHexColorStream << std::setfill('0') << std::setw(8) << std::hex
|
|
293
|
+
<< val;
|
|
294
|
+
|
|
295
|
+
auto invertedHexColor = invertedHexColorStream.str();
|
|
296
|
+
auto hexColor =
|
|
297
|
+
"#" + invertedHexColor.substr(2, 6) + invertedHexColor.substr(0, 2);
|
|
298
|
+
|
|
299
|
+
return hexColor;
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
std::string NativeReanimatedModule::obtainPropFromShadowNode(
|
|
303
|
+
jsi::Runtime &rt,
|
|
304
|
+
const std::string &propName,
|
|
305
|
+
const ShadowNode::Shared &shadowNode) {
|
|
306
|
+
auto newestCloneOfShadowNode =
|
|
307
|
+
uiManager_->getNewestCloneOfShadowNode(*shadowNode);
|
|
308
|
+
|
|
309
|
+
if (propName == "width" || propName == "height" || propName == "top" ||
|
|
310
|
+
propName == "left") {
|
|
311
|
+
// These props are calculated from frame
|
|
312
|
+
auto layoutableShadowNode = dynamic_cast<LayoutableShadowNode const *>(
|
|
313
|
+
newestCloneOfShadowNode.get());
|
|
314
|
+
const auto &frame = layoutableShadowNode->layoutMetrics_.frame;
|
|
315
|
+
|
|
316
|
+
if (propName == "width") {
|
|
317
|
+
return std::to_string(frame.size.width);
|
|
318
|
+
} else if (propName == "height") {
|
|
319
|
+
return std::to_string(frame.size.height);
|
|
320
|
+
} else if (propName == "top") {
|
|
321
|
+
return std::to_string(frame.origin.y);
|
|
322
|
+
} else if (propName == "left") {
|
|
323
|
+
return std::to_string(frame.origin.x);
|
|
324
|
+
}
|
|
325
|
+
} else {
|
|
326
|
+
// These props are calculated from viewProps
|
|
327
|
+
auto props = newestCloneOfShadowNode->getProps();
|
|
328
|
+
auto viewProps = std::static_pointer_cast<const ViewProps>(props);
|
|
329
|
+
if (propName == "opacity") {
|
|
330
|
+
return std::to_string(viewProps->opacity);
|
|
331
|
+
} else if (propName == "zIndex") {
|
|
332
|
+
if (viewProps->zIndex.has_value()) {
|
|
333
|
+
return std::to_string(*viewProps->zIndex);
|
|
334
|
+
}
|
|
335
|
+
} else if (propName == "backgroundColor") {
|
|
336
|
+
return intColorToHex(*viewProps->backgroundColor);
|
|
337
|
+
}
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
throw std::runtime_error(std::string(
|
|
341
|
+
"Getting property `" + propName +
|
|
342
|
+
"` with function `getViewProp` is not supported"));
|
|
343
|
+
}
|
|
344
|
+
|
|
233
345
|
jsi::Value NativeReanimatedModule::getViewProp(
|
|
234
346
|
jsi::Runtime &rnRuntime,
|
|
235
|
-
const jsi::Value &
|
|
347
|
+
const jsi::Value &shadowNodeWrapper,
|
|
236
348
|
const jsi::Value &propName,
|
|
237
349
|
const jsi::Value &callback) {
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
350
|
+
const auto propNameStr = propName.asString(rnRuntime).utf8(rnRuntime);
|
|
351
|
+
const auto funPtr = std::make_shared<jsi::Function>(
|
|
352
|
+
callback.getObject(rnRuntime).asFunction(rnRuntime));
|
|
353
|
+
const auto shadowNode = shadowNodeFromValue(rnRuntime, shadowNodeWrapper);
|
|
354
|
+
uiScheduler_->scheduleOnUI([=]() {
|
|
355
|
+
jsi::Runtime &uiRuntime = uiWorkletRuntime_->getJSIRuntime();
|
|
356
|
+
const auto resultStr =
|
|
357
|
+
obtainPropFromShadowNode(uiRuntime, propNameStr, shadowNode);
|
|
358
|
+
|
|
359
|
+
jsScheduler_->scheduleOnJS([=](jsi::Runtime &rnRuntime) {
|
|
360
|
+
const auto resultValue =
|
|
361
|
+
jsi::String::createFromUtf8(rnRuntime, resultStr);
|
|
362
|
+
funPtr->call(rnRuntime, resultValue);
|
|
363
|
+
});
|
|
364
|
+
});
|
|
365
|
+
return jsi::Value::undefined();
|
|
366
|
+
}
|
|
367
|
+
|
|
241
368
|
#else
|
|
242
|
-
|
|
369
|
+
|
|
370
|
+
jsi::Value NativeReanimatedModule::getViewProp(
|
|
371
|
+
jsi::Runtime &rnRuntime,
|
|
372
|
+
const jsi::Value &viewTag,
|
|
373
|
+
const jsi::Value &propName,
|
|
374
|
+
const jsi::Value &callback) {
|
|
243
375
|
const auto propNameStr = propName.asString(rnRuntime).utf8(rnRuntime);
|
|
244
376
|
const auto funPtr = std::make_shared<jsi::Function>(
|
|
245
377
|
callback.getObject(rnRuntime).asFunction(rnRuntime));
|
|
246
378
|
|
|
379
|
+
const int viewTagInt = viewTag.asNumber();
|
|
380
|
+
|
|
247
381
|
uiScheduler_->scheduleOnUI([=]() {
|
|
248
382
|
jsi::Runtime &uiRuntime = uiWorkletRuntime_->getJSIRuntime();
|
|
249
|
-
const
|
|
383
|
+
const jsi::Value propNameValue =
|
|
250
384
|
jsi::String::createFromUtf8(uiRuntime, propNameStr);
|
|
251
385
|
const auto resultValue =
|
|
252
386
|
obtainPropFunction_(uiRuntime, viewTagInt, propNameValue);
|
|
@@ -258,11 +392,11 @@ jsi::Value NativeReanimatedModule::getViewProp(
|
|
|
258
392
|
funPtr->call(rnRuntime, resultValue);
|
|
259
393
|
});
|
|
260
394
|
});
|
|
261
|
-
|
|
262
395
|
return jsi::Value::undefined();
|
|
263
|
-
#endif
|
|
264
396
|
}
|
|
265
397
|
|
|
398
|
+
#endif
|
|
399
|
+
|
|
266
400
|
jsi::Value NativeReanimatedModule::enableLayoutAnimations(
|
|
267
401
|
jsi::Runtime &,
|
|
268
402
|
const jsi::Value &config) {
|
|
@@ -293,23 +427,6 @@ jsi::Value NativeReanimatedModule::configureProps(
|
|
|
293
427
|
return jsi::Value::undefined();
|
|
294
428
|
}
|
|
295
429
|
|
|
296
|
-
jsi::Value NativeReanimatedModule::configureLayoutAnimation(
|
|
297
|
-
jsi::Runtime &rt,
|
|
298
|
-
const jsi::Value &viewTag,
|
|
299
|
-
const jsi::Value &type,
|
|
300
|
-
const jsi::Value &sharedTransitionTag,
|
|
301
|
-
const jsi::Value &config) {
|
|
302
|
-
layoutAnimationsManager_.configureAnimation(
|
|
303
|
-
viewTag.asNumber(),
|
|
304
|
-
static_cast<LayoutAnimationType>(type.asNumber()),
|
|
305
|
-
sharedTransitionTag.asString(rt).utf8(rt),
|
|
306
|
-
extractShareableOrThrow<ShareableObject>(
|
|
307
|
-
rt,
|
|
308
|
-
config,
|
|
309
|
-
"[Reanimated] Layout animation config must be an object."));
|
|
310
|
-
return jsi::Value::undefined();
|
|
311
|
-
}
|
|
312
|
-
|
|
313
430
|
jsi::Value NativeReanimatedModule::configureLayoutAnimationBatch(
|
|
314
431
|
jsi::Runtime &rt,
|
|
315
432
|
const jsi::Value &layoutAnimationsBatch) {
|
|
@@ -331,8 +448,18 @@ jsi::Value NativeReanimatedModule::configureLayoutAnimationBatch(
|
|
|
331
448
|
config,
|
|
332
449
|
"[Reanimated] Layout animation config must be an object.");
|
|
333
450
|
}
|
|
451
|
+
if (batch[i].type != SHARED_ELEMENT_TRANSITION &&
|
|
452
|
+
batch[i].type != SHARED_ELEMENT_TRANSITION_PROGRESS) {
|
|
453
|
+
continue;
|
|
454
|
+
}
|
|
455
|
+
auto sharedTransitionTag = item.getProperty(rt, "sharedTransitionTag");
|
|
456
|
+
if (sharedTransitionTag.isUndefined()) {
|
|
457
|
+
batch[i].config = nullptr;
|
|
458
|
+
} else {
|
|
459
|
+
batch[i].sharedTransitionTag = sharedTransitionTag.asString(rt).utf8(rt);
|
|
460
|
+
}
|
|
334
461
|
}
|
|
335
|
-
layoutAnimationsManager_
|
|
462
|
+
layoutAnimationsManager_->configureAnimationBatch(batch);
|
|
336
463
|
return jsi::Value::undefined();
|
|
337
464
|
}
|
|
338
465
|
|
|
@@ -340,7 +467,7 @@ void NativeReanimatedModule::setShouldAnimateExiting(
|
|
|
340
467
|
jsi::Runtime &rt,
|
|
341
468
|
const jsi::Value &viewTag,
|
|
342
469
|
const jsi::Value &shouldAnimate) {
|
|
343
|
-
layoutAnimationsManager_
|
|
470
|
+
layoutAnimationsManager_->setShouldAnimateExiting(
|
|
344
471
|
viewTag.asNumber(), shouldAnimate.getBool());
|
|
345
472
|
}
|
|
346
473
|
|
|
@@ -461,10 +588,11 @@ bool NativeReanimatedModule::handleRawEvent(
|
|
|
461
588
|
double currentTime) {
|
|
462
589
|
const EventTarget *eventTarget = rawEvent.eventTarget.get();
|
|
463
590
|
if (eventTarget == nullptr) {
|
|
464
|
-
// after app reload
|
|
465
|
-
// 0 and view is thrown into recycle pool setting content offset
|
|
466
|
-
// scroll event eventTarget is null though, because it's
|
|
467
|
-
// just ignore this event, because it's an event on
|
|
591
|
+
// after app reload scrollView is unmounted and its content offset is set
|
|
592
|
+
// to 0 and view is thrown into recycle pool setting content offset
|
|
593
|
+
// triggers scroll event eventTarget is null though, because it's
|
|
594
|
+
// unmounting we can just ignore this event, because it's an event on
|
|
595
|
+
// unmounted component
|
|
468
596
|
return false;
|
|
469
597
|
}
|
|
470
598
|
|
|
@@ -485,8 +613,8 @@ bool NativeReanimatedModule::handleRawEvent(
|
|
|
485
613
|
auto res = handleEvent(eventType, tag, std::move(payload), currentTime);
|
|
486
614
|
// TODO: we should call performOperations conditionally if event is handled
|
|
487
615
|
// (res == true), but for now handleEvent always returns false. Thankfully,
|
|
488
|
-
// performOperations does not trigger a lot of code if there is nothing to
|
|
489
|
-
// done so this is fine for now.
|
|
616
|
+
// performOperations does not trigger a lot of code if there is nothing to
|
|
617
|
+
// be done so this is fine for now.
|
|
490
618
|
performOperations();
|
|
491
619
|
return res;
|
|
492
620
|
}
|
|
@@ -531,8 +659,8 @@ void NativeReanimatedModule::performOperations() {
|
|
|
531
659
|
tagsToRemove_.clear();
|
|
532
660
|
}
|
|
533
661
|
|
|
534
|
-
// Even if only non-layout props are changed, we need to store the update
|
|
535
|
-
// PropsRegistry anyway so that React doesn't overwrite it in the next
|
|
662
|
+
// Even if only non-layout props are changed, we need to store the update
|
|
663
|
+
// in PropsRegistry anyway so that React doesn't overwrite it in the next
|
|
536
664
|
// render. Currently, only opacity and transform are treated in a special
|
|
537
665
|
// way but backgroundColor, shadowOpacity etc. would get overwritten (see
|
|
538
666
|
// `_propKeysManagedByAnimated_DO_NOT_USE_THIS_IS_BROKEN`).
|
|
@@ -578,9 +706,9 @@ void NativeReanimatedModule::performOperations() {
|
|
|
578
706
|
if (propsRegistry_->shouldReanimatedSkipCommit()) {
|
|
579
707
|
// It may happen that `performOperations` is called on the UI thread
|
|
580
708
|
// while React Native tries to commit a new tree on the JS thread.
|
|
581
|
-
// In this case, we should skip the commit here and let React Native do
|
|
582
|
-
// The commit will include the current values from PropsRegistry
|
|
583
|
-
//
|
|
709
|
+
// In this case, we should skip the commit here and let React Native do
|
|
710
|
+
// it. The commit will include the current values from PropsRegistry which
|
|
711
|
+
// will be applied in ReanimatedCommitHook.
|
|
584
712
|
return;
|
|
585
713
|
}
|
|
586
714
|
|
|
@@ -603,9 +731,10 @@ void NativeReanimatedModule::performOperations() {
|
|
|
603
731
|
react_native_assert(family.getSurfaceId() == surfaceId_);
|
|
604
732
|
|
|
605
733
|
#if REACT_NATIVE_MINOR_VERSION >= 73
|
|
606
|
-
// Fix for catching nullptr returned from commit hook was
|
|
607
|
-
// in 0.72.4 but we have only check for minor version
|
|
608
|
-
// Native so enable that optimization in React Native >=
|
|
734
|
+
// Fix for catching nullptr returned from commit hook was
|
|
735
|
+
// introduced in 0.72.4 but we have only check for minor version
|
|
736
|
+
// of React Native so enable that optimization in React Native >=
|
|
737
|
+
// 0.73
|
|
609
738
|
if (propsRegistry_->shouldReanimatedSkipCommit()) {
|
|
610
739
|
return nullptr;
|
|
611
740
|
}
|
|
@@ -659,6 +788,18 @@ void NativeReanimatedModule::dispatchCommand(
|
|
|
659
788
|
uiManager_->dispatchCommand(shadowNode, commandName, args);
|
|
660
789
|
}
|
|
661
790
|
|
|
791
|
+
jsi::String NativeReanimatedModule::obtainProp(
|
|
792
|
+
jsi::Runtime &rt,
|
|
793
|
+
const jsi::Value &shadowNodeWrapper,
|
|
794
|
+
const jsi::Value &propName) {
|
|
795
|
+
jsi::Runtime &uiRuntime = uiWorkletRuntime_->getJSIRuntime();
|
|
796
|
+
const auto propNameStr = propName.asString(rt).utf8(rt);
|
|
797
|
+
const auto shadowNode = shadowNodeFromValue(rt, shadowNodeWrapper);
|
|
798
|
+
const auto resultStr =
|
|
799
|
+
obtainPropFromShadowNode(uiRuntime, propNameStr, shadowNode);
|
|
800
|
+
return jsi::String::createFromUtf8(rt, resultStr);
|
|
801
|
+
}
|
|
802
|
+
|
|
662
803
|
jsi::Value NativeReanimatedModule::measure(
|
|
663
804
|
jsi::Runtime &rt,
|
|
664
805
|
const jsi::Value &shadowNodeValue) {
|
|
@@ -669,9 +810,9 @@ jsi::Value NativeReanimatedModule::measure(
|
|
|
669
810
|
*shadowNode, nullptr, {/* .includeTransform = */ true});
|
|
670
811
|
|
|
671
812
|
if (layoutMetrics == EmptyLayoutMetrics) {
|
|
672
|
-
// Originally, in this case React Native returns `{0, 0, 0, 0, 0, 0}`,
|
|
673
|
-
// likely due to the type of measure callback function which accepts
|
|
674
|
-
// array of numbers (not null). In Reanimated, `measure` returns
|
|
813
|
+
// Originally, in this case React Native returns `{0, 0, 0, 0, 0, 0}`,
|
|
814
|
+
// most likely due to the type of measure callback function which accepts
|
|
815
|
+
// just an array of numbers (not null). In Reanimated, `measure` returns
|
|
675
816
|
// `MeasuredDimensions | null`.
|
|
676
817
|
return jsi::Value::null();
|
|
677
818
|
}
|
|
@@ -679,7 +820,7 @@ jsi::Value NativeReanimatedModule::measure(
|
|
|
679
820
|
uiManager_->getNewestCloneOfShadowNode(*shadowNode);
|
|
680
821
|
|
|
681
822
|
auto layoutableShadowNode =
|
|
682
|
-
|
|
823
|
+
dynamic_cast<LayoutableShadowNode const *>(newestCloneOfShadowNode.get());
|
|
683
824
|
facebook::react::Point originRelativeToParent =
|
|
684
825
|
layoutableShadowNode != nullptr
|
|
685
826
|
? layoutableShadowNode->getLayoutMetrics().frame.origin
|
|
@@ -706,8 +847,25 @@ jsi::Value NativeReanimatedModule::measure(
|
|
|
706
847
|
void NativeReanimatedModule::initializeFabric(
|
|
707
848
|
const std::shared_ptr<UIManager> &uiManager) {
|
|
708
849
|
uiManager_ = uiManager;
|
|
709
|
-
|
|
710
|
-
|
|
850
|
+
uiManager->setAnimationDelegate(nullptr);
|
|
851
|
+
Scheduler *scheduler = (Scheduler *)uiManager->getDelegate();
|
|
852
|
+
auto cdr = scheduler->getContextContainer()
|
|
853
|
+
->at<std::weak_ptr<const ComponentDescriptorRegistry>>(
|
|
854
|
+
"ComponentDescriptorRegistry_DO_NOT_USE_PRETTY_PLEASE");
|
|
855
|
+
|
|
856
|
+
layoutAnimationsProxy_ = std::make_shared<LayoutAnimationsProxy>(
|
|
857
|
+
layoutAnimationsManager_,
|
|
858
|
+
this,
|
|
859
|
+
cdr.lock(),
|
|
860
|
+
scheduler->getContextContainer());
|
|
861
|
+
uiManager->getShadowTreeRegistry().enumerate(
|
|
862
|
+
[this](const ShadowTree &shadowTree, bool &stop) {
|
|
863
|
+
shadowTree.getMountingCoordinator()->setMountingOverrideDelegate(
|
|
864
|
+
layoutAnimationsProxy_);
|
|
865
|
+
});
|
|
866
|
+
|
|
867
|
+
commitHook_ = std::make_shared<ReanimatedCommitHook>(
|
|
868
|
+
propsRegistry_, uiManager_);
|
|
711
869
|
#if REACT_NATIVE_MINOR_VERSION >= 73
|
|
712
870
|
mountHook_ =
|
|
713
871
|
std::make_shared<ReanimatedMountHook>(propsRegistry_, uiManager_);
|