react-native-reanimated 3.0.0-rc.0 → 3.0.0-rc.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Common/cpp/AnimatedSensor/AnimatedSensorModule.cpp +35 -37
- package/Common/cpp/{headers/AnimatedSensor → AnimatedSensor}/AnimatedSensorModule.h +4 -3
- package/Common/cpp/Fabric/FabricUtils.cpp +8 -102
- package/Common/cpp/{headers/Fabric → Fabric}/FabricUtils.h +4 -24
- package/Common/cpp/Fabric/ReanimatedUIManagerBinding.cpp +87 -45
- package/Common/cpp/{headers/Fabric → Fabric}/ReanimatedUIManagerBinding.h +1 -0
- package/Common/cpp/Fabric/ShadowTreeCloner.cpp +92 -0
- package/Common/cpp/Fabric/ShadowTreeCloner.h +41 -0
- package/Common/cpp/LayoutAnimations/LayoutAnimationsManager.cpp +76 -0
- package/Common/cpp/LayoutAnimations/LayoutAnimationsManager.h +41 -0
- package/Common/cpp/NativeModules/NativeReanimatedModule.cpp +215 -176
- package/Common/cpp/{headers/NativeModules → NativeModules}/NativeReanimatedModule.h +51 -28
- package/Common/cpp/NativeModules/NativeReanimatedModuleSpec.cpp +59 -29
- package/Common/cpp/{headers/NativeModules → NativeModules}/NativeReanimatedModuleSpec.h +28 -13
- package/Common/cpp/ReanimatedRuntime/ReanimatedHermesRuntime.cpp +138 -0
- package/Common/cpp/ReanimatedRuntime/ReanimatedHermesRuntime.h +134 -0
- package/Common/cpp/ReanimatedRuntime/ReanimatedRuntime.cpp +55 -0
- package/Common/cpp/ReanimatedRuntime/ReanimatedRuntime.h +28 -0
- package/Common/cpp/ReanimatedRuntime/RuntimeInitialization.md +194 -0
- package/Common/cpp/{headers/Registries → Registries}/EventHandlerRegistry.h +0 -0
- package/Common/cpp/{headers/Registries → Registries}/NewestShadowNodesRegistry.h +0 -0
- package/Common/cpp/{headers/SharedItems → SharedItems}/RuntimeManager.h +1 -34
- package/Common/cpp/SharedItems/Shareables.cpp +144 -0
- package/Common/cpp/SharedItems/Shareables.h +470 -0
- package/Common/cpp/{headers/SharedItems → SharedItems}/SharedParent.h +0 -0
- package/Common/cpp/{headers/SpecTools → SpecTools}/ErrorHandler.h +0 -0
- package/Common/cpp/{headers/Tools → Tools}/FeaturesConfig.h +0 -0
- package/Common/cpp/{headers/Tools → Tools}/PlatformDepMethodsHolder.h +11 -0
- package/Common/cpp/{headers/Tools → Tools}/ReanimatedHiddenHeaders.h +1 -1
- package/Common/cpp/Tools/ReanimatedVersion.cpp +17 -0
- package/Common/cpp/Tools/ReanimatedVersion.h +11 -0
- package/Common/cpp/Tools/RuntimeDecorator.cpp +95 -59
- package/Common/cpp/{headers/Tools → Tools}/RuntimeDecorator.h +13 -3
- package/Common/cpp/Tools/Scheduler.cpp +10 -0
- package/Common/cpp/{headers/Tools → Tools}/Scheduler.h +0 -0
- package/Common/cpp/Tools/SingleInstanceChecker.h +58 -0
- package/Common/cpp/{headers/Tools → Tools}/WorkletEventHandler.h +0 -0
- package/RNReanimated.podspec +23 -64
- package/android/CMakeLists.txt +233 -223
- package/android/build.gradle +800 -287
- package/android/gradle/wrapper/gradle-wrapper.properties +1 -1
- package/android/src/fabric/java/com/swmansion/reanimated/NativeProxy.java +51 -33
- package/android/src/main/cpp/AndroidErrorHandler.cpp +3 -4
- package/android/src/main/cpp/{headers/AndroidErrorHandler.h → AndroidErrorHandler.h} +1 -4
- package/android/src/main/cpp/AndroidLogger.cpp +4 -1
- package/android/src/main/cpp/{headers/AndroidLogger.h → AndroidLogger.h} +0 -0
- package/android/src/main/cpp/{headers/AndroidScheduler.h → AndroidScheduler.h} +0 -0
- package/android/src/main/cpp/{headers/JNIHelper.h → JNIHelper.h} +0 -0
- package/android/src/main/cpp/LayoutAnimations.cpp +39 -57
- package/android/src/main/cpp/LayoutAnimations.h +56 -0
- package/android/src/main/cpp/NativeProxy.cpp +107 -49
- package/android/src/main/cpp/{headers/NativeProxy.h → NativeProxy.h} +33 -2
- package/android/src/main/cpp/OnLoad.cpp +1 -0
- package/android/src/main/cpp/{headers/TurboModule.h → TurboModule.h} +0 -0
- package/android/src/main/java/com/swmansion/reanimated/NodesManager.java +4 -2
- package/android/src/main/java/com/swmansion/reanimated/ReanimatedMessageQueueThreadBase.java +72 -0
- package/android/src/main/java/com/swmansion/reanimated/ReanimatedPackage.java +5 -4
- package/android/src/main/java/com/swmansion/reanimated/keyboardObserver/ReanimatedKeyboardEventListener.java +166 -0
- package/android/src/main/java/com/swmansion/reanimated/layoutReanimation/AnimationsManager.java +240 -219
- package/android/src/main/java/com/swmansion/reanimated/layoutReanimation/LayoutAnimations.java +7 -5
- package/android/src/main/java/com/swmansion/reanimated/layoutReanimation/NativeMethodsHolder.java +5 -3
- package/android/src/main/java/com/swmansion/reanimated/layoutReanimation/ViewHierarchyObserver.java +1 -1
- package/android/src/main/java/com/swmansion/reanimated/sensor/ReanimatedSensor.java +5 -1
- package/android/src/main/java/com/swmansion/reanimated/sensor/ReanimatedSensorContainer.java +1 -1
- package/android/src/main/java/com/swmansion/reanimated/sensor/ReanimatedSensorListener.java +24 -1
- package/android/src/main/java/com/swmansion/reanimated/sensor/ReanimatedSensorType.java +7 -5
- package/android/src/paper/java/com/swmansion/reanimated/NativeProxy.java +52 -14
- package/android/src/reactNativeVersionPatch/ReanimatedUIManager/70/com/swmansion/reanimated/ReanimatedUIManagerFactory.java +16 -0
- package/android/src/{main/java → reactNativeVersionPatch/ReanimatedUIManager/70}/com/swmansion/reanimated/layoutReanimation/ReanimatedUIManager.java +1 -1
- package/android/src/reactNativeVersionPatch/ReanimatedUIManager/latest/com/swmansion/reanimated/ReanimatedUIManagerFactory.java +63 -0
- package/android/src/reactNativeVersionPatch/ReanimatedUIManager/latest/com/swmansion/reanimated/layoutReanimation/ReanimatedUIManager.java +271 -0
- package/android/{rnVersionPatch/62 → src/reactNativeVersionPatch/UIImplementation/64/com/swmansion/reanimated}/layoutReanimation/ReanimatedUIImplementation.java +0 -0
- package/android/src/{main/java → reactNativeVersionPatch/UIImplementation/latest}/com/swmansion/reanimated/layoutReanimation/ReanimatedUIImplementation.java +0 -0
- package/android/src/reactNativeVersionPatch/messageQueueThread/67/com/swmansion/reanimated/ReanimatedMessageQueueThread.java +12 -0
- package/android/src/reactNativeVersionPatch/messageQueueThread/latest/com/swmansion/reanimated/ReanimatedMessageQueueThread.java +12 -0
- package/android/{rnVersionPatch/62 → src/reactNativeVersionPatch/nativeHierarchyManager/62/com/swmansion/reanimated}/layoutReanimation/ReanimatedNativeHierarchyManager.java +8 -44
- package/android/src/{main/java → reactNativeVersionPatch/nativeHierarchyManager/latest}/com/swmansion/reanimated/layoutReanimation/ReanimatedNativeHierarchyManager.java +23 -91
- package/ios/LayoutReanimation/REAAnimationsManager.h +20 -8
- package/ios/LayoutReanimation/REAAnimationsManager.m +251 -160
- package/ios/LayoutReanimation/REAUIManager.mm +36 -83
- package/ios/REAModule.mm +36 -6
- package/ios/REANodesManager.mm +31 -8
- package/ios/keyboardObserver/REAKeyboardEventObserver.h +17 -0
- package/ios/keyboardObserver/REAKeyboardEventObserver.m +198 -0
- package/ios/native/NativeProxy.mm +79 -143
- package/ios/native/REAInitializer.h +2 -2
- package/ios/native/REAInitializer.mm +6 -2
- package/ios/native/REAJSIUtils.h +66 -0
- package/ios/native/REAMessageThread.h +22 -0
- package/ios/native/REAMessageThread.mm +38 -0
- package/ios/native/UIResponder+Reanimated.mm +1 -1
- package/ios/sensor/ReanimatedSensor.m +27 -18
- package/lib/commonjs/Animated.js +70 -0
- package/lib/commonjs/Animated.js.map +1 -0
- package/lib/commonjs/ConfigHelper.js +173 -0
- package/lib/commonjs/ConfigHelper.js.map +1 -0
- package/lib/commonjs/createAnimatedComponent.js +473 -0
- package/lib/commonjs/createAnimatedComponent.js.map +1 -0
- package/lib/commonjs/index.js +44 -0
- package/lib/commonjs/index.js.map +1 -0
- package/lib/commonjs/index.web.js +32 -0
- package/lib/commonjs/index.web.js.map +1 -0
- package/lib/commonjs/reanimated2/Bezier.js +166 -0
- package/lib/commonjs/reanimated2/Bezier.js.map +1 -0
- package/lib/commonjs/reanimated2/Colors.js +694 -0
- package/lib/commonjs/reanimated2/Colors.js.map +1 -0
- package/lib/{reanimated2 → commonjs/reanimated2}/Easing.js +151 -83
- package/lib/commonjs/reanimated2/Easing.js.map +1 -0
- package/lib/commonjs/reanimated2/NativeMethods.js +136 -0
- package/lib/commonjs/reanimated2/NativeMethods.js.map +1 -0
- package/lib/commonjs/reanimated2/NativeReanimated/NativeReanimated.js +108 -0
- package/lib/commonjs/reanimated2/NativeReanimated/NativeReanimated.js.map +1 -0
- package/lib/commonjs/reanimated2/NativeReanimated/index.js +26 -0
- package/lib/commonjs/reanimated2/NativeReanimated/index.js.map +1 -0
- package/lib/commonjs/reanimated2/PlatformChecker.js +33 -0
- package/lib/commonjs/reanimated2/PlatformChecker.js.map +1 -0
- package/lib/commonjs/reanimated2/PropAdapters.js +68 -0
- package/lib/commonjs/reanimated2/PropAdapters.js.map +1 -0
- package/lib/commonjs/reanimated2/UpdateProps.js +82 -0
- package/lib/commonjs/reanimated2/UpdateProps.js.map +1 -0
- package/lib/commonjs/reanimated2/ViewDescriptorsSet.js +68 -0
- package/lib/commonjs/reanimated2/ViewDescriptorsSet.js.map +1 -0
- package/lib/commonjs/reanimated2/WorkletEventHandler.js +77 -0
- package/lib/commonjs/reanimated2/WorkletEventHandler.js.map +1 -0
- package/lib/commonjs/reanimated2/animation/commonTypes.js +6 -0
- package/lib/commonjs/reanimated2/animation/commonTypes.js.map +1 -0
- package/lib/commonjs/reanimated2/animation/decay.js +132 -0
- package/lib/commonjs/reanimated2/animation/decay.js.map +1 -0
- package/lib/commonjs/reanimated2/animation/delay.js +77 -0
- package/lib/commonjs/reanimated2/animation/delay.js.map +1 -0
- package/lib/commonjs/reanimated2/animation/index.js +82 -0
- package/lib/commonjs/reanimated2/animation/index.js.map +1 -0
- package/lib/commonjs/reanimated2/animation/repeat.js +83 -0
- package/lib/commonjs/reanimated2/animation/repeat.js.map +1 -0
- package/lib/commonjs/reanimated2/animation/sequence.js +91 -0
- package/lib/commonjs/reanimated2/animation/sequence.js.map +1 -0
- package/lib/commonjs/reanimated2/animation/spring.js +121 -0
- package/lib/commonjs/reanimated2/animation/spring.js.map +1 -0
- package/lib/commonjs/reanimated2/animation/styleAnimation.js +206 -0
- package/lib/commonjs/reanimated2/animation/styleAnimation.js.map +1 -0
- package/lib/commonjs/reanimated2/animation/timing.js +82 -0
- package/lib/commonjs/reanimated2/animation/timing.js.map +1 -0
- package/lib/commonjs/reanimated2/animation/util.js +233 -0
- package/lib/commonjs/reanimated2/animation/util.js.map +1 -0
- package/lib/commonjs/reanimated2/commonTypes.js +24 -0
- package/lib/commonjs/reanimated2/commonTypes.js.map +1 -0
- package/lib/commonjs/reanimated2/component/FlatList.js +69 -0
- package/lib/commonjs/reanimated2/component/FlatList.js.map +1 -0
- package/lib/commonjs/reanimated2/component/Image.js +17 -0
- package/lib/commonjs/reanimated2/component/Image.js.map +1 -0
- package/lib/commonjs/reanimated2/component/ScrollView.js +17 -0
- package/lib/commonjs/reanimated2/component/ScrollView.js.map +1 -0
- package/lib/commonjs/reanimated2/component/Text.js +17 -0
- package/lib/commonjs/reanimated2/component/Text.js.map +1 -0
- package/lib/commonjs/reanimated2/component/View.js +17 -0
- package/lib/commonjs/reanimated2/component/View.js.map +1 -0
- package/lib/commonjs/reanimated2/core.js +194 -0
- package/lib/commonjs/reanimated2/core.js.map +1 -0
- package/lib/commonjs/reanimated2/errors.js +66 -0
- package/lib/commonjs/reanimated2/errors.js.map +1 -0
- package/lib/commonjs/reanimated2/fabricUtils.js +27 -0
- package/lib/commonjs/reanimated2/fabricUtils.js.map +1 -0
- package/lib/commonjs/reanimated2/fabricUtils.web.js +21 -0
- package/lib/commonjs/reanimated2/fabricUtils.web.js.map +1 -0
- package/lib/commonjs/reanimated2/frameCallback/FrameCallbackRegistryJS.js +55 -0
- package/lib/commonjs/reanimated2/frameCallback/FrameCallbackRegistryJS.js.map +1 -0
- package/lib/commonjs/reanimated2/frameCallback/FrameCallbackRegistryUI.js +96 -0
- package/lib/commonjs/reanimated2/frameCallback/FrameCallbackRegistryUI.js.map +1 -0
- package/lib/commonjs/reanimated2/globals.d.js +6 -0
- package/lib/commonjs/reanimated2/globals.d.js.map +1 -0
- package/lib/commonjs/reanimated2/hook/Hooks.js +35 -0
- package/lib/commonjs/reanimated2/hook/Hooks.js.map +1 -0
- package/lib/commonjs/reanimated2/hook/commonTypes.js +6 -0
- package/lib/commonjs/reanimated2/hook/commonTypes.js.map +1 -0
- package/lib/commonjs/reanimated2/hook/index.js +126 -0
- package/lib/commonjs/reanimated2/hook/index.js.map +1 -0
- package/lib/commonjs/reanimated2/hook/useAnimatedGestureHandler.js +66 -0
- package/lib/commonjs/reanimated2/hook/useAnimatedGestureHandler.js.map +1 -0
- package/lib/commonjs/reanimated2/hook/useAnimatedKeyboard.js +54 -0
- package/lib/commonjs/reanimated2/hook/useAnimatedKeyboard.js.map +1 -0
- package/lib/commonjs/reanimated2/hook/useAnimatedReaction.js +44 -0
- package/lib/commonjs/reanimated2/hook/useAnimatedReaction.js.map +1 -0
- package/lib/commonjs/reanimated2/hook/useAnimatedRef.js +53 -0
- package/lib/commonjs/reanimated2/hook/useAnimatedRef.js.map +1 -0
- package/lib/commonjs/reanimated2/hook/useAnimatedScrollHandler.js +62 -0
- package/lib/commonjs/reanimated2/hook/useAnimatedScrollHandler.js.map +1 -0
- package/lib/commonjs/reanimated2/hook/useAnimatedSensor.js +85 -0
- package/lib/commonjs/reanimated2/hook/useAnimatedSensor.js.map +1 -0
- package/lib/commonjs/reanimated2/hook/useAnimatedStyle.js +435 -0
- package/lib/commonjs/reanimated2/hook/useAnimatedStyle.js.map +1 -0
- package/lib/commonjs/reanimated2/hook/useDerivedValue.js +49 -0
- package/lib/commonjs/reanimated2/hook/useDerivedValue.js.map +1 -0
- package/lib/commonjs/reanimated2/hook/useFrameCallback.js +36 -0
- package/lib/commonjs/reanimated2/hook/useFrameCallback.js.map +1 -0
- package/lib/commonjs/reanimated2/hook/useScrollViewOffset.js +33 -0
- package/lib/commonjs/reanimated2/hook/useScrollViewOffset.js.map +1 -0
- package/lib/commonjs/reanimated2/hook/useSharedValue.js +31 -0
- package/lib/commonjs/reanimated2/hook/useSharedValue.js.map +1 -0
- package/lib/commonjs/reanimated2/hook/utils.js +247 -0
- package/lib/commonjs/reanimated2/hook/utils.js.map +1 -0
- package/lib/commonjs/reanimated2/index.js +162 -0
- package/lib/commonjs/reanimated2/index.js.map +1 -0
- package/lib/commonjs/reanimated2/initializers.js +157 -0
- package/lib/commonjs/reanimated2/initializers.js.map +1 -0
- package/lib/commonjs/reanimated2/interpolateColor.js +231 -0
- package/lib/commonjs/reanimated2/interpolateColor.js.map +1 -0
- package/lib/commonjs/reanimated2/interpolation.js +143 -0
- package/lib/commonjs/reanimated2/interpolation.js.map +1 -0
- package/lib/commonjs/reanimated2/jestUtils.js +222 -0
- package/lib/commonjs/reanimated2/jestUtils.js.map +1 -0
- package/lib/commonjs/reanimated2/js-reanimated/JSReanimated.js +71 -0
- package/lib/commonjs/reanimated2/js-reanimated/JSReanimated.js.map +1 -0
- package/lib/commonjs/reanimated2/js-reanimated/Mapper.js +74 -0
- package/lib/commonjs/reanimated2/js-reanimated/Mapper.js.map +1 -0
- package/lib/commonjs/reanimated2/js-reanimated/MapperRegistry.js +146 -0
- package/lib/commonjs/reanimated2/js-reanimated/MapperRegistry.js.map +1 -0
- package/lib/commonjs/reanimated2/js-reanimated/MutableValue.js +57 -0
- package/lib/commonjs/reanimated2/js-reanimated/MutableValue.js.map +1 -0
- package/lib/commonjs/reanimated2/js-reanimated/commonTypes.js +6 -0
- package/lib/commonjs/reanimated2/js-reanimated/commonTypes.js.map +1 -0
- package/lib/commonjs/reanimated2/js-reanimated/global.js +54 -0
- package/lib/commonjs/reanimated2/js-reanimated/global.js.map +1 -0
- package/lib/commonjs/reanimated2/js-reanimated/index.js +62 -0
- package/lib/commonjs/reanimated2/js-reanimated/index.js.map +1 -0
- package/lib/commonjs/reanimated2/layoutReanimation/animationBuilder/BaseAnimationBuilder.js +100 -0
- package/lib/commonjs/reanimated2/layoutReanimation/animationBuilder/BaseAnimationBuilder.js.map +1 -0
- package/lib/commonjs/reanimated2/layoutReanimation/animationBuilder/ComplexAnimationBuilder.js +203 -0
- package/lib/commonjs/reanimated2/layoutReanimation/animationBuilder/ComplexAnimationBuilder.js.map +1 -0
- package/lib/commonjs/reanimated2/layoutReanimation/animationBuilder/Keyframe.js +244 -0
- package/lib/commonjs/reanimated2/layoutReanimation/animationBuilder/Keyframe.js.map +1 -0
- package/lib/commonjs/reanimated2/layoutReanimation/animationBuilder/commonTypes.js +6 -0
- package/lib/commonjs/reanimated2/layoutReanimation/animationBuilder/commonTypes.js.map +1 -0
- package/lib/commonjs/reanimated2/layoutReanimation/animationBuilder/index.js +30 -0
- package/lib/commonjs/reanimated2/layoutReanimation/animationBuilder/index.js.map +1 -0
- package/lib/commonjs/reanimated2/layoutReanimation/animationsManager.js +87 -0
- package/lib/commonjs/reanimated2/layoutReanimation/animationsManager.js.map +1 -0
- package/lib/commonjs/reanimated2/layoutReanimation/defaultAnimations/Bounce.js +563 -0
- package/lib/commonjs/reanimated2/layoutReanimation/defaultAnimations/Bounce.js.map +1 -0
- package/lib/commonjs/reanimated2/layoutReanimation/defaultAnimations/Fade.js +409 -0
- package/lib/commonjs/reanimated2/layoutReanimation/defaultAnimations/Fade.js.map +1 -0
- package/lib/commonjs/reanimated2/layoutReanimation/defaultAnimations/Flip.js +559 -0
- package/lib/commonjs/reanimated2/layoutReanimation/defaultAnimations/Flip.js.map +1 -0
- package/lib/commonjs/reanimated2/layoutReanimation/defaultAnimations/Lightspeed.js +215 -0
- package/lib/commonjs/reanimated2/layoutReanimation/defaultAnimations/Lightspeed.js.map +1 -0
- package/lib/commonjs/reanimated2/layoutReanimation/defaultAnimations/Pinwheel.js +101 -0
- package/lib/commonjs/reanimated2/layoutReanimation/defaultAnimations/Pinwheel.js.map +1 -0
- package/lib/commonjs/reanimated2/layoutReanimation/defaultAnimations/Roll.js +183 -0
- package/lib/commonjs/reanimated2/layoutReanimation/defaultAnimations/Roll.js.map +1 -0
- package/lib/commonjs/reanimated2/layoutReanimation/defaultAnimations/Rotate.js +403 -0
- package/lib/commonjs/reanimated2/layoutReanimation/defaultAnimations/Rotate.js.map +1 -0
- package/lib/commonjs/reanimated2/layoutReanimation/defaultAnimations/Slide.js +291 -0
- package/lib/commonjs/reanimated2/layoutReanimation/defaultAnimations/Slide.js.map +1 -0
- package/lib/commonjs/reanimated2/layoutReanimation/defaultAnimations/Stretch.js +167 -0
- package/lib/commonjs/reanimated2/layoutReanimation/defaultAnimations/Stretch.js.map +1 -0
- package/lib/commonjs/reanimated2/layoutReanimation/defaultAnimations/Zoom.js +693 -0
- package/lib/commonjs/reanimated2/layoutReanimation/defaultAnimations/Zoom.js.map +1 -0
- package/lib/commonjs/reanimated2/layoutReanimation/defaultAnimations/index.js +136 -0
- package/lib/commonjs/reanimated2/layoutReanimation/defaultAnimations/index.js.map +1 -0
- package/lib/commonjs/reanimated2/layoutReanimation/defaultTransitions/CurvedTransition.js +120 -0
- package/lib/commonjs/reanimated2/layoutReanimation/defaultTransitions/CurvedTransition.js.map +1 -0
- package/lib/commonjs/reanimated2/layoutReanimation/defaultTransitions/EntryExitTransition.js +180 -0
- package/lib/commonjs/reanimated2/layoutReanimation/defaultTransitions/EntryExitTransition.js.map +1 -0
- package/lib/commonjs/reanimated2/layoutReanimation/defaultTransitions/FadingTransition.js +66 -0
- package/lib/commonjs/reanimated2/layoutReanimation/defaultTransitions/FadingTransition.js.map +1 -0
- package/lib/commonjs/reanimated2/layoutReanimation/defaultTransitions/JumpingTransition.js +64 -0
- package/lib/commonjs/reanimated2/layoutReanimation/defaultTransitions/JumpingTransition.js.map +1 -0
- package/lib/commonjs/reanimated2/layoutReanimation/defaultTransitions/LinearTransition.js +52 -0
- package/lib/commonjs/reanimated2/layoutReanimation/defaultTransitions/LinearTransition.js.map +1 -0
- package/lib/commonjs/reanimated2/layoutReanimation/defaultTransitions/SequencedTransition.js +68 -0
- package/lib/commonjs/reanimated2/layoutReanimation/defaultTransitions/SequencedTransition.js.map +1 -0
- package/lib/commonjs/reanimated2/layoutReanimation/defaultTransitions/index.js +84 -0
- package/lib/commonjs/reanimated2/layoutReanimation/defaultTransitions/index.js.map +1 -0
- package/lib/commonjs/reanimated2/layoutReanimation/index.js +47 -0
- package/lib/commonjs/reanimated2/layoutReanimation/index.js.map +1 -0
- package/lib/commonjs/reanimated2/mappers.js +186 -0
- package/lib/commonjs/reanimated2/mappers.js.map +1 -0
- package/lib/commonjs/reanimated2/mock.js +114 -0
- package/lib/commonjs/reanimated2/mock.js.map +1 -0
- package/lib/commonjs/reanimated2/mutables.js +173 -0
- package/lib/commonjs/reanimated2/mutables.js.map +1 -0
- package/lib/commonjs/reanimated2/platform-specific/RNRenderer.js +16 -0
- package/lib/commonjs/reanimated2/platform-specific/RNRenderer.js.map +1 -0
- package/lib/{reanimated2 → commonjs/reanimated2}/platform-specific/RNRenderer.web.js +2 -0
- package/lib/commonjs/reanimated2/platform-specific/RNRenderer.web.js.map +1 -0
- package/lib/commonjs/reanimated2/platform-specific/checkVersion.js +33 -0
- package/lib/commonjs/reanimated2/platform-specific/checkVersion.js.map +1 -0
- package/lib/commonjs/reanimated2/platform-specific/checkVersion.web.js +15 -0
- package/lib/commonjs/reanimated2/platform-specific/checkVersion.web.js.map +1 -0
- package/lib/commonjs/reanimated2/shareables.js +159 -0
- package/lib/commonjs/reanimated2/shareables.js.map +1 -0
- package/lib/commonjs/reanimated2/threads.js +68 -0
- package/lib/commonjs/reanimated2/threads.js.map +1 -0
- package/lib/commonjs/reanimated2/time.js +55 -0
- package/lib/commonjs/reanimated2/time.js.map +1 -0
- package/lib/commonjs/reanimated2/utils.js +28 -0
- package/lib/commonjs/reanimated2/utils.js.map +1 -0
- package/lib/commonjs/reanimated2/valueSetter.js +81 -0
- package/lib/commonjs/reanimated2/valueSetter.js.map +1 -0
- package/lib/commonjs/setAndForwardRef.js +63 -0
- package/lib/commonjs/setAndForwardRef.js.map +1 -0
- package/lib/module/Animated.js +8 -0
- package/lib/module/Animated.js.map +1 -0
- package/lib/module/ConfigHelper.js +161 -0
- package/lib/module/ConfigHelper.js.map +1 -0
- package/lib/module/createAnimatedComponent.js +451 -0
- package/lib/module/createAnimatedComponent.js.map +1 -0
- package/lib/module/index.js +15 -0
- package/lib/module/index.js.map +1 -0
- package/lib/module/index.web.js +6 -0
- package/lib/module/index.web.js.map +1 -0
- package/lib/module/reanimated2/Bezier.js +159 -0
- package/lib/module/reanimated2/Bezier.js.map +1 -0
- package/lib/module/reanimated2/Colors.js +648 -0
- package/lib/module/reanimated2/Colors.js.map +1 -0
- package/lib/{types/reanimated2/Easing.d.ts → module/reanimated2/Easing.js} +179 -40
- package/lib/module/reanimated2/Easing.js.map +1 -0
- package/lib/module/reanimated2/NativeMethods.js +120 -0
- package/lib/module/reanimated2/NativeMethods.js.map +1 -0
- package/lib/module/reanimated2/NativeReanimated/NativeReanimated.js +97 -0
- package/lib/module/reanimated2/NativeReanimated/NativeReanimated.js.map +1 -0
- package/lib/{reanimated2 → module/reanimated2}/NativeReanimated/index.js +6 -4
- package/lib/module/reanimated2/NativeReanimated/index.js.map +1 -0
- package/lib/module/reanimated2/PlatformChecker.js +17 -0
- package/lib/module/reanimated2/PlatformChecker.js.map +1 -0
- package/lib/module/reanimated2/PropAdapters.js +56 -0
- package/lib/module/reanimated2/PropAdapters.js.map +1 -0
- package/lib/module/reanimated2/UpdateProps.js +64 -0
- package/lib/module/reanimated2/UpdateProps.js.map +1 -0
- package/lib/module/reanimated2/ViewDescriptorsSet.js +57 -0
- package/lib/module/reanimated2/ViewDescriptorsSet.js.map +1 -0
- package/lib/module/reanimated2/WorkletEventHandler.js +65 -0
- package/lib/module/reanimated2/WorkletEventHandler.js.map +1 -0
- package/lib/module/reanimated2/animation/commonTypes.js +2 -0
- package/lib/module/reanimated2/animation/commonTypes.js.map +1 -0
- package/lib/module/reanimated2/animation/decay.js +123 -0
- package/lib/module/reanimated2/animation/decay.js.map +1 -0
- package/lib/module/reanimated2/animation/delay.js +69 -0
- package/lib/module/reanimated2/animation/delay.js.map +1 -0
- package/lib/{reanimated2 → module/reanimated2}/animation/index.js +1 -0
- package/lib/module/reanimated2/animation/index.js.map +1 -0
- package/lib/module/reanimated2/animation/repeat.js +75 -0
- package/lib/module/reanimated2/animation/repeat.js.map +1 -0
- package/lib/module/reanimated2/animation/sequence.js +83 -0
- package/lib/module/reanimated2/animation/sequence.js.map +1 -0
- package/lib/module/reanimated2/animation/spring.js +113 -0
- package/lib/module/reanimated2/animation/spring.js.map +1 -0
- package/lib/module/reanimated2/animation/styleAnimation.js +191 -0
- package/lib/module/reanimated2/animation/styleAnimation.js.map +1 -0
- package/lib/module/reanimated2/animation/timing.js +73 -0
- package/lib/module/reanimated2/animation/timing.js.map +1 -0
- package/lib/module/reanimated2/animation/util.js +216 -0
- package/lib/module/reanimated2/animation/util.js.map +1 -0
- package/lib/module/reanimated2/commonTypes.js +17 -0
- package/lib/module/reanimated2/commonTypes.js.map +1 -0
- package/lib/module/reanimated2/component/FlatList.js +47 -0
- package/lib/module/reanimated2/component/FlatList.js.map +1 -0
- package/lib/module/reanimated2/component/Image.js +5 -0
- package/lib/module/reanimated2/component/Image.js.map +1 -0
- package/lib/module/reanimated2/component/ScrollView.js +5 -0
- package/lib/module/reanimated2/component/ScrollView.js.map +1 -0
- package/lib/module/reanimated2/component/Text.js +5 -0
- package/lib/module/reanimated2/component/Text.js.map +1 -0
- package/lib/module/reanimated2/component/View.js +5 -0
- package/lib/module/reanimated2/component/View.js.map +1 -0
- package/lib/module/reanimated2/core.js +119 -0
- package/lib/module/reanimated2/core.js.map +1 -0
- package/lib/module/reanimated2/errors.js +58 -0
- package/lib/module/reanimated2/errors.js.map +1 -0
- package/lib/module/reanimated2/fabricUtils.js +18 -0
- package/lib/module/reanimated2/fabricUtils.js.map +1 -0
- package/lib/module/reanimated2/fabricUtils.web.js +12 -0
- package/lib/module/reanimated2/fabricUtils.web.js.map +1 -0
- package/lib/module/reanimated2/frameCallback/FrameCallbackRegistryJS.js +44 -0
- package/lib/module/reanimated2/frameCallback/FrameCallbackRegistryJS.js.map +1 -0
- package/lib/module/reanimated2/frameCallback/FrameCallbackRegistryUI.js +87 -0
- package/lib/module/reanimated2/frameCallback/FrameCallbackRegistryUI.js.map +1 -0
- package/lib/module/reanimated2/globals.d.js +2 -0
- package/lib/module/reanimated2/globals.d.js.map +1 -0
- package/lib/{reanimated2 → module/reanimated2}/hook/Hooks.js +4 -3
- package/lib/module/reanimated2/hook/Hooks.js.map +1 -0
- package/lib/module/reanimated2/hook/commonTypes.js +2 -0
- package/lib/module/reanimated2/hook/commonTypes.js.map +1 -0
- package/lib/module/reanimated2/hook/index.js +13 -0
- package/lib/module/reanimated2/hook/index.js.map +1 -0
- package/lib/module/reanimated2/hook/useAnimatedGestureHandler.js +56 -0
- package/lib/module/reanimated2/hook/useAnimatedGestureHandler.js.map +1 -0
- package/lib/module/reanimated2/hook/useAnimatedKeyboard.js +44 -0
- package/lib/module/reanimated2/hook/useAnimatedKeyboard.js.map +1 -0
- package/lib/module/reanimated2/hook/useAnimatedReaction.js +35 -0
- package/lib/module/reanimated2/hook/useAnimatedReaction.js.map +1 -0
- package/lib/module/reanimated2/hook/useAnimatedRef.js +41 -0
- package/lib/module/reanimated2/hook/useAnimatedRef.js.map +1 -0
- package/lib/module/reanimated2/hook/useAnimatedScrollHandler.js +54 -0
- package/lib/module/reanimated2/hook/useAnimatedScrollHandler.js.map +1 -0
- package/lib/module/reanimated2/hook/useAnimatedSensor.js +74 -0
- package/lib/module/reanimated2/hook/useAnimatedSensor.js.map +1 -0
- package/lib/module/reanimated2/hook/useAnimatedStyle.js +414 -0
- package/lib/module/reanimated2/hook/useAnimatedStyle.js.map +1 -0
- package/lib/module/reanimated2/hook/useDerivedValue.js +39 -0
- package/lib/module/reanimated2/hook/useDerivedValue.js.map +1 -0
- package/lib/module/reanimated2/hook/useFrameCallback.js +24 -0
- package/lib/module/reanimated2/hook/useFrameCallback.js.map +1 -0
- package/lib/module/reanimated2/hook/useScrollViewOffset.js +21 -0
- package/lib/module/reanimated2/hook/useScrollViewOffset.js.map +1 -0
- package/lib/module/reanimated2/hook/useSharedValue.js +21 -0
- package/lib/module/reanimated2/hook/useSharedValue.js.map +1 -0
- package/lib/module/reanimated2/hook/utils.js +208 -0
- package/lib/module/reanimated2/hook/utils.js.map +1 -0
- package/lib/{reanimated2 → module/reanimated2}/index.js +1 -0
- package/lib/module/reanimated2/index.js.map +1 -0
- package/lib/module/reanimated2/initializers.js +143 -0
- package/lib/module/reanimated2/initializers.js.map +1 -0
- package/lib/module/reanimated2/interpolateColor.js +212 -0
- package/lib/module/reanimated2/interpolateColor.js.map +1 -0
- package/lib/module/reanimated2/interpolation.js +135 -0
- package/lib/module/reanimated2/interpolation.js.map +1 -0
- package/lib/module/reanimated2/jestUtils.js +202 -0
- package/lib/module/reanimated2/jestUtils.js.map +1 -0
- package/lib/module/reanimated2/js-reanimated/JSReanimated.js +60 -0
- package/lib/module/reanimated2/js-reanimated/JSReanimated.js.map +1 -0
- package/lib/module/reanimated2/js-reanimated/Mapper.js +62 -0
- package/lib/module/reanimated2/js-reanimated/Mapper.js.map +1 -0
- package/lib/module/reanimated2/js-reanimated/MapperRegistry.js +137 -0
- package/lib/module/reanimated2/js-reanimated/MapperRegistry.js.map +1 -0
- package/lib/module/reanimated2/js-reanimated/MutableValue.js +48 -0
- package/lib/module/reanimated2/js-reanimated/MutableValue.js.map +1 -0
- package/lib/module/reanimated2/js-reanimated/commonTypes.js +2 -0
- package/lib/module/reanimated2/js-reanimated/commonTypes.js.map +1 -0
- package/lib/module/reanimated2/js-reanimated/global.js +45 -0
- package/lib/module/reanimated2/js-reanimated/global.js.map +1 -0
- package/lib/module/reanimated2/js-reanimated/index.js +48 -0
- package/lib/module/reanimated2/js-reanimated/index.js.map +1 -0
- package/lib/module/reanimated2/layoutReanimation/animationBuilder/BaseAnimationBuilder.js +90 -0
- package/lib/module/reanimated2/layoutReanimation/animationBuilder/BaseAnimationBuilder.js.map +1 -0
- package/lib/module/reanimated2/layoutReanimation/animationBuilder/ComplexAnimationBuilder.js +192 -0
- package/lib/module/reanimated2/layoutReanimation/animationBuilder/ComplexAnimationBuilder.js.map +1 -0
- package/lib/module/reanimated2/layoutReanimation/animationBuilder/Keyframe.js +233 -0
- package/lib/module/reanimated2/layoutReanimation/animationBuilder/Keyframe.js.map +1 -0
- package/lib/module/reanimated2/layoutReanimation/animationBuilder/commonTypes.js +2 -0
- package/lib/module/reanimated2/layoutReanimation/animationBuilder/commonTypes.js.map +1 -0
- package/lib/{reanimated2 → module/reanimated2}/layoutReanimation/animationBuilder/index.js +1 -0
- package/lib/module/reanimated2/layoutReanimation/animationBuilder/index.js.map +1 -0
- package/lib/module/reanimated2/layoutReanimation/animationsManager.js +82 -0
- package/lib/module/reanimated2/layoutReanimation/animationsManager.js.map +1 -0
- package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Bounce.js +525 -0
- package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Bounce.js.map +1 -0
- package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Fade.js +372 -0
- package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Fade.js.map +1 -0
- package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Flip.js +516 -0
- package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Flip.js.map +1 -0
- package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Lightspeed.js +195 -0
- package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Lightspeed.js.map +1 -0
- package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Pinwheel.js +88 -0
- package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Pinwheel.js.map +1 -0
- package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Roll.js +164 -0
- package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Roll.js.map +1 -0
- package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Rotate.js +372 -0
- package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Rotate.js.map +1 -0
- package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Slide.js +260 -0
- package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Slide.js.map +1 -0
- package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Stretch.js +148 -0
- package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Stretch.js.map +1 -0
- package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Zoom.js +638 -0
- package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Zoom.js.map +1 -0
- package/lib/{reanimated2 → module/reanimated2}/layoutReanimation/defaultAnimations/index.js +1 -0
- package/lib/module/reanimated2/layoutReanimation/defaultAnimations/index.js.map +1 -0
- package/lib/module/reanimated2/layoutReanimation/defaultTransitions/CurvedTransition.js +108 -0
- package/lib/module/reanimated2/layoutReanimation/defaultTransitions/CurvedTransition.js.map +1 -0
- package/lib/module/reanimated2/layoutReanimation/defaultTransitions/EntryExitTransition.js +166 -0
- package/lib/module/reanimated2/layoutReanimation/defaultTransitions/EntryExitTransition.js.map +1 -0
- package/lib/module/reanimated2/layoutReanimation/defaultTransitions/FadingTransition.js +55 -0
- package/lib/module/reanimated2/layoutReanimation/defaultTransitions/FadingTransition.js.map +1 -0
- package/lib/module/reanimated2/layoutReanimation/defaultTransitions/JumpingTransition.js +52 -0
- package/lib/module/reanimated2/layoutReanimation/defaultTransitions/JumpingTransition.js.map +1 -0
- package/lib/module/reanimated2/layoutReanimation/defaultTransitions/LinearTransition.js +41 -0
- package/lib/module/reanimated2/layoutReanimation/defaultTransitions/LinearTransition.js.map +1 -0
- package/lib/module/reanimated2/layoutReanimation/defaultTransitions/SequencedTransition.js +57 -0
- package/lib/module/reanimated2/layoutReanimation/defaultTransitions/SequencedTransition.js.map +1 -0
- package/lib/{reanimated2 → module/reanimated2}/layoutReanimation/defaultTransitions/index.js +1 -0
- package/lib/module/reanimated2/layoutReanimation/defaultTransitions/index.js.map +1 -0
- package/lib/{reanimated2 → module/reanimated2}/layoutReanimation/index.js +2 -1
- package/lib/module/reanimated2/layoutReanimation/index.js.map +1 -0
- package/lib/module/reanimated2/mappers.js +173 -0
- package/lib/module/reanimated2/mappers.js.map +1 -0
- package/lib/module/reanimated2/mock.js +112 -0
- package/lib/module/reanimated2/mock.js.map +1 -0
- package/lib/module/reanimated2/mutables.js +149 -0
- package/lib/module/reanimated2/mutables.js.map +1 -0
- package/lib/{reanimated2 → module/reanimated2}/platform-specific/RNRenderer.js +1 -0
- package/lib/module/reanimated2/platform-specific/RNRenderer.js.map +1 -0
- package/lib/module/reanimated2/platform-specific/RNRenderer.web.js +3 -0
- package/lib/module/reanimated2/platform-specific/RNRenderer.web.js.map +1 -0
- package/lib/module/reanimated2/platform-specific/checkVersion.js +25 -0
- package/lib/module/reanimated2/platform-specific/checkVersion.js.map +1 -0
- package/lib/module/reanimated2/platform-specific/checkVersion.web.js +8 -0
- package/lib/module/reanimated2/platform-specific/checkVersion.web.js.map +1 -0
- package/lib/module/reanimated2/shareables.js +138 -0
- package/lib/module/reanimated2/shareables.js.map +1 -0
- package/lib/module/reanimated2/threads.js +56 -0
- package/lib/module/reanimated2/threads.js.map +1 -0
- package/lib/module/reanimated2/time.js +37 -0
- package/lib/module/reanimated2/time.js.map +1 -0
- package/lib/module/reanimated2/utils.js +21 -0
- package/lib/module/reanimated2/utils.js.map +1 -0
- package/lib/module/reanimated2/valueSetter.js +66 -0
- package/lib/module/reanimated2/valueSetter.js.map +1 -0
- package/lib/{types/setAndForwardRef.d.ts → module/setAndForwardRef.js} +21 -6
- package/lib/module/setAndForwardRef.js.map +1 -0
- package/mock.js +1 -0
- package/package.json +40 -28
- package/plugin.js +200 -62
- package/react-native-reanimated.d.ts +81 -18
- package/scripts/reanimated_utils.rb +81 -0
- package/src/Animated.ts +11 -0
- package/src/createAnimatedComponent.tsx +44 -44
- package/src/index.ts +13 -0
- package/src/index.web.ts +5 -0
- package/src/reanimated2/Colors.ts +39 -12
- package/src/reanimated2/NativeMethods.ts +91 -39
- package/src/reanimated2/NativeReanimated/NativeReanimated.ts +61 -43
- package/src/reanimated2/ViewDescriptorsSet.ts +30 -69
- package/src/reanimated2/WorkletEventHandler.ts +4 -11
- package/src/reanimated2/animation/decay.ts +79 -30
- package/src/reanimated2/animation/delay.ts +0 -12
- package/src/reanimated2/animation/index.ts +7 -4
- package/src/reanimated2/animation/repeat.ts +0 -25
- package/src/reanimated2/animation/sequence.ts +0 -18
- package/src/reanimated2/animation/util.ts +35 -16
- package/src/reanimated2/commonTypes.ts +51 -4
- package/src/reanimated2/component/FlatList.tsx +51 -22
- package/src/reanimated2/component/Image.ts +6 -0
- package/src/reanimated2/component/ScrollView.ts +6 -0
- package/src/reanimated2/component/Text.ts +6 -0
- package/src/reanimated2/component/View.ts +6 -0
- package/src/reanimated2/core.ts +87 -273
- package/src/reanimated2/errors.ts +57 -0
- package/src/reanimated2/fabricUtils.web.ts +19 -0
- package/src/reanimated2/frameCallback/FrameCallbackRegistryJS.ts +40 -0
- package/src/reanimated2/frameCallback/FrameCallbackRegistryUI.ts +115 -0
- package/src/reanimated2/globals.d.ts +96 -26
- package/src/reanimated2/hook/index.ts +15 -14
- package/src/reanimated2/hook/useAnimatedKeyboard.ts +44 -0
- package/src/reanimated2/hook/useAnimatedRef.ts +27 -9
- package/src/reanimated2/hook/useAnimatedScrollHandler.ts +3 -1
- package/src/reanimated2/hook/useAnimatedSensor.ts +37 -35
- package/src/reanimated2/hook/useAnimatedStyle.ts +26 -74
- package/src/reanimated2/hook/useFrameCallback.ts +40 -0
- package/src/reanimated2/hook/useScrollViewOffset.ts +37 -0
- package/src/reanimated2/hook/useSharedValue.ts +6 -3
- package/src/reanimated2/hook/utils.ts +1 -1
- package/src/reanimated2/initializers.ts +143 -0
- package/src/reanimated2/interpolateColor.ts +106 -22
- package/src/reanimated2/jestUtils.ts +33 -32
- package/src/reanimated2/js-reanimated/JSReanimated.ts +32 -87
- package/src/reanimated2/js-reanimated/global.ts +47 -0
- package/src/reanimated2/js-reanimated/index.ts +4 -36
- package/src/reanimated2/layoutReanimation/animationBuilder/commonTypes.ts +11 -0
- package/src/reanimated2/layoutReanimation/animationBuilder/index.ts +2 -1
- package/src/reanimated2/layoutReanimation/animationsManager.ts +91 -0
- package/src/reanimated2/layoutReanimation/defaultAnimations/Bounce.ts +16 -19
- package/src/reanimated2/layoutReanimation/defaultAnimations/Lightspeed.ts +14 -11
- package/src/reanimated2/layoutReanimation/defaultAnimations/Roll.ts +21 -11
- package/src/reanimated2/layoutReanimation/defaultAnimations/Slide.ts +32 -11
- package/src/reanimated2/layoutReanimation/defaultAnimations/Zoom.ts +36 -19
- package/src/reanimated2/layoutReanimation/index.ts +1 -1
- package/src/reanimated2/mappers.ts +179 -0
- package/src/reanimated2/mock.ts +111 -0
- package/src/reanimated2/mutables.ts +151 -0
- package/src/reanimated2/platform-specific/checkVersion.ts +28 -0
- package/src/reanimated2/platform-specific/checkVersion.web.ts +6 -0
- package/src/reanimated2/shareables.ts +128 -0
- package/src/reanimated2/threads.ts +58 -0
- package/src/reanimated2/time.ts +30 -0
- package/src/reanimated2/utils.ts +12 -5
- package/src/reanimated2/valueSetter.ts +64 -0
- package/Common/cpp/LayoutAnimations/LayoutAnimationsProxy.cpp +0 -43
- package/Common/cpp/Registries/MapperRegistry.cpp +0 -145
- package/Common/cpp/Registries/WorkletsCache.cpp +0 -38
- package/Common/cpp/SharedItems/FrozenObject.cpp +0 -35
- package/Common/cpp/SharedItems/MutableValue.cpp +0 -132
- package/Common/cpp/SharedItems/MutableValueSetterProxy.cpp +0 -47
- package/Common/cpp/SharedItems/RemoteObject.cpp +0 -45
- package/Common/cpp/SharedItems/ShareableValue.cpp +0 -525
- package/Common/cpp/Tools/JSIStoreValueUser.cpp +0 -55
- package/Common/cpp/Tools/Mapper.cpp +0 -86
- package/Common/cpp/headers/LayoutAnimations/LayoutAnimationsProxy.h +0 -32
- package/Common/cpp/headers/Registries/MapperRegistry.h +0 -29
- package/Common/cpp/headers/Registries/WorkletsCache.h +0 -24
- package/Common/cpp/headers/SharedItems/FrozenObject.h +0 -36
- package/Common/cpp/headers/SharedItems/HostFunctionHandler.h +0 -28
- package/Common/cpp/headers/SharedItems/MutableValue.h +0 -54
- package/Common/cpp/headers/SharedItems/MutableValueSetterProxy.h +0 -25
- package/Common/cpp/headers/SharedItems/RemoteObject.h +0 -35
- package/Common/cpp/headers/SharedItems/ShareableValue.h +0 -63
- package/Common/cpp/headers/SharedItems/ValueWrapper.h +0 -183
- package/Common/cpp/headers/Tools/JSIStoreValueUser.h +0 -37
- package/Common/cpp/headers/Tools/Mapper.h +0 -51
- package/android/local.properties +0 -1
- package/android/rnVersionPatch/63/layoutReanimation/ReanimatedUIImplementation.java +0 -68
- package/android/rnVersionPatch/64/layoutReanimation/ReanimatedUIImplementation.java +0 -68
- package/android/rnVersionPatch/65/.gitkeep +0 -0
- package/android/rnVersionPatch/66/.gitkeep +0 -0
- package/android/rnVersionPatch/67/.gitkeep +0 -0
- package/android/rnVersionPatch/68/.gitkeep +0 -0
- package/android/rnVersionPatch/backup/.gitkeep +0 -0
- package/android/src/main/cpp/headers/LayoutAnimations.h +0 -42
- package/android/src/main/java/com/swmansion/reanimated/AndroidErrorHandler.java +0 -8
- package/android/src/main/java/com/swmansion/reanimated/ReanimatedJSIModulePackage.java +0 -29
- package/lib/Animated.js +0 -18
- package/lib/ConfigHelper.js +0 -145
- package/lib/ReanimatedEventEmitter.js +0 -3
- package/lib/ReanimatedModule.js +0 -2
- package/lib/ReanimatedModule.macos.js +0 -2
- package/lib/ReanimatedModule.native.js +0 -12
- package/lib/ReanimatedModule.windows.js +0 -2
- package/lib/ReanimatedModuleCompat.js +0 -66
- package/lib/__mocks__/ReanimatedEventEmitter.js +0 -8
- package/lib/__mocks__/ReanimatedModule.native.js +0 -11
- package/lib/createAnimatedComponent.js +0 -375
- package/lib/index.js +0 -18
- package/lib/reanimated2/Bezier.js +0 -126
- package/lib/reanimated2/Colors.js +0 -522
- package/lib/reanimated2/NativeMethods.js +0 -59
- package/lib/reanimated2/NativeReanimated/NativeReanimated.js +0 -50
- package/lib/reanimated2/PlatformChecker.js +0 -16
- package/lib/reanimated2/PropAdapters.js +0 -55
- package/lib/reanimated2/UpdateProps.js +0 -70
- package/lib/reanimated2/ViewDescriptorsSet.js +0 -75
- package/lib/reanimated2/WorkletEventHandler.js +0 -37
- package/lib/reanimated2/__mocks__/MutableValue.js +0 -13
- package/lib/reanimated2/__mocks__/NativeReanimated.js +0 -20
- package/lib/reanimated2/__mocks__/NativeReanimated.native.js +0 -20
- package/lib/reanimated2/animation/commonTypes.js +0 -1
- package/lib/reanimated2/animation/decay.js +0 -71
- package/lib/reanimated2/animation/delay.js +0 -64
- package/lib/reanimated2/animation/repeat.js +0 -69
- package/lib/reanimated2/animation/sequence.js +0 -72
- package/lib/reanimated2/animation/spring.js +0 -103
- package/lib/reanimated2/animation/styleAnimation.js +0 -171
- package/lib/reanimated2/animation/timing.js +0 -64
- package/lib/reanimated2/animation/util.js +0 -180
- package/lib/reanimated2/commonTypes.js +0 -1
- package/lib/reanimated2/component/FlatList.js +0 -30
- package/lib/reanimated2/component/WrappedComponents.js +0 -9
- package/lib/reanimated2/component/index.js +0 -4
- package/lib/reanimated2/core.js +0 -276
- package/lib/reanimated2/fabricUtils.js +0 -18
- package/lib/reanimated2/globals.d.ts +0 -76
- package/lib/reanimated2/hook/commonTypes.js +0 -1
- package/lib/reanimated2/hook/index.js +0 -9
- package/lib/reanimated2/hook/useAnimatedGestureHandler.js +0 -49
- package/lib/reanimated2/hook/useAnimatedReaction.js +0 -37
- package/lib/reanimated2/hook/useAnimatedRef.js +0 -29
- package/lib/reanimated2/hook/useAnimatedScrollHandler.js +0 -41
- package/lib/reanimated2/hook/useAnimatedSensor.js +0 -66
- package/lib/reanimated2/hook/useAnimatedStyle.js +0 -393
- package/lib/reanimated2/hook/useDerivedValue.js +0 -36
- package/lib/reanimated2/hook/useSharedValue.js +0 -17
- package/lib/reanimated2/hook/utils.js +0 -173
- package/lib/reanimated2/interpolateColor.js +0 -101
- package/lib/reanimated2/interpolation.js +0 -112
- package/lib/reanimated2/jestUtils.js +0 -160
- package/lib/reanimated2/js-reanimated/JSReanimated.js +0 -99
- package/lib/reanimated2/js-reanimated/Mapper.js +0 -43
- package/lib/reanimated2/js-reanimated/MapperRegistry.js +0 -101
- package/lib/reanimated2/js-reanimated/MutableValue.js +0 -29
- package/lib/reanimated2/js-reanimated/commonTypes.js +0 -1
- package/lib/reanimated2/js-reanimated/index.js +0 -62
- package/lib/reanimated2/layoutReanimation/LayoutAnimationRepository.js +0 -67
- package/lib/reanimated2/layoutReanimation/animationBuilder/BaseAnimationBuilder.js +0 -69
- package/lib/reanimated2/layoutReanimation/animationBuilder/ComplexAnimationBuilder.js +0 -133
- package/lib/reanimated2/layoutReanimation/animationBuilder/Keyframe.js +0 -194
- package/lib/reanimated2/layoutReanimation/animationBuilder/commonTypes.js +0 -1
- package/lib/reanimated2/layoutReanimation/defaultAnimations/Bounce.js +0 -376
- package/lib/reanimated2/layoutReanimation/defaultAnimations/Default.js +0 -36
- package/lib/reanimated2/layoutReanimation/defaultAnimations/Fade.js +0 -275
- package/lib/reanimated2/layoutReanimation/defaultAnimations/Flip.js +0 -385
- package/lib/reanimated2/layoutReanimation/defaultAnimations/Lightspeed.js +0 -138
- package/lib/reanimated2/layoutReanimation/defaultAnimations/Pinwheel.js +0 -81
- package/lib/reanimated2/layoutReanimation/defaultAnimations/Roll.js +0 -115
- package/lib/reanimated2/layoutReanimation/defaultAnimations/Rotate.js +0 -273
- package/lib/reanimated2/layoutReanimation/defaultAnimations/Slide.js +0 -203
- package/lib/reanimated2/layoutReanimation/defaultAnimations/Stretch.js +0 -101
- package/lib/reanimated2/layoutReanimation/defaultAnimations/Zoom.js +0 -451
- package/lib/reanimated2/layoutReanimation/defaultTransitions/CurvedTransition.js +0 -90
- package/lib/reanimated2/layoutReanimation/defaultTransitions/EntryExitTransition.js +0 -132
- package/lib/reanimated2/layoutReanimation/defaultTransitions/FadingTransition.js +0 -37
- package/lib/reanimated2/layoutReanimation/defaultTransitions/JumpingTransition.js +0 -41
- package/lib/reanimated2/layoutReanimation/defaultTransitions/LinearTransition.js +0 -34
- package/lib/reanimated2/layoutReanimation/defaultTransitions/SequencedTransition.js +0 -46
- package/lib/reanimated2/mock.js +0 -69
- package/lib/reanimated2/utils.js +0 -9
- package/lib/setAndForwardRef.js +0 -19
- package/lib/types/ConfigHelper.d.ts +0 -12
- package/lib/types/ReanimatedEventEmitter.d.ts +0 -3
- package/lib/types/ReanimatedModule.d.ts +0 -2
- package/lib/types/ReanimatedModule.macos.d.ts +0 -2
- package/lib/types/ReanimatedModule.native.d.ts +0 -2
- package/lib/types/ReanimatedModule.windows.d.ts +0 -2
- package/lib/types/ReanimatedModuleCompat.d.ts +0 -14
- package/lib/types/createAnimatedComponent.d.ts +0 -33
- package/lib/types/reanimated2/Bezier.d.ts +0 -6
- package/lib/types/reanimated2/Colors.d.ts +0 -31
- package/lib/types/reanimated2/NativeMethods.d.ts +0 -15
- package/lib/types/reanimated2/NativeReanimated/NativeReanimated.d.ts +0 -20
- package/lib/types/reanimated2/NativeReanimated/index.d.ts +0 -3
- package/lib/types/reanimated2/PlatformChecker.d.ts +0 -5
- package/lib/types/reanimated2/PropAdapters.d.ts +0 -4
- package/lib/types/reanimated2/UpdateProps.d.ts +0 -9
- package/lib/types/reanimated2/ViewDescriptorsSet.d.ts +0 -20
- package/lib/types/reanimated2/WorkletEventHandler.d.ts +0 -13
- package/lib/types/reanimated2/__mocks__/MutableValue.d.ts +0 -5
- package/lib/types/reanimated2/__mocks__/NativeReanimated.d.ts +0 -13
- package/lib/types/reanimated2/__mocks__/NativeReanimated.native.d.ts +0 -13
- package/lib/types/reanimated2/animation/commonTypes.d.ts +0 -27
- package/lib/types/reanimated2/animation/decay.d.ts +0 -19
- package/lib/types/reanimated2/animation/delay.d.ts +0 -7
- package/lib/types/reanimated2/animation/index.d.ts +0 -9
- package/lib/types/reanimated2/animation/repeat.d.ts +0 -12
- package/lib/types/reanimated2/animation/sequence.d.ts +0 -7
- package/lib/types/reanimated2/animation/spring.d.ts +0 -22
- package/lib/types/reanimated2/animation/styleAnimation.d.ts +0 -7
- package/lib/types/reanimated2/animation/timing.d.ts +0 -21
- package/lib/types/reanimated2/animation/util.d.ts +0 -9
- package/lib/types/reanimated2/commonTypes.d.ts +0 -80
- package/lib/types/reanimated2/component/FlatList.d.ts +0 -9
- package/lib/types/reanimated2/component/WrappedComponents.d.ts +0 -8
- package/lib/types/reanimated2/component/index.d.ts +0 -9
- package/lib/types/reanimated2/core.d.ts +0 -24
- package/lib/types/reanimated2/fabricUtils.d.ts +0 -4
- package/lib/types/reanimated2/hook/Hooks.d.ts +0 -5
- package/lib/types/reanimated2/hook/commonTypes.d.ts +0 -15
- package/lib/types/reanimated2/hook/index.d.ts +0 -10
- package/lib/types/reanimated2/hook/useAnimatedGestureHandler.d.ts +0 -35
- package/lib/types/reanimated2/hook/useAnimatedReaction.d.ts +0 -12
- package/lib/types/reanimated2/hook/useAnimatedRef.d.ts +0 -3
- package/lib/types/reanimated2/hook/useAnimatedScrollHandler.d.ts +0 -21
- package/lib/types/reanimated2/hook/useAnimatedSensor.d.ts +0 -18
- package/lib/types/reanimated2/hook/useAnimatedStyle.d.ts +0 -11
- package/lib/types/reanimated2/hook/useDerivedValue.d.ts +0 -4
- package/lib/types/reanimated2/hook/useSharedValue.d.ts +0 -2
- package/lib/types/reanimated2/hook/utils.d.ts +0 -28
- package/lib/types/reanimated2/index.d.ts +0 -12
- package/lib/types/reanimated2/interpolateColor.d.ts +0 -31
- package/lib/types/reanimated2/interpolation.d.ts +0 -11
- package/lib/types/reanimated2/jestUtils.d.ts +0 -12
- package/lib/types/reanimated2/js-reanimated/JSReanimated.d.ts +0 -30
- package/lib/types/reanimated2/js-reanimated/Mapper.d.ts +0 -14
- package/lib/types/reanimated2/js-reanimated/MapperRegistry.d.ts +0 -14
- package/lib/types/reanimated2/js-reanimated/MutableValue.d.ts +0 -14
- package/lib/types/reanimated2/js-reanimated/commonTypes.d.ts +0 -44
- package/lib/types/reanimated2/js-reanimated/index.d.ts +0 -15
- package/lib/types/reanimated2/layoutReanimation/LayoutAnimationRepository.d.ts +0 -1
- package/lib/types/reanimated2/layoutReanimation/animationBuilder/BaseAnimationBuilder.d.ts +0 -22
- package/lib/types/reanimated2/layoutReanimation/animationBuilder/ComplexAnimationBuilder.d.ts +0 -38
- package/lib/types/reanimated2/layoutReanimation/animationBuilder/Keyframe.d.ts +0 -25
- package/lib/types/reanimated2/layoutReanimation/animationBuilder/commonTypes.d.ts +0 -77
- package/lib/types/reanimated2/layoutReanimation/animationBuilder/index.d.ts +0 -4
- package/lib/types/reanimated2/layoutReanimation/defaultAnimations/Bounce.d.ts +0 -62
- package/lib/types/reanimated2/layoutReanimation/defaultAnimations/Default.d.ts +0 -4
- package/lib/types/reanimated2/layoutReanimation/defaultAnimations/Fade.d.ts +0 -42
- package/lib/types/reanimated2/layoutReanimation/defaultAnimations/Flip.d.ts +0 -50
- package/lib/types/reanimated2/layoutReanimation/defaultAnimations/Lightspeed.d.ts +0 -18
- package/lib/types/reanimated2/layoutReanimation/defaultAnimations/Pinwheel.d.ts +0 -10
- package/lib/types/reanimated2/layoutReanimation/defaultAnimations/Roll.d.ts +0 -18
- package/lib/types/reanimated2/layoutReanimation/defaultAnimations/Rotate.d.ts +0 -34
- package/lib/types/reanimated2/layoutReanimation/defaultAnimations/Slide.d.ts +0 -34
- package/lib/types/reanimated2/layoutReanimation/defaultAnimations/Stretch.d.ts +0 -18
- package/lib/types/reanimated2/layoutReanimation/defaultAnimations/Zoom.d.ts +0 -66
- package/lib/types/reanimated2/layoutReanimation/defaultAnimations/index.d.ts +0 -10
- package/lib/types/reanimated2/layoutReanimation/defaultTransitions/CurvedTransition.d.ts +0 -19
- package/lib/types/reanimated2/layoutReanimation/defaultTransitions/EntryExitTransition.d.ts +0 -13
- package/lib/types/reanimated2/layoutReanimation/defaultTransitions/FadingTransition.d.ts +0 -6
- package/lib/types/reanimated2/layoutReanimation/defaultTransitions/JumpingTransition.d.ts +0 -6
- package/lib/types/reanimated2/layoutReanimation/defaultTransitions/LinearTransition.d.ts +0 -7
- package/lib/types/reanimated2/layoutReanimation/defaultTransitions/SequencedTransition.d.ts +0 -9
- package/lib/types/reanimated2/layoutReanimation/defaultTransitions/index.d.ts +0 -6
- package/lib/types/reanimated2/layoutReanimation/index.d.ts +0 -4
- package/lib/types/reanimated2/mock.d.ts +0 -55
- package/lib/types/reanimated2/platform-specific/RNRenderer.d.ts +0 -1
- package/lib/types/reanimated2/platform-specific/RNRenderer.web.d.ts +0 -0
- package/lib/types/reanimated2/utils.d.ts +0 -7
- package/src/Animated.js +0 -18
- package/src/ReanimatedEventEmitter.ts +0 -4
- package/src/ReanimatedModule.macos.ts +0 -3
- package/src/ReanimatedModule.native.ts +0 -13
- package/src/ReanimatedModule.ts +0 -3
- package/src/ReanimatedModule.windows.ts +0 -3
- package/src/ReanimatedModuleCompat.ts +0 -51
- package/src/__mocks__/ReanimatedEventEmitter.js +0 -8
- package/src/__mocks__/ReanimatedModule.native.js +0 -11
- package/src/reanimated2/__mocks__/MutableValue.ts +0 -15
- package/src/reanimated2/__mocks__/NativeReanimated.ts +0 -23
- package/src/reanimated2/component/WrappedComponents.ts +0 -11
- package/src/reanimated2/component/index.ts +0 -9
- package/src/reanimated2/layoutReanimation/LayoutAnimationRepository.ts +0 -75
- package/src/reanimated2/layoutReanimation/defaultAnimations/Default.ts +0 -49
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
#include "AnimatedSensorModule.h"
|
|
2
|
-
|
|
3
|
-
#include
|
|
2
|
+
|
|
3
|
+
#include <memory>
|
|
4
|
+
#include <utility>
|
|
5
|
+
|
|
6
|
+
#include "Shareables.h"
|
|
4
7
|
|
|
5
8
|
namespace reanimated {
|
|
6
9
|
|
|
7
10
|
AnimatedSensorModule::AnimatedSensorModule(
|
|
8
|
-
const PlatformDepMethodsHolder &platformDepMethodsHolder
|
|
9
|
-
RuntimeManager *runtimeManager)
|
|
11
|
+
const PlatformDepMethodsHolder &platformDepMethodsHolder)
|
|
10
12
|
: platformRegisterSensorFunction_(platformDepMethodsHolder.registerSensor),
|
|
11
13
|
platformUnregisterSensorFunction_(
|
|
12
|
-
platformDepMethodsHolder.unregisterSensor)
|
|
13
|
-
runtimeManager_(runtimeManager) {}
|
|
14
|
+
platformDepMethodsHolder.unregisterSensor) {}
|
|
14
15
|
|
|
15
16
|
AnimatedSensorModule::~AnimatedSensorModule() {
|
|
16
17
|
// It is called during app reload because app reload doesn't call hooks
|
|
@@ -22,41 +23,38 @@ AnimatedSensorModule::~AnimatedSensorModule() {
|
|
|
22
23
|
|
|
23
24
|
jsi::Value AnimatedSensorModule::registerSensor(
|
|
24
25
|
jsi::Runtime &rt,
|
|
25
|
-
const
|
|
26
|
+
const std::shared_ptr<JSRuntimeHelper> &runtimeHelper,
|
|
27
|
+
const jsi::Value &sensorTypeValue,
|
|
26
28
|
const jsi::Value &interval,
|
|
27
|
-
const jsi::Value &
|
|
28
|
-
|
|
29
|
-
rt, sensorDataContainer.getObject(rt), runtimeManager_);
|
|
30
|
-
auto &mutableObject =
|
|
31
|
-
ValueWrapper::asMutableValue(sensorsData->valueContainer);
|
|
29
|
+
const jsi::Value &sensorDataHandler) {
|
|
30
|
+
SensorType sensorType = static_cast<SensorType>(sensorTypeValue.asNumber());
|
|
32
31
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
setter = [&, mutableObject](double newValues[]) {
|
|
36
|
-
jsi::Runtime &runtime = *runtimeManager_->runtime.get();
|
|
37
|
-
jsi::Object value(runtime);
|
|
38
|
-
value.setProperty(runtime, "qw", newValues[0]);
|
|
39
|
-
value.setProperty(runtime, "qx", newValues[1]);
|
|
40
|
-
value.setProperty(runtime, "qy", newValues[2]);
|
|
41
|
-
value.setProperty(runtime, "qz", newValues[3]);
|
|
42
|
-
value.setProperty(runtime, "yaw", newValues[4]);
|
|
43
|
-
value.setProperty(runtime, "pitch", newValues[5]);
|
|
44
|
-
value.setProperty(runtime, "roll", newValues[6]);
|
|
45
|
-
mutableObject->setValue(runtime, std::move(value));
|
|
46
|
-
};
|
|
47
|
-
} else {
|
|
48
|
-
setter = [&, mutableObject](double newValues[]) {
|
|
49
|
-
jsi::Runtime &runtime = *runtimeManager_->runtime.get();
|
|
50
|
-
jsi::Object value(runtime);
|
|
51
|
-
value.setProperty(runtime, "x", newValues[0]);
|
|
52
|
-
value.setProperty(runtime, "y", newValues[1]);
|
|
53
|
-
value.setProperty(runtime, "z", newValues[2]);
|
|
54
|
-
mutableObject->setValue(runtime, std::move(value));
|
|
55
|
-
};
|
|
56
|
-
}
|
|
32
|
+
auto shareableHandler = extractShareableOrThrow(rt, sensorDataHandler);
|
|
33
|
+
auto uiRuntime = runtimeHelper->uiRuntime();
|
|
57
34
|
|
|
58
35
|
int sensorId = platformRegisterSensorFunction_(
|
|
59
|
-
sensorType
|
|
36
|
+
sensorType, interval.asNumber(), [=](double newValues[]) {
|
|
37
|
+
jsi::Runtime &rt = *uiRuntime;
|
|
38
|
+
auto handler =
|
|
39
|
+
shareableHandler->getJSValue(rt).asObject(rt).asFunction(rt);
|
|
40
|
+
if (sensorType == SensorType::ROTATION_VECTOR) {
|
|
41
|
+
jsi::Object value(rt);
|
|
42
|
+
value.setProperty(rt, "qx", newValues[0]);
|
|
43
|
+
value.setProperty(rt, "qy", newValues[1]);
|
|
44
|
+
value.setProperty(rt, "qz", newValues[2]);
|
|
45
|
+
value.setProperty(rt, "qw", newValues[3]);
|
|
46
|
+
value.setProperty(rt, "yaw", newValues[4]);
|
|
47
|
+
value.setProperty(rt, "pitch", newValues[5]);
|
|
48
|
+
value.setProperty(rt, "roll", newValues[6]);
|
|
49
|
+
handler.call(rt, value);
|
|
50
|
+
} else {
|
|
51
|
+
jsi::Object value(rt);
|
|
52
|
+
value.setProperty(rt, "x", newValues[0]);
|
|
53
|
+
value.setProperty(rt, "y", newValues[1]);
|
|
54
|
+
value.setProperty(rt, "z", newValues[2]);
|
|
55
|
+
handler.call(rt, value);
|
|
56
|
+
}
|
|
57
|
+
});
|
|
60
58
|
if (sensorId != -1) {
|
|
61
59
|
sensorsIds_.insert(sensorId);
|
|
62
60
|
}
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
#pragma once
|
|
2
2
|
|
|
3
3
|
#include <jsi/jsi.h>
|
|
4
|
+
#include <memory>
|
|
4
5
|
#include <unordered_set>
|
|
5
6
|
|
|
6
7
|
#include "PlatformDepMethodsHolder.h"
|
|
7
8
|
#include "RuntimeManager.h"
|
|
9
|
+
#include "Shareables.h"
|
|
8
10
|
|
|
9
11
|
namespace reanimated {
|
|
10
12
|
|
|
@@ -22,16 +24,15 @@ class AnimatedSensorModule {
|
|
|
22
24
|
std::unordered_set<int> sensorsIds_;
|
|
23
25
|
RegisterSensorFunction platformRegisterSensorFunction_;
|
|
24
26
|
UnregisterSensorFunction platformUnregisterSensorFunction_;
|
|
25
|
-
RuntimeManager *runtimeManager_;
|
|
26
27
|
|
|
27
28
|
public:
|
|
28
29
|
AnimatedSensorModule(
|
|
29
|
-
const PlatformDepMethodsHolder &platformDepMethodsHolder
|
|
30
|
-
RuntimeManager *runtimeManager);
|
|
30
|
+
const PlatformDepMethodsHolder &platformDepMethodsHolder);
|
|
31
31
|
~AnimatedSensorModule();
|
|
32
32
|
|
|
33
33
|
jsi::Value registerSensor(
|
|
34
34
|
jsi::Runtime &rt,
|
|
35
|
+
const std::shared_ptr<JSRuntimeHelper> &runtimeHelper,
|
|
35
36
|
const jsi::Value &sensorType,
|
|
36
37
|
const jsi::Value &interval,
|
|
37
38
|
const jsi::Value &sensorDataContainer);
|
|
@@ -1,7 +1,13 @@
|
|
|
1
1
|
#ifdef RCT_NEW_ARCH_ENABLED
|
|
2
2
|
|
|
3
|
+
#if REACT_NATIVE_MINOR_VERSION < 69
|
|
4
|
+
#error \
|
|
5
|
+
"Reanimated 3 does not support React Native 0.68.x when Fabric is enabled. Please upgrade to React Native 0.69.0 or newer if you want to use Reanimated with the new architecture."
|
|
6
|
+
#endif
|
|
7
|
+
|
|
3
8
|
#include "FabricUtils.h"
|
|
4
9
|
|
|
10
|
+
#include <react/renderer/debug/SystraceSection.h>
|
|
5
11
|
#include <react/renderer/uimanager/UIManagerBinding.h>
|
|
6
12
|
|
|
7
13
|
using namespace facebook::react;
|
|
@@ -17,110 +23,10 @@ RuntimeExecutor getRuntimeExecutorFromBinding(Binding *binding) {
|
|
|
17
23
|
}
|
|
18
24
|
#endif
|
|
19
25
|
|
|
20
|
-
inline static const UIManagerPublic *getUIManagerPublic(
|
|
21
|
-
const UIManager *uiManager) {
|
|
22
|
-
return reinterpret_cast<const UIManagerPublic *>(uiManager);
|
|
23
|
-
}
|
|
24
|
-
|
|
25
26
|
std::shared_ptr<const ContextContainer> getContextContainerFromUIManager(
|
|
26
27
|
const UIManager *uiManager) {
|
|
27
|
-
return
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
inline static UIManagerDelegate *getDelegateFromUIManager(
|
|
31
|
-
const UIManager *uiManager) {
|
|
32
|
-
return getUIManagerPublic(uiManager)->delegate_;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
void UIManager_dispatchCommand(
|
|
36
|
-
const std::shared_ptr<UIManager> &uiManager,
|
|
37
|
-
const ShadowNode::Shared &shadowNode,
|
|
38
|
-
std::string const &commandName,
|
|
39
|
-
folly::dynamic const &args) {
|
|
40
|
-
auto delegate_ = getDelegateFromUIManager(&*uiManager);
|
|
41
|
-
|
|
42
|
-
// copied from UIManager.cpp
|
|
43
|
-
if (delegate_) {
|
|
44
|
-
delegate_->uiManagerDidDispatchCommand(shadowNode, commandName, args);
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
LayoutMetrics UIManager_getRelativeLayoutMetrics(
|
|
49
|
-
const std::shared_ptr<UIManager> &uiManager,
|
|
50
|
-
ShadowNode const &shadowNode,
|
|
51
|
-
ShadowNode const *ancestorShadowNode,
|
|
52
|
-
LayoutableShadowNode::LayoutInspectingPolicy policy) {
|
|
53
|
-
// based on implementation from UIManager.cpp
|
|
54
|
-
const auto &shadowTreeRegistry = uiManager->getShadowTreeRegistry();
|
|
55
|
-
|
|
56
|
-
// We might store here an owning pointer to `ancestorShadowNode` to ensure
|
|
57
|
-
// that the node is not deallocated during method execution lifetime.
|
|
58
|
-
auto owningAncestorShadowNode = ShadowNode::Shared{};
|
|
59
|
-
|
|
60
|
-
if (!ancestorShadowNode) {
|
|
61
|
-
shadowTreeRegistry.visit(
|
|
62
|
-
shadowNode.getSurfaceId(), [&](ShadowTree const &shadowTree) {
|
|
63
|
-
owningAncestorShadowNode =
|
|
64
|
-
shadowTree.getCurrentRevision().rootShadowNode;
|
|
65
|
-
ancestorShadowNode = owningAncestorShadowNode.get();
|
|
66
|
-
});
|
|
67
|
-
} else {
|
|
68
|
-
// It is possible for JavaScript (or other callers) to have a reference
|
|
69
|
-
// to a previous version of ShadowNodes, but we enforce that
|
|
70
|
-
// metrics are only calculated on most recently committed versions.
|
|
71
|
-
owningAncestorShadowNode =
|
|
72
|
-
uiManager->getNewestCloneOfShadowNode(*ancestorShadowNode);
|
|
73
|
-
ancestorShadowNode = owningAncestorShadowNode.get();
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
auto layoutableAncestorShadowNode =
|
|
77
|
-
traitCast<LayoutableShadowNode const *>(ancestorShadowNode);
|
|
78
|
-
|
|
79
|
-
if (!layoutableAncestorShadowNode) {
|
|
80
|
-
return EmptyLayoutMetrics;
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
return LayoutableShadowNode::computeRelativeLayoutMetrics(
|
|
84
|
-
shadowNode.getFamily(), *layoutableAncestorShadowNode, policy);
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
SharedShadowNode UIManager_cloneNode(
|
|
88
|
-
const UIManager *uiManager,
|
|
89
|
-
const ShadowNode::Shared &shadowNode,
|
|
90
|
-
const SharedShadowNodeSharedList &children,
|
|
91
|
-
const RawProps *rawProps) {
|
|
92
|
-
auto delegate_ = getDelegateFromUIManager(uiManager);
|
|
93
|
-
auto contextContainer_ = getContextContainerFromUIManager(uiManager);
|
|
94
|
-
|
|
95
|
-
// copied from UIManager.cpp
|
|
96
|
-
PropsParserContext propsParserContext{
|
|
97
|
-
shadowNode->getFamily().getSurfaceId(), *contextContainer_.get()};
|
|
98
|
-
|
|
99
|
-
auto &componentDescriptor = shadowNode->getComponentDescriptor();
|
|
100
|
-
auto clonedShadowNode = componentDescriptor.cloneShadowNode(
|
|
101
|
-
*shadowNode,
|
|
102
|
-
{
|
|
103
|
-
/* .props = */
|
|
104
|
-
rawProps ? componentDescriptor.cloneProps(
|
|
105
|
-
propsParserContext, shadowNode->getProps(), *rawProps)
|
|
106
|
-
: ShadowNodeFragment::propsPlaceholder(),
|
|
107
|
-
/* .children = */ children,
|
|
108
|
-
});
|
|
109
|
-
|
|
110
|
-
if (delegate_) {
|
|
111
|
-
delegate_->uiManagerDidCloneShadowNode(
|
|
112
|
-
*shadowNode.get(), *clonedShadowNode);
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
return clonedShadowNode;
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
void UIManager_appendChild(
|
|
119
|
-
const ShadowNode::Shared &parentShadowNode,
|
|
120
|
-
const ShadowNode::Shared &childShadowNode) {
|
|
121
|
-
// copied from UIManager.cpp
|
|
122
|
-
auto &componentDescriptor = parentShadowNode->getComponentDescriptor();
|
|
123
|
-
componentDescriptor.appendChild(parentShadowNode, childShadowNode);
|
|
28
|
+
return reinterpret_cast<const UIManagerPublic *>(uiManager)
|
|
29
|
+
->contextContainer_;
|
|
124
30
|
}
|
|
125
31
|
|
|
126
32
|
} // namespace reanimated
|
|
@@ -2,21 +2,23 @@
|
|
|
2
2
|
#ifdef RCT_NEW_ARCH_ENABLED
|
|
3
3
|
|
|
4
4
|
#ifdef ANDROID
|
|
5
|
-
#include <Binding.h>
|
|
6
5
|
#include <fbjni/fbjni.h>
|
|
6
|
+
#include <react/fabric/Binding.h>
|
|
7
7
|
#endif
|
|
8
8
|
#include <react/renderer/uimanager/UIManager.h>
|
|
9
9
|
|
|
10
10
|
#include <memory>
|
|
11
11
|
#include <string>
|
|
12
12
|
|
|
13
|
-
using namespace facebook
|
|
13
|
+
using namespace facebook;
|
|
14
|
+
using namespace react;
|
|
14
15
|
|
|
15
16
|
namespace reanimated {
|
|
16
17
|
|
|
17
18
|
struct UIManagerBindingPublic {
|
|
18
19
|
void *vtable;
|
|
19
20
|
std::shared_ptr<UIManager> uiManager_;
|
|
21
|
+
std::unique_ptr<EventHandler const> eventHandler_;
|
|
20
22
|
};
|
|
21
23
|
|
|
22
24
|
struct UIManagerPublic {
|
|
@@ -51,28 +53,6 @@ RuntimeExecutor getRuntimeExecutorFromBinding(Binding *binding);
|
|
|
51
53
|
std::shared_ptr<const ContextContainer> getContextContainerFromUIManager(
|
|
52
54
|
const UIManager *uiManager);
|
|
53
55
|
|
|
54
|
-
void UIManager_dispatchCommand(
|
|
55
|
-
const std::shared_ptr<UIManager> &uiManager,
|
|
56
|
-
const ShadowNode::Shared &shadowNode,
|
|
57
|
-
std::string const &commandName,
|
|
58
|
-
folly::dynamic const &args);
|
|
59
|
-
|
|
60
|
-
LayoutMetrics UIManager_getRelativeLayoutMetrics(
|
|
61
|
-
const std::shared_ptr<UIManager> &uiManager,
|
|
62
|
-
ShadowNode const &shadowNode,
|
|
63
|
-
ShadowNode const *ancestorShadowNode,
|
|
64
|
-
LayoutableShadowNode::LayoutInspectingPolicy policy);
|
|
65
|
-
|
|
66
|
-
SharedShadowNode UIManager_cloneNode(
|
|
67
|
-
const UIManager *uiManager,
|
|
68
|
-
const ShadowNode::Shared &shadowNode,
|
|
69
|
-
const SharedShadowNodeSharedList &children = nullptr,
|
|
70
|
-
const RawProps *rawProps = nullptr);
|
|
71
|
-
|
|
72
|
-
void UIManager_appendChild(
|
|
73
|
-
const ShadowNode::Shared &parentShadowNode,
|
|
74
|
-
const ShadowNode::Shared &childShadowNode);
|
|
75
|
-
|
|
76
56
|
} // namespace reanimated
|
|
77
57
|
|
|
78
58
|
#endif // RCT_NEW_ARCH_ENABLED
|
|
@@ -4,6 +4,10 @@
|
|
|
4
4
|
#include "FabricUtils.h"
|
|
5
5
|
#include "NewestShadowNodesRegistry.h"
|
|
6
6
|
|
|
7
|
+
#include <react/renderer/debug/SystraceSection.h>
|
|
8
|
+
|
|
9
|
+
#include <utility>
|
|
10
|
+
|
|
7
11
|
using namespace facebook;
|
|
8
12
|
using namespace react;
|
|
9
13
|
|
|
@@ -17,45 +21,87 @@ void ReanimatedUIManagerBinding::createAndInstallIfNeeded(
|
|
|
17
21
|
&newestShadowNodesRegistry) {
|
|
18
22
|
// adapted from UIManagerBinding.cpp
|
|
19
23
|
auto uiManagerModuleName = "nativeFabricUIManager";
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
24
|
+
|
|
25
|
+
auto eventHandler = [&]() -> std::unique_ptr<EventHandler const> {
|
|
26
|
+
auto uiManagerValue =
|
|
27
|
+
runtime.global().getProperty(runtime, uiManagerModuleName);
|
|
28
|
+
if (uiManagerValue.isUndefined()) {
|
|
29
|
+
return nullptr;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
auto uiManagerBinding =
|
|
33
|
+
uiManagerValue.asObject(runtime).asHostObject<UIManagerBinding>(
|
|
34
|
+
runtime);
|
|
35
|
+
auto uiManagerBindingPublic =
|
|
36
|
+
reinterpret_cast<UIManagerBindingPublic *>(&*uiManagerBinding);
|
|
37
|
+
return std::move(uiManagerBindingPublic->eventHandler_);
|
|
38
|
+
}();
|
|
39
|
+
|
|
40
|
+
auto reanimatedUiManagerBinding =
|
|
41
|
+
std::make_shared<ReanimatedUIManagerBinding>(
|
|
42
|
+
uiManager,
|
|
43
|
+
runtimeExecutor,
|
|
44
|
+
std::move(eventHandler),
|
|
45
|
+
newestShadowNodesRegistry);
|
|
46
|
+
auto object =
|
|
47
|
+
jsi::Object::createFromHostObject(runtime, reanimatedUiManagerBinding);
|
|
23
48
|
runtime.global().setProperty(runtime, uiManagerModuleName, std::move(object));
|
|
24
49
|
}
|
|
25
50
|
|
|
26
51
|
ReanimatedUIManagerBinding::ReanimatedUIManagerBinding(
|
|
27
52
|
std::shared_ptr<UIManager> uiManager,
|
|
28
53
|
RuntimeExecutor runtimeExecutor,
|
|
54
|
+
std::unique_ptr<EventHandler const> eventHandler,
|
|
29
55
|
std::shared_ptr<NewestShadowNodesRegistry> newestShadowNodesRegistry)
|
|
30
|
-
: UIManagerBinding(uiManager
|
|
56
|
+
: UIManagerBinding(uiManager),
|
|
31
57
|
uiManager_(std::move(uiManager)),
|
|
32
|
-
newestShadowNodesRegistry_(newestShadowNodesRegistry) {
|
|
58
|
+
newestShadowNodesRegistry_(newestShadowNodesRegistry) {
|
|
59
|
+
if (eventHandler != nullptr) {
|
|
60
|
+
reinterpret_cast<UIManagerBindingPublic *>(this)->eventHandler_ =
|
|
61
|
+
std::move(eventHandler);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
33
64
|
|
|
34
65
|
ReanimatedUIManagerBinding::~ReanimatedUIManagerBinding() {}
|
|
35
66
|
|
|
36
|
-
|
|
37
|
-
uiManager_->setDelegate(nullptr);
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
static inline ShadowNode::Shared cloneNode(
|
|
67
|
+
static inline ShadowNode::Shared cloneNodeUsingNewest(
|
|
41
68
|
UIManager *uiManager,
|
|
42
69
|
NewestShadowNodesRegistry *newestShadowNodesRegistry,
|
|
43
|
-
const
|
|
44
|
-
const
|
|
45
|
-
const
|
|
70
|
+
ShadowNode const &shadowNode,
|
|
71
|
+
ShadowNode::SharedListOfShared const &children = nullptr,
|
|
72
|
+
RawProps const *rawProps = nullptr) {
|
|
46
73
|
{
|
|
47
74
|
auto lock = newestShadowNodesRegistry->createLock();
|
|
48
|
-
auto newest = newestShadowNodesRegistry->get(shadowNode
|
|
75
|
+
auto newest = newestShadowNodesRegistry->get(shadowNode.getTag());
|
|
49
76
|
if (newest != nullptr) {
|
|
50
77
|
// ShadowNode managed by Reanimated, use newest ShadowNode from registry
|
|
51
|
-
auto clone =
|
|
78
|
+
auto clone = uiManager->cloneNode(*newest, children, rawProps);
|
|
52
79
|
newestShadowNodesRegistry->update(clone);
|
|
53
80
|
return clone;
|
|
54
81
|
}
|
|
55
82
|
} // release lock since we don't need registry anymore
|
|
56
83
|
|
|
57
84
|
// ShadowNode not managed by Reanimated (yet?)
|
|
58
|
-
return
|
|
85
|
+
return uiManager->cloneNode(shadowNode, children, rawProps);
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
static inline void appendChildUsingNewest(
|
|
89
|
+
UIManager *uiManager,
|
|
90
|
+
NewestShadowNodesRegistry *newestShadowNodesRegistry,
|
|
91
|
+
const ShadowNode::Shared &parentShadowNode,
|
|
92
|
+
const ShadowNode::Shared &childShadowNode) {
|
|
93
|
+
{
|
|
94
|
+
auto lock = newestShadowNodesRegistry->createLock();
|
|
95
|
+
auto newestChildShadowNode =
|
|
96
|
+
newestShadowNodesRegistry->get(childShadowNode->getTag());
|
|
97
|
+
if (newestChildShadowNode != nullptr) {
|
|
98
|
+
uiManager->appendChild(parentShadowNode, newestChildShadowNode);
|
|
99
|
+
return;
|
|
100
|
+
}
|
|
101
|
+
} // release lock since we don't need registry anymore
|
|
102
|
+
|
|
103
|
+
// child ShadowNode not managed by Reanimated (yet?)
|
|
104
|
+
uiManager->appendChild(parentShadowNode, childShadowNode);
|
|
59
105
|
}
|
|
60
106
|
|
|
61
107
|
jsi::Value ReanimatedUIManagerBinding::get(
|
|
@@ -69,6 +115,7 @@ jsi::Value ReanimatedUIManagerBinding::get(
|
|
|
69
115
|
|
|
70
116
|
// based on implementation from UIManagerBinding.cpp
|
|
71
117
|
auto methodName = name.utf8(runtime);
|
|
118
|
+
SystraceSection s("ReanimatedUIManagerBinding::get", "name", methodName);
|
|
72
119
|
UIManager *uiManager = uiManager_.get();
|
|
73
120
|
NewestShadowNodesRegistry *newestShadowNodesRegistry =
|
|
74
121
|
newestShadowNodesRegistry_.get();
|
|
@@ -81,15 +128,15 @@ jsi::Value ReanimatedUIManagerBinding::get(
|
|
|
81
128
|
1,
|
|
82
129
|
[uiManager, newestShadowNodesRegistry](
|
|
83
130
|
jsi::Runtime &runtime,
|
|
84
|
-
jsi::Value const &thisValue
|
|
131
|
+
jsi::Value const & /*thisValue*/,
|
|
85
132
|
jsi::Value const *arguments,
|
|
86
|
-
size_t count) noexcept -> jsi::Value {
|
|
133
|
+
size_t /*count*/) noexcept -> jsi::Value {
|
|
87
134
|
return valueFromShadowNode(
|
|
88
135
|
runtime,
|
|
89
|
-
|
|
136
|
+
cloneNodeUsingNewest(
|
|
90
137
|
uiManager,
|
|
91
138
|
newestShadowNodesRegistry,
|
|
92
|
-
shadowNodeFromValue(runtime, arguments[0])));
|
|
139
|
+
*shadowNodeFromValue(runtime, arguments[0])));
|
|
93
140
|
});
|
|
94
141
|
}
|
|
95
142
|
|
|
@@ -101,15 +148,15 @@ jsi::Value ReanimatedUIManagerBinding::get(
|
|
|
101
148
|
1,
|
|
102
149
|
[uiManager, newestShadowNodesRegistry](
|
|
103
150
|
jsi::Runtime &runtime,
|
|
104
|
-
jsi::Value const &thisValue
|
|
151
|
+
jsi::Value const & /*thisValue*/,
|
|
105
152
|
jsi::Value const *arguments,
|
|
106
|
-
size_t count) noexcept -> jsi::Value {
|
|
153
|
+
size_t /*count*/) noexcept -> jsi::Value {
|
|
107
154
|
return valueFromShadowNode(
|
|
108
155
|
runtime,
|
|
109
|
-
|
|
156
|
+
cloneNodeUsingNewest(
|
|
110
157
|
uiManager,
|
|
111
158
|
newestShadowNodesRegistry,
|
|
112
|
-
shadowNodeFromValue(runtime, arguments[0]),
|
|
159
|
+
*shadowNodeFromValue(runtime, arguments[0]),
|
|
113
160
|
ShadowNode::emptySharedShadowNodeSharedList()));
|
|
114
161
|
});
|
|
115
162
|
}
|
|
@@ -122,16 +169,16 @@ jsi::Value ReanimatedUIManagerBinding::get(
|
|
|
122
169
|
2,
|
|
123
170
|
[uiManager, newestShadowNodesRegistry](
|
|
124
171
|
jsi::Runtime &runtime,
|
|
125
|
-
jsi::Value const &thisValue
|
|
172
|
+
jsi::Value const & /*thisValue*/,
|
|
126
173
|
jsi::Value const *arguments,
|
|
127
|
-
size_t count) noexcept -> jsi::Value {
|
|
174
|
+
size_t /*count*/) noexcept -> jsi::Value {
|
|
128
175
|
auto const &rawProps = RawProps(runtime, arguments[1]);
|
|
129
176
|
return valueFromShadowNode(
|
|
130
177
|
runtime,
|
|
131
|
-
|
|
178
|
+
cloneNodeUsingNewest(
|
|
132
179
|
uiManager,
|
|
133
180
|
newestShadowNodesRegistry,
|
|
134
|
-
shadowNodeFromValue(runtime, arguments[0]),
|
|
181
|
+
*shadowNodeFromValue(runtime, arguments[0]),
|
|
135
182
|
nullptr,
|
|
136
183
|
&rawProps));
|
|
137
184
|
});
|
|
@@ -145,16 +192,16 @@ jsi::Value ReanimatedUIManagerBinding::get(
|
|
|
145
192
|
2,
|
|
146
193
|
[uiManager, newestShadowNodesRegistry](
|
|
147
194
|
jsi::Runtime &runtime,
|
|
148
|
-
jsi::Value const &thisValue
|
|
195
|
+
jsi::Value const & /*thisValue*/,
|
|
149
196
|
jsi::Value const *arguments,
|
|
150
|
-
size_t count) noexcept -> jsi::Value {
|
|
197
|
+
size_t /*count*/) noexcept -> jsi::Value {
|
|
151
198
|
auto const &rawProps = RawProps(runtime, arguments[1]);
|
|
152
199
|
return valueFromShadowNode(
|
|
153
200
|
runtime,
|
|
154
|
-
|
|
201
|
+
cloneNodeUsingNewest(
|
|
155
202
|
uiManager,
|
|
156
203
|
newestShadowNodesRegistry,
|
|
157
|
-
shadowNodeFromValue(runtime, arguments[0]),
|
|
204
|
+
*shadowNodeFromValue(runtime, arguments[0]),
|
|
158
205
|
ShadowNode::emptySharedShadowNodeSharedList(),
|
|
159
206
|
&rawProps));
|
|
160
207
|
});
|
|
@@ -165,21 +212,16 @@ jsi::Value ReanimatedUIManagerBinding::get(
|
|
|
165
212
|
runtime,
|
|
166
213
|
name,
|
|
167
214
|
2,
|
|
168
|
-
[newestShadowNodesRegistry](
|
|
215
|
+
[uiManager, newestShadowNodesRegistry](
|
|
169
216
|
jsi::Runtime &runtime,
|
|
170
|
-
jsi::Value const &thisValue
|
|
217
|
+
jsi::Value const & /*thisValue*/,
|
|
171
218
|
jsi::Value const *arguments,
|
|
172
|
-
size_t count) noexcept -> jsi::Value {
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
if (newest != nullptr) {
|
|
179
|
-
child = newest;
|
|
180
|
-
}
|
|
181
|
-
}
|
|
182
|
-
UIManager_appendChild(parent, child);
|
|
219
|
+
size_t /*count*/) noexcept -> jsi::Value {
|
|
220
|
+
appendChildUsingNewest(
|
|
221
|
+
uiManager,
|
|
222
|
+
newestShadowNodesRegistry,
|
|
223
|
+
shadowNodeFromValue(runtime, arguments[0]),
|
|
224
|
+
shadowNodeFromValue(runtime, arguments[1]));
|
|
183
225
|
return jsi::Value::undefined();
|
|
184
226
|
});
|
|
185
227
|
}
|
|
@@ -28,6 +28,7 @@ class ReanimatedUIManagerBinding : public UIManagerBinding {
|
|
|
28
28
|
ReanimatedUIManagerBinding(
|
|
29
29
|
std::shared_ptr<UIManager> uiManager,
|
|
30
30
|
RuntimeExecutor runtimeExecutor,
|
|
31
|
+
std::unique_ptr<EventHandler const> eventHandler,
|
|
31
32
|
std::shared_ptr<NewestShadowNodesRegistry> newestShadowNodesRegistry);
|
|
32
33
|
|
|
33
34
|
~ReanimatedUIManagerBinding();
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
#ifdef RCT_NEW_ARCH_ENABLED
|
|
2
|
+
|
|
3
|
+
#include "ShadowTreeCloner.h"
|
|
4
|
+
#include "FabricUtils.h"
|
|
5
|
+
|
|
6
|
+
namespace reanimated {
|
|
7
|
+
|
|
8
|
+
ShadowTreeCloner::ShadowTreeCloner(
|
|
9
|
+
std::shared_ptr<NewestShadowNodesRegistry> newestShadowNodesRegistry,
|
|
10
|
+
std::shared_ptr<UIManager> uiManager,
|
|
11
|
+
SurfaceId surfaceId)
|
|
12
|
+
: newestShadowNodesRegistry_{newestShadowNodesRegistry},
|
|
13
|
+
propsParserContext_{
|
|
14
|
+
surfaceId,
|
|
15
|
+
*getContextContainerFromUIManager(&*uiManager)} {}
|
|
16
|
+
|
|
17
|
+
ShadowTreeCloner::~ShadowTreeCloner() {
|
|
18
|
+
#ifdef DEBUG
|
|
19
|
+
react_native_assert(
|
|
20
|
+
yogaChildrenUpdates_.empty() &&
|
|
21
|
+
"Deallocating `ShadowTreeCloner` without calling `updateYogaChildren`.");
|
|
22
|
+
#endif
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
ShadowNode::Unshared ShadowTreeCloner::cloneWithNewProps(
|
|
26
|
+
const ShadowNode::Shared &oldRootNode,
|
|
27
|
+
const ShadowNodeFamily &family,
|
|
28
|
+
RawProps &&rawProps) {
|
|
29
|
+
// adapted from ShadowNode::cloneTree
|
|
30
|
+
|
|
31
|
+
auto ancestors = family.getAncestors(*oldRootNode);
|
|
32
|
+
|
|
33
|
+
if (ancestors.empty()) {
|
|
34
|
+
return ShadowNode::Unshared{nullptr};
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
auto &parent = ancestors.back();
|
|
38
|
+
auto &oldShadowNode = parent.first.get().getChildren().at(parent.second);
|
|
39
|
+
|
|
40
|
+
const auto newest = newestShadowNodesRegistry_->get(oldShadowNode->getTag());
|
|
41
|
+
|
|
42
|
+
const auto &source = newest == nullptr ? oldShadowNode : newest;
|
|
43
|
+
|
|
44
|
+
const auto props = source->getComponentDescriptor().cloneProps(
|
|
45
|
+
propsParserContext_, source->getProps(), rawProps);
|
|
46
|
+
|
|
47
|
+
auto newChildNode = source->clone({/* .props = */ props});
|
|
48
|
+
|
|
49
|
+
for (auto it = ancestors.rbegin(); it != ancestors.rend(); ++it) {
|
|
50
|
+
auto &parentNode = it->first.get();
|
|
51
|
+
auto childIndex = it->second;
|
|
52
|
+
|
|
53
|
+
auto children = parentNode.getChildren();
|
|
54
|
+
const auto &oldChildNode = *children.at(childIndex);
|
|
55
|
+
react_native_assert(ShadowNode::sameFamily(oldChildNode, *newChildNode));
|
|
56
|
+
|
|
57
|
+
newestShadowNodesRegistry_->set(newChildNode, parentNode.getTag());
|
|
58
|
+
|
|
59
|
+
if (!parentNode.getSealed()) {
|
|
60
|
+
// Optimization: if a ShadowNode is unsealed, we can directly update its
|
|
61
|
+
// children instead of cloning the whole path to the root node.
|
|
62
|
+
auto &parentNodeNonConst = const_cast<ShadowNode &>(parentNode);
|
|
63
|
+
parentNodeNonConst.replaceChild(oldChildNode, newChildNode, childIndex);
|
|
64
|
+
yogaChildrenUpdates_.insert(&parentNodeNonConst);
|
|
65
|
+
return std::const_pointer_cast<ShadowNode>(oldRootNode);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
children[childIndex] = newChildNode;
|
|
69
|
+
|
|
70
|
+
newChildNode = parentNode.clone({
|
|
71
|
+
ShadowNodeFragment::propsPlaceholder(),
|
|
72
|
+
std::make_shared<ShadowNode::ListOfShared>(children),
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
return std::const_pointer_cast<ShadowNode>(newChildNode);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
void ShadowTreeCloner::updateYogaChildren() {
|
|
80
|
+
// Unfortunately, `replaceChild` does not update Yoga nodes, so we need to
|
|
81
|
+
// update them manually here.
|
|
82
|
+
for (ShadowNode *shadowNode : yogaChildrenUpdates_) {
|
|
83
|
+
static_cast<YogaLayoutableShadowNode *>(shadowNode)->updateYogaChildren();
|
|
84
|
+
}
|
|
85
|
+
#ifdef DEBUG
|
|
86
|
+
yogaChildrenUpdates_.clear();
|
|
87
|
+
#endif
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
} // namespace reanimated
|
|
91
|
+
|
|
92
|
+
#endif // RCT_NEW_ARCH_ENABLED
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
#pragma once
|
|
2
|
+
#ifdef RCT_NEW_ARCH_ENABLED
|
|
3
|
+
|
|
4
|
+
#include <react/renderer/core/PropsParserContext.h>
|
|
5
|
+
#include <react/renderer/uimanager/UIManager.h>
|
|
6
|
+
|
|
7
|
+
#include <memory>
|
|
8
|
+
#include <set>
|
|
9
|
+
|
|
10
|
+
#include "NewestShadowNodesRegistry.h"
|
|
11
|
+
|
|
12
|
+
using namespace facebook;
|
|
13
|
+
using namespace react;
|
|
14
|
+
|
|
15
|
+
namespace reanimated {
|
|
16
|
+
|
|
17
|
+
class ShadowTreeCloner {
|
|
18
|
+
public:
|
|
19
|
+
ShadowTreeCloner(
|
|
20
|
+
std::shared_ptr<NewestShadowNodesRegistry> newestShadowNodesRegistry,
|
|
21
|
+
std::shared_ptr<UIManager> uiManager,
|
|
22
|
+
SurfaceId surfaceId);
|
|
23
|
+
|
|
24
|
+
~ShadowTreeCloner();
|
|
25
|
+
|
|
26
|
+
ShadowNode::Unshared cloneWithNewProps(
|
|
27
|
+
const ShadowNode::Shared &oldRootNode,
|
|
28
|
+
const ShadowNodeFamily &family,
|
|
29
|
+
RawProps &&rawProps);
|
|
30
|
+
|
|
31
|
+
void updateYogaChildren();
|
|
32
|
+
|
|
33
|
+
private:
|
|
34
|
+
std::shared_ptr<NewestShadowNodesRegistry> newestShadowNodesRegistry_;
|
|
35
|
+
PropsParserContext propsParserContext_;
|
|
36
|
+
std::set<ShadowNode *> yogaChildrenUpdates_;
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
} // namespace reanimated
|
|
40
|
+
|
|
41
|
+
#endif // RCT_NEW_ARCH_ENABLED
|