react-native-reanimated 3.0.0-rc.9 → 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 +105 -109
- package/Common/cpp/NativeModules/NativeReanimatedModule.h +19 -12
- package/Common/cpp/NativeModules/NativeReanimatedModuleSpec.cpp +15 -7
- package/Common/cpp/NativeModules/NativeReanimatedModuleSpec.h +6 -2
- package/Common/cpp/ReanimatedRuntime/ReanimatedHermesRuntime.cpp +20 -1
- package/Common/cpp/ReanimatedRuntime/ReanimatedHermesRuntime.h +9 -0
- 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 +9 -63
- package/Common/cpp/SharedItems/Shareables.h +77 -72
- 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 +49 -230
- package/Common/cpp/Tools/RuntimeDecorator.h +0 -2
- 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 +28 -4
- package/ios/LayoutReanimation/REAAnimationsManager.m +216 -61
- 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 +64 -17
- 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 +16 -33
- 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/core.js +33 -14
- package/lib/commonjs/reanimated2/core.js.map +1 -1
- 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 -40
- 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 +71 -32
- package/lib/commonjs/reanimated2/initializers.js.map +1 -1
- 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 +103 -13
- 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 +0 -2
- 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 +17 -9
- 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 +20 -1
- 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 +36 -15
- 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 +16 -32
- 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/core.js +32 -7
- package/lib/module/reanimated2/core.js.map +1 -1
- 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 +46 -43
- 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 +72 -33
- package/lib/module/reanimated2/initializers.js.map +1 -1
- 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 +103 -13
- 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 +0 -2
- 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 -8
- 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 +20 -1
- 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 +36 -12
- 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 +10 -10
- package/{plugin.js → plugin/index.js} +128 -249
- 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 +52 -39
- 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/core.ts +42 -9
- package/src/reanimated2/frameCallback/FrameCallbackRegistryUI.ts +2 -2
- package/src/reanimated2/globals.d.ts +12 -15
- 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 +44 -36
- 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 +76 -35
- package/src/reanimated2/interpolateColor.ts +104 -20
- package/src/reanimated2/jestUtils.ts +1 -1
- package/src/reanimated2/js-reanimated/JSReanimated.ts +98 -15
- 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 +0 -1
- 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 -9
- 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 +24 -1
- 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 +45 -16
- 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
|
@@ -99,7 +99,7 @@ NativeReanimatedModule::NativeReanimatedModule(
|
|
|
99
99
|
};
|
|
100
100
|
|
|
101
101
|
auto makeShareableClone = [this](jsi::Runtime &rt, const jsi::Value &value) {
|
|
102
|
-
return this->makeShareableClone(rt, value);
|
|
102
|
+
return this->makeShareableClone(rt, value, jsi::Value::undefined());
|
|
103
103
|
};
|
|
104
104
|
|
|
105
105
|
auto updateDataSynchronously =
|
|
@@ -120,8 +120,8 @@ NativeReanimatedModule::NativeReanimatedModule(
|
|
|
120
120
|
};
|
|
121
121
|
|
|
122
122
|
auto removeShadowNodeFromRegistry =
|
|
123
|
-
[this](jsi::Runtime &rt, const jsi::Value &
|
|
124
|
-
this->removeShadowNodeFromRegistry(rt,
|
|
123
|
+
[this](jsi::Runtime &rt, const jsi::Value &tag) {
|
|
124
|
+
this->removeShadowNodeFromRegistry(rt, tag);
|
|
125
125
|
};
|
|
126
126
|
|
|
127
127
|
auto measure = [this](jsi::Runtime &rt, const jsi::Value &shadowNodeValue) {
|
|
@@ -154,8 +154,6 @@ NativeReanimatedModule::NativeReanimatedModule(
|
|
|
154
154
|
makeShareableClone,
|
|
155
155
|
updateDataSynchronously,
|
|
156
156
|
platformDepMethodsHolder.getCurrentTime,
|
|
157
|
-
platformDepMethodsHolder.registerSensor,
|
|
158
|
-
platformDepMethodsHolder.unregisterSensor,
|
|
159
157
|
platformDepMethodsHolder.setGestureStateFunction,
|
|
160
158
|
platformDepMethodsHolder.progressLayoutAnimation,
|
|
161
159
|
platformDepMethodsHolder.endLayoutAnimation);
|
|
@@ -246,7 +244,8 @@ jsi::Value NativeReanimatedModule::getDataSynchronously(
|
|
|
246
244
|
|
|
247
245
|
jsi::Value NativeReanimatedModule::makeShareableClone(
|
|
248
246
|
jsi::Runtime &rt,
|
|
249
|
-
const jsi::Value &value
|
|
247
|
+
const jsi::Value &value,
|
|
248
|
+
const jsi::Value &shouldRetainRemote) {
|
|
250
249
|
std::shared_ptr<Shareable> shareable;
|
|
251
250
|
if (value.isObject()) {
|
|
252
251
|
auto object = value.asObject(rt);
|
|
@@ -258,18 +257,25 @@ jsi::Value NativeReanimatedModule::makeShareableClone(
|
|
|
258
257
|
shareable = std::make_shared<ShareableRemoteFunction>(
|
|
259
258
|
runtimeHelper, rt, object.asFunction(rt));
|
|
260
259
|
} else if (object.isArray(rt)) {
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
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));
|
|
268
269
|
} else {
|
|
269
|
-
|
|
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
|
+
}
|
|
270
276
|
}
|
|
271
277
|
} else if (value.isString()) {
|
|
272
|
-
shareable = std::make_shared<ShareableString>(
|
|
278
|
+
shareable = std::make_shared<ShareableString>(value.asString(rt).utf8(rt));
|
|
273
279
|
} else if (value.isUndefined()) {
|
|
274
280
|
shareable = std::make_shared<ShareableScalar>();
|
|
275
281
|
} else if (value.isNull()) {
|
|
@@ -278,6 +284,13 @@ jsi::Value NativeReanimatedModule::makeShareableClone(
|
|
|
278
284
|
shareable = std::make_shared<ShareableScalar>(value.getBool());
|
|
279
285
|
} else if (value.isNumber()) {
|
|
280
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));
|
|
281
294
|
} else {
|
|
282
295
|
throw std::runtime_error("attempted to convert an unsupported value type");
|
|
283
296
|
}
|
|
@@ -288,19 +301,21 @@ jsi::Value NativeReanimatedModule::registerEventHandler(
|
|
|
288
301
|
jsi::Runtime &rt,
|
|
289
302
|
const jsi::Value &eventHash,
|
|
290
303
|
const jsi::Value &worklet) {
|
|
291
|
-
static
|
|
304
|
+
static uint64_t EVENT_HANDLER_ID = 1;
|
|
292
305
|
|
|
293
|
-
|
|
306
|
+
uint64_t newRegistrationId = EVENT_HANDLER_ID++;
|
|
294
307
|
auto eventName = eventHash.asString(rt).utf8(rt);
|
|
295
308
|
auto handlerShareable = extractShareableOrThrow(rt, worklet);
|
|
296
309
|
|
|
297
310
|
scheduler->scheduleOnUI([=] {
|
|
298
311
|
jsi::Runtime &rt = *runtimeHelper->uiRuntime();
|
|
299
|
-
auto handlerFunction =
|
|
300
|
-
handlerShareable->getJSValue(rt).asObject(rt).asFunction(rt);
|
|
312
|
+
auto handlerFunction = handlerShareable->getJSValue(rt);
|
|
301
313
|
auto handler = std::make_shared<WorkletEventHandler>(
|
|
302
|
-
|
|
303
|
-
|
|
314
|
+
runtimeHelper,
|
|
315
|
+
newRegistrationId,
|
|
316
|
+
eventName,
|
|
317
|
+
std::move(handlerFunction));
|
|
318
|
+
eventHandlerRegistry->registerEventHandler(std::move(handler));
|
|
304
319
|
});
|
|
305
320
|
|
|
306
321
|
return jsi::Value(static_cast<double>(newRegistrationId));
|
|
@@ -309,7 +324,7 @@ jsi::Value NativeReanimatedModule::registerEventHandler(
|
|
|
309
324
|
void NativeReanimatedModule::unregisterEventHandler(
|
|
310
325
|
jsi::Runtime &rt,
|
|
311
326
|
const jsi::Value ®istrationId) {
|
|
312
|
-
|
|
327
|
+
uint64_t id = registrationId.asNumber();
|
|
313
328
|
scheduler->scheduleOnUI(
|
|
314
329
|
[=] { eventHandlerRegistry->unregisterEventHandler(id); });
|
|
315
330
|
}
|
|
@@ -369,37 +384,22 @@ jsi::Value NativeReanimatedModule::configureLayoutAnimation(
|
|
|
369
384
|
jsi::Runtime &rt,
|
|
370
385
|
const jsi::Value &viewTag,
|
|
371
386
|
const jsi::Value &type,
|
|
387
|
+
const jsi::Value &sharedTransitionTag,
|
|
372
388
|
const jsi::Value &config) {
|
|
373
389
|
layoutAnimationsManager_.configureAnimation(
|
|
374
390
|
viewTag.asNumber(),
|
|
375
|
-
type.
|
|
391
|
+
static_cast<LayoutAnimationType>(type.asNumber()),
|
|
392
|
+
sharedTransitionTag.asString(rt).utf8(rt),
|
|
376
393
|
extractShareableOrThrow(rt, config));
|
|
377
394
|
return jsi::Value::undefined();
|
|
378
395
|
}
|
|
379
396
|
|
|
380
397
|
void NativeReanimatedModule::onEvent(
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
jsi::Value
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
#endif
|
|
387
|
-
/**/) {
|
|
388
|
-
try {
|
|
389
|
-
#ifdef RCT_NEW_ARCH_ENABLED
|
|
390
|
-
eventHandlerRegistry->processEvent(*runtime, eventName, payload);
|
|
391
|
-
#else
|
|
392
|
-
eventHandlerRegistry->processEvent(*runtime, eventName, eventAsString);
|
|
393
|
-
#endif
|
|
394
|
-
} catch (std::exception &e) {
|
|
395
|
-
std::string str = e.what();
|
|
396
|
-
this->errorHandler->setError(str);
|
|
397
|
-
this->errorHandler->raise();
|
|
398
|
-
} catch (...) {
|
|
399
|
-
std::string str = "OnEvent error";
|
|
400
|
-
this->errorHandler->setError(str);
|
|
401
|
-
this->errorHandler->raise();
|
|
402
|
-
}
|
|
398
|
+
double eventTimestamp,
|
|
399
|
+
const std::string &eventName,
|
|
400
|
+
const jsi::Value &payload) {
|
|
401
|
+
eventHandlerRegistry->processEvent(
|
|
402
|
+
*runtime, eventTimestamp, eventName, payload);
|
|
403
403
|
}
|
|
404
404
|
|
|
405
405
|
bool NativeReanimatedModule::isAnyHandlerWaitingForEvent(
|
|
@@ -415,20 +415,10 @@ void NativeReanimatedModule::maybeRequestRender() {
|
|
|
415
415
|
}
|
|
416
416
|
|
|
417
417
|
void NativeReanimatedModule::onRender(double timestampMs) {
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
callback(timestampMs);
|
|
423
|
-
}
|
|
424
|
-
} catch (std::exception &e) {
|
|
425
|
-
std::string str = e.what();
|
|
426
|
-
this->errorHandler->setError(str);
|
|
427
|
-
this->errorHandler->raise();
|
|
428
|
-
} catch (...) {
|
|
429
|
-
std::string str = "OnRender error";
|
|
430
|
-
this->errorHandler->setError(str);
|
|
431
|
-
this->errorHandler->raise();
|
|
418
|
+
std::vector<FrameCallback> callbacks = frameCallbacks;
|
|
419
|
+
frameCallbacks.clear();
|
|
420
|
+
for (auto &callback : callbacks) {
|
|
421
|
+
callback(timestampMs);
|
|
432
422
|
}
|
|
433
423
|
}
|
|
434
424
|
|
|
@@ -436,9 +426,15 @@ jsi::Value NativeReanimatedModule::registerSensor(
|
|
|
436
426
|
jsi::Runtime &rt,
|
|
437
427
|
const jsi::Value &sensorType,
|
|
438
428
|
const jsi::Value &interval,
|
|
429
|
+
const jsi::Value &iosReferenceFrame,
|
|
439
430
|
const jsi::Value &sensorDataHandler) {
|
|
440
431
|
return animatedSensorModule.registerSensor(
|
|
441
|
-
rt,
|
|
432
|
+
rt,
|
|
433
|
+
runtimeHelper,
|
|
434
|
+
sensorType,
|
|
435
|
+
interval,
|
|
436
|
+
iosReferenceFrame,
|
|
437
|
+
sensorDataHandler);
|
|
442
438
|
}
|
|
443
439
|
|
|
444
440
|
void NativeReanimatedModule::unregisterSensor(
|
|
@@ -447,6 +443,10 @@ void NativeReanimatedModule::unregisterSensor(
|
|
|
447
443
|
animatedSensorModule.unregisterSensor(sensorId);
|
|
448
444
|
}
|
|
449
445
|
|
|
446
|
+
void NativeReanimatedModule::cleanupSensors() {
|
|
447
|
+
animatedSensorModule.unregisterAllSensors();
|
|
448
|
+
}
|
|
449
|
+
|
|
450
450
|
#ifdef RCT_NEW_ARCH_ENABLED
|
|
451
451
|
bool NativeReanimatedModule::isThereAnyLayoutProp(
|
|
452
452
|
jsi::Runtime &rt,
|
|
@@ -463,24 +463,20 @@ bool NativeReanimatedModule::isThereAnyLayoutProp(
|
|
|
463
463
|
}
|
|
464
464
|
return false;
|
|
465
465
|
}
|
|
466
|
+
#endif // RCT_NEW_ARCH_ENABLED
|
|
466
467
|
|
|
467
468
|
bool NativeReanimatedModule::handleEvent(
|
|
468
469
|
const std::string &eventName,
|
|
469
|
-
jsi::Value
|
|
470
|
+
const jsi::Value &payload,
|
|
470
471
|
double currentTime) {
|
|
471
|
-
|
|
472
|
-
jsi::Object global = rt.global();
|
|
473
|
-
jsi::String eventTimestampName =
|
|
474
|
-
jsi::String::createFromAscii(rt, "_eventTimestamp");
|
|
475
|
-
global.setProperty(rt, eventTimestampName, currentTime);
|
|
476
|
-
onEvent(eventName, std::move(payload));
|
|
477
|
-
global.setProperty(rt, eventTimestampName, jsi::Value::undefined());
|
|
472
|
+
onEvent(currentTime, eventName, payload);
|
|
478
473
|
|
|
479
474
|
// TODO: return true if Reanimated successfully handled the event
|
|
480
475
|
// to avoid sending it to JavaScript
|
|
481
476
|
return false;
|
|
482
477
|
}
|
|
483
478
|
|
|
479
|
+
#ifdef RCT_NEW_ARCH_ENABLED
|
|
484
480
|
bool NativeReanimatedModule::handleRawEvent(
|
|
485
481
|
const RawEvent &rawEvent,
|
|
486
482
|
double currentTime) {
|
|
@@ -504,7 +500,13 @@ bool NativeReanimatedModule::handleRawEvent(
|
|
|
504
500
|
jsi::Runtime &rt = *runtime.get();
|
|
505
501
|
jsi::Value payload = payloadFactory(rt);
|
|
506
502
|
|
|
507
|
-
|
|
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;
|
|
508
510
|
}
|
|
509
511
|
|
|
510
512
|
void NativeReanimatedModule::updateProps(
|
|
@@ -543,36 +545,33 @@ void NativeReanimatedModule::performOperations() {
|
|
|
543
545
|
jsi::Runtime &rt = *runtime.get();
|
|
544
546
|
|
|
545
547
|
shadowTreeRegistry.visit(surfaceId_, [&](ShadowTree const &shadowTree) {
|
|
548
|
+
auto lock = newestShadowNodesRegistry_->createLock();
|
|
549
|
+
|
|
546
550
|
shadowTree.commit([&](RootShadowNode const &oldRootShadowNode) {
|
|
547
551
|
auto rootNode = oldRootShadowNode.ShadowNode::clone(ShadowNodeFragment{});
|
|
548
552
|
|
|
549
553
|
ShadowTreeCloner shadowTreeCloner{
|
|
550
554
|
newestShadowNodesRegistry_, uiManager_, surfaceId_};
|
|
551
555
|
|
|
552
|
-
{
|
|
553
|
-
|
|
554
|
-
|
|
556
|
+
for (const auto &pair : copiedOperationsQueue) {
|
|
557
|
+
const ShadowNodeFamily &family = pair.first->getFamily();
|
|
558
|
+
react_native_assert(family.getSurfaceId() == surfaceId_);
|
|
555
559
|
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
react_native_assert(family.getSurfaceId() == surfaceId_);
|
|
560
|
+
auto newRootNode = shadowTreeCloner.cloneWithNewProps(
|
|
561
|
+
rootNode, family, RawProps(rt, *pair.second));
|
|
559
562
|
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
// still tries to animate it, let's skip update for this specific
|
|
566
|
-
// component
|
|
567
|
-
continue;
|
|
568
|
-
}
|
|
569
|
-
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;
|
|
570
568
|
}
|
|
569
|
+
rootNode = newRootNode;
|
|
570
|
+
}
|
|
571
571
|
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
}
|
|
572
|
+
// remove ShadowNodes and its ancestors from NewestShadowNodesRegistry
|
|
573
|
+
for (auto tag : copiedTagsToRemove) {
|
|
574
|
+
newestShadowNodesRegistry_->remove(tag);
|
|
576
575
|
}
|
|
577
576
|
|
|
578
577
|
shadowTreeCloner.updateYogaChildren();
|
|
@@ -584,9 +583,8 @@ void NativeReanimatedModule::performOperations() {
|
|
|
584
583
|
|
|
585
584
|
void NativeReanimatedModule::removeShadowNodeFromRegistry(
|
|
586
585
|
jsi::Runtime &rt,
|
|
587
|
-
const jsi::Value &
|
|
588
|
-
|
|
589
|
-
tagsToRemove_.push_back(shadowNode->getTag());
|
|
586
|
+
const jsi::Value &tag) {
|
|
587
|
+
tagsToRemove_.push_back(tag.asNumber());
|
|
590
588
|
}
|
|
591
589
|
|
|
592
590
|
void NativeReanimatedModule::dispatchCommand(
|
|
@@ -597,9 +595,7 @@ void NativeReanimatedModule::dispatchCommand(
|
|
|
597
595
|
ShadowNode::Shared shadowNode = shadowNodeFromValue(rt, shadowNodeValue);
|
|
598
596
|
std::string commandName = stringFromValue(rt, commandNameValue);
|
|
599
597
|
folly::dynamic args = commandArgsFromValue(rt, argsValue);
|
|
600
|
-
|
|
601
|
-
// TODO: use uiManager_->dispatchCommand once it's public
|
|
602
|
-
UIManager_dispatchCommand(uiManager_, shadowNode, commandName, args);
|
|
598
|
+
uiManager_->dispatchCommand(shadowNode, commandName, args);
|
|
603
599
|
}
|
|
604
600
|
|
|
605
601
|
jsi::Value NativeReanimatedModule::measure(
|
|
@@ -608,11 +604,8 @@ jsi::Value NativeReanimatedModule::measure(
|
|
|
608
604
|
// based on implementation from UIManagerBinding.cpp
|
|
609
605
|
|
|
610
606
|
auto shadowNode = shadowNodeFromValue(rt, shadowNodeValue);
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
// *shadowNode, nullptr, {/* .includeTransform = */ true});
|
|
614
|
-
auto layoutMetrics = UIManager_getRelativeLayoutMetrics(
|
|
615
|
-
uiManager_, *shadowNode, nullptr, {/* .includeTransform = */ true});
|
|
607
|
+
auto layoutMetrics = uiManager_->getRelativeLayoutMetrics(
|
|
608
|
+
*shadowNode, nullptr, {/* .includeTransform = */ true});
|
|
616
609
|
|
|
617
610
|
if (layoutMetrics == EmptyLayoutMetrics) {
|
|
618
611
|
// Originally, in this case React Native returns `{0, 0, 0, 0, 0, 0}`, most
|
|
@@ -626,7 +619,8 @@ jsi::Value NativeReanimatedModule::measure(
|
|
|
626
619
|
|
|
627
620
|
auto layoutableShadowNode =
|
|
628
621
|
traitCast<LayoutableShadowNode const *>(newestCloneOfShadowNode.get());
|
|
629
|
-
facebook::react::Point originRelativeToParent =
|
|
622
|
+
facebook::react::Point originRelativeToParent =
|
|
623
|
+
layoutableShadowNode != nullptr
|
|
630
624
|
? layoutableShadowNode->getLayoutMetrics().frame.origin
|
|
631
625
|
: facebook::react::Point();
|
|
632
626
|
|
|
@@ -661,15 +655,17 @@ void NativeReanimatedModule::setNewestShadowNodesRegistry(
|
|
|
661
655
|
|
|
662
656
|
jsi::Value NativeReanimatedModule::subscribeForKeyboardEvents(
|
|
663
657
|
jsi::Runtime &rt,
|
|
664
|
-
const jsi::Value &handlerWorklet
|
|
658
|
+
const jsi::Value &handlerWorklet,
|
|
659
|
+
const jsi::Value &isStatusBarTranslucent) {
|
|
665
660
|
auto shareableHandler = extractShareableOrThrow(rt, handlerWorklet);
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
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());
|
|
673
669
|
}
|
|
674
670
|
|
|
675
671
|
void NativeReanimatedModule::unsubscribeFromKeyboardEvents(
|
|
@@ -52,8 +52,10 @@ class NativeReanimatedModule : public NativeReanimatedModuleSpec,
|
|
|
52
52
|
const jsi::Value &callGuard,
|
|
53
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
|
|
|
@@ -30,7 +30,8 @@ class JSI_EXPORT NativeReanimatedModuleSpec : public TurboModule {
|
|
|
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
|
|
|
@@ -42,6 +42,11 @@ class HermesExecutorRuntimeAdapter
|
|
|
42
42
|
thread_->quitSynchronous();
|
|
43
43
|
}
|
|
44
44
|
|
|
45
|
+
#if REACT_NATIVE_MINOR_VERSION >= 71
|
|
46
|
+
facebook::hermes::HermesRuntime &getRuntime() override {
|
|
47
|
+
return hermesRuntime_;
|
|
48
|
+
}
|
|
49
|
+
#else
|
|
45
50
|
facebook::jsi::Runtime &getRuntime() override {
|
|
46
51
|
return hermesRuntime_;
|
|
47
52
|
}
|
|
@@ -49,6 +54,7 @@ class HermesExecutorRuntimeAdapter
|
|
|
49
54
|
facebook::hermes::debugger::Debugger &getDebugger() override {
|
|
50
55
|
return hermesRuntime_.getDebugger();
|
|
51
56
|
}
|
|
57
|
+
#endif // REACT_NATIVE_MINOR_VERSION
|
|
52
58
|
|
|
53
59
|
// This is not empty in the original implementation, but we decided to tickle
|
|
54
60
|
// the runtime by running a small piece of code on every frame as using this
|
|
@@ -73,8 +79,13 @@ ReanimatedHermesRuntime::ReanimatedHermesRuntime(
|
|
|
73
79
|
#if HERMES_ENABLE_DEBUGGER
|
|
74
80
|
auto adapter =
|
|
75
81
|
std::make_unique<HermesExecutorRuntimeAdapter>(*runtime_, jsQueue);
|
|
82
|
+
#if REACT_NATIVE_MINOR_VERSION >= 71
|
|
83
|
+
debugToken_ = facebook::hermes::inspector::chrome::enableDebugging(
|
|
84
|
+
std::move(adapter), "Reanimated Runtime");
|
|
85
|
+
#else
|
|
76
86
|
facebook::hermes::inspector::chrome::enableDebugging(
|
|
77
87
|
std::move(adapter), "Reanimated Runtime");
|
|
88
|
+
#endif // REACT_NATIVE_MINOR_VERSION
|
|
78
89
|
#else
|
|
79
90
|
// This is required by iOS, because there is an assertion in the destructor
|
|
80
91
|
// that the thread was indeed `quit` before
|
|
@@ -103,8 +114,12 @@ ReanimatedHermesRuntime::ReanimatedHermesRuntime(
|
|
|
103
114
|
sourceMap = std::make_shared<const jsi::StringBuffer>(
|
|
104
115
|
args[2].asString(rt).utf8(rt));
|
|
105
116
|
}
|
|
117
|
+
#if REACT_NATIVE_MINOR_VERSION >= 65
|
|
106
118
|
return wrappedRuntime->evaluateJavaScriptWithSourceMap(
|
|
107
119
|
code, sourceMap, sourceURL);
|
|
120
|
+
#else
|
|
121
|
+
return wrappedRuntime->evaluateJavaScript(code, sourceURL);
|
|
122
|
+
#endif
|
|
108
123
|
});
|
|
109
124
|
runtime_->global().setProperty(
|
|
110
125
|
*runtime_, "evalWithSourceMap", evalWithSourceMap);
|
|
@@ -114,8 +129,12 @@ ReanimatedHermesRuntime::ReanimatedHermesRuntime(
|
|
|
114
129
|
ReanimatedHermesRuntime::~ReanimatedHermesRuntime() {
|
|
115
130
|
#if HERMES_ENABLE_DEBUGGER
|
|
116
131
|
// We have to disable debugging before the runtime is destroyed.
|
|
132
|
+
#if REACT_NATIVE_MINOR_VERSION >= 71
|
|
133
|
+
facebook::hermes::inspector::chrome::disableDebugging(debugToken_);
|
|
134
|
+
#else
|
|
117
135
|
facebook::hermes::inspector::chrome::disableDebugging(*runtime_);
|
|
118
|
-
#endif
|
|
136
|
+
#endif // REACT_NATIVE_MINOR_VERSION
|
|
137
|
+
#endif // HERMES_ENABLE_DEBUGGER
|
|
119
138
|
}
|
|
120
139
|
|
|
121
140
|
} // namespace reanimated
|
|
@@ -25,6 +25,10 @@
|
|
|
25
25
|
#include <hermes/hermes.h>
|
|
26
26
|
#endif
|
|
27
27
|
|
|
28
|
+
#if REACT_NATIVE_MINOR_VERSION >= 71
|
|
29
|
+
#include <hermes/inspector/chrome/Registration.h>
|
|
30
|
+
#endif
|
|
31
|
+
|
|
28
32
|
namespace reanimated {
|
|
29
33
|
|
|
30
34
|
using namespace facebook;
|
|
@@ -118,6 +122,11 @@ class ReanimatedHermesRuntime
|
|
|
118
122
|
private:
|
|
119
123
|
std::unique_ptr<facebook::hermes::HermesRuntime> runtime_;
|
|
120
124
|
ReanimatedReentrancyCheck reentrancyCheck_;
|
|
125
|
+
#if HERMES_ENABLE_DEBUGGER
|
|
126
|
+
#if REACT_NATIVE_MINOR_VERSION >= 71
|
|
127
|
+
facebook::hermes::inspector::chrome::DebugSessionToken debugToken_;
|
|
128
|
+
#endif // REACT_NATIVE_MINOR_VERSION >= 71
|
|
129
|
+
#endif // HERMES_ENABLE_DEBUGGER
|
|
121
130
|
};
|
|
122
131
|
|
|
123
132
|
} // namespace reanimated
|
|
@@ -11,8 +11,12 @@
|
|
|
11
11
|
#elif JS_RUNTIME_V8
|
|
12
12
|
#include <v8runtime/V8RuntimeFactory.h>
|
|
13
13
|
#else
|
|
14
|
+
#if REACT_NATIVE_MINOR_VERSION >= 71
|
|
15
|
+
#include <jsc/JSCRuntime.h>
|
|
16
|
+
#else
|
|
14
17
|
#include <jsi/JSCRuntime.h>
|
|
15
|
-
#endif
|
|
18
|
+
#endif // REACT_NATIVE_MINOR_VERSION
|
|
19
|
+
#endif // JS_RUNTIME
|
|
16
20
|
|
|
17
21
|
namespace reanimated {
|
|
18
22
|
|