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
package/ios/REANodesManager.m
CHANGED
|
@@ -1,28 +1,27 @@
|
|
|
1
|
-
#import
|
|
2
|
-
|
|
1
|
+
#import <RNReanimated/REAAlwaysNode.h>
|
|
2
|
+
#import <RNReanimated/REABezierNode.h>
|
|
3
|
+
#import <RNReanimated/REABlockNode.h>
|
|
4
|
+
#import <RNReanimated/REACallFuncNode.h>
|
|
5
|
+
#import <RNReanimated/REAClockNodes.h>
|
|
6
|
+
#import <RNReanimated/REAConcatNode.h>
|
|
7
|
+
#import <RNReanimated/REACondNode.h>
|
|
8
|
+
#import <RNReanimated/READebugNode.h>
|
|
9
|
+
#import <RNReanimated/REAEventNode.h>
|
|
10
|
+
#import <RNReanimated/REAFunctionNode.h>
|
|
11
|
+
#import <RNReanimated/REAJSCallNode.h>
|
|
12
|
+
#import <RNReanimated/REAModule.h>
|
|
13
|
+
#import <RNReanimated/REANode.h>
|
|
14
|
+
#import <RNReanimated/REANodesManager.h>
|
|
15
|
+
#import <RNReanimated/REAOperatorNode.h>
|
|
16
|
+
#import <RNReanimated/REAParamNode.h>
|
|
17
|
+
#import <RNReanimated/REAPropsNode.h>
|
|
18
|
+
#import <RNReanimated/REASetNode.h>
|
|
19
|
+
#import <RNReanimated/REAStyleNode.h>
|
|
20
|
+
#import <RNReanimated/REATransformNode.h>
|
|
21
|
+
#import <RNReanimated/REAValueNode.h>
|
|
3
22
|
#import <React/RCTConvert.h>
|
|
4
|
-
|
|
5
23
|
#import <React/RCTShadowView.h>
|
|
6
|
-
#import
|
|
7
|
-
#import "Nodes/REABezierNode.h"
|
|
8
|
-
#import "Nodes/REABlockNode.h"
|
|
9
|
-
#import "Nodes/REACallFuncNode.h"
|
|
10
|
-
#import "Nodes/REAClockNodes.h"
|
|
11
|
-
#import "Nodes/REAConcatNode.h"
|
|
12
|
-
#import "Nodes/REACondNode.h"
|
|
13
|
-
#import "Nodes/READebugNode.h"
|
|
14
|
-
#import "Nodes/REAEventNode.h"
|
|
15
|
-
#import "Nodes/REAFunctionNode.h"
|
|
16
|
-
#import "Nodes/REAJSCallNode.h"
|
|
17
|
-
#import "Nodes/REANode.h"
|
|
18
|
-
#import "Nodes/REAOperatorNode.h"
|
|
19
|
-
#import "Nodes/REAParamNode.h"
|
|
20
|
-
#import "Nodes/REAPropsNode.h"
|
|
21
|
-
#import "Nodes/REASetNode.h"
|
|
22
|
-
#import "Nodes/REAStyleNode.h"
|
|
23
|
-
#import "Nodes/REATransformNode.h"
|
|
24
|
-
#import "Nodes/REAValueNode.h"
|
|
25
|
-
#import "REAModule.h"
|
|
24
|
+
#import <stdatomic.h>
|
|
26
25
|
|
|
27
26
|
// Interface below has been added in order to use private methods of RCTUIManager,
|
|
28
27
|
// RCTUIManager#UpdateView is a React Method which is exported to JS but in
|
|
@@ -46,6 +45,17 @@
|
|
|
46
45
|
|
|
47
46
|
@end
|
|
48
47
|
|
|
48
|
+
@interface ComponentUpdate : NSObject
|
|
49
|
+
|
|
50
|
+
@property (nonnull) NSMutableDictionary *props;
|
|
51
|
+
@property (nonnull) NSNumber *viewTag;
|
|
52
|
+
@property (nonnull) NSString *viewName;
|
|
53
|
+
|
|
54
|
+
@end
|
|
55
|
+
|
|
56
|
+
@implementation ComponentUpdate
|
|
57
|
+
@end
|
|
58
|
+
|
|
49
59
|
@implementation RCTUIManager (SyncUpdates)
|
|
50
60
|
|
|
51
61
|
- (BOOL)hasEnqueuedUICommands
|
|
@@ -99,6 +109,9 @@
|
|
|
99
109
|
BOOL _tryRunBatchUpdatesSynchronously;
|
|
100
110
|
REAEventHandler _eventHandler;
|
|
101
111
|
volatile void (^_mounting)(void);
|
|
112
|
+
NSMutableDictionary<NSNumber *, ComponentUpdate *> *_componentUpdateBuffer;
|
|
113
|
+
volatile atomic_bool _shouldFlushUpdateBuffer;
|
|
114
|
+
NSMutableDictionary<NSNumber *, UIView *> *_viewRegistry;
|
|
102
115
|
}
|
|
103
116
|
|
|
104
117
|
- (instancetype)initWithModule:(REAModule *)reanimatedModule uiManager:(RCTUIManager *)uiManager
|
|
@@ -113,6 +126,9 @@
|
|
|
113
126
|
_wantRunUpdates = NO;
|
|
114
127
|
_onAnimationCallbacks = [NSMutableArray new];
|
|
115
128
|
_operationsInBatch = [NSMutableArray new];
|
|
129
|
+
_componentUpdateBuffer = [NSMutableDictionary new];
|
|
130
|
+
_viewRegistry = [_uiManager valueForKey:@"_viewRegistry"];
|
|
131
|
+
_shouldFlushUpdateBuffer = false;
|
|
116
132
|
}
|
|
117
133
|
|
|
118
134
|
_displayLink = [CADisplayLink displayLinkWithTarget:self selector:@selector(onAnimationFrame:)];
|
|
@@ -125,7 +141,7 @@
|
|
|
125
141
|
- (void)invalidate
|
|
126
142
|
{
|
|
127
143
|
_eventHandler = nil;
|
|
128
|
-
[
|
|
144
|
+
[_displayLink invalidate];
|
|
129
145
|
}
|
|
130
146
|
|
|
131
147
|
- (void)operationsBatchDidComplete
|
|
@@ -486,10 +502,16 @@
|
|
|
486
502
|
}
|
|
487
503
|
}
|
|
488
504
|
|
|
489
|
-
- (void)
|
|
505
|
+
- (void)configureUiProps:(nonnull NSSet<NSString *> *)uiPropsSet
|
|
506
|
+
andNativeProps:(nonnull NSSet<NSString *> *)nativePropsSet
|
|
507
|
+
{
|
|
508
|
+
_uiProps = uiPropsSet;
|
|
509
|
+
_nativeProps = nativePropsSet;
|
|
510
|
+
}
|
|
511
|
+
|
|
512
|
+
- (BOOL)isNotNativeViewFullyMounted:(NSNumber *)viewTag
|
|
490
513
|
{
|
|
491
|
-
|
|
492
|
-
_nativeProps = nativeProps;
|
|
514
|
+
return _viewRegistry[viewTag].superview == nil;
|
|
493
515
|
}
|
|
494
516
|
|
|
495
517
|
- (void)setValueForNodeID:(nonnull NSNumber *)nodeID value:(nonnull NSNumber *)newValue
|
|
@@ -506,6 +528,24 @@
|
|
|
506
528
|
ofViewWithTag:(nonnull NSNumber *)viewTag
|
|
507
529
|
withName:(nonnull NSString *)viewName
|
|
508
530
|
{
|
|
531
|
+
ComponentUpdate *lastSnapshot = _componentUpdateBuffer[viewTag];
|
|
532
|
+
if ([self isNotNativeViewFullyMounted:viewTag] || lastSnapshot != nil) {
|
|
533
|
+
if (lastSnapshot == nil) {
|
|
534
|
+
ComponentUpdate *propsSnapshot = [ComponentUpdate new];
|
|
535
|
+
propsSnapshot.props = [props mutableCopy];
|
|
536
|
+
propsSnapshot.viewTag = viewTag;
|
|
537
|
+
propsSnapshot.viewName = viewName;
|
|
538
|
+
_componentUpdateBuffer[viewTag] = propsSnapshot;
|
|
539
|
+
atomic_store(&_shouldFlushUpdateBuffer, true);
|
|
540
|
+
} else {
|
|
541
|
+
NSMutableDictionary *lastProps = lastSnapshot.props;
|
|
542
|
+
for (NSString *key in props) {
|
|
543
|
+
[lastProps setValue:props[key] forKey:key];
|
|
544
|
+
}
|
|
545
|
+
}
|
|
546
|
+
return;
|
|
547
|
+
}
|
|
548
|
+
|
|
509
549
|
// TODO: refactor PropsNode to also use this function
|
|
510
550
|
NSMutableDictionary *uiProps = [NSMutableDictionary new];
|
|
511
551
|
NSMutableDictionary *nativeProps = [NSMutableDictionary new];
|
|
@@ -553,4 +593,34 @@
|
|
|
553
593
|
return result;
|
|
554
594
|
}
|
|
555
595
|
|
|
596
|
+
- (void)maybeFlushUpdateBuffer
|
|
597
|
+
{
|
|
598
|
+
RCTAssertUIManagerQueue();
|
|
599
|
+
bool shouldFlushUpdateBuffer = atomic_load(&_shouldFlushUpdateBuffer);
|
|
600
|
+
if (!shouldFlushUpdateBuffer) {
|
|
601
|
+
return;
|
|
602
|
+
}
|
|
603
|
+
|
|
604
|
+
__weak typeof(self) weakSelf = self;
|
|
605
|
+
[_uiManager addUIBlock:^(__unused RCTUIManager *manager, __unused NSDictionary<NSNumber *, UIView *> *viewRegistry) {
|
|
606
|
+
__typeof__(self) strongSelf = weakSelf;
|
|
607
|
+
if (strongSelf == nil) {
|
|
608
|
+
return;
|
|
609
|
+
}
|
|
610
|
+
atomic_store(&strongSelf->_shouldFlushUpdateBuffer, false);
|
|
611
|
+
NSMutableDictionary *componentUpdateBuffer = [strongSelf->_componentUpdateBuffer copy];
|
|
612
|
+
strongSelf->_componentUpdateBuffer = [NSMutableDictionary new];
|
|
613
|
+
for (NSNumber *tag in componentUpdateBuffer) {
|
|
614
|
+
ComponentUpdate *componentUpdate = componentUpdateBuffer[tag];
|
|
615
|
+
if (componentUpdate == Nil) {
|
|
616
|
+
continue;
|
|
617
|
+
}
|
|
618
|
+
[strongSelf updateProps:componentUpdate.props
|
|
619
|
+
ofViewWithTag:componentUpdate.viewTag
|
|
620
|
+
withName:componentUpdate.viewName];
|
|
621
|
+
}
|
|
622
|
+
[strongSelf performOperations];
|
|
623
|
+
}];
|
|
624
|
+
}
|
|
625
|
+
|
|
556
626
|
@end
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
+
#import <RNReanimated/RCTConvert+REATransition.h>
|
|
2
|
+
#import <RNReanimated/REAAllTransitions.h>
|
|
1
3
|
#import <React/RCTViewManager.h>
|
|
2
4
|
|
|
3
|
-
#import "RCTConvert+REATransition.h"
|
|
4
|
-
#import "REAAllTransitions.h"
|
|
5
|
-
|
|
6
5
|
@interface REASnapshotRemover : NSObject <CAAnimationDelegate>
|
|
7
6
|
@end
|
|
8
7
|
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
#import <QuartzCore/QuartzCore.h>
|
|
2
|
+
#import <RNReanimated/REATransitionAnimation.h>
|
|
3
|
+
#import <RNReanimated/REATransitionValues.h>
|
|
2
4
|
#import <React/RCTView.h>
|
|
3
5
|
#import <UIKit/UIKit.h>
|
|
4
6
|
|
|
5
|
-
#import "REATransitionAnimation.h"
|
|
6
|
-
#import "REATransitionValues.h"
|
|
7
|
-
|
|
8
7
|
// TODO: fix below implementation
|
|
9
8
|
#define IS_LAYOUT_ONLY(view) ([view isKindOfClass:[RCTView class]] && view.backgroundColor == nil)
|
|
10
9
|
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
#import <QuartzCore/QuartzCore.h>
|
|
2
|
+
#import <RNReanimated/RCTConvert+REATransition.h>
|
|
3
|
+
#import <RNReanimated/REATransition.h>
|
|
4
|
+
#import <RNReanimated/REATransitionValues.h>
|
|
2
5
|
#import <React/RCTConvert.h>
|
|
3
6
|
#import <React/RCTViewManager.h>
|
|
4
7
|
#import <UIKit/UIKit.h>
|
|
5
8
|
|
|
6
|
-
#import "RCTConvert+REATransition.h"
|
|
7
|
-
#import "REATransition.h"
|
|
8
|
-
#import "REATransitionValues.h"
|
|
9
|
-
|
|
10
9
|
#define DEFAULT_PROPAGATION_SPEED 3
|
|
11
10
|
|
|
12
11
|
@interface REATransitionGroup : REATransition
|
|
@@ -1,10 +1,8 @@
|
|
|
1
|
-
#import
|
|
2
|
-
|
|
1
|
+
#import <RNReanimated/REATransition.h>
|
|
2
|
+
#import <RNReanimated/REATransitionManager.h>
|
|
3
3
|
#import <React/RCTUIManager.h>
|
|
4
4
|
#import <React/RCTUIManagerObserverCoordinator.h>
|
|
5
5
|
|
|
6
|
-
#import "REATransition.h"
|
|
7
|
-
|
|
8
6
|
@interface REATransitionManager () <RCTUIManagerObserver>
|
|
9
7
|
@end
|
|
10
8
|
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
+
#import <RNReanimated/REATransition.h>
|
|
2
|
+
#import <RNReanimated/REATransitionValues.h>
|
|
1
3
|
#import <React/RCTView.h>
|
|
2
4
|
#import <React/RCTViewManager.h>
|
|
3
5
|
|
|
4
|
-
#import "REATransition.h"
|
|
5
|
-
#import "REATransitionValues.h"
|
|
6
|
-
|
|
7
6
|
@implementation REATransitionValues
|
|
8
7
|
|
|
9
8
|
- (instancetype)initWithView:(UIView *)view forRoot:(UIView *)root
|
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
#import <Foundation/Foundation.h>
|
|
2
|
-
#import <RNGestureHandlerStateManager.h>
|
|
2
|
+
#import <RNReanimated/RNGestureHandlerStateManager.h>
|
|
3
3
|
#import <React/RCTUIManager.h>
|
|
4
4
|
#include <string>
|
|
5
|
-
#import <string>
|
|
6
5
|
#include <utility>
|
|
7
6
|
#include <vector>
|
|
8
|
-
#import <vector>
|
|
9
7
|
|
|
10
8
|
namespace reanimated {
|
|
11
9
|
|
package/ios/native/NativeProxy.h
CHANGED
|
@@ -1,18 +1,21 @@
|
|
|
1
|
-
|
|
1
|
+
#import <RNReanimated/LayoutAnimationsProxy.h>
|
|
2
|
+
#import <RNReanimated/NativeMethods.h>
|
|
3
|
+
#import <RNReanimated/NativeProxy.h>
|
|
4
|
+
#import <RNReanimated/REAAnimationsManager.h>
|
|
5
|
+
#import <RNReanimated/REAIOSErrorHandler.h>
|
|
6
|
+
#import <RNReanimated/REAIOSScheduler.h>
|
|
7
|
+
#import <RNReanimated/REAModule.h>
|
|
8
|
+
#import <RNReanimated/REANodesManager.h>
|
|
9
|
+
#import <RNReanimated/REAUIManager.h>
|
|
10
|
+
#import <RNReanimated/RNGestureHandlerStateManager.h>
|
|
11
|
+
#import <RNReanimated/ReanimatedSensorContainer.h>
|
|
2
12
|
#import <React/RCTFollyConvert.h>
|
|
3
13
|
#import <React/RCTUIManager.h>
|
|
4
14
|
#import <folly/json.h>
|
|
5
15
|
|
|
6
|
-
#
|
|
7
|
-
#import
|
|
8
|
-
#
|
|
9
|
-
#import "NativeProxy.h"
|
|
10
|
-
#import "REAAnimationsManager.h"
|
|
11
|
-
#import "REAIOSErrorHandler.h"
|
|
12
|
-
#import "REAIOSScheduler.h"
|
|
13
|
-
#import "REAModule.h"
|
|
14
|
-
#import "REANodesManager.h"
|
|
15
|
-
#import "REAUIManager.h"
|
|
16
|
+
#if TARGET_IPHONE_SIMULATOR
|
|
17
|
+
#import <dlfcn.h>
|
|
18
|
+
#endif
|
|
16
19
|
|
|
17
20
|
#if __has_include(<reacthermes/HermesExecutorFactory.h>)
|
|
18
21
|
#import <reacthermes/HermesExecutorFactory.h>
|
|
@@ -27,6 +30,41 @@ namespace reanimated {
|
|
|
27
30
|
using namespace facebook;
|
|
28
31
|
using namespace react;
|
|
29
32
|
|
|
33
|
+
static CGFloat SimAnimationDragCoefficient(void)
|
|
34
|
+
{
|
|
35
|
+
static float (*UIAnimationDragCoefficient)(void) = NULL;
|
|
36
|
+
#if TARGET_IPHONE_SIMULATOR
|
|
37
|
+
static dispatch_once_t onceToken;
|
|
38
|
+
dispatch_once(&onceToken, ^{
|
|
39
|
+
UIAnimationDragCoefficient = (float (*)(void))dlsym(RTLD_DEFAULT, "UIAnimationDragCoefficient");
|
|
40
|
+
});
|
|
41
|
+
#endif
|
|
42
|
+
return UIAnimationDragCoefficient ? UIAnimationDragCoefficient() : 1.f;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
static CFTimeInterval calculateTimestampWithSlowAnimations(CFTimeInterval currentTimestamp)
|
|
46
|
+
{
|
|
47
|
+
#if TARGET_IPHONE_SIMULATOR
|
|
48
|
+
static CFTimeInterval dragCoefChangedTimestamp = CACurrentMediaTime();
|
|
49
|
+
static CGFloat previousDragCoef = SimAnimationDragCoefficient();
|
|
50
|
+
|
|
51
|
+
const CGFloat dragCoef = SimAnimationDragCoefficient();
|
|
52
|
+
if (previousDragCoef != dragCoef) {
|
|
53
|
+
previousDragCoef = dragCoef;
|
|
54
|
+
dragCoefChangedTimestamp = CACurrentMediaTime();
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
const bool areSlowAnimationsEnabled = dragCoef != 1.f;
|
|
58
|
+
if (areSlowAnimationsEnabled) {
|
|
59
|
+
return (dragCoefChangedTimestamp + (currentTimestamp - dragCoefChangedTimestamp) / dragCoef);
|
|
60
|
+
} else {
|
|
61
|
+
return currentTimestamp;
|
|
62
|
+
}
|
|
63
|
+
#else
|
|
64
|
+
return currentTimestamp;
|
|
65
|
+
#endif
|
|
66
|
+
}
|
|
67
|
+
|
|
30
68
|
// COPIED FROM RCTTurboModule.mm
|
|
31
69
|
static id convertJSIValueToObjCObject(jsi::Runtime &runtime, const jsi::Value &value);
|
|
32
70
|
|
|
@@ -87,6 +125,17 @@ static id convertJSIValueToObjCObject(jsi::Runtime &runtime, const jsi::Value &v
|
|
|
87
125
|
throw std::runtime_error("Unsupported jsi::jsi::Value kind");
|
|
88
126
|
}
|
|
89
127
|
|
|
128
|
+
static NSSet *convertProps(jsi::Runtime &rt, const jsi::Value &props)
|
|
129
|
+
{
|
|
130
|
+
NSMutableSet *propsSet = [[NSMutableSet alloc] init];
|
|
131
|
+
jsi::Array propsNames = props.asObject(rt).asArray(rt);
|
|
132
|
+
for (int i = 0; i < propsNames.size(rt); i++) {
|
|
133
|
+
NSString *propName = @(propsNames.getValueAtIndex(rt, i).asString(rt).utf8(rt).c_str());
|
|
134
|
+
[propsSet addObject:propName];
|
|
135
|
+
}
|
|
136
|
+
return propsSet;
|
|
137
|
+
}
|
|
138
|
+
|
|
90
139
|
std::shared_ptr<NativeReanimatedModule> createReanimatedModule(
|
|
91
140
|
RCTBridge *bridge,
|
|
92
141
|
std::shared_ptr<CallInvoker> jsInvoker)
|
|
@@ -149,7 +198,7 @@ std::shared_ptr<NativeReanimatedModule> createReanimatedModule(
|
|
|
149
198
|
|
|
150
199
|
auto requestRender = [reanimatedModule, &module](std::function<void(double)> onRender, jsi::Runtime &rt) {
|
|
151
200
|
[reanimatedModule.nodesManager postOnAnimation:^(CADisplayLink *displayLink) {
|
|
152
|
-
double frameTimestamp = displayLink.targetTimestamp * 1000;
|
|
201
|
+
double frameTimestamp = calculateTimestampWithSlowAnimations(displayLink.targetTimestamp) * 1000;
|
|
153
202
|
jsi::Object global = rt.global();
|
|
154
203
|
jsi::String frameTimestampName = jsi::String::createFromAscii(rt, "_frameTimestamp");
|
|
155
204
|
global.setProperty(rt, frameTimestampName, frameTimestamp);
|
|
@@ -158,7 +207,7 @@ std::shared_ptr<NativeReanimatedModule> createReanimatedModule(
|
|
|
158
207
|
}];
|
|
159
208
|
};
|
|
160
209
|
|
|
161
|
-
auto getCurrentTime = []() { return CACurrentMediaTime() * 1000; };
|
|
210
|
+
auto getCurrentTime = []() { return calculateTimestampWithSlowAnimations(CACurrentMediaTime()) * 1000; };
|
|
162
211
|
|
|
163
212
|
// Layout Animations start
|
|
164
213
|
REAUIManager *reaUiManagerNoCast = [bridge moduleForClass:[REAUIManager class]];
|
|
@@ -179,6 +228,13 @@ std::shared_ptr<NativeReanimatedModule> createReanimatedModule(
|
|
|
179
228
|
}
|
|
180
229
|
};
|
|
181
230
|
|
|
231
|
+
auto configurePropsFunction = [reanimatedModule](
|
|
232
|
+
jsi::Runtime &rt, const jsi::Value &uiProps, const jsi::Value &nativeProps) {
|
|
233
|
+
NSSet *uiPropsSet = convertProps(rt, uiProps);
|
|
234
|
+
NSSet *nativePropsSet = convertProps(rt, nativeProps);
|
|
235
|
+
[reanimatedModule.nodesManager configureUiProps:uiPropsSet andNativeProps:nativePropsSet];
|
|
236
|
+
};
|
|
237
|
+
|
|
182
238
|
std::shared_ptr<LayoutAnimationsProxy> layoutAnimationsProxy =
|
|
183
239
|
std::make_shared<LayoutAnimationsProxy>(notifyAboutProgress, notifyAboutEnd);
|
|
184
240
|
std::weak_ptr<jsi::Runtime> wrt = animatedRuntime;
|
|
@@ -224,14 +280,29 @@ std::shared_ptr<NativeReanimatedModule> createReanimatedModule(
|
|
|
224
280
|
|
|
225
281
|
// Layout Animations end
|
|
226
282
|
|
|
283
|
+
// sensors
|
|
284
|
+
ReanimatedSensorContainer *reanimatedSensorContainer = [[ReanimatedSensorContainer alloc] init];
|
|
285
|
+
auto registerSensorFunction = [=](int sensorType, int interval, std::function<void(double[])> setter) -> int {
|
|
286
|
+
return [reanimatedSensorContainer registerSensor:(ReanimatedSensorType)sensorType
|
|
287
|
+
interval:interval
|
|
288
|
+
setter:^(double *data) {
|
|
289
|
+
setter(data);
|
|
290
|
+
}];
|
|
291
|
+
};
|
|
292
|
+
|
|
293
|
+
auto unregisterSensorFunction = [=](int sensorId) { [reanimatedSensorContainer unregisterSensor:sensorId]; };
|
|
294
|
+
// end sensors
|
|
295
|
+
|
|
227
296
|
PlatformDepMethodsHolder platformDepMethodsHolder = {
|
|
228
297
|
requestRender,
|
|
229
298
|
propUpdater,
|
|
230
299
|
scrollToFunction,
|
|
231
300
|
measuringFunction,
|
|
232
301
|
getCurrentTime,
|
|
302
|
+
registerSensorFunction,
|
|
303
|
+
unregisterSensorFunction,
|
|
233
304
|
setGestureStateFunction,
|
|
234
|
-
|
|
305
|
+
configurePropsFunction};
|
|
235
306
|
|
|
236
307
|
module = std::make_shared<NativeReanimatedModule>(
|
|
237
308
|
jsInvoker,
|
|
@@ -250,7 +321,7 @@ std::shared_ptr<NativeReanimatedModule> createReanimatedModule(
|
|
|
250
321
|
std::string eventAsString;
|
|
251
322
|
try {
|
|
252
323
|
eventAsString = folly::toJson(convertIdToFollyDynamic([event arguments][2]));
|
|
253
|
-
} catch (
|
|
324
|
+
} catch (std::exception &) {
|
|
254
325
|
// Events from other libraries may contain NaN or INF values which cannot be represented in JSON.
|
|
255
326
|
// See https://github.com/software-mansion/react-native-reanimated/issues/1776 for details.
|
|
256
327
|
return;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
#import
|
|
2
|
-
#import
|
|
3
|
-
#import
|
|
1
|
+
#import <RNReanimated/REAInitializer.h>
|
|
2
|
+
#import <RNReanimated/REAUIManager.h>
|
|
3
|
+
#import <RNReanimated/UIResponder+Reanimated.h>
|
|
4
4
|
|
|
5
5
|
#if __has_include(<reacthermes/HermesExecutorFactory.h>)
|
|
6
6
|
#import <reacthermes/HermesExecutorFactory.h>
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
#if __has_include(<CoreMotion/CoreMotion.h>)
|
|
2
|
+
#import <CoreMotion/CoreMotion.h>
|
|
3
|
+
#endif
|
|
4
|
+
#import <RNReanimated/ReanimatedSensorType.h>
|
|
5
|
+
|
|
6
|
+
@interface ReanimatedSensor : NSObject {
|
|
7
|
+
ReanimatedSensorType _sensorType;
|
|
8
|
+
double _interval;
|
|
9
|
+
double _lastTimestamp;
|
|
10
|
+
#if !TARGET_OS_TV
|
|
11
|
+
CMMotionManager *_motionManager;
|
|
12
|
+
#endif
|
|
13
|
+
void (^_setter)(double[]);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
- (instancetype)init:(ReanimatedSensorType)sensorType interval:(int)interval setter:(void (^)(double[]))setter;
|
|
17
|
+
- (bool)initialize;
|
|
18
|
+
- (bool)initializeGyroscope;
|
|
19
|
+
- (bool)initializeAccelerometer;
|
|
20
|
+
- (bool)initializeGravity;
|
|
21
|
+
- (bool)initializeMagnetometer;
|
|
22
|
+
- (bool)initializeOrientation;
|
|
23
|
+
- (void)cancel;
|
|
24
|
+
|
|
25
|
+
@end
|