react-native-reanimated 3.0.0-rc.8 → 3.0.0
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 +30 -12
- package/Common/cpp/AnimatedSensor/AnimatedSensorModule.h +2 -0
- package/Common/cpp/Fabric/FabricUtils.cpp +3 -107
- package/Common/cpp/Fabric/FabricUtils.h +3 -24
- package/Common/cpp/Fabric/ReanimatedUIManagerBinding.cpp +54 -37
- package/Common/cpp/LayoutAnimations/LayoutAnimationType.h +8 -0
- package/Common/cpp/LayoutAnimations/LayoutAnimationsManager.cpp +81 -26
- package/Common/cpp/LayoutAnimations/LayoutAnimationsManager.h +20 -3
- package/Common/cpp/NativeModules/NativeReanimatedModule.cpp +122 -121
- package/Common/cpp/NativeModules/NativeReanimatedModule.h +21 -14
- package/Common/cpp/NativeModules/NativeReanimatedModuleSpec.cpp +15 -7
- package/Common/cpp/NativeModules/NativeReanimatedModuleSpec.h +8 -4
- package/Common/cpp/ReanimatedRuntime/ReanimatedHermesRuntime.cpp +50 -1
- package/Common/cpp/ReanimatedRuntime/ReanimatedHermesRuntime.h +10 -1
- package/Common/cpp/ReanimatedRuntime/ReanimatedRuntime.cpp +5 -1
- package/Common/cpp/Registries/EventHandlerRegistry.cpp +8 -34
- package/Common/cpp/Registries/EventHandlerRegistry.h +7 -13
- package/Common/cpp/SharedItems/Shareables.cpp +11 -63
- package/Common/cpp/SharedItems/Shareables.h +113 -93
- package/Common/cpp/Tools/CollectionUtils.h +14 -0
- package/Common/cpp/Tools/JsiUtils.cpp +26 -0
- package/Common/cpp/Tools/JsiUtils.h +176 -0
- package/Common/cpp/Tools/PlatformDepMethodsHolder.h +5 -5
- package/Common/cpp/Tools/ReanimatedVersion.cpp +17 -0
- package/Common/cpp/Tools/ReanimatedVersion.h +11 -0
- package/Common/cpp/Tools/RuntimeDecorator.cpp +67 -247
- package/Common/cpp/Tools/RuntimeDecorator.h +2 -3
- package/Common/cpp/Tools/WorkletEventHandler.cpp +3 -2
- package/Common/cpp/Tools/WorkletEventHandler.h +14 -6
- package/RNReanimated.podspec +2 -1
- package/android/CMakeLists.txt +188 -181
- package/android/build.gradle +362 -311
- package/android/proguard-rules.pro +2 -0
- package/android/src/fabric/java/com/swmansion/reanimated/NativeProxy.java +63 -295
- package/android/src/main/cpp/LayoutAnimations.cpp +35 -5
- package/android/src/main/cpp/LayoutAnimations.h +23 -6
- package/android/src/main/cpp/NativeProxy.cpp +143 -98
- package/android/src/main/cpp/NativeProxy.h +22 -28
- package/android/src/main/java/com/swmansion/reanimated/ReanimatedPackage.java +5 -4
- package/android/src/main/java/com/swmansion/reanimated/Utils.java +7 -1
- package/android/src/main/java/com/swmansion/reanimated/keyboardObserver/ReanimatedKeyboardEventListener.java +10 -3
- package/android/src/main/java/com/swmansion/reanimated/layoutReanimation/AnimationsManager.java +218 -35
- package/android/src/main/java/com/swmansion/reanimated/layoutReanimation/LayoutAnimations.java +43 -17
- package/android/src/main/java/com/swmansion/reanimated/layoutReanimation/NativeMethodsHolder.java +6 -2
- package/android/src/main/java/com/swmansion/reanimated/layoutReanimation/SharedElement.java +19 -0
- package/android/src/main/java/com/swmansion/reanimated/layoutReanimation/SharedTransitionManager.java +610 -0
- package/android/src/main/java/com/swmansion/reanimated/layoutReanimation/Snapshot.java +93 -23
- package/android/src/main/java/com/swmansion/reanimated/nativeProxy/AnimationFrameCallback.java +19 -0
- package/android/src/main/java/com/swmansion/reanimated/nativeProxy/EventHandler.java +35 -0
- package/android/src/main/java/com/swmansion/reanimated/nativeProxy/KeyboardEventDataUpdater.java +16 -0
- package/android/src/main/java/com/swmansion/reanimated/nativeProxy/NativeProxyCommon.java +206 -0
- package/android/src/main/java/com/swmansion/reanimated/nativeProxy/SensorSetter.java +17 -0
- package/android/src/main/java/com/swmansion/reanimated/sensor/ReanimatedSensor.java +9 -3
- package/android/src/main/java/com/swmansion/reanimated/sensor/ReanimatedSensorContainer.java +3 -4
- package/android/src/main/java/com/swmansion/reanimated/sensor/ReanimatedSensorListener.java +31 -7
- package/android/src/paper/java/com/swmansion/reanimated/NativeProxy.java +90 -307
- package/android/src/reactNativeVersionPatch/ReanimatedUIManager/70/com/swmansion/reanimated/ReanimatedUIManagerFactory.java +16 -0
- 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/src/reactNativeVersionPatch/nativeHierarchyManager/latest/com/swmansion/reanimated/layoutReanimation/ReanimatedNativeHierarchyManager.java +76 -20
- package/ios/LayoutReanimation/REAAnimationsManager.h +31 -5
- package/ios/LayoutReanimation/REAAnimationsManager.m +265 -77
- package/ios/LayoutReanimation/REAFrame.h +10 -0
- package/ios/LayoutReanimation/REAFrame.m +15 -0
- package/ios/LayoutReanimation/REAScreensHelper.h +19 -0
- package/ios/LayoutReanimation/REAScreensHelper.m +106 -0
- package/ios/LayoutReanimation/REASharedElement.h +15 -0
- package/ios/LayoutReanimation/REASharedElement.m +16 -0
- package/ios/LayoutReanimation/REASharedTransitionManager.h +17 -0
- package/ios/LayoutReanimation/REASharedTransitionManager.m +632 -0
- package/ios/LayoutReanimation/REASnapshot.h +1 -0
- package/ios/LayoutReanimation/REASnapshot.m +96 -11
- package/ios/LayoutReanimation/REAUIManager.mm +67 -60
- package/ios/REAModule.mm +2 -7
- package/ios/REANodesManager.mm +1 -21
- package/ios/keyboardObserver/REAKeyboardEventObserver.m +72 -36
- package/ios/native/NativeProxy.mm +75 -114
- package/ios/native/REAInitializer.mm +2 -7
- package/ios/native/REAJSIUtils.h +60 -2
- package/ios/sensor/ReanimatedSensor.h +6 -2
- package/ios/sensor/ReanimatedSensor.m +43 -7
- package/ios/sensor/ReanimatedSensorContainer.h +4 -1
- package/ios/sensor/ReanimatedSensorContainer.m +8 -2
- package/lib/commonjs/createAnimatedComponent.js +232 -28
- package/lib/commonjs/createAnimatedComponent.js.map +1 -1
- package/lib/commonjs/reanimated2/Colors.js +43 -22
- package/lib/commonjs/reanimated2/Colors.js.map +1 -1
- package/lib/commonjs/reanimated2/NativeReanimated/NativeReanimated.js +18 -35
- package/lib/commonjs/reanimated2/NativeReanimated/NativeReanimated.js.map +1 -1
- package/lib/commonjs/reanimated2/animation/styleAnimation.js +5 -1
- package/lib/commonjs/reanimated2/animation/styleAnimation.js.map +1 -1
- package/lib/commonjs/reanimated2/animation/util.js +17 -15
- package/lib/commonjs/reanimated2/animation/util.js.map +1 -1
- package/lib/commonjs/reanimated2/commonTypes.js +33 -1
- package/lib/commonjs/reanimated2/commonTypes.js.map +1 -1
- package/lib/commonjs/reanimated2/component/FlatList.js +19 -3
- package/lib/commonjs/reanimated2/component/FlatList.js.map +1 -1
- package/lib/commonjs/reanimated2/core.js +34 -83
- package/lib/commonjs/reanimated2/core.js.map +1 -1
- package/lib/commonjs/reanimated2/errors.js +66 -0
- package/lib/commonjs/reanimated2/errors.js.map +1 -0
- package/lib/commonjs/reanimated2/frameCallback/FrameCallbackRegistryUI.js +2 -2
- package/lib/commonjs/reanimated2/frameCallback/FrameCallbackRegistryUI.js.map +1 -1
- package/lib/commonjs/reanimated2/globals.d.js.map +1 -1
- package/lib/commonjs/reanimated2/hook/index.js +0 -6
- package/lib/commonjs/reanimated2/hook/index.js.map +1 -1
- package/lib/commonjs/reanimated2/hook/useAnimatedKeyboard.js +5 -2
- package/lib/commonjs/reanimated2/hook/useAnimatedKeyboard.js.map +1 -1
- package/lib/commonjs/reanimated2/hook/useAnimatedReaction.js +13 -1
- package/lib/commonjs/reanimated2/hook/useAnimatedReaction.js.map +1 -1
- package/lib/commonjs/reanimated2/hook/useAnimatedRef.js +1 -1
- package/lib/commonjs/reanimated2/hook/useAnimatedRef.js.map +1 -1
- package/lib/commonjs/reanimated2/hook/useAnimatedSensor.js +89 -16
- package/lib/commonjs/reanimated2/hook/useAnimatedSensor.js.map +1 -1
- package/lib/commonjs/reanimated2/hook/useAnimatedStyle.js +43 -50
- package/lib/commonjs/reanimated2/hook/useAnimatedStyle.js.map +1 -1
- package/lib/commonjs/reanimated2/hook/useDerivedValue.js +13 -1
- package/lib/commonjs/reanimated2/hook/useDerivedValue.js.map +1 -1
- package/lib/commonjs/reanimated2/hook/useScrollViewOffset.js +2 -2
- package/lib/commonjs/reanimated2/hook/useScrollViewOffset.js.map +1 -1
- package/lib/commonjs/reanimated2/hook/utils.js +18 -65
- package/lib/commonjs/reanimated2/hook/utils.js.map +1 -1
- package/lib/commonjs/reanimated2/index.js +13 -0
- package/lib/commonjs/reanimated2/index.js.map +1 -1
- package/lib/commonjs/reanimated2/initializers.js +196 -0
- package/lib/commonjs/reanimated2/initializers.js.map +1 -0
- package/lib/commonjs/reanimated2/interpolateColor.js +96 -19
- package/lib/commonjs/reanimated2/interpolateColor.js.map +1 -1
- package/lib/commonjs/reanimated2/jestUtils.js +1 -1
- package/lib/commonjs/reanimated2/jestUtils.js.map +1 -1
- package/lib/commonjs/reanimated2/js-reanimated/JSReanimated.js +101 -16
- package/lib/commonjs/reanimated2/js-reanimated/JSReanimated.js.map +1 -1
- package/lib/commonjs/reanimated2/js-reanimated/Mapper.js +22 -0
- package/lib/commonjs/reanimated2/js-reanimated/Mapper.js.map +1 -1
- package/lib/commonjs/reanimated2/js-reanimated/WebSensor.js +2 -0
- package/lib/commonjs/reanimated2/js-reanimated/WebSensor.js.map +1 -0
- package/lib/commonjs/reanimated2/js-reanimated/commonTypes.js.map +1 -1
- package/lib/commonjs/reanimated2/js-reanimated/global.js +4 -9
- package/lib/commonjs/reanimated2/js-reanimated/global.js.map +1 -1
- package/lib/commonjs/reanimated2/js-reanimated/index.js +0 -1
- package/lib/commonjs/reanimated2/js-reanimated/index.js.map +1 -1
- package/lib/commonjs/reanimated2/layoutReanimation/animationBuilder/commonTypes.js +11 -0
- package/lib/commonjs/reanimated2/layoutReanimation/animationBuilder/commonTypes.js.map +1 -1
- package/lib/commonjs/reanimated2/layoutReanimation/animationBuilder/index.js +8 -0
- package/lib/commonjs/reanimated2/layoutReanimation/animationBuilder/index.js.map +1 -1
- package/lib/commonjs/reanimated2/layoutReanimation/animationsManager.js +16 -12
- package/lib/commonjs/reanimated2/layoutReanimation/animationsManager.js.map +1 -1
- package/lib/commonjs/reanimated2/layoutReanimation/defaultAnimations/Bounce.js +16 -23
- package/lib/commonjs/reanimated2/layoutReanimation/defaultAnimations/Bounce.js.map +1 -1
- package/lib/commonjs/reanimated2/layoutReanimation/defaultAnimations/Lightspeed.js +8 -14
- package/lib/commonjs/reanimated2/layoutReanimation/defaultAnimations/Lightspeed.js.map +1 -1
- package/lib/commonjs/reanimated2/layoutReanimation/defaultAnimations/Roll.js +8 -14
- package/lib/commonjs/reanimated2/layoutReanimation/defaultAnimations/Roll.js.map +1 -1
- package/lib/commonjs/reanimated2/layoutReanimation/defaultAnimations/Slide.js +8 -15
- package/lib/commonjs/reanimated2/layoutReanimation/defaultAnimations/Slide.js.map +1 -1
- package/lib/commonjs/reanimated2/layoutReanimation/defaultAnimations/Zoom.js +16 -23
- package/lib/commonjs/reanimated2/layoutReanimation/defaultAnimations/Zoom.js.map +1 -1
- package/lib/commonjs/reanimated2/layoutReanimation/index.js +13 -0
- package/lib/commonjs/reanimated2/layoutReanimation/index.js.map +1 -1
- package/lib/commonjs/reanimated2/layoutReanimation/sharedTransitions/index.js +94 -0
- package/lib/commonjs/reanimated2/layoutReanimation/sharedTransitions/index.js.map +1 -0
- package/lib/commonjs/reanimated2/mappers.js +18 -6
- package/lib/commonjs/reanimated2/mappers.js.map +1 -1
- package/lib/commonjs/reanimated2/mock.js +45 -0
- package/lib/commonjs/reanimated2/mock.js.map +1 -1
- package/lib/commonjs/reanimated2/mutables.js +4 -2
- package/lib/commonjs/reanimated2/mutables.js.map +1 -1
- package/lib/commonjs/reanimated2/platform-specific/checkVersion.js +42 -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/pluginUtils.js +11 -0
- package/lib/commonjs/reanimated2/pluginUtils.js.map +1 -0
- package/lib/commonjs/reanimated2/shareables.js +38 -11
- package/lib/commonjs/reanimated2/shareables.js.map +1 -1
- package/lib/commonjs/reanimated2/threads.js +114 -4
- package/lib/commonjs/reanimated2/threads.js.map +1 -1
- package/lib/commonjs/reanimated2/utils.js +7 -0
- package/lib/commonjs/reanimated2/utils.js.map +1 -1
- package/lib/commonjs/reanimated2/valueSetter.js +1 -3
- package/lib/commonjs/reanimated2/valueSetter.js.map +1 -1
- package/lib/module/createAnimatedComponent.js +229 -29
- package/lib/module/createAnimatedComponent.js.map +1 -1
- package/lib/module/reanimated2/Colors.js +35 -19
- package/lib/module/reanimated2/Colors.js.map +1 -1
- package/lib/module/reanimated2/NativeReanimated/NativeReanimated.js +18 -34
- package/lib/module/reanimated2/NativeReanimated/NativeReanimated.js.map +1 -1
- package/lib/module/reanimated2/animation/styleAnimation.js +5 -1
- package/lib/module/reanimated2/animation/styleAnimation.js.map +1 -1
- package/lib/module/reanimated2/animation/util.js +17 -16
- package/lib/module/reanimated2/animation/util.js.map +1 -1
- package/lib/module/reanimated2/commonTypes.js +29 -0
- package/lib/module/reanimated2/commonTypes.js.map +1 -1
- package/lib/module/reanimated2/component/FlatList.js +18 -4
- package/lib/module/reanimated2/component/FlatList.js.map +1 -1
- package/lib/module/reanimated2/core.js +30 -76
- package/lib/module/reanimated2/core.js.map +1 -1
- package/lib/module/reanimated2/errors.js +58 -0
- package/lib/module/reanimated2/errors.js.map +1 -0
- package/lib/module/reanimated2/frameCallback/FrameCallbackRegistryUI.js +2 -2
- package/lib/module/reanimated2/frameCallback/FrameCallbackRegistryUI.js.map +1 -1
- package/lib/module/reanimated2/globals.d.js.map +1 -1
- package/lib/module/reanimated2/hook/index.js +1 -1
- package/lib/module/reanimated2/hook/index.js.map +1 -1
- package/lib/module/reanimated2/hook/useAnimatedKeyboard.js +5 -2
- package/lib/module/reanimated2/hook/useAnimatedKeyboard.js.map +1 -1
- package/lib/module/reanimated2/hook/useAnimatedReaction.js +12 -1
- package/lib/module/reanimated2/hook/useAnimatedReaction.js.map +1 -1
- package/lib/module/reanimated2/hook/useAnimatedRef.js +2 -2
- package/lib/module/reanimated2/hook/useAnimatedRef.js.map +1 -1
- package/lib/module/reanimated2/hook/useAnimatedSensor.js +88 -13
- package/lib/module/reanimated2/hook/useAnimatedSensor.js.map +1 -1
- package/lib/module/reanimated2/hook/useAnimatedStyle.js +45 -52
- package/lib/module/reanimated2/hook/useAnimatedStyle.js.map +1 -1
- package/lib/module/reanimated2/hook/useDerivedValue.js +12 -1
- package/lib/module/reanimated2/hook/useDerivedValue.js.map +1 -1
- package/lib/module/reanimated2/hook/useScrollViewOffset.js +2 -2
- package/lib/module/reanimated2/hook/useScrollViewOffset.js.map +1 -1
- package/lib/module/reanimated2/hook/utils.js +17 -60
- package/lib/module/reanimated2/hook/utils.js.map +1 -1
- package/lib/module/reanimated2/index.js +1 -0
- package/lib/module/reanimated2/index.js.map +1 -1
- package/lib/module/reanimated2/initializers.js +182 -0
- package/lib/module/reanimated2/initializers.js.map +1 -0
- package/lib/module/reanimated2/interpolateColor.js +96 -19
- package/lib/module/reanimated2/interpolateColor.js.map +1 -1
- package/lib/module/reanimated2/jestUtils.js +1 -1
- package/lib/module/reanimated2/jestUtils.js.map +1 -1
- package/lib/module/reanimated2/js-reanimated/JSReanimated.js +101 -16
- package/lib/module/reanimated2/js-reanimated/JSReanimated.js.map +1 -1
- package/lib/module/reanimated2/js-reanimated/Mapper.js +21 -0
- package/lib/module/reanimated2/js-reanimated/Mapper.js.map +1 -1
- package/lib/module/reanimated2/js-reanimated/WebSensor.js +2 -0
- package/lib/module/reanimated2/js-reanimated/WebSensor.js.map +1 -0
- package/lib/module/reanimated2/js-reanimated/commonTypes.js.map +1 -1
- package/lib/module/reanimated2/js-reanimated/global.js +4 -9
- package/lib/module/reanimated2/js-reanimated/global.js.map +1 -1
- package/lib/module/reanimated2/js-reanimated/index.js +0 -1
- package/lib/module/reanimated2/js-reanimated/index.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/animationBuilder/commonTypes.js +9 -1
- package/lib/module/reanimated2/layoutReanimation/animationBuilder/commonTypes.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/animationBuilder/index.js +1 -0
- package/lib/module/reanimated2/layoutReanimation/animationBuilder/index.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/animationsManager.js +15 -10
- package/lib/module/reanimated2/layoutReanimation/animationsManager.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Bounce.js +16 -21
- package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Bounce.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Lightspeed.js +8 -12
- package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Lightspeed.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Roll.js +8 -12
- package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Roll.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Slide.js +8 -13
- package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Slide.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Zoom.js +16 -21
- package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Zoom.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/index.js +1 -0
- package/lib/module/reanimated2/layoutReanimation/index.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/sharedTransitions/index.js +82 -0
- package/lib/module/reanimated2/layoutReanimation/sharedTransitions/index.js.map +1 -0
- package/lib/module/reanimated2/mappers.js +16 -6
- package/lib/module/reanimated2/mappers.js.map +1 -1
- package/lib/module/reanimated2/mock.js +45 -0
- package/lib/module/reanimated2/mock.js.map +1 -1
- package/lib/module/reanimated2/mutables.js +4 -2
- package/lib/module/reanimated2/mutables.js.map +1 -1
- package/lib/module/reanimated2/platform-specific/checkVersion.js +35 -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/pluginUtils.js +4 -0
- package/lib/module/reanimated2/pluginUtils.js.map +1 -0
- package/lib/module/reanimated2/shareables.js +38 -9
- package/lib/module/reanimated2/shareables.js.map +1 -1
- package/lib/module/reanimated2/threads.js +105 -4
- package/lib/module/reanimated2/threads.js.map +1 -1
- package/lib/module/reanimated2/utils.js +5 -0
- package/lib/module/reanimated2/utils.js.map +1 -1
- package/lib/module/reanimated2/valueSetter.js +1 -2
- package/lib/module/reanimated2/valueSetter.js.map +1 -1
- package/package.json +9 -8
- package/{plugin.js → plugin/index.js} +173 -228
- package/react-native-reanimated.d.ts +57 -10
- package/scripts/reanimated_utils.rb +15 -2
- package/src/createAnimatedComponent.tsx +238 -28
- package/src/reanimated2/Colors.ts +38 -11
- package/src/reanimated2/NativeReanimated/NativeReanimated.ts +63 -41
- package/src/reanimated2/animation/styleAnimation.ts +8 -1
- package/src/reanimated2/animation/util.ts +29 -16
- package/src/reanimated2/commonTypes.ts +28 -1
- package/src/reanimated2/component/FlatList.tsx +30 -5
- package/src/reanimated2/core.ts +45 -75
- package/src/reanimated2/errors.ts +57 -0
- package/src/reanimated2/frameCallback/FrameCallbackRegistryUI.ts +2 -2
- package/src/reanimated2/globals.d.ts +34 -18
- package/src/reanimated2/hook/index.ts +1 -1
- package/src/reanimated2/hook/useAnimatedKeyboard.ts +10 -4
- package/src/reanimated2/hook/useAnimatedReaction.ts +12 -5
- package/src/reanimated2/hook/useAnimatedRef.ts +1 -4
- package/src/reanimated2/hook/useAnimatedSensor.ts +88 -11
- package/src/reanimated2/hook/useAnimatedStyle.ts +43 -45
- package/src/reanimated2/hook/useDerivedValue.ts +8 -1
- package/src/reanimated2/hook/useScrollViewOffset.ts +2 -2
- package/src/reanimated2/hook/utils.ts +15 -61
- package/src/reanimated2/index.ts +1 -0
- package/src/reanimated2/initializers.ts +184 -0
- package/src/reanimated2/interpolateColor.ts +104 -20
- package/src/reanimated2/jestUtils.ts +1 -1
- package/src/reanimated2/js-reanimated/JSReanimated.ts +105 -18
- package/src/reanimated2/js-reanimated/Mapper.ts +32 -0
- package/src/reanimated2/js-reanimated/WebSensor.ts +34 -0
- package/src/reanimated2/js-reanimated/commonTypes.ts +0 -1
- package/src/reanimated2/js-reanimated/global.ts +4 -8
- package/src/reanimated2/js-reanimated/index.ts +0 -1
- package/src/reanimated2/layoutReanimation/animationBuilder/commonTypes.ts +13 -1
- package/src/reanimated2/layoutReanimation/animationBuilder/index.ts +1 -0
- package/src/reanimated2/layoutReanimation/animationsManager.ts +17 -12
- 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 -0
- package/src/reanimated2/layoutReanimation/sharedTransitions/index.ts +87 -0
- package/src/reanimated2/mappers.ts +17 -6
- package/src/reanimated2/mock.ts +128 -0
- package/src/reanimated2/mutables.ts +2 -0
- package/src/reanimated2/platform-specific/checkVersion.ts +39 -0
- package/src/reanimated2/platform-specific/checkVersion.web.ts +6 -0
- package/src/reanimated2/pluginUtils.ts +8 -0
- package/src/reanimated2/shareables.ts +47 -11
- package/src/reanimated2/threads.ts +103 -1
- package/src/reanimated2/utils.ts +6 -0
- package/src/reanimated2/valueSetter.ts +1 -2
- package/lib/commonjs/reanimated2/time.js +0 -55
- package/lib/commonjs/reanimated2/time.js.map +0 -1
- package/lib/module/reanimated2/time.js +0 -37
- package/lib/module/reanimated2/time.js.map +0 -1
- package/src/reanimated2/time.ts +0 -30
- /package/android/src/{main/java → reactNativeVersionPatch/ReanimatedUIManager/70}/com/swmansion/reanimated/layoutReanimation/ReanimatedUIManager.java +0 -0
|
@@ -58,8 +58,11 @@ NativeReanimatedModule::NativeReanimatedModule(
|
|
|
58
58
|
platformDepMethodsHolder.configurePropsFunction)
|
|
59
59
|
#endif
|
|
60
60
|
{
|
|
61
|
-
auto requestAnimationFrame = [=](
|
|
62
|
-
|
|
61
|
+
auto requestAnimationFrame = [=](jsi::Runtime &rt, const jsi::Value &fn) {
|
|
62
|
+
auto jsFunction = std::make_shared<jsi::Value>(rt, fn);
|
|
63
|
+
frameCallbacks.push_back([=](double timestamp) {
|
|
64
|
+
runtimeHelper->runOnUIGuarded(*jsFunction, jsi::Value(timestamp));
|
|
65
|
+
});
|
|
63
66
|
maybeRequestRender();
|
|
64
67
|
};
|
|
65
68
|
|
|
@@ -96,7 +99,7 @@ NativeReanimatedModule::NativeReanimatedModule(
|
|
|
96
99
|
};
|
|
97
100
|
|
|
98
101
|
auto makeShareableClone = [this](jsi::Runtime &rt, const jsi::Value &value) {
|
|
99
|
-
return this->makeShareableClone(rt, value);
|
|
102
|
+
return this->makeShareableClone(rt, value, jsi::Value::undefined());
|
|
100
103
|
};
|
|
101
104
|
|
|
102
105
|
auto updateDataSynchronously =
|
|
@@ -117,8 +120,8 @@ NativeReanimatedModule::NativeReanimatedModule(
|
|
|
117
120
|
};
|
|
118
121
|
|
|
119
122
|
auto removeShadowNodeFromRegistry =
|
|
120
|
-
[this](jsi::Runtime &rt, const jsi::Value &
|
|
121
|
-
this->removeShadowNodeFromRegistry(rt,
|
|
123
|
+
[this](jsi::Runtime &rt, const jsi::Value &tag) {
|
|
124
|
+
this->removeShadowNodeFromRegistry(rt, tag);
|
|
122
125
|
};
|
|
123
126
|
|
|
124
127
|
auto measure = [this](jsi::Runtime &rt, const jsi::Value &shadowNodeValue) {
|
|
@@ -151,8 +154,6 @@ NativeReanimatedModule::NativeReanimatedModule(
|
|
|
151
154
|
makeShareableClone,
|
|
152
155
|
updateDataSynchronously,
|
|
153
156
|
platformDepMethodsHolder.getCurrentTime,
|
|
154
|
-
platformDepMethodsHolder.registerSensor,
|
|
155
|
-
platformDepMethodsHolder.unregisterSensor,
|
|
156
157
|
platformDepMethodsHolder.setGestureStateFunction,
|
|
157
158
|
platformDepMethodsHolder.progressLayoutAnimation,
|
|
158
159
|
platformDepMethodsHolder.endLayoutAnimation);
|
|
@@ -174,24 +175,28 @@ NativeReanimatedModule::NativeReanimatedModule(
|
|
|
174
175
|
|
|
175
176
|
void NativeReanimatedModule::installCoreFunctions(
|
|
176
177
|
jsi::Runtime &rt,
|
|
177
|
-
const jsi::Value &
|
|
178
|
-
const jsi::Value &
|
|
178
|
+
const jsi::Value &callGuard,
|
|
179
|
+
const jsi::Value &valueUnpacker) {
|
|
179
180
|
if (!runtimeHelper) {
|
|
180
181
|
// initialize runtimeHelper here if not already present. We expect only one
|
|
181
182
|
// instace of the helper to exists.
|
|
182
183
|
runtimeHelper =
|
|
183
184
|
std::make_shared<JSRuntimeHelper>(&rt, this->runtime.get(), scheduler);
|
|
184
185
|
}
|
|
186
|
+
runtimeHelper->callGuard =
|
|
187
|
+
std::make_unique<CoreFunction>(runtimeHelper.get(), callGuard);
|
|
185
188
|
runtimeHelper->valueUnpacker =
|
|
186
|
-
std::
|
|
189
|
+
std::make_unique<CoreFunction>(runtimeHelper.get(), valueUnpacker);
|
|
187
190
|
}
|
|
188
191
|
|
|
189
192
|
NativeReanimatedModule::~NativeReanimatedModule() {
|
|
190
193
|
if (runtimeHelper) {
|
|
194
|
+
runtimeHelper->callGuard = nullptr;
|
|
191
195
|
runtimeHelper->valueUnpacker = nullptr;
|
|
192
|
-
// event handler registry
|
|
193
|
-
// to go away before we tear down the runtime
|
|
196
|
+
// event handler registry and frame callbacks store some JSI values from UI
|
|
197
|
+
// runtime, so they have to go away before we tear down the runtime
|
|
194
198
|
eventHandlerRegistry.reset();
|
|
199
|
+
frameCallbacks.clear();
|
|
195
200
|
runtime.reset();
|
|
196
201
|
// make sure uiRuntimeDestroyed is set after the runtime is deallocated
|
|
197
202
|
runtimeHelper->uiRuntimeDestroyed = true;
|
|
@@ -205,13 +210,11 @@ void NativeReanimatedModule::scheduleOnUI(
|
|
|
205
210
|
assert(
|
|
206
211
|
shareableWorklet->valueType() == Shareable::WorkletType &&
|
|
207
212
|
"only worklets can be scheduled to run on UI");
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
jsi::Runtime &rt = *uiRuntime;
|
|
213
|
+
scheduler->scheduleOnUI([=] {
|
|
214
|
+
jsi::Runtime &rt = *runtimeHelper->uiRuntime();
|
|
211
215
|
auto workletValue = shareableWorklet->getJSValue(rt);
|
|
212
|
-
workletValue
|
|
216
|
+
runtimeHelper->runOnUIGuarded(workletValue);
|
|
213
217
|
});
|
|
214
|
-
maybeRequestRender();
|
|
215
218
|
}
|
|
216
219
|
|
|
217
220
|
jsi::Value NativeReanimatedModule::makeSynchronizedDataHolder(
|
|
@@ -241,7 +244,8 @@ jsi::Value NativeReanimatedModule::getDataSynchronously(
|
|
|
241
244
|
|
|
242
245
|
jsi::Value NativeReanimatedModule::makeShareableClone(
|
|
243
246
|
jsi::Runtime &rt,
|
|
244
|
-
const jsi::Value &value
|
|
247
|
+
const jsi::Value &value,
|
|
248
|
+
const jsi::Value &shouldRetainRemote) {
|
|
245
249
|
std::shared_ptr<Shareable> shareable;
|
|
246
250
|
if (value.isObject()) {
|
|
247
251
|
auto object = value.asObject(rt);
|
|
@@ -253,18 +257,25 @@ jsi::Value NativeReanimatedModule::makeShareableClone(
|
|
|
253
257
|
shareable = std::make_shared<ShareableRemoteFunction>(
|
|
254
258
|
runtimeHelper, rt, object.asFunction(rt));
|
|
255
259
|
} else if (object.isArray(rt)) {
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
260
|
+
if (shouldRetainRemote.isBool() && shouldRetainRemote.getBool()) {
|
|
261
|
+
shareable = std::make_shared<RetainingShareable<ShareableArray>>(
|
|
262
|
+
runtimeHelper, rt, object.asArray(rt));
|
|
263
|
+
} else {
|
|
264
|
+
shareable = std::make_shared<ShareableArray>(rt, object.asArray(rt));
|
|
265
|
+
}
|
|
266
|
+
} else if (object.isHostObject(rt)) {
|
|
267
|
+
shareable = std::make_shared<ShareableHostObject>(
|
|
268
|
+
runtimeHelper, rt, object.getHostObject(rt));
|
|
263
269
|
} else {
|
|
264
|
-
|
|
270
|
+
if (shouldRetainRemote.isBool() && shouldRetainRemote.getBool()) {
|
|
271
|
+
shareable = std::make_shared<RetainingShareable<ShareableObject>>(
|
|
272
|
+
runtimeHelper, rt, object);
|
|
273
|
+
} else {
|
|
274
|
+
shareable = std::make_shared<ShareableObject>(rt, object);
|
|
275
|
+
}
|
|
265
276
|
}
|
|
266
277
|
} else if (value.isString()) {
|
|
267
|
-
shareable = std::make_shared<ShareableString>(
|
|
278
|
+
shareable = std::make_shared<ShareableString>(value.asString(rt).utf8(rt));
|
|
268
279
|
} else if (value.isUndefined()) {
|
|
269
280
|
shareable = std::make_shared<ShareableScalar>();
|
|
270
281
|
} else if (value.isNull()) {
|
|
@@ -273,6 +284,13 @@ jsi::Value NativeReanimatedModule::makeShareableClone(
|
|
|
273
284
|
shareable = std::make_shared<ShareableScalar>(value.getBool());
|
|
274
285
|
} else if (value.isNumber()) {
|
|
275
286
|
shareable = std::make_shared<ShareableScalar>(value.getNumber());
|
|
287
|
+
} else if (value.isSymbol()) {
|
|
288
|
+
// TODO: this is only a placeholder implementation, here we replace symbols
|
|
289
|
+
// with strings in order to make certain objects to be captured. There isn't
|
|
290
|
+
// yet any usecase for using symbols on the UI runtime so it is fine to keep
|
|
291
|
+
// it like this for now.
|
|
292
|
+
shareable =
|
|
293
|
+
std::make_shared<ShareableString>(value.getSymbol(rt).toString(rt));
|
|
276
294
|
} else {
|
|
277
295
|
throw std::runtime_error("attempted to convert an unsupported value type");
|
|
278
296
|
}
|
|
@@ -283,19 +301,21 @@ jsi::Value NativeReanimatedModule::registerEventHandler(
|
|
|
283
301
|
jsi::Runtime &rt,
|
|
284
302
|
const jsi::Value &eventHash,
|
|
285
303
|
const jsi::Value &worklet) {
|
|
286
|
-
static
|
|
304
|
+
static uint64_t EVENT_HANDLER_ID = 1;
|
|
287
305
|
|
|
288
|
-
|
|
306
|
+
uint64_t newRegistrationId = EVENT_HANDLER_ID++;
|
|
289
307
|
auto eventName = eventHash.asString(rt).utf8(rt);
|
|
290
308
|
auto handlerShareable = extractShareableOrThrow(rt, worklet);
|
|
291
309
|
|
|
292
310
|
scheduler->scheduleOnUI([=] {
|
|
293
311
|
jsi::Runtime &rt = *runtimeHelper->uiRuntime();
|
|
294
|
-
auto handlerFunction =
|
|
295
|
-
handlerShareable->getJSValue(rt).asObject(rt).asFunction(rt);
|
|
312
|
+
auto handlerFunction = handlerShareable->getJSValue(rt);
|
|
296
313
|
auto handler = std::make_shared<WorkletEventHandler>(
|
|
297
|
-
|
|
298
|
-
|
|
314
|
+
runtimeHelper,
|
|
315
|
+
newRegistrationId,
|
|
316
|
+
eventName,
|
|
317
|
+
std::move(handlerFunction));
|
|
318
|
+
eventHandlerRegistry->registerEventHandler(std::move(handler));
|
|
299
319
|
});
|
|
300
320
|
|
|
301
321
|
return jsi::Value(static_cast<double>(newRegistrationId));
|
|
@@ -304,7 +324,7 @@ jsi::Value NativeReanimatedModule::registerEventHandler(
|
|
|
304
324
|
void NativeReanimatedModule::unregisterEventHandler(
|
|
305
325
|
jsi::Runtime &rt,
|
|
306
326
|
const jsi::Value ®istrationId) {
|
|
307
|
-
|
|
327
|
+
uint64_t id = registrationId.asNumber();
|
|
308
328
|
scheduler->scheduleOnUI(
|
|
309
329
|
[=] { eventHandlerRegistry->unregisterEventHandler(id); });
|
|
310
330
|
}
|
|
@@ -364,37 +384,22 @@ jsi::Value NativeReanimatedModule::configureLayoutAnimation(
|
|
|
364
384
|
jsi::Runtime &rt,
|
|
365
385
|
const jsi::Value &viewTag,
|
|
366
386
|
const jsi::Value &type,
|
|
387
|
+
const jsi::Value &sharedTransitionTag,
|
|
367
388
|
const jsi::Value &config) {
|
|
368
389
|
layoutAnimationsManager_.configureAnimation(
|
|
369
390
|
viewTag.asNumber(),
|
|
370
|
-
type.
|
|
391
|
+
static_cast<LayoutAnimationType>(type.asNumber()),
|
|
392
|
+
sharedTransitionTag.asString(rt).utf8(rt),
|
|
371
393
|
extractShareableOrThrow(rt, config));
|
|
372
394
|
return jsi::Value::undefined();
|
|
373
395
|
}
|
|
374
396
|
|
|
375
397
|
void NativeReanimatedModule::onEvent(
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
jsi::Value
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
#endif
|
|
382
|
-
/**/) {
|
|
383
|
-
try {
|
|
384
|
-
#ifdef RCT_NEW_ARCH_ENABLED
|
|
385
|
-
eventHandlerRegistry->processEvent(*runtime, eventName, payload);
|
|
386
|
-
#else
|
|
387
|
-
eventHandlerRegistry->processEvent(*runtime, eventName, eventAsString);
|
|
388
|
-
#endif
|
|
389
|
-
} catch (std::exception &e) {
|
|
390
|
-
std::string str = e.what();
|
|
391
|
-
this->errorHandler->setError(str);
|
|
392
|
-
this->errorHandler->raise();
|
|
393
|
-
} catch (...) {
|
|
394
|
-
std::string str = "OnEvent error";
|
|
395
|
-
this->errorHandler->setError(str);
|
|
396
|
-
this->errorHandler->raise();
|
|
397
|
-
}
|
|
398
|
+
double eventTimestamp,
|
|
399
|
+
const std::string &eventName,
|
|
400
|
+
const jsi::Value &payload) {
|
|
401
|
+
eventHandlerRegistry->processEvent(
|
|
402
|
+
*runtime, eventTimestamp, eventName, payload);
|
|
398
403
|
}
|
|
399
404
|
|
|
400
405
|
bool NativeReanimatedModule::isAnyHandlerWaitingForEvent(
|
|
@@ -410,20 +415,10 @@ void NativeReanimatedModule::maybeRequestRender() {
|
|
|
410
415
|
}
|
|
411
416
|
|
|
412
417
|
void NativeReanimatedModule::onRender(double timestampMs) {
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
callback(timestampMs);
|
|
418
|
-
}
|
|
419
|
-
} catch (std::exception &e) {
|
|
420
|
-
std::string str = e.what();
|
|
421
|
-
this->errorHandler->setError(str);
|
|
422
|
-
this->errorHandler->raise();
|
|
423
|
-
} catch (...) {
|
|
424
|
-
std::string str = "OnRender error";
|
|
425
|
-
this->errorHandler->setError(str);
|
|
426
|
-
this->errorHandler->raise();
|
|
418
|
+
std::vector<FrameCallback> callbacks = frameCallbacks;
|
|
419
|
+
frameCallbacks.clear();
|
|
420
|
+
for (auto &callback : callbacks) {
|
|
421
|
+
callback(timestampMs);
|
|
427
422
|
}
|
|
428
423
|
}
|
|
429
424
|
|
|
@@ -431,9 +426,15 @@ jsi::Value NativeReanimatedModule::registerSensor(
|
|
|
431
426
|
jsi::Runtime &rt,
|
|
432
427
|
const jsi::Value &sensorType,
|
|
433
428
|
const jsi::Value &interval,
|
|
429
|
+
const jsi::Value &iosReferenceFrame,
|
|
434
430
|
const jsi::Value &sensorDataHandler) {
|
|
435
431
|
return animatedSensorModule.registerSensor(
|
|
436
|
-
rt,
|
|
432
|
+
rt,
|
|
433
|
+
runtimeHelper,
|
|
434
|
+
sensorType,
|
|
435
|
+
interval,
|
|
436
|
+
iosReferenceFrame,
|
|
437
|
+
sensorDataHandler);
|
|
437
438
|
}
|
|
438
439
|
|
|
439
440
|
void NativeReanimatedModule::unregisterSensor(
|
|
@@ -442,6 +443,10 @@ void NativeReanimatedModule::unregisterSensor(
|
|
|
442
443
|
animatedSensorModule.unregisterSensor(sensorId);
|
|
443
444
|
}
|
|
444
445
|
|
|
446
|
+
void NativeReanimatedModule::cleanupSensors() {
|
|
447
|
+
animatedSensorModule.unregisterAllSensors();
|
|
448
|
+
}
|
|
449
|
+
|
|
445
450
|
#ifdef RCT_NEW_ARCH_ENABLED
|
|
446
451
|
bool NativeReanimatedModule::isThereAnyLayoutProp(
|
|
447
452
|
jsi::Runtime &rt,
|
|
@@ -458,24 +463,20 @@ bool NativeReanimatedModule::isThereAnyLayoutProp(
|
|
|
458
463
|
}
|
|
459
464
|
return false;
|
|
460
465
|
}
|
|
466
|
+
#endif // RCT_NEW_ARCH_ENABLED
|
|
461
467
|
|
|
462
468
|
bool NativeReanimatedModule::handleEvent(
|
|
463
469
|
const std::string &eventName,
|
|
464
|
-
jsi::Value
|
|
470
|
+
const jsi::Value &payload,
|
|
465
471
|
double currentTime) {
|
|
466
|
-
|
|
467
|
-
jsi::Object global = rt.global();
|
|
468
|
-
jsi::String eventTimestampName =
|
|
469
|
-
jsi::String::createFromAscii(rt, "_eventTimestamp");
|
|
470
|
-
global.setProperty(rt, eventTimestampName, currentTime);
|
|
471
|
-
onEvent(eventName, std::move(payload));
|
|
472
|
-
global.setProperty(rt, eventTimestampName, jsi::Value::undefined());
|
|
472
|
+
onEvent(currentTime, eventName, payload);
|
|
473
473
|
|
|
474
474
|
// TODO: return true if Reanimated successfully handled the event
|
|
475
475
|
// to avoid sending it to JavaScript
|
|
476
476
|
return false;
|
|
477
477
|
}
|
|
478
478
|
|
|
479
|
+
#ifdef RCT_NEW_ARCH_ENABLED
|
|
479
480
|
bool NativeReanimatedModule::handleRawEvent(
|
|
480
481
|
const RawEvent &rawEvent,
|
|
481
482
|
double currentTime) {
|
|
@@ -499,7 +500,13 @@ bool NativeReanimatedModule::handleRawEvent(
|
|
|
499
500
|
jsi::Runtime &rt = *runtime.get();
|
|
500
501
|
jsi::Value payload = payloadFactory(rt);
|
|
501
502
|
|
|
502
|
-
|
|
503
|
+
auto res = handleEvent(eventName, std::move(payload), currentTime);
|
|
504
|
+
// TODO: we should call performOperations conditionally if event is handled
|
|
505
|
+
// (res == true), but for now handleEvent always returns false. Thankfully,
|
|
506
|
+
// performOperations does not trigger a lot of code if there is nothing to be
|
|
507
|
+
// done so this is fine for now.
|
|
508
|
+
performOperations();
|
|
509
|
+
return res;
|
|
503
510
|
}
|
|
504
511
|
|
|
505
512
|
void NativeReanimatedModule::updateProps(
|
|
@@ -538,36 +545,33 @@ void NativeReanimatedModule::performOperations() {
|
|
|
538
545
|
jsi::Runtime &rt = *runtime.get();
|
|
539
546
|
|
|
540
547
|
shadowTreeRegistry.visit(surfaceId_, [&](ShadowTree const &shadowTree) {
|
|
548
|
+
auto lock = newestShadowNodesRegistry_->createLock();
|
|
549
|
+
|
|
541
550
|
shadowTree.commit([&](RootShadowNode const &oldRootShadowNode) {
|
|
542
551
|
auto rootNode = oldRootShadowNode.ShadowNode::clone(ShadowNodeFragment{});
|
|
543
552
|
|
|
544
553
|
ShadowTreeCloner shadowTreeCloner{
|
|
545
554
|
newestShadowNodesRegistry_, uiManager_, surfaceId_};
|
|
546
555
|
|
|
547
|
-
{
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
for (const auto &pair : copiedOperationsQueue) {
|
|
552
|
-
const ShadowNodeFamily &family = pair.first->getFamily();
|
|
553
|
-
react_native_assert(family.getSurfaceId() == surfaceId_);
|
|
556
|
+
for (const auto &pair : copiedOperationsQueue) {
|
|
557
|
+
const ShadowNodeFamily &family = pair.first->getFamily();
|
|
558
|
+
react_native_assert(family.getSurfaceId() == surfaceId_);
|
|
554
559
|
|
|
555
|
-
|
|
556
|
-
|
|
560
|
+
auto newRootNode = shadowTreeCloner.cloneWithNewProps(
|
|
561
|
+
rootNode, family, RawProps(rt, *pair.second));
|
|
557
562
|
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
}
|
|
564
|
-
rootNode = newRootNode;
|
|
563
|
+
if (newRootNode == nullptr) {
|
|
564
|
+
// this happens when React removed the component but Reanimated
|
|
565
|
+
// still tries to animate it, let's skip update for this specific
|
|
566
|
+
// component
|
|
567
|
+
continue;
|
|
565
568
|
}
|
|
569
|
+
rootNode = newRootNode;
|
|
570
|
+
}
|
|
566
571
|
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
}
|
|
572
|
+
// remove ShadowNodes and its ancestors from NewestShadowNodesRegistry
|
|
573
|
+
for (auto tag : copiedTagsToRemove) {
|
|
574
|
+
newestShadowNodesRegistry_->remove(tag);
|
|
571
575
|
}
|
|
572
576
|
|
|
573
577
|
shadowTreeCloner.updateYogaChildren();
|
|
@@ -579,9 +583,8 @@ void NativeReanimatedModule::performOperations() {
|
|
|
579
583
|
|
|
580
584
|
void NativeReanimatedModule::removeShadowNodeFromRegistry(
|
|
581
585
|
jsi::Runtime &rt,
|
|
582
|
-
const jsi::Value &
|
|
583
|
-
|
|
584
|
-
tagsToRemove_.push_back(shadowNode->getTag());
|
|
586
|
+
const jsi::Value &tag) {
|
|
587
|
+
tagsToRemove_.push_back(tag.asNumber());
|
|
585
588
|
}
|
|
586
589
|
|
|
587
590
|
void NativeReanimatedModule::dispatchCommand(
|
|
@@ -592,9 +595,7 @@ void NativeReanimatedModule::dispatchCommand(
|
|
|
592
595
|
ShadowNode::Shared shadowNode = shadowNodeFromValue(rt, shadowNodeValue);
|
|
593
596
|
std::string commandName = stringFromValue(rt, commandNameValue);
|
|
594
597
|
folly::dynamic args = commandArgsFromValue(rt, argsValue);
|
|
595
|
-
|
|
596
|
-
// TODO: use uiManager_->dispatchCommand once it's public
|
|
597
|
-
UIManager_dispatchCommand(uiManager_, shadowNode, commandName, args);
|
|
598
|
+
uiManager_->dispatchCommand(shadowNode, commandName, args);
|
|
598
599
|
}
|
|
599
600
|
|
|
600
601
|
jsi::Value NativeReanimatedModule::measure(
|
|
@@ -603,11 +604,8 @@ jsi::Value NativeReanimatedModule::measure(
|
|
|
603
604
|
// based on implementation from UIManagerBinding.cpp
|
|
604
605
|
|
|
605
606
|
auto shadowNode = shadowNodeFromValue(rt, shadowNodeValue);
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
// *shadowNode, nullptr, {/* .includeTransform = */ true});
|
|
609
|
-
auto layoutMetrics = UIManager_getRelativeLayoutMetrics(
|
|
610
|
-
uiManager_, *shadowNode, nullptr, {/* .includeTransform = */ true});
|
|
607
|
+
auto layoutMetrics = uiManager_->getRelativeLayoutMetrics(
|
|
608
|
+
*shadowNode, nullptr, {/* .includeTransform = */ true});
|
|
611
609
|
|
|
612
610
|
if (layoutMetrics == EmptyLayoutMetrics) {
|
|
613
611
|
// Originally, in this case React Native returns `{0, 0, 0, 0, 0, 0}`, most
|
|
@@ -621,7 +619,8 @@ jsi::Value NativeReanimatedModule::measure(
|
|
|
621
619
|
|
|
622
620
|
auto layoutableShadowNode =
|
|
623
621
|
traitCast<LayoutableShadowNode const *>(newestCloneOfShadowNode.get());
|
|
624
|
-
facebook::react::Point originRelativeToParent =
|
|
622
|
+
facebook::react::Point originRelativeToParent =
|
|
623
|
+
layoutableShadowNode != nullptr
|
|
625
624
|
? layoutableShadowNode->getLayoutMetrics().frame.origin
|
|
626
625
|
: facebook::react::Point();
|
|
627
626
|
|
|
@@ -656,15 +655,17 @@ void NativeReanimatedModule::setNewestShadowNodesRegistry(
|
|
|
656
655
|
|
|
657
656
|
jsi::Value NativeReanimatedModule::subscribeForKeyboardEvents(
|
|
658
657
|
jsi::Runtime &rt,
|
|
659
|
-
const jsi::Value &handlerWorklet
|
|
658
|
+
const jsi::Value &handlerWorklet,
|
|
659
|
+
const jsi::Value &isStatusBarTranslucent) {
|
|
660
660
|
auto shareableHandler = extractShareableOrThrow(rt, handlerWorklet);
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
661
|
+
return subscribeForKeyboardEventsFunction(
|
|
662
|
+
[=](int keyboardState, int height) {
|
|
663
|
+
jsi::Runtime &rt = *runtimeHelper->uiRuntime();
|
|
664
|
+
auto handler = shareableHandler->getJSValue(rt);
|
|
665
|
+
runtimeHelper->runOnUIGuarded(
|
|
666
|
+
handler, jsi::Value(keyboardState), jsi::Value(height));
|
|
667
|
+
},
|
|
668
|
+
isStatusBarTranslucent.getBool());
|
|
668
669
|
}
|
|
669
670
|
|
|
670
671
|
void NativeReanimatedModule::unsubscribeFromKeyboardEvents(
|
|
@@ -49,11 +49,13 @@ class NativeReanimatedModule : public NativeReanimatedModuleSpec,
|
|
|
49
49
|
|
|
50
50
|
void installCoreFunctions(
|
|
51
51
|
jsi::Runtime &rt,
|
|
52
|
-
const jsi::Value &
|
|
53
|
-
const jsi::Value &
|
|
52
|
+
const jsi::Value &callGuard,
|
|
53
|
+
const jsi::Value &valueUnpacker) override;
|
|
54
54
|
|
|
55
|
-
jsi::Value makeShareableClone(
|
|
56
|
-
|
|
55
|
+
jsi::Value makeShareableClone(
|
|
56
|
+
jsi::Runtime &rt,
|
|
57
|
+
const jsi::Value &value,
|
|
58
|
+
const jsi::Value &shouldRetainRemote) override;
|
|
57
59
|
|
|
58
60
|
jsi::Value makeSynchronizedDataHolder(
|
|
59
61
|
jsi::Runtime &rt,
|
|
@@ -92,14 +94,16 @@ class NativeReanimatedModule : public NativeReanimatedModuleSpec,
|
|
|
92
94
|
jsi::Runtime &rt,
|
|
93
95
|
const jsi::Value &viewTag,
|
|
94
96
|
const jsi::Value &type,
|
|
97
|
+
const jsi::Value &sharedTransitionTag,
|
|
95
98
|
const jsi::Value &config) override;
|
|
96
99
|
|
|
97
100
|
void onRender(double timestampMs);
|
|
98
|
-
|
|
99
|
-
void onEvent(
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
101
|
+
|
|
102
|
+
void onEvent(
|
|
103
|
+
double eventTimestamp,
|
|
104
|
+
const std::string &eventName,
|
|
105
|
+
const jsi::Value &payload);
|
|
106
|
+
|
|
103
107
|
bool isAnyHandlerWaitingForEvent(std::string eventName);
|
|
104
108
|
|
|
105
109
|
void maybeRequestRender();
|
|
@@ -107,7 +111,7 @@ class NativeReanimatedModule : public NativeReanimatedModuleSpec,
|
|
|
107
111
|
|
|
108
112
|
bool handleEvent(
|
|
109
113
|
const std::string &eventName,
|
|
110
|
-
jsi::Value
|
|
114
|
+
const jsi::Value &payload,
|
|
111
115
|
double currentTime);
|
|
112
116
|
|
|
113
117
|
#ifdef RCT_NEW_ARCH_ENABLED
|
|
@@ -118,9 +122,7 @@ class NativeReanimatedModule : public NativeReanimatedModuleSpec,
|
|
|
118
122
|
const jsi::Value &shadowNodeValue,
|
|
119
123
|
const jsi::Value &props);
|
|
120
124
|
|
|
121
|
-
void removeShadowNodeFromRegistry(
|
|
122
|
-
jsi::Runtime &rt,
|
|
123
|
-
const jsi::Value &shadowNodeValue);
|
|
125
|
+
void removeShadowNodeFromRegistry(jsi::Runtime &rt, const jsi::Value &tag);
|
|
124
126
|
|
|
125
127
|
void performOperations();
|
|
126
128
|
|
|
@@ -142,11 +144,16 @@ class NativeReanimatedModule : public NativeReanimatedModuleSpec,
|
|
|
142
144
|
jsi::Runtime &rt,
|
|
143
145
|
const jsi::Value &sensorType,
|
|
144
146
|
const jsi::Value &interval,
|
|
147
|
+
const jsi::Value &iosReferenceFrame,
|
|
145
148
|
const jsi::Value &sensorDataContainer) override;
|
|
146
149
|
void unregisterSensor(jsi::Runtime &rt, const jsi::Value &sensorId) override;
|
|
150
|
+
|
|
151
|
+
void cleanupSensors();
|
|
152
|
+
|
|
147
153
|
jsi::Value subscribeForKeyboardEvents(
|
|
148
154
|
jsi::Runtime &rt,
|
|
149
|
-
const jsi::Value &keyboardEventContainer
|
|
155
|
+
const jsi::Value &keyboardEventContainer,
|
|
156
|
+
const jsi::Value &isStatusBarTranslucent) override;
|
|
150
157
|
void unsubscribeFromKeyboardEvents(
|
|
151
158
|
jsi::Runtime &rt,
|
|
152
159
|
const jsi::Value &listenerId) override;
|
|
@@ -24,7 +24,7 @@ static jsi::Value SPEC_PREFIX(makeShareableClone)(
|
|
|
24
24
|
const jsi::Value *args,
|
|
25
25
|
size_t count) {
|
|
26
26
|
return static_cast<NativeReanimatedModuleSpec *>(&turboModule)
|
|
27
|
-
->makeShareableClone(rt, std::move(args[0]));
|
|
27
|
+
->makeShareableClone(rt, std::move(args[0]), std::move(args[1]));
|
|
28
28
|
}
|
|
29
29
|
|
|
30
30
|
// Sync methods
|
|
@@ -106,7 +106,11 @@ static jsi::Value SPEC_PREFIX(registerSensor)(
|
|
|
106
106
|
size_t count) {
|
|
107
107
|
return static_cast<NativeReanimatedModuleSpec *>(&turboModule)
|
|
108
108
|
->registerSensor(
|
|
109
|
-
rt,
|
|
109
|
+
rt,
|
|
110
|
+
std::move(args[0]),
|
|
111
|
+
std::move(args[1]),
|
|
112
|
+
std::move(args[2]),
|
|
113
|
+
std::move(args[3]));
|
|
110
114
|
}
|
|
111
115
|
|
|
112
116
|
static jsi::Value SPEC_PREFIX(unregisterSensor)(
|
|
@@ -135,7 +139,7 @@ static jsi::Value SPEC_PREFIX(subscribeForKeyboardEvents)(
|
|
|
135
139
|
const jsi::Value *args,
|
|
136
140
|
size_t count) {
|
|
137
141
|
return static_cast<NativeReanimatedModuleSpec *>(&turboModule)
|
|
138
|
-
->subscribeForKeyboardEvents(rt, std::move(args[0]));
|
|
142
|
+
->subscribeForKeyboardEvents(rt, std::move(args[0]), std::move(args[1]));
|
|
139
143
|
}
|
|
140
144
|
|
|
141
145
|
static jsi::Value SPEC_PREFIX(unsubscribeFromKeyboardEvents)(
|
|
@@ -155,7 +159,11 @@ static jsi::Value SPEC_PREFIX(configureLayoutAnimation)(
|
|
|
155
159
|
size_t count) {
|
|
156
160
|
return static_cast<NativeReanimatedModuleSpec *>(&turboModule)
|
|
157
161
|
->configureLayoutAnimation(
|
|
158
|
-
rt,
|
|
162
|
+
rt,
|
|
163
|
+
std::move(args[0]),
|
|
164
|
+
std::move(args[1]),
|
|
165
|
+
std::move(args[2]),
|
|
166
|
+
std::move(args[3]));
|
|
159
167
|
}
|
|
160
168
|
|
|
161
169
|
NativeReanimatedModuleSpec::NativeReanimatedModuleSpec(
|
|
@@ -165,7 +173,7 @@ NativeReanimatedModuleSpec::NativeReanimatedModuleSpec(
|
|
|
165
173
|
MethodMetadata{2, SPEC_PREFIX(installCoreFunctions)};
|
|
166
174
|
|
|
167
175
|
methodMap_["makeShareableClone"] =
|
|
168
|
-
MethodMetadata{
|
|
176
|
+
MethodMetadata{2, SPEC_PREFIX(makeShareableClone)};
|
|
169
177
|
|
|
170
178
|
methodMap_["makeSynchronizedDataHolder"] =
|
|
171
179
|
MethodMetadata{1, SPEC_PREFIX(makeSynchronizedDataHolder)};
|
|
@@ -182,12 +190,12 @@ NativeReanimatedModuleSpec::NativeReanimatedModuleSpec(
|
|
|
182
190
|
methodMap_["getViewProp"] = MethodMetadata{3, SPEC_PREFIX(getViewProp)};
|
|
183
191
|
methodMap_["enableLayoutAnimations"] =
|
|
184
192
|
MethodMetadata{2, SPEC_PREFIX(enableLayoutAnimations)};
|
|
185
|
-
methodMap_["registerSensor"] = MethodMetadata{
|
|
193
|
+
methodMap_["registerSensor"] = MethodMetadata{4, SPEC_PREFIX(registerSensor)};
|
|
186
194
|
methodMap_["unregisterSensor"] =
|
|
187
195
|
MethodMetadata{1, SPEC_PREFIX(unregisterSensor)};
|
|
188
196
|
methodMap_["configureProps"] = MethodMetadata{2, SPEC_PREFIX(configureProps)};
|
|
189
197
|
methodMap_["subscribeForKeyboardEvents"] =
|
|
190
|
-
MethodMetadata{
|
|
198
|
+
MethodMetadata{2, SPEC_PREFIX(subscribeForKeyboardEvents)};
|
|
191
199
|
methodMap_["unsubscribeFromKeyboardEvents"] =
|
|
192
200
|
MethodMetadata{1, SPEC_PREFIX(unsubscribeFromKeyboardEvents)};
|
|
193
201
|
|
|
@@ -24,13 +24,14 @@ class JSI_EXPORT NativeReanimatedModuleSpec : public TurboModule {
|
|
|
24
24
|
public:
|
|
25
25
|
virtual void installCoreFunctions(
|
|
26
26
|
jsi::Runtime &rt,
|
|
27
|
-
const jsi::Value &
|
|
28
|
-
const jsi::Value &
|
|
27
|
+
const jsi::Value &callGuard,
|
|
28
|
+
const jsi::Value &valueUnpacker) = 0;
|
|
29
29
|
|
|
30
30
|
// SharedValue
|
|
31
31
|
virtual jsi::Value makeShareableClone(
|
|
32
32
|
jsi::Runtime &rt,
|
|
33
|
-
const jsi::Value &value
|
|
33
|
+
const jsi::Value &value,
|
|
34
|
+
const jsi::Value &shouldRetainRemote) = 0;
|
|
34
35
|
|
|
35
36
|
// Synchronized data objects
|
|
36
37
|
virtual jsi::Value makeSynchronizedDataHolder(
|
|
@@ -64,6 +65,7 @@ class JSI_EXPORT NativeReanimatedModuleSpec : public TurboModule {
|
|
|
64
65
|
jsi::Runtime &rt,
|
|
65
66
|
const jsi::Value &sensorType,
|
|
66
67
|
const jsi::Value &interval,
|
|
68
|
+
const jsi::Value &iosReferenceFrame,
|
|
67
69
|
const jsi::Value &sensorDataContainer) = 0;
|
|
68
70
|
virtual void unregisterSensor(
|
|
69
71
|
jsi::Runtime &rt,
|
|
@@ -72,7 +74,8 @@ class JSI_EXPORT NativeReanimatedModuleSpec : public TurboModule {
|
|
|
72
74
|
// keyboard
|
|
73
75
|
virtual jsi::Value subscribeForKeyboardEvents(
|
|
74
76
|
jsi::Runtime &rt,
|
|
75
|
-
const jsi::Value &keyboardEventContainer
|
|
77
|
+
const jsi::Value &keyboardEventContainer,
|
|
78
|
+
const jsi::Value &isStatusBarTranslucent) = 0;
|
|
76
79
|
virtual void unsubscribeFromKeyboardEvents(
|
|
77
80
|
jsi::Runtime &rt,
|
|
78
81
|
const jsi::Value &listenerId) = 0;
|
|
@@ -91,6 +94,7 @@ class JSI_EXPORT NativeReanimatedModuleSpec : public TurboModule {
|
|
|
91
94
|
jsi::Runtime &rt,
|
|
92
95
|
const jsi::Value &viewTag,
|
|
93
96
|
const jsi::Value &type,
|
|
97
|
+
const jsi::Value &sharedTransitionTag,
|
|
94
98
|
const jsi::Value &config) = 0;
|
|
95
99
|
};
|
|
96
100
|
|