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,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* imported from react-native
|
|
3
|
+
*/
|
|
4
|
+
import { MutableRefObject } from 'react';
|
|
5
|
+
/**
|
|
6
|
+
* This is a helper function for when a component needs to be able to forward a ref
|
|
7
|
+
* to a child component, but still needs to have access to that component as part of
|
|
8
|
+
* its implementation.
|
|
9
|
+
*
|
|
10
|
+
* Its main use case is in wrappers for native components.
|
|
11
|
+
*
|
|
12
|
+
* Usage:
|
|
13
|
+
*
|
|
14
|
+
* class MyView extends React.Component {
|
|
15
|
+
* _nativeRef = null;
|
|
16
|
+
*
|
|
17
|
+
* _setNativeRef = setAndForwardRef({
|
|
18
|
+
* getForwardedRef: () => this.props.forwardedRef,
|
|
19
|
+
* setLocalRef: ref => {
|
|
20
|
+
* this._nativeRef = ref;
|
|
21
|
+
* },
|
|
22
|
+
* });
|
|
23
|
+
*
|
|
24
|
+
* render() {
|
|
25
|
+
* return <View ref={this._setNativeRef} />;
|
|
26
|
+
* }
|
|
27
|
+
* }
|
|
28
|
+
*
|
|
29
|
+
* const MyViewWithRef = React.forwardRef((props, ref) => (
|
|
30
|
+
* <MyView {...props} forwardedRef={ref} />
|
|
31
|
+
* ));
|
|
32
|
+
*
|
|
33
|
+
* module.exports = MyViewWithRef;
|
|
34
|
+
*/
|
|
35
|
+
export declare type ForwardedRef<T> = () => MutableRefObject<T> | ((ref: T) => void);
|
|
36
|
+
declare function setAndForwardRef<T>({ getForwardedRef, setLocalRef, }: {
|
|
37
|
+
getForwardedRef: ForwardedRef<T>;
|
|
38
|
+
setLocalRef: (ref: T) => void;
|
|
39
|
+
}): (ref: T) => void;
|
|
40
|
+
export default setAndForwardRef;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/mock.js
CHANGED
|
@@ -28,7 +28,7 @@ function simulateCallbackFactory(...params) {
|
|
|
28
28
|
callback &&
|
|
29
29
|
setTimeout(() => {
|
|
30
30
|
// user defined callback
|
|
31
|
-
// eslint-disable-next-line
|
|
31
|
+
// eslint-disable-next-line node/no-callback-literal
|
|
32
32
|
callback(...params);
|
|
33
33
|
}, 0);
|
|
34
34
|
};
|
|
@@ -73,9 +73,9 @@ function createMockComponent(name) {
|
|
|
73
73
|
|
|
74
74
|
function createTransitioningComponent(Component) {
|
|
75
75
|
return class extends React.Component {
|
|
76
|
-
static displayName = `Transitioning.${
|
|
77
|
-
Component.name ||
|
|
78
|
-
|
|
76
|
+
static displayName = `Transitioning.${
|
|
77
|
+
Component.displayName || Component.name || 'Component'
|
|
78
|
+
}`;
|
|
79
79
|
|
|
80
80
|
setNativeProps() {
|
|
81
81
|
// noop
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-native-reanimated",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.7.0",
|
|
4
4
|
"description": "More powerful alternative to Animated library for React Native.",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"start": "node node_modules/react-native/local-cli/cli.js start",
|
|
@@ -18,14 +18,21 @@
|
|
|
18
18
|
"format:common": "find Common/ -iname *.h -o -iname *.cpp | xargs clang-format -i",
|
|
19
19
|
"release": "npm login && release-it",
|
|
20
20
|
"type:check": "yarn tsc --noEmit",
|
|
21
|
-
"type:generate": "yarn type:generate:clean && yarn type:generate:cp-js-src && yarn type:generate:tsc && yarn type:generate:remove.ts && yarn type:generate:remove.tsx",
|
|
21
|
+
"type:generate": "yarn type:generate:clean && yarn type:generate:cp-js-src && yarn type:generate:tsc && yarn type:generate:tsc:declaration && yarn type:generate:remove.ts && yarn type:generate:remove.tsx && yarn type:generate:remove.js:from-src",
|
|
22
22
|
"type:generate:clean": "rm -rf lib/ && mkdir lib/",
|
|
23
23
|
"type:generate:cp-js-src": "cp -RL src/* lib/",
|
|
24
24
|
"type:generate:tsc": "yarn tsc",
|
|
25
|
+
"type:generate:tsc:declaration": "yarn tsc --project tsconfig.json --pretty --declaration --emitDeclarationOnly --outDir lib/types",
|
|
25
26
|
"type:generate:remove.ts": "find ./lib -type f -name \"*.ts\" -and -not -name \"*.d.ts\" -delete",
|
|
26
27
|
"type:generate:remove.tsx": "find ./lib -type f -name \"*.tsx\" -and -not -name \"*.d.ts\" -delete",
|
|
28
|
+
"type:generate:remove.js:from-src": "find ./src/reanimated2 -type f -name \"*.js\" -delete",
|
|
27
29
|
"prepare": "husky install",
|
|
28
|
-
"circular_dependency_check": "yarn madge --extensions js,ts,tsx --circular ./src"
|
|
30
|
+
"circular_dependency_check": "yarn madge --extensions js,ts,tsx --circular ./src",
|
|
31
|
+
"setup": "yarn && cd Example && yarn && cd ios && pod install --verbose && cd ../..",
|
|
32
|
+
"clean": "rm -rf node_modules && cd Example && rm -rf node_modules && cd ios && pod deintegrate && cd ../..",
|
|
33
|
+
"reset": "yarn clean && yarn setup",
|
|
34
|
+
"clean:deep": "cd android && rm -rf .cxx .gradle build && cd ../Example/android && rm -rf .gradle build app/build && cd ../.. && yarn clean",
|
|
35
|
+
"reset:deep": "yarn clean:deep && yarn setup"
|
|
29
36
|
},
|
|
30
37
|
"main": "lib/Animated.js",
|
|
31
38
|
"module": "lib/Animated",
|
|
@@ -36,7 +43,6 @@
|
|
|
36
43
|
"Common/",
|
|
37
44
|
"src/",
|
|
38
45
|
"lib/",
|
|
39
|
-
"libSo/",
|
|
40
46
|
"android/src/main/AndroidManifest.xml",
|
|
41
47
|
"android/src/main/java/",
|
|
42
48
|
"android/build.gradle",
|
|
@@ -49,7 +55,6 @@
|
|
|
49
55
|
"react-native-reanimated.d.ts",
|
|
50
56
|
"mock.js",
|
|
51
57
|
"plugin.js",
|
|
52
|
-
"expo-module.config.json",
|
|
53
58
|
"!__snapshots__",
|
|
54
59
|
"!*.test.js",
|
|
55
60
|
"!*.test.js.map"
|
|
@@ -69,56 +74,55 @@
|
|
|
69
74
|
},
|
|
70
75
|
"homepage": "https://github.com/software-mansion/react-native-reanimated#readme",
|
|
71
76
|
"dependencies": {
|
|
72
|
-
"@babel/plugin-transform-object-assign": "^7.
|
|
77
|
+
"@babel/plugin-transform-object-assign": "^7.16.7",
|
|
78
|
+
"@babel/preset-typescript": "^7.16.7",
|
|
73
79
|
"@types/invariant": "^2.2.35",
|
|
74
80
|
"invariant": "^2.2.4",
|
|
75
81
|
"lodash.isequal": "^4.5.0",
|
|
76
|
-
"
|
|
77
|
-
"react-native-screens": "^3.4.0",
|
|
82
|
+
"setimmediate": "^1.0.5",
|
|
78
83
|
"string-hash-64": "^1.0.3"
|
|
79
84
|
},
|
|
80
85
|
"peerDependencies": {
|
|
86
|
+
"@babel/core": "^7.0.0-0",
|
|
81
87
|
"react": "*",
|
|
82
|
-
"react-native": "*"
|
|
83
|
-
"react-native-gesture-handler": "*"
|
|
88
|
+
"react-native": "*"
|
|
84
89
|
},
|
|
85
90
|
"devDependencies": {
|
|
86
|
-
"@babel/core": "^7.
|
|
87
|
-
"@babel/plugin-proposal-class-properties": "^7.7
|
|
88
|
-
"@babel/preset-env": "^7.
|
|
89
|
-
"@
|
|
90
|
-
"@react-native-community/bob": "^0.14.3",
|
|
91
|
+
"@babel/core": "^7.17.2",
|
|
92
|
+
"@babel/plugin-proposal-class-properties": "^7.16.7",
|
|
93
|
+
"@babel/preset-env": "^7.16.11",
|
|
94
|
+
"@react-native-community/bob": "^0.17.1",
|
|
91
95
|
"@react-native-community/eslint-config": "^0.0.5",
|
|
92
|
-
"@testing-library/jest-native": "^
|
|
96
|
+
"@testing-library/jest-native": "^4.0.4",
|
|
93
97
|
"@testing-library/react-hooks": "^5.0.3",
|
|
94
98
|
"@testing-library/react-native": "^7.1.0",
|
|
95
|
-
"@types/babel-types": "^7.0.
|
|
96
|
-
"@types/babel__core": "^7.1.
|
|
97
|
-
"@types/babel__generator": "^7.6.
|
|
98
|
-
"@types/babel__traverse": "^7.
|
|
99
|
-
"@types/jest": "^
|
|
100
|
-
"@types/react-native": "^0.
|
|
101
|
-
"@typescript-eslint/eslint-plugin": "^
|
|
102
|
-
"@typescript-eslint/parser": "^
|
|
103
|
-
"babel-eslint": "^10.0
|
|
104
|
-
"babel-jest": "^
|
|
99
|
+
"@types/babel-types": "^7.0.11",
|
|
100
|
+
"@types/babel__core": "^7.1.18",
|
|
101
|
+
"@types/babel__generator": "^7.6.4",
|
|
102
|
+
"@types/babel__traverse": "^7.14.2",
|
|
103
|
+
"@types/jest": "^27.4.0",
|
|
104
|
+
"@types/react-native": "^0.66.15",
|
|
105
|
+
"@typescript-eslint/eslint-plugin": "^5.11.0",
|
|
106
|
+
"@typescript-eslint/parser": "^5.11.0",
|
|
107
|
+
"babel-eslint": "^10.1.0",
|
|
108
|
+
"babel-jest": "^27.5.1",
|
|
105
109
|
"babel-plugin-module-resolver": "^4.1.0",
|
|
106
|
-
"clang-format": "^1.
|
|
107
|
-
"eslint": "^
|
|
108
|
-
"eslint-config-prettier": "^
|
|
109
|
-
"eslint-config-standard": "^
|
|
110
|
-
"eslint-import-resolver-babel-module": "^5.
|
|
111
|
-
"eslint-plugin-import": "^2.
|
|
112
|
-
"eslint-plugin-node": "^
|
|
113
|
-
"eslint-plugin-promise": "^
|
|
114
|
-
"eslint-plugin-standard": "^
|
|
115
|
-
"husky": "^7.0.
|
|
116
|
-
"jest": "^
|
|
110
|
+
"clang-format": "^1.6.0",
|
|
111
|
+
"eslint": "^8.8.0",
|
|
112
|
+
"eslint-config-prettier": "^8.3.0",
|
|
113
|
+
"eslint-config-standard": "^16.0.3",
|
|
114
|
+
"eslint-import-resolver-babel-module": "^5.3.1",
|
|
115
|
+
"eslint-plugin-import": "^2.25.4",
|
|
116
|
+
"eslint-plugin-node": "^11.1.0",
|
|
117
|
+
"eslint-plugin-promise": "^6.0.0",
|
|
118
|
+
"eslint-plugin-standard": "^5.0.0",
|
|
119
|
+
"husky": "^7.0.4",
|
|
120
|
+
"jest": "^27.5.1",
|
|
117
121
|
"lint-staged": "^11.2.0",
|
|
118
122
|
"madge": "^5.0.1",
|
|
119
|
-
"prettier": "^2.
|
|
123
|
+
"prettier": "^2.5.1",
|
|
120
124
|
"react": "17.0.2",
|
|
121
|
-
"react-native": "0.
|
|
125
|
+
"react-native": "0.68.0",
|
|
122
126
|
"react-native-codegen": "^0.0.7",
|
|
123
127
|
"react-native-gesture-handler": "^1.6.1",
|
|
124
128
|
"react-test-renderer": "17.0.2",
|
package/plugin.js
CHANGED
|
@@ -30,7 +30,9 @@ const objectHooks = new Set([
|
|
|
30
30
|
const globals = new Set([
|
|
31
31
|
'this',
|
|
32
32
|
'console',
|
|
33
|
+
'performance',
|
|
33
34
|
'_setGlobalConsole',
|
|
35
|
+
'_chronoNow',
|
|
34
36
|
'Date',
|
|
35
37
|
'Array',
|
|
36
38
|
'ArrayBuffer',
|
|
@@ -85,6 +87,7 @@ const blacklistedFunctions = new Set([
|
|
|
85
87
|
'toString',
|
|
86
88
|
'map',
|
|
87
89
|
'filter',
|
|
90
|
+
'findIndex',
|
|
88
91
|
'forEach',
|
|
89
92
|
'valueOf',
|
|
90
93
|
'toPrecision',
|
|
@@ -508,18 +511,6 @@ function makeWorklet(t, fun, fileName) {
|
|
|
508
511
|
);
|
|
509
512
|
}
|
|
510
513
|
|
|
511
|
-
statements.push(
|
|
512
|
-
t.expressionStatement(
|
|
513
|
-
t.callExpression(
|
|
514
|
-
t.memberExpression(
|
|
515
|
-
t.identifier('global'),
|
|
516
|
-
t.identifier('__reanimatedWorkletInit'),
|
|
517
|
-
false
|
|
518
|
-
),
|
|
519
|
-
[privateFunctionId]
|
|
520
|
-
)
|
|
521
|
-
)
|
|
522
|
-
);
|
|
523
514
|
statements.push(t.returnStatement(privateFunctionId));
|
|
524
515
|
|
|
525
516
|
const newFun = t.functionExpression(fun.id, [], t.blockStatement(statements));
|
|
@@ -7,8 +7,6 @@ declare module 'react-native-reanimated' {
|
|
|
7
7
|
ReactNode,
|
|
8
8
|
Component,
|
|
9
9
|
RefObject,
|
|
10
|
-
ComponentType,
|
|
11
|
-
ComponentProps,
|
|
12
10
|
FunctionComponent,
|
|
13
11
|
} from 'react';
|
|
14
12
|
import {
|
|
@@ -31,7 +29,6 @@ declare module 'react-native-reanimated' {
|
|
|
31
29
|
NativeScrollEvent,
|
|
32
30
|
NativeSyntheticEvent,
|
|
33
31
|
ColorValue,
|
|
34
|
-
OpaqueColorValue,
|
|
35
32
|
EasingFunction,
|
|
36
33
|
} from 'react-native';
|
|
37
34
|
import {
|
|
@@ -39,16 +36,24 @@ declare module 'react-native-reanimated' {
|
|
|
39
36
|
PanGestureHandlerGestureEvent,
|
|
40
37
|
} from 'react-native-gesture-handler';
|
|
41
38
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
39
|
+
import('./lib/reanimated2/globals');
|
|
40
|
+
|
|
41
|
+
export type TimingAnimation =
|
|
42
|
+
import('./lib/types/lib/reanimated2/animation/index').TimingAnimation;
|
|
43
|
+
export type SpringAnimation =
|
|
44
|
+
import('./lib/types/lib/reanimated2/animation/index').SpringAnimation;
|
|
45
|
+
export type DecayAnimation =
|
|
46
|
+
import('./lib/types/lib/reanimated2/animation/index').DecayAnimation;
|
|
47
|
+
export type DelayAnimation =
|
|
48
|
+
import('./lib/types/lib/reanimated2/animation/commonTypes').DelayAnimation;
|
|
49
|
+
export type RepeatAnimation =
|
|
50
|
+
import('./lib/types/lib/reanimated2/animation/index').RepeatAnimation;
|
|
51
|
+
export type SequenceAnimation =
|
|
52
|
+
import('./lib/types/lib/reanimated2/animation/index').SequenceAnimation;
|
|
53
|
+
export type StyleLayoutAnimation =
|
|
54
|
+
import('./lib/types/lib/reanimated2/animation/index').StyleLayoutAnimation;
|
|
55
|
+
export type Animation<T> =
|
|
56
|
+
import('./lib/types/lib/reanimated2/commonTypes').Animation<T>;
|
|
52
57
|
|
|
53
58
|
namespace Animated {
|
|
54
59
|
type Nullable<T> = T | null | undefined;
|
|
@@ -150,7 +155,7 @@ declare module 'react-native-reanimated' {
|
|
|
150
155
|
? T['style']
|
|
151
156
|
: Record<string, unknown>;
|
|
152
157
|
|
|
153
|
-
export type AnimateProps<P extends
|
|
158
|
+
export type AnimateProps<P extends object> = {
|
|
154
159
|
[K in keyof P]: P[K] | AnimatedNode<P[K]>;
|
|
155
160
|
} & {
|
|
156
161
|
style?: StyleProp<AnimateStyle<StylesOrDefault<P>>>;
|
|
@@ -394,16 +399,16 @@ declare module 'react-native-reanimated' {
|
|
|
394
399
|
value: Adaptable<number>,
|
|
395
400
|
config: InterpolationConfig
|
|
396
401
|
): AnimatedNode<number>;
|
|
397
|
-
export function interpolateColors(
|
|
402
|
+
export function interpolateColors<T extends string | number>(
|
|
398
403
|
animationValue: Adaptable<number>,
|
|
399
404
|
{
|
|
400
405
|
inputRange,
|
|
401
406
|
outputColorRange,
|
|
402
407
|
}: {
|
|
403
408
|
inputRange: ReadonlyArray<Adaptable<number>>;
|
|
404
|
-
outputColorRange: ReadonlyArray<Adaptable<
|
|
409
|
+
outputColorRange: ReadonlyArray<Adaptable<T>>;
|
|
405
410
|
}
|
|
406
|
-
): AnimatedNode<
|
|
411
|
+
): AnimatedNode<T>;
|
|
407
412
|
export const max: BinaryOperator;
|
|
408
413
|
export const min: BinaryOperator;
|
|
409
414
|
|
|
@@ -481,6 +486,23 @@ declare module 'react-native-reanimated' {
|
|
|
481
486
|
targetGlobalOriginY: number;
|
|
482
487
|
}
|
|
483
488
|
|
|
489
|
+
export enum SensorType {
|
|
490
|
+
ACCELEROMETER = 1,
|
|
491
|
+
GYROSCOPE = 2,
|
|
492
|
+
GRAVITY = 3,
|
|
493
|
+
MAGNETIC_FIELD = 4,
|
|
494
|
+
ROTATION = 5,
|
|
495
|
+
}
|
|
496
|
+
|
|
497
|
+
export type SensorConfig = {
|
|
498
|
+
interval: number;
|
|
499
|
+
};
|
|
500
|
+
|
|
501
|
+
export function useAnimatedSensor(
|
|
502
|
+
sensorType: SensorType,
|
|
503
|
+
userConfig?: SensorConfig
|
|
504
|
+
);
|
|
505
|
+
|
|
484
506
|
export interface ExitAnimationsValues {
|
|
485
507
|
currentOriginX: number;
|
|
486
508
|
currentOriginY: number;
|
|
@@ -557,9 +579,10 @@ declare module 'react-native-reanimated' {
|
|
|
557
579
|
finished?: boolean,
|
|
558
580
|
current?: AnimatableValue
|
|
559
581
|
) => void;
|
|
582
|
+
export type EasingFunctionFactory = { factory: () => EasingFunction };
|
|
560
583
|
export interface WithTimingConfig {
|
|
561
584
|
duration?: number;
|
|
562
|
-
easing?: EasingFunction;
|
|
585
|
+
easing?: EasingFunction | EasingFunctionFactory;
|
|
563
586
|
}
|
|
564
587
|
export interface WithDecayConfig {
|
|
565
588
|
deceleration?: number;
|
|
@@ -576,29 +599,29 @@ declare module 'react-native-reanimated' {
|
|
|
576
599
|
restDisplacementThreshold?: number;
|
|
577
600
|
velocity?: number;
|
|
578
601
|
}
|
|
579
|
-
export function withTiming(
|
|
580
|
-
toValue:
|
|
602
|
+
export function withTiming<T extends AnimatableValue>(
|
|
603
|
+
toValue: T,
|
|
581
604
|
userConfig?: WithTimingConfig,
|
|
582
605
|
callback?: AnimationCallback
|
|
583
|
-
):
|
|
584
|
-
export function withSpring(
|
|
585
|
-
toValue:
|
|
606
|
+
): T;
|
|
607
|
+
export function withSpring<T extends AnimatableValue>(
|
|
608
|
+
toValue: T,
|
|
586
609
|
userConfig?: WithSpringConfig,
|
|
587
610
|
callback?: AnimationCallback
|
|
588
|
-
):
|
|
611
|
+
): T;
|
|
589
612
|
export function withDecay(
|
|
590
613
|
userConfig: WithDecayConfig,
|
|
591
614
|
callback?: AnimationCallback
|
|
592
615
|
): number;
|
|
593
616
|
export function cancelAnimation<T>(sharedValue: SharedValue<T>): void;
|
|
594
|
-
export function withDelay(delayMS: number, delayedAnimation:
|
|
595
|
-
export function withRepeat(
|
|
596
|
-
animation:
|
|
617
|
+
export function withDelay<T extends AnimatableValue>(delayMS: number, delayedAnimation: T): T;
|
|
618
|
+
export function withRepeat<T extends AnimatableValue>(
|
|
619
|
+
animation: T,
|
|
597
620
|
numberOfReps?: number,
|
|
598
621
|
reverse?: boolean,
|
|
599
622
|
callback?: AnimationCallback
|
|
600
|
-
):
|
|
601
|
-
export function withSequence(...animations: [
|
|
623
|
+
): T;
|
|
624
|
+
export function withSequence<T extends AnimatableValue>(...animations: [T, ...T[]]): T;
|
|
602
625
|
|
|
603
626
|
// reanimated2 functions
|
|
604
627
|
export function runOnUI<A extends any[], R>(
|
|
@@ -619,12 +642,12 @@ declare module 'react-native-reanimated' {
|
|
|
619
642
|
fn: (...args: A) => R
|
|
620
643
|
): (...args: Parameters<typeof fn>) => R;
|
|
621
644
|
|
|
622
|
-
export function interpolateColor(
|
|
645
|
+
export function interpolateColor<T extends string | number>(
|
|
623
646
|
value: number,
|
|
624
647
|
inputRange: readonly number[],
|
|
625
|
-
outputRange: readonly
|
|
648
|
+
outputRange: readonly T[],
|
|
626
649
|
colorSpace?: 'RGB' | 'HSV'
|
|
627
|
-
):
|
|
650
|
+
): T;
|
|
628
651
|
|
|
629
652
|
export enum ColorSpace {
|
|
630
653
|
RGB = 0,
|
|
@@ -829,6 +852,9 @@ declare module 'react-native-reanimated' {
|
|
|
829
852
|
callback: (finished: boolean) => void
|
|
830
853
|
): ComplexAnimationBuilder;
|
|
831
854
|
|
|
855
|
+
static withInitialValues(values: StyleProps): BaseAnimationBuilder;
|
|
856
|
+
withInitialValues(values: StyleProps): BaseAnimationBuilder;
|
|
857
|
+
|
|
832
858
|
static easing(easingFunction: EasingFunction): ComplexAnimationBuilder;
|
|
833
859
|
easing(easingFunction: EasingFunction): ComplexAnimationBuilder;
|
|
834
860
|
static springify(): ComplexAnimationBuilder;
|
package/src/ConfigHelper.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { configureProps as jsiConfigureProps } from './reanimated2/core';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Styles allowed to be direcly updated in UI thread
|
|
@@ -78,7 +78,6 @@ let NATIVE_THREAD_PROPS_WHITELIST: Record<string, boolean> = {
|
|
|
78
78
|
borderTopLeftRadius: true,
|
|
79
79
|
borderTopRightRadius: true,
|
|
80
80
|
borderTopStartRadius: true,
|
|
81
|
-
opacity: true,
|
|
82
81
|
elevation: true,
|
|
83
82
|
fontSize: true,
|
|
84
83
|
lineHeight: true,
|
|
@@ -107,9 +106,9 @@ let NATIVE_THREAD_PROPS_WHITELIST: Record<string, boolean> = {
|
|
|
107
106
|
};
|
|
108
107
|
|
|
109
108
|
function configureProps(): void {
|
|
110
|
-
|
|
111
|
-
Object.keys(
|
|
112
|
-
Object.keys(
|
|
109
|
+
jsiConfigureProps(
|
|
110
|
+
Object.keys(UI_THREAD_PROPS_WHITELIST),
|
|
111
|
+
Object.keys(NATIVE_THREAD_PROPS_WHITELIST)
|
|
113
112
|
);
|
|
114
113
|
}
|
|
115
114
|
|
|
@@ -161,7 +161,7 @@ interface ComponentRef extends Component {
|
|
|
161
161
|
getScrollableNode?: () => ComponentRef;
|
|
162
162
|
}
|
|
163
163
|
|
|
164
|
-
interface InitialComponentProps extends Record<string, unknown> {
|
|
164
|
+
export interface InitialComponentProps extends Record<string, unknown> {
|
|
165
165
|
ref?: Ref<Component>;
|
|
166
166
|
collapsable?: boolean;
|
|
167
167
|
}
|
|
@@ -194,6 +194,7 @@ export default function createAnimatedComponent(
|
|
|
194
194
|
_viewTag = -1;
|
|
195
195
|
_isFirstRender = true;
|
|
196
196
|
animatedStyle: { value: StyleProps } = { value: {} };
|
|
197
|
+
initialStyle = {};
|
|
197
198
|
sv: SharedValue<null | Record<string, unknown>> | null;
|
|
198
199
|
_propsAnimated?: PropsAnimated;
|
|
199
200
|
_component: ComponentRef | null = null;
|
|
@@ -606,13 +607,12 @@ export default function createAnimatedComponent(
|
|
|
606
607
|
// this is how we recognize styles returned by useAnimatedStyle
|
|
607
608
|
style.viewsRef.add(this);
|
|
608
609
|
if (this._isFirstRender) {
|
|
609
|
-
|
|
610
|
+
this.initialStyle = {
|
|
610
611
|
...style.initial.value,
|
|
611
612
|
...initialUpdaterRun<StyleProps>(style.initial.updater),
|
|
612
613
|
};
|
|
613
|
-
} else {
|
|
614
|
-
return style.initial.value;
|
|
615
614
|
}
|
|
615
|
+
return this.initialStyle;
|
|
616
616
|
} else {
|
|
617
617
|
return style;
|
|
618
618
|
}
|
|
@@ -37,7 +37,7 @@ export function createAnimatedFunction(cb) {
|
|
|
37
37
|
for (let i = 0; i < params.length; i++) {
|
|
38
38
|
params[i] = createAnimatedParam();
|
|
39
39
|
}
|
|
40
|
-
// eslint-disable-next-line
|
|
40
|
+
// eslint-disable-next-line node/no-callback-literal
|
|
41
41
|
const what = cb(...params);
|
|
42
42
|
const func = new AnimatedFunction(what, ...params);
|
|
43
43
|
return (...args) => {
|
|
@@ -128,15 +128,13 @@ export default function interpolate(value, config) {
|
|
|
128
128
|
const right = extrapolateRight || extrapolate;
|
|
129
129
|
let output = interpolateInternal(value, inputRange, outputRange);
|
|
130
130
|
|
|
131
|
-
if (left === Extrapolate.
|
|
132
|
-
} else if (left === Extrapolate.CLAMP) {
|
|
131
|
+
if (left === Extrapolate.CLAMP) {
|
|
133
132
|
output = cond(lessThan(value, inputRange[0]), outputRange[0], output);
|
|
134
133
|
} else if (left === Extrapolate.IDENTITY) {
|
|
135
134
|
output = cond(lessThan(value, inputRange[0]), value, output);
|
|
136
135
|
}
|
|
137
136
|
|
|
138
|
-
if (right === Extrapolate.
|
|
139
|
-
} else if (right === Extrapolate.CLAMP) {
|
|
137
|
+
if (right === Extrapolate.CLAMP) {
|
|
140
138
|
output = cond(
|
|
141
139
|
greaterThan(value, inputRange[inputRange.length - 1]),
|
|
142
140
|
outputRange[outputRange.length - 1],
|
|
@@ -64,7 +64,8 @@ function getMatchers(): Matchers {
|
|
|
64
64
|
'hsla' + call(NUMBER, PERCENTAGE, PERCENTAGE, NUMBER)
|
|
65
65
|
);
|
|
66
66
|
cachedMatchers.hex3 = /^#([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/;
|
|
67
|
-
cachedMatchers.hex4 =
|
|
67
|
+
cachedMatchers.hex4 =
|
|
68
|
+
/^#([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/;
|
|
68
69
|
cachedMatchers.hex6 = /^#([0-9a-fA-F]{6})$/;
|
|
69
70
|
cachedMatchers.hex8 = /^#([0-9a-fA-F]{8})$/;
|
|
70
71
|
}
|
|
@@ -109,7 +109,10 @@ function cubic(t: number): number {
|
|
|
109
109
|
*/
|
|
110
110
|
function poly(n: number): EasingFn {
|
|
111
111
|
'worklet';
|
|
112
|
-
return (t) =>
|
|
112
|
+
return (t) => {
|
|
113
|
+
'worklet';
|
|
114
|
+
return Math.pow(t, n);
|
|
115
|
+
};
|
|
113
116
|
}
|
|
114
117
|
|
|
115
118
|
/**
|
|
@@ -171,7 +174,10 @@ function elastic(bounciness = 1): EasingFn {
|
|
|
171
174
|
*/
|
|
172
175
|
function back(s = 1.70158): (t: number) => number {
|
|
173
176
|
'worklet';
|
|
174
|
-
return (t) =>
|
|
177
|
+
return (t) => {
|
|
178
|
+
'worklet';
|
|
179
|
+
return t * t * ((s + 1) * t - s);
|
|
180
|
+
};
|
|
175
181
|
}
|
|
176
182
|
|
|
177
183
|
/**
|
|
@@ -312,7 +318,7 @@ function createChecker(
|
|
|
312
318
|
}
|
|
313
319
|
// @ts-ignore this is implicitly any - TODO
|
|
314
320
|
const res = worklet.apply(this, arguments);
|
|
315
|
-
if (!_WORKLET && res && typeof res === 'function' && res.
|
|
321
|
+
if (!_WORKLET && res && typeof res === 'function' && res.__workletHash) {
|
|
316
322
|
return createChecker(res, workletName, arguments);
|
|
317
323
|
}
|
|
318
324
|
return res;
|
|
@@ -1,31 +1,54 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { NativeModules } from 'react-native';
|
|
2
|
+
import {
|
|
3
|
+
SharedValue,
|
|
4
|
+
SensorValue3D,
|
|
5
|
+
SensorValueRotation,
|
|
6
|
+
} from '../commonTypes';
|
|
2
7
|
import { Descriptor } from '../hook/commonTypes';
|
|
3
8
|
|
|
4
|
-
const InnerNativeModule = global.__reanimatedModuleProxy;
|
|
5
|
-
|
|
6
9
|
export class NativeReanimated {
|
|
7
10
|
native: boolean;
|
|
8
|
-
|
|
11
|
+
private InnerNativeModule: any;
|
|
9
12
|
|
|
10
13
|
constructor(native = true) {
|
|
14
|
+
if (global.__reanimatedModuleProxy === undefined) {
|
|
15
|
+
const { ReanimatedModule } = NativeModules;
|
|
16
|
+
ReanimatedModule?.installTurboModule();
|
|
17
|
+
}
|
|
18
|
+
this.InnerNativeModule = global.__reanimatedModuleProxy;
|
|
11
19
|
this.native = native;
|
|
12
|
-
this.useOnlyV1 = InnerNativeModule === null;
|
|
13
20
|
}
|
|
14
21
|
|
|
15
22
|
installCoreFunctions(valueSetter: <T>(value: T) => void): void {
|
|
16
|
-
return InnerNativeModule.installCoreFunctions(valueSetter);
|
|
23
|
+
return this.InnerNativeModule.installCoreFunctions(valueSetter);
|
|
17
24
|
}
|
|
18
25
|
|
|
19
26
|
makeShareable<T>(value: T): T {
|
|
20
|
-
return InnerNativeModule.makeShareable(value);
|
|
27
|
+
return this.InnerNativeModule.makeShareable(value);
|
|
21
28
|
}
|
|
22
29
|
|
|
23
30
|
makeMutable<T>(value: T): SharedValue<T> {
|
|
24
|
-
return InnerNativeModule.makeMutable(value);
|
|
31
|
+
return this.InnerNativeModule.makeMutable(value);
|
|
25
32
|
}
|
|
26
33
|
|
|
27
34
|
makeRemote<T>(object = {}): T {
|
|
28
|
-
return InnerNativeModule.makeRemote(object);
|
|
35
|
+
return this.InnerNativeModule.makeRemote(object);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
registerSensor(
|
|
39
|
+
sensorType: number,
|
|
40
|
+
interval: number,
|
|
41
|
+
sensorData: SensorValue3D | SensorValueRotation
|
|
42
|
+
) {
|
|
43
|
+
return this.InnerNativeModule.registerSensor(
|
|
44
|
+
sensorType,
|
|
45
|
+
interval,
|
|
46
|
+
sensorData
|
|
47
|
+
);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
unregisterSensor(sensorId: number) {
|
|
51
|
+
return this.InnerNativeModule.unregisterSensor(sensorId);
|
|
29
52
|
}
|
|
30
53
|
|
|
31
54
|
startMapper(
|
|
@@ -35,7 +58,7 @@ export class NativeReanimated {
|
|
|
35
58
|
updater: () => void,
|
|
36
59
|
viewDescriptors: Descriptor[] | SharedValue<Descriptor[]>
|
|
37
60
|
): number {
|
|
38
|
-
return InnerNativeModule.startMapper(
|
|
61
|
+
return this.InnerNativeModule.startMapper(
|
|
39
62
|
mapper,
|
|
40
63
|
inputs,
|
|
41
64
|
outputs,
|
|
@@ -45,18 +68,18 @@ export class NativeReanimated {
|
|
|
45
68
|
}
|
|
46
69
|
|
|
47
70
|
stopMapper(mapperId: number): void {
|
|
48
|
-
return InnerNativeModule.stopMapper(mapperId);
|
|
71
|
+
return this.InnerNativeModule.stopMapper(mapperId);
|
|
49
72
|
}
|
|
50
73
|
|
|
51
74
|
registerEventHandler<T>(
|
|
52
75
|
eventHash: string,
|
|
53
76
|
eventHandler: (event: T) => void
|
|
54
77
|
): string {
|
|
55
|
-
return InnerNativeModule.registerEventHandler(eventHash, eventHandler);
|
|
78
|
+
return this.InnerNativeModule.registerEventHandler(eventHash, eventHandler);
|
|
56
79
|
}
|
|
57
80
|
|
|
58
81
|
unregisterEventHandler(id: string): void {
|
|
59
|
-
return InnerNativeModule.unregisterEventHandler(id);
|
|
82
|
+
return this.InnerNativeModule.unregisterEventHandler(id);
|
|
60
83
|
}
|
|
61
84
|
|
|
62
85
|
getViewProp<T>(
|
|
@@ -64,10 +87,14 @@ export class NativeReanimated {
|
|
|
64
87
|
propName: string,
|
|
65
88
|
callback?: (result: T) => void
|
|
66
89
|
): Promise<T> {
|
|
67
|
-
return InnerNativeModule.getViewProp(viewTag, propName, callback);
|
|
90
|
+
return this.InnerNativeModule.getViewProp(viewTag, propName, callback);
|
|
68
91
|
}
|
|
69
92
|
|
|
70
93
|
enableLayoutAnimations(flag: boolean): void {
|
|
71
|
-
InnerNativeModule.enableLayoutAnimations(flag);
|
|
94
|
+
this.InnerNativeModule.enableLayoutAnimations(flag);
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
configureProps(uiProps: string[], nativeProps: string[]): void {
|
|
98
|
+
this.InnerNativeModule.configureProps(uiProps, nativeProps);
|
|
72
99
|
}
|
|
73
100
|
}
|