react-native-reanimated 2.4.1 → 2.7.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 +72 -0
- package/Common/cpp/NativeModules/NativeReanimatedModule.cpp +30 -1
- package/Common/cpp/NativeModules/NativeReanimatedModuleSpec.cpp +64 -39
- package/Common/cpp/SharedItems/ShareableValue.cpp +2 -2
- package/Common/cpp/Tools/RuntimeDecorator.cpp +2 -14
- package/Common/cpp/headers/AnimatedSensor/AnimatedSensorModule.h +41 -0
- package/Common/cpp/headers/NativeModules/NativeReanimatedModule.h +14 -0
- package/Common/cpp/headers/NativeModules/NativeReanimatedModuleSpec.h +14 -0
- package/Common/cpp/headers/SharedItems/MutableValue.h +4 -1
- package/Common/cpp/headers/SharedItems/ShareableValue.h +3 -0
- package/Common/cpp/headers/SharedItems/ValueWrapper.h +3 -0
- package/Common/cpp/headers/Tools/PlatformDepMethodsHolder.h +11 -0
- package/Common/cpp/headers/Tools/RuntimeDecorator.h +2 -0
- package/README.md +2 -2
- package/RNReanimated.podspec +15 -6
- package/android/.gradle/7.2/dependencies-accessors/dependencies-accessors.lock +0 -0
- package/android/.gradle/7.2/dependencies-accessors/gc.properties +0 -0
- package/android/.gradle/7.2/executionHistory/executionHistory.bin +0 -0
- package/android/.gradle/7.2/executionHistory/executionHistory.lock +0 -0
- package/android/.gradle/7.2/fileChanges/last-build.bin +0 -0
- package/android/.gradle/7.2/fileHashes/fileHashes.bin +0 -0
- package/android/.gradle/7.2/fileHashes/fileHashes.lock +0 -0
- package/android/.gradle/7.2/fileHashes/resourceHashesCache.bin +0 -0
- package/android/.gradle/7.2/gc.properties +0 -0
- package/android/.gradle/buildOutputCleanup/buildOutputCleanup.lock +0 -0
- package/android/.gradle/buildOutputCleanup/cache.properties +2 -0
- package/android/.gradle/buildOutputCleanup/outputFiles.bin +0 -0
- package/android/.gradle/checksums/checksums.lock +0 -0
- package/android/.gradle/checksums/md5-checksums.bin +0 -0
- package/android/.gradle/checksums/sha1-checksums.bin +0 -0
- package/android/.gradle/vcs-1/gc.properties +0 -0
- package/android/CMakeLists.txt +198 -0
- package/android/README.md +15 -0
- package/android/build.gradle +676 -73
- package/android/empty.cpp +1 -0
- package/android/gradle/wrapper/gradle-wrapper.jar +0 -0
- package/android/gradle/wrapper/gradle-wrapper.properties +5 -0
- package/android/gradle.properties +25 -0
- package/android/gradlew +234 -0
- package/android/gradlew.bat +89 -0
- package/android/react-native-reanimated-64-hermes.aar +0 -0
- package/android/react-native-reanimated-64-jsc.aar +0 -0
- package/android/react-native-reanimated-65-hermes.aar +0 -0
- package/android/react-native-reanimated-65-jsc.aar +0 -0
- package/android/react-native-reanimated-66-hermes.aar +0 -0
- package/android/react-native-reanimated-66-jsc.aar +0 -0
- package/android/react-native-reanimated-67-hermes.aar +0 -0
- package/android/react-native-reanimated-67-jsc.aar +0 -0
- package/android/react-native-reanimated-68-hermes.aar +0 -0
- package/android/react-native-reanimated-68-jsc.aar +0 -0
- package/android/rnVersionPatch/62/layoutReanimation/ReanimatedNativeHierarchyManager.java +412 -0
- package/android/rnVersionPatch/62/layoutReanimation/ReanimatedUIImplementation.java +68 -0
- package/android/rnVersionPatch/63/layoutReanimation/ReanimatedUIImplementation.java +68 -0
- package/android/rnVersionPatch/64/layoutReanimation/ReanimatedUIImplementation.java +68 -0
- 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/settings.gradle +1 -0
- package/android/spotless.gradle +9 -0
- package/android/src/{AndroidManifest.xml → main/AndroidManifest.xml} +0 -0
- package/android/src/main/cpp/AndroidErrorHandler.cpp +42 -0
- package/android/src/main/cpp/AndroidLogger.cpp +27 -0
- package/android/src/main/cpp/AndroidScheduler.cpp +59 -0
- package/android/src/main/cpp/JNIHelper.cpp +59 -0
- package/android/src/main/cpp/LayoutAnimations.cpp +103 -0
- package/android/src/main/cpp/NativeProxy.cpp +327 -0
- package/android/src/main/cpp/OnLoad.cpp +17 -0
- package/android/src/main/cpp/TurboModule.cpp +44 -0
- package/android/src/main/cpp/headers/AndroidErrorHandler.h +30 -0
- package/android/src/main/cpp/headers/AndroidLogger.h +16 -0
- package/android/src/main/cpp/headers/AndroidScheduler.h +41 -0
- package/android/src/main/cpp/headers/JNIHelper.h +30 -0
- package/android/src/main/cpp/headers/LayoutAnimations.h +42 -0
- package/android/src/main/cpp/headers/NativeProxy.h +170 -0
- package/android/src/main/cpp/headers/TurboModule.h +70 -0
- package/android/src/main/java/com/facebook/react/uimanager/UIManagerReanimatedHelper.java +15 -0
- package/android/src/main/java/com/swmansion/common/GestureHandlerStateManager.java +5 -0
- package/android/src/main/java/com/swmansion/reanimated/AndroidErrorHandler.java +8 -0
- package/android/src/main/java/com/swmansion/reanimated/CopiedEvent.java +43 -0
- package/android/src/main/java/com/swmansion/reanimated/MapUtils.java +26 -0
- package/android/src/main/java/com/swmansion/reanimated/NativeMethodsHelper.java +117 -0
- package/android/src/main/java/com/swmansion/reanimated/NativeProxy.java +288 -0
- package/android/src/main/java/com/swmansion/reanimated/NodesManager.java +682 -0
- package/android/src/main/java/com/swmansion/reanimated/ReanimatedJSIModulePackage.java +29 -0
- package/android/src/main/java/com/swmansion/reanimated/ReanimatedModule.java +251 -0
- package/android/src/main/java/com/swmansion/reanimated/ReanimatedPackage.java +96 -0
- package/android/src/main/java/com/swmansion/reanimated/Scheduler.java +51 -0
- package/android/src/main/java/com/swmansion/reanimated/UpdateContext.java +11 -0
- package/android/src/main/java/com/swmansion/reanimated/Utils.java +32 -0
- package/android/src/main/java/com/swmansion/reanimated/layoutReanimation/AnimationsManager.java +524 -0
- package/android/src/main/java/com/swmansion/reanimated/layoutReanimation/LayoutAnimations.java +56 -0
- package/android/src/main/java/com/swmansion/reanimated/layoutReanimation/NativeMethodsHolder.java +11 -0
- package/android/src/main/java/com/swmansion/reanimated/layoutReanimation/ReanimatedNativeHierarchyManager.java +410 -0
- package/android/src/main/java/com/swmansion/reanimated/layoutReanimation/ReanimatedUIImplementation.java +68 -0
- package/android/src/main/java/com/swmansion/reanimated/layoutReanimation/ReanimatedUIManager.java +292 -0
- package/android/src/main/java/com/swmansion/reanimated/layoutReanimation/Snapshot.java +121 -0
- package/android/src/main/java/com/swmansion/reanimated/layoutReanimation/ViewHierarchyObserver.java +12 -0
- package/android/src/main/java/com/swmansion/reanimated/nodes/AlwaysNode.java +29 -0
- package/android/src/main/java/com/swmansion/reanimated/nodes/BezierNode.java +87 -0
- package/android/src/main/java/com/swmansion/reanimated/nodes/BlockNode.java +24 -0
- package/android/src/main/java/com/swmansion/reanimated/nodes/CallFuncNode.java +49 -0
- package/android/src/main/java/com/swmansion/reanimated/nodes/ClockNode.java +38 -0
- package/android/src/main/java/com/swmansion/reanimated/nodes/ClockOpNode.java +73 -0
- package/android/src/main/java/com/swmansion/reanimated/nodes/ConcatNode.java +36 -0
- package/android/src/main/java/com/swmansion/reanimated/nodes/CondNode.java +41 -0
- package/android/src/main/java/com/swmansion/reanimated/nodes/DebugNode.java +33 -0
- package/android/src/main/java/com/swmansion/reanimated/nodes/EventNode.java +83 -0
- package/android/src/main/java/com/swmansion/reanimated/nodes/FinalNode.java +5 -0
- package/android/src/main/java/com/swmansion/reanimated/nodes/FunctionNode.java +20 -0
- package/android/src/main/java/com/swmansion/reanimated/nodes/JSCallNode.java +41 -0
- package/android/src/main/java/com/swmansion/reanimated/nodes/Node.java +139 -0
- package/android/src/main/java/com/swmansion/reanimated/nodes/NoopNode.java +37 -0
- package/android/src/main/java/com/swmansion/reanimated/nodes/OperatorNode.java +377 -0
- package/android/src/main/java/com/swmansion/reanimated/nodes/ParamNode.java +71 -0
- package/android/src/main/java/com/swmansion/reanimated/nodes/PropsNode.java +153 -0
- package/android/src/main/java/com/swmansion/reanimated/nodes/SetNode.java +32 -0
- package/android/src/main/java/com/swmansion/reanimated/nodes/StyleNode.java +40 -0
- package/android/src/main/java/com/swmansion/reanimated/nodes/TransformNode.java +84 -0
- package/android/src/main/java/com/swmansion/reanimated/nodes/ValueNode.java +40 -0
- package/android/src/main/java/com/swmansion/reanimated/sensor/ReanimatedSensor.java +41 -0
- package/android/src/main/java/com/swmansion/reanimated/sensor/ReanimatedSensorContainer.java +40 -0
- package/android/src/main/java/com/swmansion/reanimated/sensor/ReanimatedSensorListener.java +31 -0
- package/android/src/main/java/com/swmansion/reanimated/sensor/ReanimatedSensorType.java +35 -0
- package/android/src/main/java/com/swmansion/reanimated/transitions/ChangeTransition.java +84 -0
- package/android/src/main/java/com/swmansion/reanimated/transitions/SaneSidePropagation.java +25 -0
- package/android/src/main/java/com/swmansion/reanimated/transitions/Scale.java +86 -0
- package/android/src/main/java/com/swmansion/reanimated/transitions/TransitionModule.java +41 -0
- package/android/src/main/java/com/swmansion/reanimated/transitions/TransitionUtils.java +161 -0
- package/ios/LayoutReanimation/REAAnimationsManager.h +1 -1
- package/ios/LayoutReanimation/REAAnimationsManager.m +16 -6
- package/ios/LayoutReanimation/REASnapshot.m +1 -1
- package/ios/LayoutReanimation/REAUIManager.h +1 -1
- package/ios/LayoutReanimation/REAUIManager.mm +4 -5
- package/ios/Nodes/REAAlwaysNode.h +1 -1
- package/ios/Nodes/REAAlwaysNode.m +5 -5
- package/ios/Nodes/REABezierNode.h +1 -1
- package/ios/Nodes/REABezierNode.m +4 -5
- package/ios/Nodes/REABlockNode.h +1 -1
- package/ios/Nodes/REABlockNode.m +2 -2
- package/ios/Nodes/REACallFuncNode.h +1 -1
- package/ios/Nodes/REACallFuncNode.m +5 -5
- package/ios/Nodes/REAClockNodes.h +1 -1
- package/ios/Nodes/REAClockNodes.m +4 -4
- package/ios/Nodes/REAConcatNode.h +1 -1
- package/ios/Nodes/REAConcatNode.m +3 -3
- package/ios/Nodes/REACondNode.h +1 -1
- package/ios/Nodes/REACondNode.m +3 -3
- package/ios/Nodes/READebugNode.h +1 -1
- package/ios/Nodes/READebugNode.m +3 -3
- package/ios/Nodes/REAEventNode.h +1 -2
- package/ios/Nodes/REAEventNode.m +3 -3
- package/ios/Nodes/REAFunctionNode.h +1 -1
- package/ios/Nodes/REAFunctionNode.m +3 -3
- package/ios/Nodes/REAJSCallNode.h +1 -1
- package/ios/Nodes/REAJSCallNode.m +3 -3
- package/ios/Nodes/REANode.m +2 -2
- package/ios/Nodes/REAOperatorNode.h +1 -1
- package/ios/Nodes/REAOperatorNode.m +2 -3
- package/ios/Nodes/REAParamNode.h +1 -1
- package/ios/Nodes/REAParamNode.m +4 -4
- package/ios/Nodes/REAPropsNode.h +1 -1
- package/ios/Nodes/REAPropsNode.m +4 -6
- package/ios/Nodes/REASetNode.h +1 -1
- package/ios/Nodes/REASetNode.m +4 -4
- package/ios/Nodes/REAStyleNode.h +1 -1
- package/ios/Nodes/REAStyleNode.m +2 -3
- package/ios/Nodes/REATransformNode.h +1 -1
- package/ios/Nodes/REATransformNode.m +2 -2
- package/ios/Nodes/REAValueNode.h +1 -3
- package/ios/Nodes/REAValueNode.m +1 -1
- package/ios/REAEventDispatcher.m +1 -1
- package/ios/REAModule.h +1 -1
- package/ios/REAModule.m +12 -14
- package/ios/REANodesManager.h +5 -3
- package/ios/REANodesManager.m +97 -27
- package/ios/Transitioning/RCTConvert+REATransition.h +1 -2
- package/ios/Transitioning/RCTConvert+REATransition.m +1 -1
- package/ios/Transitioning/REAAllTransitions.h +1 -1
- package/ios/Transitioning/REAAllTransitions.m +2 -3
- package/ios/Transitioning/REATransition.h +2 -3
- package/ios/Transitioning/REATransition.m +3 -4
- package/ios/Transitioning/REATransitionAnimation.m +1 -2
- package/ios/Transitioning/REATransitionManager.m +2 -4
- package/ios/Transitioning/REATransitionValues.m +2 -3
- package/ios/native/NativeMethods.h +1 -3
- package/ios/native/NativeMethods.mm +1 -1
- package/ios/native/NativeProxy.h +2 -2
- package/ios/native/NativeProxy.mm +86 -15
- package/ios/native/REAIOSErrorHandler.h +2 -4
- package/ios/native/REAIOSErrorHandler.mm +1 -1
- package/ios/native/REAIOSLogger.h +1 -3
- package/ios/native/REAIOSLogger.mm +1 -1
- package/ios/native/REAIOSScheduler.h +1 -3
- package/ios/native/REAIOSScheduler.mm +2 -2
- package/ios/native/REAInitializer.h +0 -7
- package/ios/native/REAInitializer.mm +2 -2
- package/ios/native/UIResponder+Reanimated.mm +3 -3
- package/ios/sensor/ReanimatedSensor.h +25 -0
- package/ios/sensor/ReanimatedSensor.m +217 -0
- package/ios/sensor/ReanimatedSensorContainer.h +12 -0
- package/ios/sensor/ReanimatedSensorContainer.m +40 -0
- package/ios/sensor/ReanimatedSensorType.h +7 -0
- package/lib/ConfigHelper.js +2 -3
- package/lib/createAnimatedComponent.js +3 -4
- package/lib/reanimated1/core/AnimatedFunction.js +1 -1
- package/lib/reanimated1/derived/interpolate.js +2 -4
- package/lib/reanimated2/Colors.js +2 -1
- package/lib/reanimated2/Easing.js +9 -3
- package/lib/reanimated2/NativeReanimated/NativeReanimated.js +25 -12
- package/lib/reanimated2/NativeReanimated/index.js +0 -4
- package/lib/reanimated2/ViewDescriptorsSet.js +2 -2
- package/lib/reanimated2/animation/styleAnimation.js +2 -1
- package/lib/reanimated2/core.js +30 -60
- package/lib/reanimated2/globals.d.ts +7 -2
- package/lib/reanimated2/hook/index.js +1 -0
- package/lib/reanimated2/hook/useAnimatedSensor.js +66 -0
- package/lib/reanimated2/interpolateColor.js +11 -11
- package/lib/reanimated2/interpolation.js +1 -1
- package/lib/reanimated2/jestUtils.js +9 -4
- package/lib/reanimated2/js-reanimated/JSReanimated.js +23 -2
- package/lib/reanimated2/js-reanimated/index.js +3 -3
- package/lib/reanimated2/layoutReanimation/animationBuilder/ComplexAnimationBuilder.js +8 -0
- package/lib/reanimated2/layoutReanimation/animationBuilder/Keyframe.js +2 -1
- package/lib/reanimated2/layoutReanimation/defaultAnimations/Bounce.js +32 -42
- package/lib/reanimated2/layoutReanimation/defaultAnimations/Fade.js +20 -38
- package/lib/reanimated2/layoutReanimation/defaultAnimations/Flip.js +32 -44
- package/lib/reanimated2/layoutReanimation/defaultAnimations/Lightspeed.js +8 -16
- package/lib/reanimated2/layoutReanimation/defaultAnimations/Pinwheel.js +6 -10
- package/lib/reanimated2/layoutReanimation/defaultAnimations/Roll.js +8 -12
- package/lib/reanimated2/layoutReanimation/defaultAnimations/Rotate.js +20 -36
- package/lib/reanimated2/layoutReanimation/defaultAnimations/Slide.js +16 -20
- package/lib/reanimated2/layoutReanimation/defaultAnimations/Stretch.js +8 -12
- package/lib/reanimated2/layoutReanimation/defaultAnimations/Zoom.js +32 -48
- package/lib/reanimated2/layoutReanimation/defaultTransitions/EntryExitTransition.js +22 -18
- package/lib/reanimated2/mock.js +3 -2
- package/lib/types/lib/ConfigHelper.d.ts +12 -0
- package/lib/types/lib/ReanimatedEventEmitter.d.ts +3 -0
- package/lib/types/lib/ReanimatedModule.d.ts +2 -0
- package/lib/types/lib/ReanimatedModule.macos.d.ts +2 -0
- package/lib/types/lib/ReanimatedModule.native.d.ts +2 -0
- package/lib/types/lib/ReanimatedModule.windows.d.ts +2 -0
- package/lib/types/lib/ReanimatedModuleCompat.d.ts +14 -0
- package/lib/types/lib/createAnimatedComponent.d.ts +33 -0
- package/lib/types/lib/reanimated2/Bezier.d.ts +6 -0
- package/lib/types/lib/reanimated2/Colors.d.ts +31 -0
- package/lib/types/lib/reanimated2/Easing.d.ts +172 -0
- package/lib/types/lib/reanimated2/NativeMethods.d.ts +14 -0
- package/lib/types/lib/reanimated2/NativeReanimated/NativeReanimated.d.ts +20 -0
- package/lib/types/lib/reanimated2/NativeReanimated/index.d.ts +3 -0
- package/lib/types/lib/reanimated2/PlatformChecker.d.ts +5 -0
- package/lib/types/lib/reanimated2/PropAdapters.d.ts +4 -0
- package/lib/types/lib/reanimated2/UpdateProps.d.ts +9 -0
- package/lib/types/lib/reanimated2/ViewDescriptorsSet.d.ts +20 -0
- package/lib/types/lib/reanimated2/WorkletEventHandler.d.ts +13 -0
- package/lib/types/lib/reanimated2/__mocks__/MutableValue.d.ts +5 -0
- package/lib/types/lib/reanimated2/__mocks__/NativeReanimated.d.ts +13 -0
- package/lib/types/lib/reanimated2/__mocks__/NativeReanimated.native.d.ts +13 -0
- package/lib/types/lib/reanimated2/animation/commonTypes.d.ts +27 -0
- package/lib/types/lib/reanimated2/animation/decay.d.ts +19 -0
- package/lib/types/lib/reanimated2/animation/delay.d.ts +7 -0
- package/lib/types/lib/reanimated2/animation/index.d.ts +9 -0
- package/lib/types/lib/reanimated2/animation/repeat.d.ts +12 -0
- package/lib/types/lib/reanimated2/animation/sequence.d.ts +7 -0
- package/lib/types/lib/reanimated2/animation/spring.d.ts +22 -0
- package/lib/types/lib/reanimated2/animation/styleAnimation.d.ts +7 -0
- package/lib/types/lib/reanimated2/animation/timing.d.ts +21 -0
- package/lib/types/lib/reanimated2/animation/util.d.ts +9 -0
- package/lib/types/lib/reanimated2/commonTypes.d.ts +79 -0
- package/lib/types/lib/reanimated2/component/FlatList.d.ts +9 -0
- package/lib/types/lib/reanimated2/component/WrappedComponents.d.ts +8 -0
- package/lib/types/lib/reanimated2/component/index.d.ts +9 -0
- package/lib/types/lib/reanimated2/core.d.ts +24 -0
- package/lib/types/lib/reanimated2/hook/Hooks.d.ts +5 -0
- package/lib/types/lib/reanimated2/hook/commonTypes.d.ts +14 -0
- package/lib/types/lib/reanimated2/hook/index.d.ts +10 -0
- package/lib/types/lib/reanimated2/hook/useAnimatedGestureHandler.d.ts +35 -0
- package/lib/types/lib/reanimated2/hook/useAnimatedReaction.d.ts +12 -0
- package/lib/types/lib/reanimated2/hook/useAnimatedRef.d.ts +3 -0
- package/lib/types/lib/reanimated2/hook/useAnimatedScrollHandler.d.ts +21 -0
- package/lib/types/lib/reanimated2/hook/useAnimatedSensor.d.ts +20 -0
- package/lib/types/lib/reanimated2/hook/useAnimatedStyle.d.ts +11 -0
- package/lib/types/lib/reanimated2/hook/useDerivedValue.d.ts +4 -0
- package/lib/types/lib/reanimated2/hook/useSharedValue.d.ts +2 -0
- package/lib/types/lib/reanimated2/hook/utils.d.ts +28 -0
- package/lib/types/lib/reanimated2/index.d.ts +12 -0
- package/lib/types/lib/reanimated2/interpolateColor.d.ts +26 -0
- package/lib/types/lib/reanimated2/interpolation.d.ts +14 -0
- package/lib/types/lib/reanimated2/jestUtils.d.ts +12 -0
- package/lib/types/lib/reanimated2/js-reanimated/JSReanimated.d.ts +30 -0
- package/lib/types/lib/reanimated2/js-reanimated/Mapper.d.ts +14 -0
- package/lib/types/lib/reanimated2/js-reanimated/MapperRegistry.d.ts +14 -0
- package/lib/types/lib/reanimated2/js-reanimated/MutableValue.d.ts +14 -0
- package/lib/types/lib/reanimated2/js-reanimated/commonTypes.d.ts +44 -0
- package/lib/types/lib/reanimated2/js-reanimated/index.d.ts +15 -0
- package/lib/types/lib/reanimated2/layoutReanimation/LayoutAnimationRepository.d.ts +1 -0
- package/lib/types/lib/reanimated2/layoutReanimation/animationBuilder/BaseAnimationBuilder.d.ts +22 -0
- package/lib/types/lib/reanimated2/layoutReanimation/animationBuilder/ComplexAnimationBuilder.d.ts +38 -0
- package/lib/types/lib/reanimated2/layoutReanimation/animationBuilder/Keyframe.d.ts +25 -0
- package/lib/types/lib/reanimated2/layoutReanimation/animationBuilder/commonTypes.d.ts +77 -0
- package/lib/types/lib/reanimated2/layoutReanimation/animationBuilder/index.d.ts +4 -0
- package/lib/types/lib/reanimated2/layoutReanimation/defaultAnimations/Bounce.d.ts +62 -0
- package/lib/types/lib/reanimated2/layoutReanimation/defaultAnimations/Default.d.ts +4 -0
- package/lib/types/lib/reanimated2/layoutReanimation/defaultAnimations/Fade.d.ts +42 -0
- package/lib/types/lib/reanimated2/layoutReanimation/defaultAnimations/Flip.d.ts +50 -0
- package/lib/types/lib/reanimated2/layoutReanimation/defaultAnimations/Lightspeed.d.ts +18 -0
- package/lib/types/lib/reanimated2/layoutReanimation/defaultAnimations/Pinwheel.d.ts +10 -0
- package/lib/types/lib/reanimated2/layoutReanimation/defaultAnimations/Roll.d.ts +18 -0
- package/lib/types/lib/reanimated2/layoutReanimation/defaultAnimations/Rotate.d.ts +34 -0
- package/lib/types/lib/reanimated2/layoutReanimation/defaultAnimations/Slide.d.ts +34 -0
- package/lib/types/lib/reanimated2/layoutReanimation/defaultAnimations/Stretch.d.ts +18 -0
- package/lib/types/lib/reanimated2/layoutReanimation/defaultAnimations/Zoom.d.ts +66 -0
- package/lib/types/lib/reanimated2/layoutReanimation/defaultAnimations/index.d.ts +10 -0
- package/lib/types/lib/reanimated2/layoutReanimation/defaultTransitions/CurvedTransition.d.ts +19 -0
- package/lib/types/lib/reanimated2/layoutReanimation/defaultTransitions/EntryExitTransition.d.ts +13 -0
- package/lib/types/lib/reanimated2/layoutReanimation/defaultTransitions/FadingTransition.d.ts +6 -0
- package/lib/types/lib/reanimated2/layoutReanimation/defaultTransitions/JumpingTransition.d.ts +6 -0
- package/lib/types/lib/reanimated2/layoutReanimation/defaultTransitions/LinearTransition.d.ts +7 -0
- package/lib/types/lib/reanimated2/layoutReanimation/defaultTransitions/SequencedTransition.d.ts +9 -0
- package/lib/types/lib/reanimated2/layoutReanimation/defaultTransitions/index.d.ts +6 -0
- package/lib/types/lib/reanimated2/layoutReanimation/index.d.ts +4 -0
- package/lib/types/lib/reanimated2/mock.d.ts +55 -0
- package/lib/types/lib/reanimated2/platform-specific/RNRenderer.d.ts +1 -0
- package/lib/types/lib/reanimated2/platform-specific/RNRenderer.web.d.ts +0 -0
- package/lib/types/lib/reanimated2/utils.d.ts +7 -0
- package/lib/types/lib/setAndForwardRef.d.ts +40 -0
- package/lib/types/react-native-reanimated-tests.d.ts +1 -0
- package/mock.js +4 -4
- package/package.json +43 -39
- package/plugin.js +3 -12
- package/react-native-reanimated.d.ts +58 -32
- package/src/ConfigHelper.ts +4 -5
- package/src/createAnimatedComponent.tsx +4 -4
- package/src/reanimated1/core/AnimatedFunction.js +1 -1
- package/src/reanimated1/derived/interpolate.js +2 -4
- package/src/reanimated2/Colors.ts +2 -1
- package/src/reanimated2/Easing.ts +9 -3
- package/src/reanimated2/NativeReanimated/NativeReanimated.ts +42 -15
- package/src/reanimated2/NativeReanimated/index.ts +0 -6
- package/src/reanimated2/ViewDescriptorsSet.ts +2 -3
- package/src/reanimated2/animation/index.ts +1 -0
- package/src/reanimated2/animation/styleAnimation.ts +10 -7
- package/src/reanimated2/animation/timing.ts +3 -1
- package/src/reanimated2/animation/util.ts +10 -11
- package/src/reanimated2/commonTypes.ts +20 -1
- package/src/reanimated2/component/FlatList.tsx +3 -2
- package/src/reanimated2/core.ts +34 -73
- package/src/reanimated2/globals.d.ts +7 -2
- package/src/reanimated2/hook/index.ts +1 -0
- package/src/reanimated2/hook/useAnimatedSensor.ts +91 -0
- package/src/reanimated2/hook/utils.ts +2 -1
- package/src/reanimated2/interpolateColor.ts +11 -11
- package/src/reanimated2/interpolation.ts +2 -6
- package/src/reanimated2/jestUtils.ts +20 -4
- package/src/reanimated2/js-reanimated/JSReanimated.ts +25 -2
- package/src/reanimated2/js-reanimated/index.ts +3 -3
- package/src/reanimated2/layoutReanimation/animationBuilder/ComplexAnimationBuilder.ts +13 -0
- package/src/reanimated2/layoutReanimation/animationBuilder/Keyframe.ts +2 -3
- package/src/reanimated2/layoutReanimation/defaultAnimations/Bounce.ts +51 -21
- package/src/reanimated2/layoutReanimation/defaultAnimations/Fade.ts +40 -10
- package/src/reanimated2/layoutReanimation/defaultAnimations/Flip.ts +48 -12
- package/src/reanimated2/layoutReanimation/defaultAnimations/Lightspeed.ts +16 -4
- package/src/reanimated2/layoutReanimation/defaultAnimations/Pinwheel.ts +8 -2
- package/src/reanimated2/layoutReanimation/defaultAnimations/Roll.ts +16 -4
- package/src/reanimated2/layoutReanimation/defaultAnimations/Rotate.ts +32 -8
- package/src/reanimated2/layoutReanimation/defaultAnimations/Slide.ts +32 -10
- package/src/reanimated2/layoutReanimation/defaultAnimations/Stretch.ts +16 -4
- package/src/reanimated2/layoutReanimation/defaultAnimations/Zoom.ts +64 -16
- package/src/reanimated2/layoutReanimation/defaultTransitions/CurvedTransition.ts +2 -1
- package/src/reanimated2/layoutReanimation/defaultTransitions/EntryExitTransition.ts +26 -19
- package/src/reanimated2/layoutReanimation/defaultTransitions/FadingTransition.ts +2 -1
- package/src/reanimated2/layoutReanimation/defaultTransitions/JumpingTransition.ts +2 -1
- package/src/reanimated2/layoutReanimation/defaultTransitions/LinearTransition.ts +2 -1
- package/src/reanimated2/layoutReanimation/defaultTransitions/SequencedTransition.ts +2 -1
- package/src/reanimated2/mock.ts +3 -2
- package/android/expo/linking.gradle +0 -46
- package/android/expo/src/main/java/com/swmansion/reanimated/EXReanimatedAdapter.java +0 -12
- package/android/expo/src/main/java/expo/modules/adapters/reanimated/EXReanimatedPackage.java +0 -26
- package/android/react-native-reanimated-63-hermes.aar +0 -0
- package/android/react-native-reanimated-63-jsc.aar +0 -0
- package/android/src/main/java/com/swmansion/reanimated/ReanimatedProxyPackage.java +0 -15
- package/expo-module.config.json +0 -3
- package/libSo/fbjni/jni/arm64-v8a/libfbjni.so +0 -0
- package/libSo/fbjni/jni/armeabi-v7a/libfbjni.so +0 -0
- package/libSo/fbjni/jni/x86/libfbjni.so +0 -0
- package/libSo/fbjni/jni/x86_64/libfbjni.so +0 -0
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
#include "AnimatedSensorModule.h"
|
|
2
|
+
#include "MutableValue.h"
|
|
3
|
+
#include "ValueWrapper.h"
|
|
4
|
+
|
|
5
|
+
namespace reanimated {
|
|
6
|
+
|
|
7
|
+
AnimatedSensorModule::AnimatedSensorModule(
|
|
8
|
+
const PlatformDepMethodsHolder &platformDepMethodsHolder,
|
|
9
|
+
RuntimeManager *runtimeManager)
|
|
10
|
+
: platformRegisterSensorFunction_(platformDepMethodsHolder.registerSensor),
|
|
11
|
+
platformUnregisterSensorFunction_(
|
|
12
|
+
platformDepMethodsHolder.unregisterSensor),
|
|
13
|
+
runtimeManager_(runtimeManager) {}
|
|
14
|
+
|
|
15
|
+
AnimatedSensorModule::~AnimatedSensorModule() {
|
|
16
|
+
// It is called during app reload because app reload doesn't call hooks
|
|
17
|
+
// unmounting
|
|
18
|
+
for (auto sensorId : sensorsIds_) {
|
|
19
|
+
platformUnregisterSensorFunction_(sensorId);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
jsi::Value AnimatedSensorModule::registerSensor(
|
|
24
|
+
jsi::Runtime &rt,
|
|
25
|
+
const jsi::Value &sensorType,
|
|
26
|
+
const jsi::Value &interval,
|
|
27
|
+
const jsi::Value &sensorDataContainer) {
|
|
28
|
+
std::shared_ptr<ShareableValue> sensorsData = ShareableValue::adapt(
|
|
29
|
+
rt, sensorDataContainer.getObject(rt), runtimeManager_);
|
|
30
|
+
auto &mutableObject =
|
|
31
|
+
ValueWrapper::asMutableValue(sensorsData->valueContainer);
|
|
32
|
+
|
|
33
|
+
std::function<void(double[])> setter;
|
|
34
|
+
if (sensorType.asNumber() == SensorType::ROTATION_VECTOR) {
|
|
35
|
+
setter = [&, mutableObject](double newValues[]) {
|
|
36
|
+
jsi::Runtime &runtime = *runtimeManager_->runtime.get();
|
|
37
|
+
jsi::Object value(runtime);
|
|
38
|
+
value.setProperty(runtime, "qw", newValues[0]);
|
|
39
|
+
value.setProperty(runtime, "qx", newValues[1]);
|
|
40
|
+
value.setProperty(runtime, "qy", newValues[2]);
|
|
41
|
+
value.setProperty(runtime, "qz", newValues[3]);
|
|
42
|
+
value.setProperty(runtime, "yaw", newValues[4]);
|
|
43
|
+
value.setProperty(runtime, "pitch", newValues[5]);
|
|
44
|
+
value.setProperty(runtime, "roll", newValues[6]);
|
|
45
|
+
mutableObject->setValue(runtime, std::move(value));
|
|
46
|
+
};
|
|
47
|
+
} else {
|
|
48
|
+
setter = [&, mutableObject](double newValues[]) {
|
|
49
|
+
jsi::Runtime &runtime = *runtimeManager_->runtime.get();
|
|
50
|
+
jsi::Object value(runtime);
|
|
51
|
+
value.setProperty(runtime, "x", newValues[0]);
|
|
52
|
+
value.setProperty(runtime, "y", newValues[1]);
|
|
53
|
+
value.setProperty(runtime, "z", newValues[2]);
|
|
54
|
+
mutableObject->setValue(runtime, std::move(value));
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
int sensorId = platformRegisterSensorFunction_(
|
|
59
|
+
sensorType.asNumber(), interval.asNumber(), setter);
|
|
60
|
+
if (sensorId != -1) {
|
|
61
|
+
sensorsIds_.insert(sensorId);
|
|
62
|
+
}
|
|
63
|
+
return jsi::Value(sensorId);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
void AnimatedSensorModule::unregisterSensor(const jsi::Value &sensorId) {
|
|
67
|
+
// It is called during sensor hook unmounting
|
|
68
|
+
sensorsIds_.erase(sensorId.getNumber());
|
|
69
|
+
platformUnregisterSensorFunction_(sensorId.asNumber());
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
} // namespace reanimated
|
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
#include "JSIStoreValueUser.h"
|
|
9
9
|
#include "Mapper.h"
|
|
10
10
|
#include "MapperRegistry.h"
|
|
11
|
+
#include "MutableValue.h"
|
|
11
12
|
#include "ReanimatedHiddenHeaders.h"
|
|
12
13
|
#include "RuntimeDecorator.h"
|
|
13
14
|
#include "ShareableValue.h"
|
|
@@ -70,7 +71,10 @@ NativeReanimatedModule::NativeReanimatedModule(
|
|
|
70
71
|
mapperRegistry(std::make_shared<MapperRegistry>()),
|
|
71
72
|
eventHandlerRegistry(std::make_shared<EventHandlerRegistry>()),
|
|
72
73
|
requestRender(platformDepMethodsHolder.requestRender),
|
|
73
|
-
propObtainer(propObtainer)
|
|
74
|
+
propObtainer(propObtainer),
|
|
75
|
+
animatedSensorModule(platformDepMethodsHolder, this),
|
|
76
|
+
configurePropsPlatformFunction(
|
|
77
|
+
platformDepMethodsHolder.configurePropsFunction) {
|
|
74
78
|
auto requestAnimationFrame = [=](FrameCallback callback) {
|
|
75
79
|
frameCallbacks.push_back(callback);
|
|
76
80
|
maybeRequestRender();
|
|
@@ -85,6 +89,8 @@ NativeReanimatedModule::NativeReanimatedModule(
|
|
|
85
89
|
platformDepMethodsHolder.scrollToFunction,
|
|
86
90
|
platformDepMethodsHolder.measuringFunction,
|
|
87
91
|
platformDepMethodsHolder.getCurrentTime,
|
|
92
|
+
platformDepMethodsHolder.registerSensor,
|
|
93
|
+
platformDepMethodsHolder.unregisterSensor,
|
|
88
94
|
platformDepMethodsHolder.setGestureStateFunction,
|
|
89
95
|
layoutAnimationsProxy);
|
|
90
96
|
onRenderCallback = [this](double timestampMs) {
|
|
@@ -243,6 +249,14 @@ jsi::Value NativeReanimatedModule::enableLayoutAnimations(
|
|
|
243
249
|
return jsi::Value::undefined();
|
|
244
250
|
}
|
|
245
251
|
|
|
252
|
+
jsi::Value NativeReanimatedModule::configureProps(
|
|
253
|
+
jsi::Runtime &rt,
|
|
254
|
+
const jsi::Value &uiProps,
|
|
255
|
+
const jsi::Value &nativeProps) {
|
|
256
|
+
configurePropsPlatformFunction(rt, uiProps, nativeProps);
|
|
257
|
+
return jsi::Value::undefined();
|
|
258
|
+
}
|
|
259
|
+
|
|
246
260
|
void NativeReanimatedModule::onEvent(
|
|
247
261
|
std::string eventName,
|
|
248
262
|
std::string eventAsString) {
|
|
@@ -298,4 +312,19 @@ void NativeReanimatedModule::onRender(double timestampMs) {
|
|
|
298
312
|
}
|
|
299
313
|
}
|
|
300
314
|
|
|
315
|
+
jsi::Value NativeReanimatedModule::registerSensor(
|
|
316
|
+
jsi::Runtime &rt,
|
|
317
|
+
const jsi::Value &sensorType,
|
|
318
|
+
const jsi::Value &interval,
|
|
319
|
+
const jsi::Value &sensorDataContainer) {
|
|
320
|
+
return animatedSensorModule.registerSensor(
|
|
321
|
+
rt, sensorType, interval, sensorDataContainer);
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
void NativeReanimatedModule::unregisterSensor(
|
|
325
|
+
jsi::Runtime &rt,
|
|
326
|
+
const jsi::Value &sensorId) {
|
|
327
|
+
animatedSensorModule.unregisterSensor(sensorId);
|
|
328
|
+
}
|
|
329
|
+
|
|
301
330
|
} // namespace reanimated
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
#include "NativeReanimatedModuleSpec.h"
|
|
2
2
|
|
|
3
|
+
#define SPEC_PREFIX(FN_NAME) __hostFunction_NativeReanimatedModuleSpec_##FN_NAME
|
|
4
|
+
|
|
3
5
|
namespace reanimated {
|
|
4
6
|
|
|
5
|
-
static jsi::Value
|
|
6
|
-
__hostFunction_NativeReanimatedModuleSpec_installCoreFunctions(
|
|
7
|
+
static jsi::Value SPEC_PREFIX(installCoreFunctions)(
|
|
7
8
|
jsi::Runtime &rt,
|
|
8
9
|
TurboModule &turboModule,
|
|
9
10
|
const jsi::Value *args,
|
|
@@ -15,7 +16,7 @@ __hostFunction_NativeReanimatedModuleSpec_installCoreFunctions(
|
|
|
15
16
|
|
|
16
17
|
// SharedValue
|
|
17
18
|
|
|
18
|
-
static jsi::Value
|
|
19
|
+
static jsi::Value SPEC_PREFIX(makeShareable)(
|
|
19
20
|
jsi::Runtime &rt,
|
|
20
21
|
TurboModule &turboModule,
|
|
21
22
|
const jsi::Value *args,
|
|
@@ -24,7 +25,7 @@ static jsi::Value __hostFunction_NativeReanimatedModuleSpec_makeShareable(
|
|
|
24
25
|
->makeShareable(rt, std::move(args[0]));
|
|
25
26
|
}
|
|
26
27
|
|
|
27
|
-
static jsi::Value
|
|
28
|
+
static jsi::Value SPEC_PREFIX(makeMutable)(
|
|
28
29
|
jsi::Runtime &rt,
|
|
29
30
|
TurboModule &turboModule,
|
|
30
31
|
const jsi::Value *args,
|
|
@@ -33,7 +34,7 @@ static jsi::Value __hostFunction_NativeReanimatedModuleSpec_makeMutable(
|
|
|
33
34
|
->makeMutable(rt, std::move(args[0]));
|
|
34
35
|
}
|
|
35
36
|
|
|
36
|
-
static jsi::Value
|
|
37
|
+
static jsi::Value SPEC_PREFIX(makeRemote)(
|
|
37
38
|
jsi::Runtime &rt,
|
|
38
39
|
TurboModule &turboModule,
|
|
39
40
|
const jsi::Value *args,
|
|
@@ -42,7 +43,7 @@ static jsi::Value __hostFunction_NativeReanimatedModuleSpec_makeRemote(
|
|
|
42
43
|
->makeRemote(rt, std::move(args[0]));
|
|
43
44
|
}
|
|
44
45
|
|
|
45
|
-
static jsi::Value
|
|
46
|
+
static jsi::Value SPEC_PREFIX(startMapper)(
|
|
46
47
|
jsi::Runtime &rt,
|
|
47
48
|
TurboModule &turboModule,
|
|
48
49
|
const jsi::Value *args,
|
|
@@ -57,7 +58,7 @@ static jsi::Value __hostFunction_NativeReanimatedModuleSpec_startMapper(
|
|
|
57
58
|
std::move(args[4]));
|
|
58
59
|
}
|
|
59
60
|
|
|
60
|
-
static jsi::Value
|
|
61
|
+
static jsi::Value SPEC_PREFIX(stopMapper)(
|
|
61
62
|
jsi::Runtime &rt,
|
|
62
63
|
TurboModule &turboModule,
|
|
63
64
|
const jsi::Value *args,
|
|
@@ -67,8 +68,7 @@ static jsi::Value __hostFunction_NativeReanimatedModuleSpec_stopMapper(
|
|
|
67
68
|
return jsi::Value::undefined();
|
|
68
69
|
}
|
|
69
70
|
|
|
70
|
-
static jsi::Value
|
|
71
|
-
__hostFunction_NativeReanimatedModuleSpec_registerEventHandler(
|
|
71
|
+
static jsi::Value SPEC_PREFIX(registerEventHandler)(
|
|
72
72
|
jsi::Runtime &rt,
|
|
73
73
|
TurboModule &turboModule,
|
|
74
74
|
const jsi::Value *args,
|
|
@@ -77,8 +77,7 @@ __hostFunction_NativeReanimatedModuleSpec_registerEventHandler(
|
|
|
77
77
|
->registerEventHandler(rt, std::move(args[0]), std::move(args[1]));
|
|
78
78
|
}
|
|
79
79
|
|
|
80
|
-
static jsi::Value
|
|
81
|
-
__hostFunction_NativeReanimatedModuleSpec_unregisterEventHandler(
|
|
80
|
+
static jsi::Value SPEC_PREFIX(unregisterEventHandler)(
|
|
82
81
|
jsi::Runtime &rt,
|
|
83
82
|
TurboModule &turboModule,
|
|
84
83
|
const jsi::Value *args,
|
|
@@ -88,7 +87,7 @@ __hostFunction_NativeReanimatedModuleSpec_unregisterEventHandler(
|
|
|
88
87
|
return jsi::Value::undefined();
|
|
89
88
|
}
|
|
90
89
|
|
|
91
|
-
static jsi::Value
|
|
90
|
+
static jsi::Value SPEC_PREFIX(getViewProp)(
|
|
92
91
|
jsi::Runtime &rt,
|
|
93
92
|
TurboModule &turboModule,
|
|
94
93
|
const jsi::Value *args,
|
|
@@ -99,8 +98,7 @@ static jsi::Value __hostFunction_NativeReanimatedModuleSpec_getViewProp(
|
|
|
99
98
|
return jsi::Value::undefined();
|
|
100
99
|
}
|
|
101
100
|
|
|
102
|
-
static jsi::Value
|
|
103
|
-
__hostFunction_NativeReanimatedModuleSpec_enableLayoutAnimations(
|
|
101
|
+
static jsi::Value SPEC_PREFIX(enableLayoutAnimations)(
|
|
104
102
|
jsi::Runtime &rt,
|
|
105
103
|
TurboModule &turboModule,
|
|
106
104
|
const jsi::Value *args,
|
|
@@ -110,33 +108,60 @@ __hostFunction_NativeReanimatedModuleSpec_enableLayoutAnimations(
|
|
|
110
108
|
return jsi::Value::undefined();
|
|
111
109
|
}
|
|
112
110
|
|
|
111
|
+
static jsi::Value SPEC_PREFIX(registerSensor)(
|
|
112
|
+
jsi::Runtime &rt,
|
|
113
|
+
TurboModule &turboModule,
|
|
114
|
+
const jsi::Value *args,
|
|
115
|
+
size_t count) {
|
|
116
|
+
return static_cast<NativeReanimatedModuleSpec *>(&turboModule)
|
|
117
|
+
->registerSensor(
|
|
118
|
+
rt, std::move(args[0]), std::move(args[1]), std::move(args[2]));
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
static jsi::Value SPEC_PREFIX(unregisterSensor)(
|
|
122
|
+
jsi::Runtime &rt,
|
|
123
|
+
TurboModule &turboModule,
|
|
124
|
+
const jsi::Value *args,
|
|
125
|
+
size_t count) {
|
|
126
|
+
static_cast<NativeReanimatedModuleSpec *>(&turboModule)
|
|
127
|
+
->unregisterSensor(rt, std::move(args[0]));
|
|
128
|
+
return jsi::Value::undefined();
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
static jsi::Value SPEC_PREFIX(configureProps)(
|
|
132
|
+
jsi::Runtime &rt,
|
|
133
|
+
TurboModule &turboModule,
|
|
134
|
+
const jsi::Value *args,
|
|
135
|
+
size_t count) {
|
|
136
|
+
static_cast<NativeReanimatedModuleSpec *>(&turboModule)
|
|
137
|
+
->configureProps(rt, std::move(args[0]), std::move(args[1]));
|
|
138
|
+
return jsi::Value::undefined();
|
|
139
|
+
}
|
|
140
|
+
|
|
113
141
|
NativeReanimatedModuleSpec::NativeReanimatedModuleSpec(
|
|
114
142
|
std::shared_ptr<CallInvoker> jsInvoker)
|
|
115
143
|
: TurboModule("NativeReanimated", jsInvoker) {
|
|
116
|
-
methodMap_["installCoreFunctions"] =
|
|
117
|
-
1,
|
|
118
|
-
|
|
119
|
-
methodMap_["makeShareable"] = MethodMetadata{
|
|
120
|
-
|
|
121
|
-
methodMap_["
|
|
122
|
-
|
|
123
|
-
methodMap_["
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
methodMap_["
|
|
127
|
-
MethodMetadata{
|
|
128
|
-
methodMap_["
|
|
129
|
-
MethodMetadata{1,
|
|
130
|
-
|
|
131
|
-
methodMap_["
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
methodMap_["enableLayoutAnimations"] = MethodMetadata{
|
|
139
|
-
2, __hostFunction_NativeReanimatedModuleSpec_enableLayoutAnimations};
|
|
144
|
+
methodMap_["installCoreFunctions"] =
|
|
145
|
+
MethodMetadata{1, SPEC_PREFIX(installCoreFunctions)};
|
|
146
|
+
|
|
147
|
+
methodMap_["makeShareable"] = MethodMetadata{1, SPEC_PREFIX(makeShareable)};
|
|
148
|
+
methodMap_["makeMutable"] = MethodMetadata{1, SPEC_PREFIX(makeMutable)};
|
|
149
|
+
methodMap_["makeRemote"] = MethodMetadata{1, SPEC_PREFIX(makeRemote)};
|
|
150
|
+
|
|
151
|
+
methodMap_["startMapper"] = MethodMetadata{5, SPEC_PREFIX(startMapper)};
|
|
152
|
+
methodMap_["stopMapper"] = MethodMetadata{1, SPEC_PREFIX(stopMapper)};
|
|
153
|
+
|
|
154
|
+
methodMap_["registerEventHandler"] =
|
|
155
|
+
MethodMetadata{2, SPEC_PREFIX(registerEventHandler)};
|
|
156
|
+
methodMap_["unregisterEventHandler"] =
|
|
157
|
+
MethodMetadata{1, SPEC_PREFIX(unregisterEventHandler)};
|
|
158
|
+
|
|
159
|
+
methodMap_["getViewProp"] = MethodMetadata{3, SPEC_PREFIX(getViewProp)};
|
|
160
|
+
methodMap_["enableLayoutAnimations"] =
|
|
161
|
+
MethodMetadata{2, SPEC_PREFIX(enableLayoutAnimations)};
|
|
162
|
+
methodMap_["registerSensor"] = MethodMetadata{3, SPEC_PREFIX(registerSensor)};
|
|
163
|
+
methodMap_["unregisterSensor"] =
|
|
164
|
+
MethodMetadata{1, SPEC_PREFIX(unregisterSensor)};
|
|
165
|
+
methodMap_["configureProps"] = MethodMetadata{2, SPEC_PREFIX(configureProps)};
|
|
140
166
|
}
|
|
141
|
-
|
|
142
167
|
} // namespace reanimated
|
|
@@ -64,7 +64,7 @@ void ShareableValue::adapt(
|
|
|
64
64
|
jsi::Object hiddenProperty = hiddenValue.asObject(rt);
|
|
65
65
|
if (hiddenProperty.isHostObject<FrozenObject>(rt)) {
|
|
66
66
|
type = ValueType::FrozenObjectType;
|
|
67
|
-
if (object.hasProperty(rt, "
|
|
67
|
+
if (object.hasProperty(rt, "__workletHash") && object.isFunction(rt)) {
|
|
68
68
|
type = ValueType::WorkletFunctionType;
|
|
69
69
|
}
|
|
70
70
|
valueContainer = std::make_unique<FrozenObjectWrapper>(
|
|
@@ -99,7 +99,7 @@ void ShareableValue::adapt(
|
|
|
99
99
|
} else if (value.isObject()) {
|
|
100
100
|
auto object = value.asObject(rt);
|
|
101
101
|
if (object.isFunction(rt)) {
|
|
102
|
-
if (object.getProperty(rt, "
|
|
102
|
+
if (object.getProperty(rt, "__workletHash").isUndefined()) {
|
|
103
103
|
// not a worklet, we treat this as a host function
|
|
104
104
|
type = ValueType::HostFunctionType;
|
|
105
105
|
containsHostFunction = true;
|
|
@@ -31,20 +31,6 @@ void RuntimeDecorator::decorateRuntime(
|
|
|
31
31
|
rt, "_LABEL", jsi::String::createFromAscii(rt, label));
|
|
32
32
|
|
|
33
33
|
jsi::Object dummyGlobal(rt);
|
|
34
|
-
auto dummyFunction = [](jsi::Runtime &rt,
|
|
35
|
-
const jsi::Value &thisValue,
|
|
36
|
-
const jsi::Value *args,
|
|
37
|
-
size_t count) -> jsi::Value {
|
|
38
|
-
return jsi::Value::undefined();
|
|
39
|
-
};
|
|
40
|
-
jsi::Function __reanimatedWorkletInit = jsi::Function::createFromHostFunction(
|
|
41
|
-
rt,
|
|
42
|
-
jsi::PropNameID::forAscii(rt, "__reanimatedWorkletInit"),
|
|
43
|
-
1,
|
|
44
|
-
dummyFunction);
|
|
45
|
-
|
|
46
|
-
dummyGlobal.setProperty(
|
|
47
|
-
rt, "__reanimatedWorkletInit", __reanimatedWorkletInit);
|
|
48
34
|
rt.global().setProperty(rt, "global", dummyGlobal);
|
|
49
35
|
|
|
50
36
|
rt.global().setProperty(rt, "jsThis", jsi::Value::undefined());
|
|
@@ -109,6 +95,8 @@ void RuntimeDecorator::decorateUIRuntime(
|
|
|
109
95
|
const ScrollToFunction scrollTo,
|
|
110
96
|
const MeasuringFunction measure,
|
|
111
97
|
const TimeProviderFunction getCurrentTime,
|
|
98
|
+
const RegisterSensorFunction registerSensor,
|
|
99
|
+
const UnregisterSensorFunction unregisterSensor,
|
|
112
100
|
const SetGestureStateFunction setGestureState,
|
|
113
101
|
std::shared_ptr<LayoutAnimationsProxy> layoutAnimationsProxy) {
|
|
114
102
|
RuntimeDecorator::decorateRuntime(rt, "UI");
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
#pragma once
|
|
2
|
+
|
|
3
|
+
#include <jsi/jsi.h>
|
|
4
|
+
#include <unordered_set>
|
|
5
|
+
|
|
6
|
+
#include "PlatformDepMethodsHolder.h"
|
|
7
|
+
#include "RuntimeManager.h"
|
|
8
|
+
|
|
9
|
+
namespace reanimated {
|
|
10
|
+
|
|
11
|
+
using namespace facebook;
|
|
12
|
+
|
|
13
|
+
enum SensorType {
|
|
14
|
+
ACCELEROMETER = 1,
|
|
15
|
+
GYROSCOPE = 2,
|
|
16
|
+
GRAVITY = 3,
|
|
17
|
+
MAGNETIC_FIELD = 4,
|
|
18
|
+
ROTATION_VECTOR = 5,
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
class AnimatedSensorModule {
|
|
22
|
+
std::unordered_set<int> sensorsIds_;
|
|
23
|
+
RegisterSensorFunction platformRegisterSensorFunction_;
|
|
24
|
+
UnregisterSensorFunction platformUnregisterSensorFunction_;
|
|
25
|
+
RuntimeManager *runtimeManager_;
|
|
26
|
+
|
|
27
|
+
public:
|
|
28
|
+
AnimatedSensorModule(
|
|
29
|
+
const PlatformDepMethodsHolder &platformDepMethodsHolder,
|
|
30
|
+
RuntimeManager *runtimeManager);
|
|
31
|
+
~AnimatedSensorModule();
|
|
32
|
+
|
|
33
|
+
jsi::Value registerSensor(
|
|
34
|
+
jsi::Runtime &rt,
|
|
35
|
+
const jsi::Value &sensorType,
|
|
36
|
+
const jsi::Value &interval,
|
|
37
|
+
const jsi::Value &sensorDataContainer);
|
|
38
|
+
void unregisterSensor(const jsi::Value &sensorId);
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
} // namespace reanimated
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
#include <string>
|
|
6
6
|
#include <vector>
|
|
7
7
|
|
|
8
|
+
#include "AnimatedSensorModule.h"
|
|
8
9
|
#include "ErrorHandler.h"
|
|
9
10
|
#include "LayoutAnimationsProxy.h"
|
|
10
11
|
#include "NativeReanimatedModuleSpec.h"
|
|
@@ -70,6 +71,10 @@ class NativeReanimatedModule : public NativeReanimatedModuleSpec,
|
|
|
70
71
|
|
|
71
72
|
jsi::Value enableLayoutAnimations(jsi::Runtime &rt, const jsi::Value &config)
|
|
72
73
|
override;
|
|
74
|
+
jsi::Value configureProps(
|
|
75
|
+
jsi::Runtime &rt,
|
|
76
|
+
const jsi::Value &uiProps,
|
|
77
|
+
const jsi::Value &nativeProps) override;
|
|
73
78
|
|
|
74
79
|
void onRender(double timestampMs);
|
|
75
80
|
void onEvent(std::string eventName, std::string eventAsString);
|
|
@@ -78,6 +83,13 @@ class NativeReanimatedModule : public NativeReanimatedModuleSpec,
|
|
|
78
83
|
void maybeRequestRender();
|
|
79
84
|
UpdaterFunction updaterFunction;
|
|
80
85
|
|
|
86
|
+
jsi::Value registerSensor(
|
|
87
|
+
jsi::Runtime &rt,
|
|
88
|
+
const jsi::Value &sensorType,
|
|
89
|
+
const jsi::Value &interval,
|
|
90
|
+
const jsi::Value &sensorDataContainer) override;
|
|
91
|
+
void unregisterSensor(jsi::Runtime &rt, const jsi::Value &sensorId) override;
|
|
92
|
+
|
|
81
93
|
private:
|
|
82
94
|
std::shared_ptr<MapperRegistry> mapperRegistry;
|
|
83
95
|
std::shared_ptr<EventHandlerRegistry> eventHandlerRegistry;
|
|
@@ -89,6 +101,8 @@ class NativeReanimatedModule : public NativeReanimatedModuleSpec,
|
|
|
89
101
|
propObtainer;
|
|
90
102
|
std::function<void(double)> onRenderCallback;
|
|
91
103
|
std::shared_ptr<LayoutAnimationsProxy> layoutAnimationsProxy;
|
|
104
|
+
AnimatedSensorModule animatedSensorModule;
|
|
105
|
+
ConfigurePropsFunction configurePropsPlatformFunction;
|
|
92
106
|
};
|
|
93
107
|
|
|
94
108
|
} // namespace reanimated
|
|
@@ -59,10 +59,24 @@ class JSI_EXPORT NativeReanimatedModuleSpec : public TurboModule {
|
|
|
59
59
|
const jsi::Value &propName,
|
|
60
60
|
const jsi::Value &callback) = 0;
|
|
61
61
|
|
|
62
|
+
// sensors
|
|
63
|
+
virtual jsi::Value registerSensor(
|
|
64
|
+
jsi::Runtime &rt,
|
|
65
|
+
const jsi::Value &sensorType,
|
|
66
|
+
const jsi::Value &interval,
|
|
67
|
+
const jsi::Value &sensorDataContainer) = 0;
|
|
68
|
+
virtual void unregisterSensor(
|
|
69
|
+
jsi::Runtime &rt,
|
|
70
|
+
const jsi::Value &sensorId) = 0;
|
|
71
|
+
|
|
62
72
|
// other
|
|
63
73
|
virtual jsi::Value enableLayoutAnimations(
|
|
64
74
|
jsi::Runtime &rt,
|
|
65
75
|
const jsi::Value &config) = 0;
|
|
76
|
+
virtual jsi::Value configureProps(
|
|
77
|
+
jsi::Runtime &rt,
|
|
78
|
+
const jsi::Value &uiProps,
|
|
79
|
+
const jsi::Value &nativeProps) = 0;
|
|
66
80
|
};
|
|
67
81
|
|
|
68
82
|
} // namespace reanimated
|
|
@@ -20,13 +20,16 @@ class MutableValue : public jsi::HostObject,
|
|
|
20
20
|
public StoreUser {
|
|
21
21
|
private:
|
|
22
22
|
friend MutableValueSetterProxy;
|
|
23
|
-
RuntimeManager *runtimeManager;
|
|
24
23
|
friend LayoutAnimationsProxy;
|
|
24
|
+
|
|
25
|
+
private:
|
|
26
|
+
RuntimeManager *runtimeManager;
|
|
25
27
|
std::mutex readWriteMutex;
|
|
26
28
|
std::shared_ptr<ShareableValue> value;
|
|
27
29
|
std::weak_ptr<jsi::Value> animation;
|
|
28
30
|
std::map<unsigned long, std::function<void()>> listeners;
|
|
29
31
|
|
|
32
|
+
public:
|
|
30
33
|
void setValue(jsi::Runtime &rt, const jsi::Value &newValue);
|
|
31
34
|
jsi::Value getValue(jsi::Runtime &rt);
|
|
32
35
|
|
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
#include <string>
|
|
7
7
|
#include <unordered_map>
|
|
8
8
|
#include <vector>
|
|
9
|
+
#include "AnimatedSensorModule.h"
|
|
9
10
|
#include "HostFunctionHandler.h"
|
|
10
11
|
#include "JSIStoreValueUser.h"
|
|
11
12
|
#include "LayoutAnimationsProxy.h"
|
|
@@ -24,6 +25,8 @@ class ShareableValue : public std::enable_shared_from_this<ShareableValue>,
|
|
|
24
25
|
friend WorkletsCache;
|
|
25
26
|
friend FrozenObject;
|
|
26
27
|
friend LayoutAnimationsProxy;
|
|
28
|
+
friend NativeReanimatedModule;
|
|
29
|
+
friend AnimatedSensorModule;
|
|
27
30
|
friend void extractMutables(
|
|
28
31
|
jsi::Runtime &rt,
|
|
29
32
|
std::shared_ptr<ShareableValue> sv,
|
|
@@ -21,7 +21,15 @@ using ScrollToFunction = std::function<void(int, double, double, bool)>;
|
|
|
21
21
|
using MeasuringFunction =
|
|
22
22
|
std::function<std::vector<std::pair<std::string, double>>(int)>;
|
|
23
23
|
using TimeProviderFunction = std::function<double(void)>;
|
|
24
|
+
|
|
25
|
+
using RegisterSensorFunction =
|
|
26
|
+
std::function<int(int, int, std::function<void(double[])>)>;
|
|
27
|
+
using UnregisterSensorFunction = std::function<void(int)>;
|
|
24
28
|
using SetGestureStateFunction = std::function<void(int, int)>;
|
|
29
|
+
using ConfigurePropsFunction = std::function<void(
|
|
30
|
+
jsi::Runtime &rt,
|
|
31
|
+
const jsi::Value &uiProps,
|
|
32
|
+
const jsi::Value &nativeProps)>;
|
|
25
33
|
|
|
26
34
|
struct PlatformDepMethodsHolder {
|
|
27
35
|
RequestRender requestRender;
|
|
@@ -29,7 +37,10 @@ struct PlatformDepMethodsHolder {
|
|
|
29
37
|
ScrollToFunction scrollToFunction;
|
|
30
38
|
MeasuringFunction measuringFunction;
|
|
31
39
|
TimeProviderFunction getCurrentTime;
|
|
40
|
+
RegisterSensorFunction registerSensor;
|
|
41
|
+
UnregisterSensorFunction unregisterSensor;
|
|
32
42
|
SetGestureStateFunction setGestureStateFunction;
|
|
43
|
+
ConfigurePropsFunction configurePropsFunction;
|
|
33
44
|
};
|
|
34
45
|
|
|
35
46
|
} // namespace reanimated
|
|
@@ -36,6 +36,8 @@ class RuntimeDecorator {
|
|
|
36
36
|
const ScrollToFunction scrollTo,
|
|
37
37
|
const MeasuringFunction measure,
|
|
38
38
|
const TimeProviderFunction getCurrentTime,
|
|
39
|
+
const RegisterSensorFunction registerSensor,
|
|
40
|
+
const UnregisterSensorFunction unregisterSensor,
|
|
39
41
|
const SetGestureStateFunction setGestureState,
|
|
40
42
|
std::shared_ptr<LayoutAnimationsProxy> layoutAnimationsProxy);
|
|
41
43
|
|
package/README.md
CHANGED
|
@@ -11,7 +11,7 @@ comes to gesture based interactions.
|
|
|
11
11
|
|
|
12
12
|
## Installation
|
|
13
13
|
|
|
14
|
-
Check out [installation](https://docs.swmansion.com/react-native-reanimated/docs/fundamentals/installation) section of our docs for the detailed installation instructions.
|
|
14
|
+
Check out the [installation](https://docs.swmansion.com/react-native-reanimated/docs/fundamentals/installation) section of our docs for the detailed installation instructions.
|
|
15
15
|
|
|
16
16
|
## Documentation
|
|
17
17
|
|
|
@@ -28,7 +28,7 @@ Reanimated library is licensed under [The MIT License](LICENSE).
|
|
|
28
28
|
|
|
29
29
|
## Credits
|
|
30
30
|
|
|
31
|
-
This project has been
|
|
31
|
+
This project has been built and is maintained thanks to the support from [Shopify](https://shopify.com), [Expo.io](https://expo.io) and [Software Mansion](https://swmansion.com)
|
|
32
32
|
|
|
33
33
|
[](https://shopify.com)
|
|
34
34
|
[](https://expo.io)
|
package/RNReanimated.podspec
CHANGED
|
@@ -3,27 +3,34 @@ require "json"
|
|
|
3
3
|
package = JSON.parse(File.read(File.join(__dir__, "package.json")))
|
|
4
4
|
|
|
5
5
|
reactVersion = '0.0.0'
|
|
6
|
+
reactTargetTvOS = false
|
|
6
7
|
|
|
7
8
|
begin
|
|
8
9
|
# standard app
|
|
9
10
|
# /appName/node_modules/react-native-reanimated/RNReanimated.podspec
|
|
10
11
|
# /appName/node_modules/react-native/package.json
|
|
11
|
-
|
|
12
|
+
reactJson = JSON.parse(File.read(File.join(__dir__, "..", "..", "node_modules", "react-native", "package.json")))
|
|
13
|
+
reactVersion = reactJson["version"]
|
|
14
|
+
reactTargetTvOS = reactJson["name"] == "react-native-tvos"
|
|
12
15
|
rescue
|
|
13
16
|
begin
|
|
14
17
|
# monorepo
|
|
15
18
|
# /monorepo/packages/appName/node_modules/react-native-reanimated/RNReanimated.podspec
|
|
16
19
|
# /monorepo/node_modules/react-native/package.json
|
|
17
|
-
|
|
20
|
+
reactJson = JSON.parse(File.read(File.join(__dir__, "..", "..", "..", "..", "node_modules", "react-native", "package.json")))
|
|
21
|
+
reactVersion = reactJson["version"]
|
|
22
|
+
reactTargetTvOS = reactJson["name"] == "react-native-tvos"
|
|
18
23
|
rescue
|
|
19
24
|
begin
|
|
20
25
|
# Example app in reanimated repo
|
|
21
26
|
# /react-native-reanimated/RNReanimated.podspec
|
|
22
27
|
# /react-native-reanimated/node_modules/react-native/package.json
|
|
23
|
-
|
|
28
|
+
reactJson = JSON.parse(File.read(File.join(__dir__, "node_modules", "react-native", "package.json")))
|
|
29
|
+
reactVersion = reactJson["version"]
|
|
30
|
+
reactTargetTvOS = ENV["ReanimatedTVOSExample"] == "1"
|
|
24
31
|
rescue
|
|
25
32
|
# should never happen
|
|
26
|
-
reactVersion = '0.
|
|
33
|
+
reactVersion = '0.68.0'
|
|
27
34
|
puts "[RNReanimated] Unable to recognized your `react-native` version! Default `react-native` version: " + reactVersion
|
|
28
35
|
end
|
|
29
36
|
end
|
|
@@ -78,7 +85,7 @@ Pod::Spec.new do |s|
|
|
|
78
85
|
|
|
79
86
|
s.requires_arc = true
|
|
80
87
|
|
|
81
|
-
s.dependency "React"
|
|
88
|
+
s.dependency "React-Core"
|
|
82
89
|
s.dependency 'FBLazyVector'
|
|
83
90
|
s.dependency 'FBReactNativeSpec'
|
|
84
91
|
s.dependency 'RCTRequired'
|
|
@@ -86,7 +93,9 @@ Pod::Spec.new do |s|
|
|
|
86
93
|
s.dependency 'React-Core'
|
|
87
94
|
s.dependency 'React-CoreModules'
|
|
88
95
|
s.dependency 'React-Core/DevSupport'
|
|
89
|
-
|
|
96
|
+
if !reactTargetTvOS
|
|
97
|
+
s.dependency 'React-RCTActionSheet'
|
|
98
|
+
end
|
|
90
99
|
s.dependency 'React-RCTNetwork'
|
|
91
100
|
s.dependency 'React-RCTAnimation'
|
|
92
101
|
s.dependency 'React-RCTLinking'
|
|
File without changes
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
File without changes
|
|
Binary file
|
|
Binary file
|