react-native-reanimated 3.0.0-rc.1 → 3.0.0-rc.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Common/cpp/AnimatedSensor/AnimatedSensorModule.cpp +35 -37
- package/Common/cpp/{headers/AnimatedSensor → AnimatedSensor}/AnimatedSensorModule.h +4 -3
- package/Common/cpp/Fabric/FabricUtils.cpp +4 -103
- package/Common/cpp/{headers/Fabric → Fabric}/FabricUtils.h +3 -24
- package/Common/cpp/Fabric/ReanimatedUIManagerBinding.cpp +56 -37
- package/Common/cpp/{headers/Fabric → Fabric}/ReanimatedUIManagerBinding.h +0 -0
- package/Common/cpp/{headers/Fabric → Fabric}/ShadowTreeCloner.h +1 -1
- package/Common/cpp/LayoutAnimations/LayoutAnimationsManager.cpp +76 -0
- package/Common/cpp/LayoutAnimations/LayoutAnimationsManager.h +41 -0
- package/Common/cpp/NativeModules/NativeReanimatedModule.cpp +205 -191
- package/Common/cpp/{headers/NativeModules → NativeModules}/NativeReanimatedModule.h +42 -28
- package/Common/cpp/NativeModules/NativeReanimatedModuleSpec.cpp +36 -29
- package/Common/cpp/{headers/NativeModules → NativeModules}/NativeReanimatedModuleSpec.h +20 -13
- package/Common/cpp/ReanimatedRuntime/ReanimatedHermesRuntime.cpp +138 -0
- package/Common/cpp/ReanimatedRuntime/ReanimatedHermesRuntime.h +134 -0
- package/Common/cpp/ReanimatedRuntime/ReanimatedRuntime.cpp +55 -0
- package/Common/cpp/ReanimatedRuntime/ReanimatedRuntime.h +28 -0
- package/Common/cpp/ReanimatedRuntime/RuntimeInitialization.md +194 -0
- package/Common/cpp/{headers/Registries → Registries}/EventHandlerRegistry.h +0 -0
- package/Common/cpp/{headers/Registries → Registries}/NewestShadowNodesRegistry.h +0 -0
- package/Common/cpp/{headers/SharedItems → SharedItems}/RuntimeManager.h +1 -34
- package/Common/cpp/SharedItems/Shareables.cpp +144 -0
- package/Common/cpp/SharedItems/Shareables.h +470 -0
- package/Common/cpp/{headers/SharedItems → SharedItems}/SharedParent.h +0 -0
- package/Common/cpp/{headers/SpecTools → SpecTools}/ErrorHandler.h +0 -0
- package/Common/cpp/{headers/Tools → Tools}/FeaturesConfig.h +0 -0
- package/Common/cpp/{headers/Tools → Tools}/PlatformDepMethodsHolder.h +6 -0
- package/Common/cpp/{headers/Tools → Tools}/ReanimatedHiddenHeaders.h +1 -1
- package/Common/cpp/Tools/ReanimatedVersion.cpp +17 -0
- package/Common/cpp/Tools/ReanimatedVersion.h +11 -0
- package/Common/cpp/Tools/RuntimeDecorator.cpp +80 -50
- package/Common/cpp/{headers/Tools → Tools}/RuntimeDecorator.h +13 -3
- package/Common/cpp/Tools/Scheduler.cpp +10 -0
- package/Common/cpp/{headers/Tools → Tools}/Scheduler.h +0 -0
- package/Common/cpp/Tools/SingleInstanceChecker.h +58 -0
- package/Common/cpp/{headers/Tools → Tools}/WorkletEventHandler.h +0 -0
- package/RNReanimated.podspec +22 -85
- package/android/CMakeLists.txt +199 -209
- package/android/build.gradle +708 -339
- package/android/gradle/wrapper/gradle-wrapper.properties +1 -1
- package/android/src/fabric/java/com/swmansion/reanimated/NativeProxy.java +26 -33
- package/android/src/main/cpp/AndroidErrorHandler.cpp +3 -4
- package/android/src/main/cpp/{headers/AndroidErrorHandler.h → AndroidErrorHandler.h} +1 -4
- package/android/src/main/cpp/AndroidLogger.cpp +4 -1
- package/android/src/main/cpp/{headers/AndroidLogger.h → AndroidLogger.h} +0 -0
- package/android/src/main/cpp/{headers/AndroidScheduler.h → AndroidScheduler.h} +0 -0
- package/android/src/main/cpp/{headers/JNIHelper.h → JNIHelper.h} +0 -0
- package/android/src/main/cpp/LayoutAnimations.cpp +39 -57
- package/android/src/main/cpp/LayoutAnimations.h +56 -0
- package/android/src/main/cpp/NativeProxy.cpp +69 -46
- package/android/src/main/cpp/{headers/NativeProxy.h → NativeProxy.h} +4 -2
- package/android/src/main/cpp/{headers/TurboModule.h → TurboModule.h} +0 -0
- package/android/src/main/java/com/swmansion/reanimated/NodesManager.java +1 -1
- package/android/src/main/java/com/swmansion/reanimated/ReanimatedMessageQueueThreadBase.java +72 -0
- package/android/src/main/java/com/swmansion/reanimated/ReanimatedPackage.java +5 -4
- package/android/src/main/java/com/swmansion/reanimated/keyboardObserver/ReanimatedKeyboardEventListener.java +2 -1
- package/android/src/main/java/com/swmansion/reanimated/layoutReanimation/AnimationsManager.java +240 -222
- package/android/src/main/java/com/swmansion/reanimated/layoutReanimation/LayoutAnimations.java +7 -5
- package/android/src/main/java/com/swmansion/reanimated/layoutReanimation/NativeMethodsHolder.java +5 -3
- package/android/src/main/java/com/swmansion/reanimated/layoutReanimation/ViewHierarchyObserver.java +1 -1
- package/android/src/main/java/com/swmansion/reanimated/sensor/ReanimatedSensorContainer.java +1 -1
- package/android/src/paper/java/com/swmansion/reanimated/NativeProxy.java +27 -14
- package/android/src/reactNativeVersionPatch/ReanimatedUIManager/70/com/swmansion/reanimated/ReanimatedUIManagerFactory.java +16 -0
- package/android/src/{main/java → reactNativeVersionPatch/ReanimatedUIManager/70}/com/swmansion/reanimated/layoutReanimation/ReanimatedUIManager.java +1 -1
- package/android/src/reactNativeVersionPatch/ReanimatedUIManager/latest/com/swmansion/reanimated/ReanimatedUIManagerFactory.java +63 -0
- package/android/src/reactNativeVersionPatch/ReanimatedUIManager/latest/com/swmansion/reanimated/layoutReanimation/ReanimatedUIManager.java +271 -0
- package/android/{rnVersionPatch/62 → src/reactNativeVersionPatch/UIImplementation/64/com/swmansion/reanimated}/layoutReanimation/ReanimatedUIImplementation.java +0 -0
- package/android/src/{main/java → reactNativeVersionPatch/UIImplementation/latest}/com/swmansion/reanimated/layoutReanimation/ReanimatedUIImplementation.java +0 -0
- package/android/src/reactNativeVersionPatch/messageQueueThread/67/com/swmansion/reanimated/ReanimatedMessageQueueThread.java +12 -0
- package/android/src/reactNativeVersionPatch/messageQueueThread/latest/com/swmansion/reanimated/ReanimatedMessageQueueThread.java +12 -0
- package/android/{rnVersionPatch/62 → src/reactNativeVersionPatch/nativeHierarchyManager/62/com/swmansion/reanimated}/layoutReanimation/ReanimatedNativeHierarchyManager.java +8 -44
- package/android/src/{main/java → reactNativeVersionPatch/nativeHierarchyManager/latest}/com/swmansion/reanimated/layoutReanimation/ReanimatedNativeHierarchyManager.java +23 -91
- package/ios/LayoutReanimation/REAAnimationsManager.h +20 -8
- package/ios/LayoutReanimation/REAAnimationsManager.m +251 -160
- package/ios/LayoutReanimation/REAUIManager.mm +36 -83
- package/ios/REAModule.mm +35 -5
- package/ios/keyboardObserver/REAKeyboardEventObserver.m +1 -1
- package/ios/native/NativeProxy.mm +60 -75
- package/ios/native/REAInitializer.h +2 -2
- package/ios/native/REAInitializer.mm +6 -2
- package/ios/native/REAMessageThread.h +22 -0
- package/ios/native/REAMessageThread.mm +38 -0
- package/ios/native/UIResponder+Reanimated.mm +1 -1
- package/lib/commonjs/createAnimatedComponent.js +33 -34
- 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/NativeMethods.js +67 -31
- package/lib/commonjs/reanimated2/NativeMethods.js.map +1 -1
- package/lib/commonjs/reanimated2/NativeReanimated/NativeReanimated.js +32 -23
- package/lib/commonjs/reanimated2/NativeReanimated/NativeReanimated.js.map +1 -1
- package/lib/commonjs/reanimated2/ViewDescriptorsSet.js +27 -55
- package/lib/commonjs/reanimated2/ViewDescriptorsSet.js.map +1 -1
- package/lib/commonjs/reanimated2/WorkletEventHandler.js +5 -3
- package/lib/commonjs/reanimated2/WorkletEventHandler.js.map +1 -1
- package/lib/commonjs/reanimated2/animation/delay.js +0 -12
- package/lib/commonjs/reanimated2/animation/delay.js.map +1 -1
- package/lib/commonjs/reanimated2/animation/repeat.js +0 -24
- package/lib/commonjs/reanimated2/animation/repeat.js.map +1 -1
- package/lib/commonjs/reanimated2/animation/sequence.js +0 -12
- package/lib/commonjs/reanimated2/animation/sequence.js.map +1 -1
- package/lib/commonjs/reanimated2/animation/util.js +14 -14
- package/lib/commonjs/reanimated2/animation/util.js.map +1 -1
- package/lib/commonjs/reanimated2/commonTypes.js +7 -0
- 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 +77 -243
- 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/FrameCallbackRegistryJS.js +4 -4
- package/lib/commonjs/reanimated2/frameCallback/FrameCallbackRegistryJS.js.map +1 -1
- package/lib/commonjs/reanimated2/frameCallback/FrameCallbackRegistryUI.js +51 -19
- 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 +8 -0
- package/lib/commonjs/reanimated2/hook/index.js.map +1 -1
- package/lib/commonjs/reanimated2/hook/useAnimatedKeyboard.js +15 -9
- package/lib/commonjs/reanimated2/hook/useAnimatedKeyboard.js.map +1 -1
- package/lib/commonjs/reanimated2/hook/useAnimatedRef.js +18 -8
- package/lib/commonjs/reanimated2/hook/useAnimatedRef.js.map +1 -1
- package/lib/commonjs/reanimated2/hook/useAnimatedScrollHandler.js.map +1 -1
- package/lib/commonjs/reanimated2/hook/useAnimatedSensor.js +27 -36
- package/lib/commonjs/reanimated2/hook/useAnimatedSensor.js.map +1 -1
- package/lib/commonjs/reanimated2/hook/useAnimatedStyle.js +23 -59
- package/lib/commonjs/reanimated2/hook/useAnimatedStyle.js.map +1 -1
- package/lib/commonjs/reanimated2/hook/useFrameCallback.js.map +1 -1
- package/lib/commonjs/reanimated2/hook/useScrollViewOffset.js +33 -0
- package/lib/commonjs/reanimated2/hook/useScrollViewOffset.js.map +1 -0
- package/lib/commonjs/reanimated2/hook/useSharedValue.js +3 -2
- package/lib/commonjs/reanimated2/hook/useSharedValue.js.map +1 -1
- package/lib/commonjs/reanimated2/hook/utils.js.map +1 -1
- package/lib/commonjs/reanimated2/initializers.js +157 -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 +25 -42
- package/lib/commonjs/reanimated2/jestUtils.js.map +1 -1
- package/lib/commonjs/reanimated2/js-reanimated/JSReanimated.js +14 -103
- package/lib/commonjs/reanimated2/js-reanimated/JSReanimated.js.map +1 -1
- package/lib/commonjs/reanimated2/js-reanimated/global.js +4 -7
- package/lib/commonjs/reanimated2/js-reanimated/global.js.map +1 -1
- package/lib/commonjs/reanimated2/js-reanimated/index.js +5 -0
- package/lib/commonjs/reanimated2/js-reanimated/index.js.map +1 -1
- package/lib/commonjs/reanimated2/layoutReanimation/animationBuilder/commonTypes.js.map +1 -1
- package/lib/commonjs/reanimated2/layoutReanimation/animationBuilder/index.js.map +1 -1
- package/lib/commonjs/reanimated2/layoutReanimation/animationsManager.js +87 -0
- package/lib/commonjs/reanimated2/layoutReanimation/animationsManager.js.map +1 -0
- package/lib/commonjs/reanimated2/layoutReanimation/defaultAnimations/Bounce.js +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 +1 -1
- package/lib/commonjs/reanimated2/layoutReanimation/index.js.map +1 -1
- package/lib/commonjs/reanimated2/mappers.js +186 -0
- package/lib/commonjs/reanimated2/mappers.js.map +1 -0
- package/lib/commonjs/reanimated2/mock.js +26 -0
- package/lib/commonjs/reanimated2/mock.js.map +1 -1
- package/lib/commonjs/reanimated2/mutables.js +173 -0
- package/lib/commonjs/reanimated2/mutables.js.map +1 -0
- package/lib/commonjs/reanimated2/platform-specific/checkVersion.js +33 -0
- package/lib/commonjs/reanimated2/platform-specific/checkVersion.js.map +1 -0
- package/lib/commonjs/reanimated2/platform-specific/checkVersion.web.js +15 -0
- package/lib/commonjs/reanimated2/platform-specific/checkVersion.web.js.map +1 -0
- package/lib/commonjs/reanimated2/shareables.js +159 -0
- package/lib/commonjs/reanimated2/shareables.js.map +1 -0
- package/lib/commonjs/reanimated2/threads.js +68 -0
- package/lib/commonjs/reanimated2/threads.js.map +1 -0
- package/lib/commonjs/reanimated2/time.js +55 -0
- package/lib/commonjs/reanimated2/time.js.map +1 -0
- package/lib/commonjs/reanimated2/utils.js +12 -3
- package/lib/commonjs/reanimated2/utils.js.map +1 -1
- package/lib/commonjs/reanimated2/valueSetter.js +81 -0
- package/lib/commonjs/reanimated2/valueSetter.js.map +1 -0
- package/lib/module/createAnimatedComponent.js +33 -34
- 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/NativeMethods.js +68 -30
- package/lib/module/reanimated2/NativeMethods.js.map +1 -1
- package/lib/module/reanimated2/NativeReanimated/NativeReanimated.js +31 -23
- package/lib/module/reanimated2/NativeReanimated/NativeReanimated.js.map +1 -1
- package/lib/module/reanimated2/ViewDescriptorsSet.js +27 -53
- package/lib/module/reanimated2/ViewDescriptorsSet.js.map +1 -1
- package/lib/module/reanimated2/WorkletEventHandler.js +4 -3
- package/lib/module/reanimated2/WorkletEventHandler.js.map +1 -1
- package/lib/module/reanimated2/animation/delay.js +0 -10
- package/lib/module/reanimated2/animation/delay.js.map +1 -1
- package/lib/module/reanimated2/animation/repeat.js +0 -20
- package/lib/module/reanimated2/animation/repeat.js.map +1 -1
- package/lib/module/reanimated2/animation/sequence.js +0 -10
- package/lib/module/reanimated2/animation/sequence.js.map +1 -1
- package/lib/module/reanimated2/animation/util.js +15 -15
- package/lib/module/reanimated2/animation/util.js.map +1 -1
- package/lib/module/reanimated2/commonTypes.js +7 -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 +34 -229
- 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/FrameCallbackRegistryJS.js +4 -4
- package/lib/module/reanimated2/frameCallback/FrameCallbackRegistryJS.js.map +1 -1
- package/lib/module/reanimated2/frameCallback/FrameCallbackRegistryUI.js +51 -19
- 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 -0
- package/lib/module/reanimated2/hook/index.js.map +1 -1
- package/lib/module/reanimated2/hook/useAnimatedKeyboard.js +16 -6
- package/lib/module/reanimated2/hook/useAnimatedKeyboard.js.map +1 -1
- package/lib/module/reanimated2/hook/useAnimatedRef.js +17 -8
- package/lib/module/reanimated2/hook/useAnimatedRef.js.map +1 -1
- package/lib/module/reanimated2/hook/useAnimatedScrollHandler.js.map +1 -1
- package/lib/module/reanimated2/hook/useAnimatedSensor.js +29 -34
- package/lib/module/reanimated2/hook/useAnimatedSensor.js.map +1 -1
- package/lib/module/reanimated2/hook/useAnimatedStyle.js +26 -62
- package/lib/module/reanimated2/hook/useAnimatedStyle.js.map +1 -1
- package/lib/module/reanimated2/hook/useFrameCallback.js.map +1 -1
- package/lib/module/reanimated2/hook/useScrollViewOffset.js +21 -0
- package/lib/module/reanimated2/hook/useScrollViewOffset.js.map +1 -0
- package/lib/module/reanimated2/hook/useSharedValue.js +3 -2
- package/lib/module/reanimated2/hook/useSharedValue.js.map +1 -1
- package/lib/module/reanimated2/hook/utils.js.map +1 -1
- package/lib/module/reanimated2/initializers.js +143 -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 +25 -40
- package/lib/module/reanimated2/jestUtils.js.map +1 -1
- package/lib/module/reanimated2/js-reanimated/JSReanimated.js +14 -98
- package/lib/module/reanimated2/js-reanimated/JSReanimated.js.map +1 -1
- package/lib/module/reanimated2/js-reanimated/global.js +4 -7
- package/lib/module/reanimated2/js-reanimated/global.js.map +1 -1
- package/lib/module/reanimated2/js-reanimated/index.js +5 -0
- package/lib/module/reanimated2/js-reanimated/index.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/animationBuilder/commonTypes.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/animationBuilder/index.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/animationsManager.js +82 -0
- package/lib/module/reanimated2/layoutReanimation/animationsManager.js.map +1 -0
- 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 -1
- package/lib/module/reanimated2/layoutReanimation/index.js.map +1 -1
- package/lib/module/reanimated2/mappers.js +173 -0
- package/lib/module/reanimated2/mappers.js.map +1 -0
- package/lib/module/reanimated2/mock.js +26 -0
- package/lib/module/reanimated2/mock.js.map +1 -1
- package/lib/module/reanimated2/mutables.js +149 -0
- package/lib/module/reanimated2/mutables.js.map +1 -0
- package/lib/module/reanimated2/platform-specific/checkVersion.js +25 -0
- package/lib/module/reanimated2/platform-specific/checkVersion.js.map +1 -0
- package/lib/module/reanimated2/platform-specific/checkVersion.web.js +8 -0
- package/lib/module/reanimated2/platform-specific/checkVersion.web.js.map +1 -0
- package/lib/module/reanimated2/shareables.js +138 -0
- package/lib/module/reanimated2/shareables.js.map +1 -0
- package/lib/module/reanimated2/threads.js +56 -0
- package/lib/module/reanimated2/threads.js.map +1 -0
- package/lib/module/reanimated2/time.js +37 -0
- package/lib/module/reanimated2/time.js.map +1 -0
- package/lib/module/reanimated2/utils.js +13 -3
- package/lib/module/reanimated2/utils.js.map +1 -1
- package/lib/module/reanimated2/valueSetter.js +66 -0
- package/lib/module/reanimated2/valueSetter.js.map +1 -0
- package/package.json +14 -9
- package/plugin.js +198 -61
- package/react-native-reanimated.d.ts +1250 -0
- package/scripts/reanimated_utils.rb +81 -0
- package/src/createAnimatedComponent.tsx +44 -44
- package/src/reanimated2/Colors.ts +38 -11
- package/src/reanimated2/NativeMethods.ts +91 -44
- package/src/reanimated2/NativeReanimated/NativeReanimated.ts +54 -45
- package/src/reanimated2/ViewDescriptorsSet.ts +30 -69
- package/src/reanimated2/WorkletEventHandler.ts +4 -11
- package/src/reanimated2/animation/delay.ts +0 -12
- package/src/reanimated2/animation/repeat.ts +0 -25
- package/src/reanimated2/animation/sequence.ts +0 -13
- package/src/reanimated2/animation/util.ts +27 -15
- package/src/reanimated2/commonTypes.ts +38 -4
- package/src/reanimated2/component/FlatList.tsx +30 -5
- package/src/reanimated2/core.ts +79 -260
- package/src/reanimated2/errors.ts +57 -0
- package/src/reanimated2/frameCallback/FrameCallbackRegistryJS.ts +6 -9
- package/src/reanimated2/frameCallback/FrameCallbackRegistryUI.ts +78 -27
- package/src/reanimated2/globals.d.ts +94 -27
- package/src/reanimated2/hook/index.ts +1 -0
- package/src/reanimated2/hook/useAnimatedKeyboard.ts +18 -9
- package/src/reanimated2/hook/useAnimatedRef.ts +27 -9
- package/src/reanimated2/hook/useAnimatedScrollHandler.ts +3 -1
- package/src/reanimated2/hook/useAnimatedSensor.ts +33 -31
- package/src/reanimated2/hook/useAnimatedStyle.ts +26 -74
- package/src/reanimated2/hook/useFrameCallback.ts +2 -1
- package/src/reanimated2/hook/useScrollViewOffset.ts +37 -0
- package/src/reanimated2/hook/useSharedValue.ts +6 -3
- package/src/reanimated2/hook/utils.ts +1 -1
- package/src/reanimated2/initializers.ts +143 -0
- package/src/reanimated2/interpolateColor.ts +106 -22
- package/src/reanimated2/jestUtils.ts +28 -35
- package/src/reanimated2/js-reanimated/JSReanimated.ts +24 -94
- package/src/reanimated2/js-reanimated/global.ts +4 -7
- package/src/reanimated2/js-reanimated/index.ts +4 -0
- package/src/reanimated2/layoutReanimation/animationBuilder/commonTypes.ts +11 -0
- package/src/reanimated2/layoutReanimation/animationBuilder/index.ts +1 -0
- package/src/reanimated2/layoutReanimation/animationsManager.ts +91 -0
- package/src/reanimated2/layoutReanimation/defaultAnimations/Bounce.ts +16 -19
- package/src/reanimated2/layoutReanimation/defaultAnimations/Lightspeed.ts +14 -11
- package/src/reanimated2/layoutReanimation/defaultAnimations/Roll.ts +21 -11
- package/src/reanimated2/layoutReanimation/defaultAnimations/Slide.ts +32 -11
- package/src/reanimated2/layoutReanimation/defaultAnimations/Zoom.ts +36 -19
- package/src/reanimated2/layoutReanimation/index.ts +1 -1
- package/src/reanimated2/mappers.ts +179 -0
- package/src/reanimated2/mock.ts +105 -0
- package/src/reanimated2/mutables.ts +151 -0
- package/src/reanimated2/platform-specific/checkVersion.ts +28 -0
- package/src/reanimated2/platform-specific/checkVersion.web.ts +6 -0
- package/src/reanimated2/shareables.ts +128 -0
- package/src/reanimated2/threads.ts +58 -0
- package/src/reanimated2/time.ts +30 -0
- package/src/reanimated2/utils.ts +12 -5
- package/src/reanimated2/valueSetter.ts +64 -0
- package/Common/cpp/LayoutAnimations/LayoutAnimationsProxy.cpp +0 -43
- package/Common/cpp/Registries/MapperRegistry.cpp +0 -145
- package/Common/cpp/Registries/WorkletsCache.cpp +0 -38
- package/Common/cpp/SharedItems/FrozenObject.cpp +0 -35
- package/Common/cpp/SharedItems/MutableValue.cpp +0 -132
- package/Common/cpp/SharedItems/MutableValueSetterProxy.cpp +0 -47
- package/Common/cpp/SharedItems/RemoteObject.cpp +0 -45
- package/Common/cpp/SharedItems/ShareableValue.cpp +0 -525
- package/Common/cpp/Tools/JSIStoreValueUser.cpp +0 -55
- package/Common/cpp/Tools/Mapper.cpp +0 -86
- package/Common/cpp/headers/LayoutAnimations/LayoutAnimationsProxy.h +0 -32
- package/Common/cpp/headers/Registries/MapperRegistry.h +0 -29
- package/Common/cpp/headers/Registries/WorkletsCache.h +0 -24
- package/Common/cpp/headers/SharedItems/FrozenObject.h +0 -36
- package/Common/cpp/headers/SharedItems/HostFunctionHandler.h +0 -28
- package/Common/cpp/headers/SharedItems/MutableValue.h +0 -54
- package/Common/cpp/headers/SharedItems/MutableValueSetterProxy.h +0 -25
- package/Common/cpp/headers/SharedItems/RemoteObject.h +0 -35
- package/Common/cpp/headers/SharedItems/ShareableValue.h +0 -63
- package/Common/cpp/headers/SharedItems/ValueWrapper.h +0 -183
- package/Common/cpp/headers/Tools/JSIStoreValueUser.h +0 -37
- package/Common/cpp/headers/Tools/Mapper.h +0 -51
- package/android/rnVersionPatch/63/layoutReanimation/ReanimatedUIImplementation.java +0 -68
- package/android/rnVersionPatch/64/layoutReanimation/ReanimatedUIImplementation.java +0 -68
- package/android/rnVersionPatch/65/.gitkeep +0 -0
- package/android/rnVersionPatch/66/.gitkeep +0 -0
- package/android/rnVersionPatch/67/.gitkeep +0 -0
- package/android/rnVersionPatch/68/.gitkeep +0 -0
- package/android/rnVersionPatch/backup/.gitkeep +0 -0
- package/android/src/main/cpp/headers/LayoutAnimations.h +0 -42
- package/android/src/main/java/com/swmansion/reanimated/AndroidErrorHandler.java +0 -8
- package/android/src/main/java/com/swmansion/reanimated/ReanimatedJSIModulePackage.java +0 -29
- package/lib/commonjs/reanimated2/layoutReanimation/LayoutAnimationRepository.js +0 -97
- package/lib/commonjs/reanimated2/layoutReanimation/LayoutAnimationRepository.js.map +0 -1
- package/lib/commonjs/reanimated2/layoutReanimation/defaultAnimations/Default.js +0 -55
- package/lib/commonjs/reanimated2/layoutReanimation/defaultAnimations/Default.js.map +0 -1
- package/lib/module/reanimated2/layoutReanimation/LayoutAnimationRepository.js +0 -91
- package/lib/module/reanimated2/layoutReanimation/LayoutAnimationRepository.js.map +0 -1
- package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Default.js +0 -40
- package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Default.js.map +0 -1
- package/src/reanimated2/layoutReanimation/LayoutAnimationRepository.ts +0 -75
- package/src/reanimated2/layoutReanimation/defaultAnimations/Default.ts +0 -49
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
#include "AnimatedSensorModule.h"
|
|
2
|
-
|
|
3
|
-
#include
|
|
2
|
+
|
|
3
|
+
#include <memory>
|
|
4
|
+
#include <utility>
|
|
5
|
+
|
|
6
|
+
#include "Shareables.h"
|
|
4
7
|
|
|
5
8
|
namespace reanimated {
|
|
6
9
|
|
|
7
10
|
AnimatedSensorModule::AnimatedSensorModule(
|
|
8
|
-
const PlatformDepMethodsHolder &platformDepMethodsHolder
|
|
9
|
-
RuntimeManager *runtimeManager)
|
|
11
|
+
const PlatformDepMethodsHolder &platformDepMethodsHolder)
|
|
10
12
|
: platformRegisterSensorFunction_(platformDepMethodsHolder.registerSensor),
|
|
11
13
|
platformUnregisterSensorFunction_(
|
|
12
|
-
platformDepMethodsHolder.unregisterSensor)
|
|
13
|
-
runtimeManager_(runtimeManager) {}
|
|
14
|
+
platformDepMethodsHolder.unregisterSensor) {}
|
|
14
15
|
|
|
15
16
|
AnimatedSensorModule::~AnimatedSensorModule() {
|
|
16
17
|
// It is called during app reload because app reload doesn't call hooks
|
|
@@ -22,41 +23,38 @@ AnimatedSensorModule::~AnimatedSensorModule() {
|
|
|
22
23
|
|
|
23
24
|
jsi::Value AnimatedSensorModule::registerSensor(
|
|
24
25
|
jsi::Runtime &rt,
|
|
25
|
-
const
|
|
26
|
+
const std::shared_ptr<JSRuntimeHelper> &runtimeHelper,
|
|
27
|
+
const jsi::Value &sensorTypeValue,
|
|
26
28
|
const jsi::Value &interval,
|
|
27
|
-
const jsi::Value &
|
|
28
|
-
|
|
29
|
-
rt, sensorDataContainer.getObject(rt), runtimeManager_);
|
|
30
|
-
auto &mutableObject =
|
|
31
|
-
ValueWrapper::asMutableValue(sensorsData->valueContainer);
|
|
29
|
+
const jsi::Value &sensorDataHandler) {
|
|
30
|
+
SensorType sensorType = static_cast<SensorType>(sensorTypeValue.asNumber());
|
|
32
31
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
setter = [&, mutableObject](double newValues[]) {
|
|
36
|
-
jsi::Runtime &runtime = *runtimeManager_->runtime.get();
|
|
37
|
-
jsi::Object value(runtime);
|
|
38
|
-
value.setProperty(runtime, "qx", newValues[0]);
|
|
39
|
-
value.setProperty(runtime, "qy", newValues[1]);
|
|
40
|
-
value.setProperty(runtime, "qz", newValues[2]);
|
|
41
|
-
value.setProperty(runtime, "qw", newValues[3]);
|
|
42
|
-
value.setProperty(runtime, "yaw", newValues[4]);
|
|
43
|
-
value.setProperty(runtime, "pitch", newValues[5]);
|
|
44
|
-
value.setProperty(runtime, "roll", newValues[6]);
|
|
45
|
-
mutableObject->setValue(runtime, std::move(value));
|
|
46
|
-
};
|
|
47
|
-
} else {
|
|
48
|
-
setter = [&, mutableObject](double newValues[]) {
|
|
49
|
-
jsi::Runtime &runtime = *runtimeManager_->runtime.get();
|
|
50
|
-
jsi::Object value(runtime);
|
|
51
|
-
value.setProperty(runtime, "x", newValues[0]);
|
|
52
|
-
value.setProperty(runtime, "y", newValues[1]);
|
|
53
|
-
value.setProperty(runtime, "z", newValues[2]);
|
|
54
|
-
mutableObject->setValue(runtime, std::move(value));
|
|
55
|
-
};
|
|
56
|
-
}
|
|
32
|
+
auto shareableHandler = extractShareableOrThrow(rt, sensorDataHandler);
|
|
33
|
+
auto uiRuntime = runtimeHelper->uiRuntime();
|
|
57
34
|
|
|
58
35
|
int sensorId = platformRegisterSensorFunction_(
|
|
59
|
-
sensorType
|
|
36
|
+
sensorType, interval.asNumber(), [=](double newValues[]) {
|
|
37
|
+
jsi::Runtime &rt = *uiRuntime;
|
|
38
|
+
auto handler =
|
|
39
|
+
shareableHandler->getJSValue(rt).asObject(rt).asFunction(rt);
|
|
40
|
+
if (sensorType == SensorType::ROTATION_VECTOR) {
|
|
41
|
+
jsi::Object value(rt);
|
|
42
|
+
value.setProperty(rt, "qx", newValues[0]);
|
|
43
|
+
value.setProperty(rt, "qy", newValues[1]);
|
|
44
|
+
value.setProperty(rt, "qz", newValues[2]);
|
|
45
|
+
value.setProperty(rt, "qw", newValues[3]);
|
|
46
|
+
value.setProperty(rt, "yaw", newValues[4]);
|
|
47
|
+
value.setProperty(rt, "pitch", newValues[5]);
|
|
48
|
+
value.setProperty(rt, "roll", newValues[6]);
|
|
49
|
+
handler.call(rt, value);
|
|
50
|
+
} else {
|
|
51
|
+
jsi::Object value(rt);
|
|
52
|
+
value.setProperty(rt, "x", newValues[0]);
|
|
53
|
+
value.setProperty(rt, "y", newValues[1]);
|
|
54
|
+
value.setProperty(rt, "z", newValues[2]);
|
|
55
|
+
handler.call(rt, value);
|
|
56
|
+
}
|
|
57
|
+
});
|
|
60
58
|
if (sensorId != -1) {
|
|
61
59
|
sensorsIds_.insert(sensorId);
|
|
62
60
|
}
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
#pragma once
|
|
2
2
|
|
|
3
3
|
#include <jsi/jsi.h>
|
|
4
|
+
#include <memory>
|
|
4
5
|
#include <unordered_set>
|
|
5
6
|
|
|
6
7
|
#include "PlatformDepMethodsHolder.h"
|
|
7
8
|
#include "RuntimeManager.h"
|
|
9
|
+
#include "Shareables.h"
|
|
8
10
|
|
|
9
11
|
namespace reanimated {
|
|
10
12
|
|
|
@@ -22,16 +24,15 @@ class AnimatedSensorModule {
|
|
|
22
24
|
std::unordered_set<int> sensorsIds_;
|
|
23
25
|
RegisterSensorFunction platformRegisterSensorFunction_;
|
|
24
26
|
UnregisterSensorFunction platformUnregisterSensorFunction_;
|
|
25
|
-
RuntimeManager *runtimeManager_;
|
|
26
27
|
|
|
27
28
|
public:
|
|
28
29
|
AnimatedSensorModule(
|
|
29
|
-
const PlatformDepMethodsHolder &platformDepMethodsHolder
|
|
30
|
-
RuntimeManager *runtimeManager);
|
|
30
|
+
const PlatformDepMethodsHolder &platformDepMethodsHolder);
|
|
31
31
|
~AnimatedSensorModule();
|
|
32
32
|
|
|
33
33
|
jsi::Value registerSensor(
|
|
34
34
|
jsi::Runtime &rt,
|
|
35
|
+
const std::shared_ptr<JSRuntimeHelper> &runtimeHelper,
|
|
35
36
|
const jsi::Value &sensorType,
|
|
36
37
|
const jsi::Value &interval,
|
|
37
38
|
const jsi::Value &sensorDataContainer);
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
#ifdef RCT_NEW_ARCH_ENABLED
|
|
2
2
|
|
|
3
|
-
#if
|
|
3
|
+
#if REACT_NATIVE_MINOR_VERSION < 69
|
|
4
4
|
#error \
|
|
5
5
|
"Reanimated 3 does not support React Native 0.68.x when Fabric is enabled. Please upgrade to React Native 0.69.0 or newer if you want to use Reanimated with the new architecture."
|
|
6
6
|
#endif
|
|
7
7
|
|
|
8
8
|
#include "FabricUtils.h"
|
|
9
9
|
|
|
10
|
+
#include <react/renderer/debug/SystraceSection.h>
|
|
10
11
|
#include <react/renderer/uimanager/UIManagerBinding.h>
|
|
11
12
|
|
|
12
13
|
using namespace facebook::react;
|
|
@@ -22,110 +23,10 @@ RuntimeExecutor getRuntimeExecutorFromBinding(Binding *binding) {
|
|
|
22
23
|
}
|
|
23
24
|
#endif
|
|
24
25
|
|
|
25
|
-
inline static const UIManagerPublic *getUIManagerPublic(
|
|
26
|
-
const UIManager *uiManager) {
|
|
27
|
-
return reinterpret_cast<const UIManagerPublic *>(uiManager);
|
|
28
|
-
}
|
|
29
|
-
|
|
30
26
|
std::shared_ptr<const ContextContainer> getContextContainerFromUIManager(
|
|
31
27
|
const UIManager *uiManager) {
|
|
32
|
-
return
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
inline static UIManagerDelegate *getDelegateFromUIManager(
|
|
36
|
-
const UIManager *uiManager) {
|
|
37
|
-
return getUIManagerPublic(uiManager)->delegate_;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
void UIManager_dispatchCommand(
|
|
41
|
-
const std::shared_ptr<UIManager> &uiManager,
|
|
42
|
-
const ShadowNode::Shared &shadowNode,
|
|
43
|
-
std::string const &commandName,
|
|
44
|
-
folly::dynamic const &args) {
|
|
45
|
-
auto delegate_ = getDelegateFromUIManager(&*uiManager);
|
|
46
|
-
|
|
47
|
-
// copied from UIManager.cpp
|
|
48
|
-
if (delegate_) {
|
|
49
|
-
delegate_->uiManagerDidDispatchCommand(shadowNode, commandName, args);
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
LayoutMetrics UIManager_getRelativeLayoutMetrics(
|
|
54
|
-
const std::shared_ptr<UIManager> &uiManager,
|
|
55
|
-
ShadowNode const &shadowNode,
|
|
56
|
-
ShadowNode const *ancestorShadowNode,
|
|
57
|
-
LayoutableShadowNode::LayoutInspectingPolicy policy) {
|
|
58
|
-
// based on implementation from UIManager.cpp
|
|
59
|
-
const auto &shadowTreeRegistry = uiManager->getShadowTreeRegistry();
|
|
60
|
-
|
|
61
|
-
// We might store here an owning pointer to `ancestorShadowNode` to ensure
|
|
62
|
-
// that the node is not deallocated during method execution lifetime.
|
|
63
|
-
auto owningAncestorShadowNode = ShadowNode::Shared{};
|
|
64
|
-
|
|
65
|
-
if (!ancestorShadowNode) {
|
|
66
|
-
shadowTreeRegistry.visit(
|
|
67
|
-
shadowNode.getSurfaceId(), [&](ShadowTree const &shadowTree) {
|
|
68
|
-
owningAncestorShadowNode =
|
|
69
|
-
shadowTree.getCurrentRevision().rootShadowNode;
|
|
70
|
-
ancestorShadowNode = owningAncestorShadowNode.get();
|
|
71
|
-
});
|
|
72
|
-
} else {
|
|
73
|
-
// It is possible for JavaScript (or other callers) to have a reference
|
|
74
|
-
// to a previous version of ShadowNodes, but we enforce that
|
|
75
|
-
// metrics are only calculated on most recently committed versions.
|
|
76
|
-
owningAncestorShadowNode =
|
|
77
|
-
uiManager->getNewestCloneOfShadowNode(*ancestorShadowNode);
|
|
78
|
-
ancestorShadowNode = owningAncestorShadowNode.get();
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
auto layoutableAncestorShadowNode =
|
|
82
|
-
traitCast<LayoutableShadowNode const *>(ancestorShadowNode);
|
|
83
|
-
|
|
84
|
-
if (!layoutableAncestorShadowNode) {
|
|
85
|
-
return EmptyLayoutMetrics;
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
return LayoutableShadowNode::computeRelativeLayoutMetrics(
|
|
89
|
-
shadowNode.getFamily(), *layoutableAncestorShadowNode, policy);
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
ShadowNode::Shared UIManager_cloneNode(
|
|
93
|
-
const UIManager *uiManager,
|
|
94
|
-
const ShadowNode::Shared &shadowNode,
|
|
95
|
-
const ShadowNode::SharedListOfShared &children,
|
|
96
|
-
const RawProps *rawProps) {
|
|
97
|
-
auto delegate_ = getDelegateFromUIManager(uiManager);
|
|
98
|
-
auto contextContainer_ = getContextContainerFromUIManager(uiManager);
|
|
99
|
-
|
|
100
|
-
// copied from UIManager.cpp
|
|
101
|
-
PropsParserContext propsParserContext{
|
|
102
|
-
shadowNode->getFamily().getSurfaceId(), *contextContainer_.get()};
|
|
103
|
-
|
|
104
|
-
auto &componentDescriptor = shadowNode->getComponentDescriptor();
|
|
105
|
-
auto clonedShadowNode = componentDescriptor.cloneShadowNode(
|
|
106
|
-
*shadowNode,
|
|
107
|
-
{
|
|
108
|
-
/* .props = */
|
|
109
|
-
rawProps ? componentDescriptor.cloneProps(
|
|
110
|
-
propsParserContext, shadowNode->getProps(), *rawProps)
|
|
111
|
-
: ShadowNodeFragment::propsPlaceholder(),
|
|
112
|
-
/* .children = */ children,
|
|
113
|
-
});
|
|
114
|
-
|
|
115
|
-
if (delegate_) {
|
|
116
|
-
delegate_->uiManagerDidCloneShadowNode(
|
|
117
|
-
*shadowNode.get(), *clonedShadowNode);
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
return clonedShadowNode;
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
void UIManager_appendChild(
|
|
124
|
-
const ShadowNode::Shared &parentShadowNode,
|
|
125
|
-
const ShadowNode::Shared &childShadowNode) {
|
|
126
|
-
// copied from UIManager.cpp
|
|
127
|
-
auto &componentDescriptor = parentShadowNode->getComponentDescriptor();
|
|
128
|
-
componentDescriptor.appendChild(parentShadowNode, childShadowNode);
|
|
28
|
+
return reinterpret_cast<const UIManagerPublic *>(uiManager)
|
|
29
|
+
->contextContainer_;
|
|
129
30
|
}
|
|
130
31
|
|
|
131
32
|
} // namespace reanimated
|
|
@@ -2,15 +2,16 @@
|
|
|
2
2
|
#ifdef RCT_NEW_ARCH_ENABLED
|
|
3
3
|
|
|
4
4
|
#ifdef ANDROID
|
|
5
|
-
#include <Binding.h>
|
|
6
5
|
#include <fbjni/fbjni.h>
|
|
6
|
+
#include <react/fabric/Binding.h>
|
|
7
7
|
#endif
|
|
8
8
|
#include <react/renderer/uimanager/UIManager.h>
|
|
9
9
|
|
|
10
10
|
#include <memory>
|
|
11
11
|
#include <string>
|
|
12
12
|
|
|
13
|
-
using namespace facebook
|
|
13
|
+
using namespace facebook;
|
|
14
|
+
using namespace react;
|
|
14
15
|
|
|
15
16
|
namespace reanimated {
|
|
16
17
|
|
|
@@ -52,28 +53,6 @@ RuntimeExecutor getRuntimeExecutorFromBinding(Binding *binding);
|
|
|
52
53
|
std::shared_ptr<const ContextContainer> getContextContainerFromUIManager(
|
|
53
54
|
const UIManager *uiManager);
|
|
54
55
|
|
|
55
|
-
void UIManager_dispatchCommand(
|
|
56
|
-
const std::shared_ptr<UIManager> &uiManager,
|
|
57
|
-
const ShadowNode::Shared &shadowNode,
|
|
58
|
-
std::string const &commandName,
|
|
59
|
-
folly::dynamic const &args);
|
|
60
|
-
|
|
61
|
-
LayoutMetrics UIManager_getRelativeLayoutMetrics(
|
|
62
|
-
const std::shared_ptr<UIManager> &uiManager,
|
|
63
|
-
ShadowNode const &shadowNode,
|
|
64
|
-
ShadowNode const *ancestorShadowNode,
|
|
65
|
-
LayoutableShadowNode::LayoutInspectingPolicy policy);
|
|
66
|
-
|
|
67
|
-
ShadowNode::Shared UIManager_cloneNode(
|
|
68
|
-
const UIManager *uiManager,
|
|
69
|
-
const ShadowNode::Shared &shadowNode,
|
|
70
|
-
const ShadowNode::SharedListOfShared &children = nullptr,
|
|
71
|
-
const RawProps *rawProps = nullptr);
|
|
72
|
-
|
|
73
|
-
void UIManager_appendChild(
|
|
74
|
-
const ShadowNode::Shared &parentShadowNode,
|
|
75
|
-
const ShadowNode::Shared &childShadowNode);
|
|
76
|
-
|
|
77
56
|
} // namespace reanimated
|
|
78
57
|
|
|
79
58
|
#endif // RCT_NEW_ARCH_ENABLED
|
|
@@ -4,6 +4,10 @@
|
|
|
4
4
|
#include "FabricUtils.h"
|
|
5
5
|
#include "NewestShadowNodesRegistry.h"
|
|
6
6
|
|
|
7
|
+
#include <react/renderer/debug/SystraceSection.h>
|
|
8
|
+
|
|
9
|
+
#include <utility>
|
|
10
|
+
|
|
7
11
|
using namespace facebook;
|
|
8
12
|
using namespace react;
|
|
9
13
|
|
|
@@ -49,7 +53,7 @@ ReanimatedUIManagerBinding::ReanimatedUIManagerBinding(
|
|
|
49
53
|
RuntimeExecutor runtimeExecutor,
|
|
50
54
|
std::unique_ptr<EventHandler const> eventHandler,
|
|
51
55
|
std::shared_ptr<NewestShadowNodesRegistry> newestShadowNodesRegistry)
|
|
52
|
-
: UIManagerBinding(uiManager
|
|
56
|
+
: UIManagerBinding(uiManager),
|
|
53
57
|
uiManager_(std::move(uiManager)),
|
|
54
58
|
newestShadowNodesRegistry_(newestShadowNodesRegistry) {
|
|
55
59
|
if (eventHandler != nullptr) {
|
|
@@ -60,25 +64,44 @@ ReanimatedUIManagerBinding::ReanimatedUIManagerBinding(
|
|
|
60
64
|
|
|
61
65
|
ReanimatedUIManagerBinding::~ReanimatedUIManagerBinding() {}
|
|
62
66
|
|
|
63
|
-
static inline ShadowNode::Shared
|
|
67
|
+
static inline ShadowNode::Shared cloneNodeUsingNewest(
|
|
64
68
|
UIManager *uiManager,
|
|
65
69
|
NewestShadowNodesRegistry *newestShadowNodesRegistry,
|
|
66
|
-
const
|
|
67
|
-
|
|
68
|
-
const
|
|
70
|
+
ShadowNode const &shadowNode,
|
|
71
|
+
ShadowNode::SharedListOfShared const &children = nullptr,
|
|
72
|
+
RawProps const *rawProps = nullptr) {
|
|
69
73
|
{
|
|
70
74
|
auto lock = newestShadowNodesRegistry->createLock();
|
|
71
|
-
auto newest = newestShadowNodesRegistry->get(shadowNode
|
|
75
|
+
auto newest = newestShadowNodesRegistry->get(shadowNode.getTag());
|
|
72
76
|
if (newest != nullptr) {
|
|
73
77
|
// ShadowNode managed by Reanimated, use newest ShadowNode from registry
|
|
74
|
-
auto clone =
|
|
78
|
+
auto clone = uiManager->cloneNode(*newest, children, rawProps);
|
|
75
79
|
newestShadowNodesRegistry->update(clone);
|
|
76
80
|
return clone;
|
|
77
81
|
}
|
|
78
82
|
} // release lock since we don't need registry anymore
|
|
79
83
|
|
|
80
84
|
// ShadowNode not managed by Reanimated (yet?)
|
|
81
|
-
return
|
|
85
|
+
return uiManager->cloneNode(shadowNode, children, rawProps);
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
static inline void appendChildUsingNewest(
|
|
89
|
+
UIManager *uiManager,
|
|
90
|
+
NewestShadowNodesRegistry *newestShadowNodesRegistry,
|
|
91
|
+
const ShadowNode::Shared &parentShadowNode,
|
|
92
|
+
const ShadowNode::Shared &childShadowNode) {
|
|
93
|
+
{
|
|
94
|
+
auto lock = newestShadowNodesRegistry->createLock();
|
|
95
|
+
auto newestChildShadowNode =
|
|
96
|
+
newestShadowNodesRegistry->get(childShadowNode->getTag());
|
|
97
|
+
if (newestChildShadowNode != nullptr) {
|
|
98
|
+
uiManager->appendChild(parentShadowNode, newestChildShadowNode);
|
|
99
|
+
return;
|
|
100
|
+
}
|
|
101
|
+
} // release lock since we don't need registry anymore
|
|
102
|
+
|
|
103
|
+
// child ShadowNode not managed by Reanimated (yet?)
|
|
104
|
+
uiManager->appendChild(parentShadowNode, childShadowNode);
|
|
82
105
|
}
|
|
83
106
|
|
|
84
107
|
jsi::Value ReanimatedUIManagerBinding::get(
|
|
@@ -92,6 +115,7 @@ jsi::Value ReanimatedUIManagerBinding::get(
|
|
|
92
115
|
|
|
93
116
|
// based on implementation from UIManagerBinding.cpp
|
|
94
117
|
auto methodName = name.utf8(runtime);
|
|
118
|
+
SystraceSection s("ReanimatedUIManagerBinding::get", "name", methodName);
|
|
95
119
|
UIManager *uiManager = uiManager_.get();
|
|
96
120
|
NewestShadowNodesRegistry *newestShadowNodesRegistry =
|
|
97
121
|
newestShadowNodesRegistry_.get();
|
|
@@ -104,15 +128,15 @@ jsi::Value ReanimatedUIManagerBinding::get(
|
|
|
104
128
|
1,
|
|
105
129
|
[uiManager, newestShadowNodesRegistry](
|
|
106
130
|
jsi::Runtime &runtime,
|
|
107
|
-
jsi::Value const &thisValue
|
|
131
|
+
jsi::Value const & /*thisValue*/,
|
|
108
132
|
jsi::Value const *arguments,
|
|
109
|
-
size_t count) noexcept -> jsi::Value {
|
|
133
|
+
size_t /*count*/) noexcept -> jsi::Value {
|
|
110
134
|
return valueFromShadowNode(
|
|
111
135
|
runtime,
|
|
112
|
-
|
|
136
|
+
cloneNodeUsingNewest(
|
|
113
137
|
uiManager,
|
|
114
138
|
newestShadowNodesRegistry,
|
|
115
|
-
shadowNodeFromValue(runtime, arguments[0])));
|
|
139
|
+
*shadowNodeFromValue(runtime, arguments[0])));
|
|
116
140
|
});
|
|
117
141
|
}
|
|
118
142
|
|
|
@@ -124,15 +148,15 @@ jsi::Value ReanimatedUIManagerBinding::get(
|
|
|
124
148
|
1,
|
|
125
149
|
[uiManager, newestShadowNodesRegistry](
|
|
126
150
|
jsi::Runtime &runtime,
|
|
127
|
-
jsi::Value const &thisValue
|
|
151
|
+
jsi::Value const & /*thisValue*/,
|
|
128
152
|
jsi::Value const *arguments,
|
|
129
|
-
size_t count) noexcept -> jsi::Value {
|
|
153
|
+
size_t /*count*/) noexcept -> jsi::Value {
|
|
130
154
|
return valueFromShadowNode(
|
|
131
155
|
runtime,
|
|
132
|
-
|
|
156
|
+
cloneNodeUsingNewest(
|
|
133
157
|
uiManager,
|
|
134
158
|
newestShadowNodesRegistry,
|
|
135
|
-
shadowNodeFromValue(runtime, arguments[0]),
|
|
159
|
+
*shadowNodeFromValue(runtime, arguments[0]),
|
|
136
160
|
ShadowNode::emptySharedShadowNodeSharedList()));
|
|
137
161
|
});
|
|
138
162
|
}
|
|
@@ -145,16 +169,16 @@ jsi::Value ReanimatedUIManagerBinding::get(
|
|
|
145
169
|
2,
|
|
146
170
|
[uiManager, newestShadowNodesRegistry](
|
|
147
171
|
jsi::Runtime &runtime,
|
|
148
|
-
jsi::Value const &thisValue
|
|
172
|
+
jsi::Value const & /*thisValue*/,
|
|
149
173
|
jsi::Value const *arguments,
|
|
150
|
-
size_t count) noexcept -> jsi::Value {
|
|
174
|
+
size_t /*count*/) noexcept -> jsi::Value {
|
|
151
175
|
auto const &rawProps = RawProps(runtime, arguments[1]);
|
|
152
176
|
return valueFromShadowNode(
|
|
153
177
|
runtime,
|
|
154
|
-
|
|
178
|
+
cloneNodeUsingNewest(
|
|
155
179
|
uiManager,
|
|
156
180
|
newestShadowNodesRegistry,
|
|
157
|
-
shadowNodeFromValue(runtime, arguments[0]),
|
|
181
|
+
*shadowNodeFromValue(runtime, arguments[0]),
|
|
158
182
|
nullptr,
|
|
159
183
|
&rawProps));
|
|
160
184
|
});
|
|
@@ -168,16 +192,16 @@ jsi::Value ReanimatedUIManagerBinding::get(
|
|
|
168
192
|
2,
|
|
169
193
|
[uiManager, newestShadowNodesRegistry](
|
|
170
194
|
jsi::Runtime &runtime,
|
|
171
|
-
jsi::Value const &thisValue
|
|
195
|
+
jsi::Value const & /*thisValue*/,
|
|
172
196
|
jsi::Value const *arguments,
|
|
173
|
-
size_t count) noexcept -> jsi::Value {
|
|
197
|
+
size_t /*count*/) noexcept -> jsi::Value {
|
|
174
198
|
auto const &rawProps = RawProps(runtime, arguments[1]);
|
|
175
199
|
return valueFromShadowNode(
|
|
176
200
|
runtime,
|
|
177
|
-
|
|
201
|
+
cloneNodeUsingNewest(
|
|
178
202
|
uiManager,
|
|
179
203
|
newestShadowNodesRegistry,
|
|
180
|
-
shadowNodeFromValue(runtime, arguments[0]),
|
|
204
|
+
*shadowNodeFromValue(runtime, arguments[0]),
|
|
181
205
|
ShadowNode::emptySharedShadowNodeSharedList(),
|
|
182
206
|
&rawProps));
|
|
183
207
|
});
|
|
@@ -188,21 +212,16 @@ jsi::Value ReanimatedUIManagerBinding::get(
|
|
|
188
212
|
runtime,
|
|
189
213
|
name,
|
|
190
214
|
2,
|
|
191
|
-
[newestShadowNodesRegistry](
|
|
215
|
+
[uiManager, newestShadowNodesRegistry](
|
|
192
216
|
jsi::Runtime &runtime,
|
|
193
|
-
jsi::Value const &thisValue
|
|
217
|
+
jsi::Value const & /*thisValue*/,
|
|
194
218
|
jsi::Value const *arguments,
|
|
195
|
-
size_t count) noexcept -> jsi::Value {
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
if (newest != nullptr) {
|
|
202
|
-
child = newest;
|
|
203
|
-
}
|
|
204
|
-
}
|
|
205
|
-
UIManager_appendChild(parent, child);
|
|
219
|
+
size_t /*count*/) noexcept -> jsi::Value {
|
|
220
|
+
appendChildUsingNewest(
|
|
221
|
+
uiManager,
|
|
222
|
+
newestShadowNodesRegistry,
|
|
223
|
+
shadowNodeFromValue(runtime, arguments[0]),
|
|
224
|
+
shadowNodeFromValue(runtime, arguments[1]));
|
|
206
225
|
return jsi::Value::undefined();
|
|
207
226
|
});
|
|
208
227
|
}
|
|
File without changes
|
|
@@ -31,8 +31,8 @@ class ShadowTreeCloner {
|
|
|
31
31
|
void updateYogaChildren();
|
|
32
32
|
|
|
33
33
|
private:
|
|
34
|
-
PropsParserContext propsParserContext_;
|
|
35
34
|
std::shared_ptr<NewestShadowNodesRegistry> newestShadowNodesRegistry_;
|
|
35
|
+
PropsParserContext propsParserContext_;
|
|
36
36
|
std::set<ShadowNode *> yogaChildrenUpdates_;
|
|
37
37
|
};
|
|
38
38
|
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
#include "LayoutAnimationsManager.h"
|
|
2
|
+
#include "Shareables.h"
|
|
3
|
+
|
|
4
|
+
#include <utility>
|
|
5
|
+
|
|
6
|
+
namespace reanimated {
|
|
7
|
+
|
|
8
|
+
void LayoutAnimationsManager::configureAnimation(
|
|
9
|
+
int tag,
|
|
10
|
+
const std::string &type,
|
|
11
|
+
std::shared_ptr<Shareable> config) {
|
|
12
|
+
auto lock = std::unique_lock<std::mutex>(animationsMutex_);
|
|
13
|
+
if (type == "entering") {
|
|
14
|
+
enteringAnimations_[tag] = config;
|
|
15
|
+
} else if (type == "exiting") {
|
|
16
|
+
exitingAnimations_[tag] = config;
|
|
17
|
+
} else if (type == "layout") {
|
|
18
|
+
layoutAnimations_[tag] = config;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
bool LayoutAnimationsManager::hasLayoutAnimation(
|
|
23
|
+
int tag,
|
|
24
|
+
const std::string &type) {
|
|
25
|
+
auto lock = std::unique_lock<std::mutex>(animationsMutex_);
|
|
26
|
+
if (type == "entering") {
|
|
27
|
+
return enteringAnimations_.find(tag) != enteringAnimations_.end();
|
|
28
|
+
} else if (type == "exiting") {
|
|
29
|
+
return exitingAnimations_.find(tag) != exitingAnimations_.end();
|
|
30
|
+
} else if (type == "layout") {
|
|
31
|
+
return layoutAnimations_.find(tag) != layoutAnimations_.end();
|
|
32
|
+
}
|
|
33
|
+
return false;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
void LayoutAnimationsManager::clearLayoutAnimationConfig(int tag) {
|
|
37
|
+
auto lock = std::unique_lock<std::mutex>(animationsMutex_);
|
|
38
|
+
enteringAnimations_.erase(tag);
|
|
39
|
+
exitingAnimations_.erase(tag);
|
|
40
|
+
layoutAnimations_.erase(tag);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
void LayoutAnimationsManager::startLayoutAnimation(
|
|
44
|
+
jsi::Runtime &rt,
|
|
45
|
+
int tag,
|
|
46
|
+
const std::string &type,
|
|
47
|
+
const jsi::Object &values) {
|
|
48
|
+
std::shared_ptr<Shareable> config, viewShareable;
|
|
49
|
+
{
|
|
50
|
+
auto lock = std::unique_lock<std::mutex>(animationsMutex_);
|
|
51
|
+
if (type == "entering") {
|
|
52
|
+
config = enteringAnimations_[tag];
|
|
53
|
+
} else if (type == "exiting") {
|
|
54
|
+
config = exitingAnimations_[tag];
|
|
55
|
+
} else if (type == "layout") {
|
|
56
|
+
config = layoutAnimations_[tag];
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
// TODO: cache the following!!
|
|
61
|
+
jsi::Value layoutAnimationRepositoryAsValue =
|
|
62
|
+
rt.global()
|
|
63
|
+
.getPropertyAsObject(rt, "global")
|
|
64
|
+
.getProperty(rt, "LayoutAnimationsManager");
|
|
65
|
+
jsi::Function startAnimationForTag =
|
|
66
|
+
layoutAnimationRepositoryAsValue.getObject(rt).getPropertyAsFunction(
|
|
67
|
+
rt, "start");
|
|
68
|
+
startAnimationForTag.call(
|
|
69
|
+
rt,
|
|
70
|
+
jsi::Value(tag),
|
|
71
|
+
jsi::String::createFromAscii(rt, type),
|
|
72
|
+
values,
|
|
73
|
+
config->getJSValue(rt));
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
} // namespace reanimated
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
#pragma once
|
|
2
|
+
|
|
3
|
+
#include "ErrorHandler.h"
|
|
4
|
+
#include "Shareables.h"
|
|
5
|
+
|
|
6
|
+
#include <jsi/jsi.h>
|
|
7
|
+
#include <stdio.h>
|
|
8
|
+
#include <functional>
|
|
9
|
+
#include <memory>
|
|
10
|
+
#include <mutex>
|
|
11
|
+
#include <string>
|
|
12
|
+
#include <unordered_map>
|
|
13
|
+
|
|
14
|
+
namespace reanimated {
|
|
15
|
+
|
|
16
|
+
using namespace facebook;
|
|
17
|
+
|
|
18
|
+
class LayoutAnimationsManager {
|
|
19
|
+
public:
|
|
20
|
+
void configureAnimation(
|
|
21
|
+
int tag,
|
|
22
|
+
const std::string &type,
|
|
23
|
+
std::shared_ptr<Shareable> config);
|
|
24
|
+
bool hasLayoutAnimation(int tag, const std::string &type);
|
|
25
|
+
void startLayoutAnimation(
|
|
26
|
+
jsi::Runtime &rt,
|
|
27
|
+
int tag,
|
|
28
|
+
const std::string &type,
|
|
29
|
+
const jsi::Object &values);
|
|
30
|
+
void clearLayoutAnimationConfig(int tag);
|
|
31
|
+
|
|
32
|
+
private:
|
|
33
|
+
std::unordered_map<int, std::shared_ptr<Shareable>> enteringAnimations_;
|
|
34
|
+
std::unordered_map<int, std::shared_ptr<Shareable>> exitingAnimations_;
|
|
35
|
+
std::unordered_map<int, std::shared_ptr<Shareable>> layoutAnimations_;
|
|
36
|
+
mutable std::mutex
|
|
37
|
+
animationsMutex_; // Protects `enteringAnimations_`, `exitingAnimations_`,
|
|
38
|
+
// `layoutAnimations_` and `viewSharedValues_`.
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
} // namespace reanimated
|