react-native-reanimated 2.4.0 → 2.6.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/Tools/RuntimeDecorator.cpp +2 -0
- 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/LICENSE +1 -1
- 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 +285 -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 +517 -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.m +14 -4
- package/ios/REAModule.m +8 -9
- package/ios/REANodesManager.h +4 -1
- package/ios/REANodesManager.m +76 -4
- package/ios/native/NativeProxy.mm +76 -4
- 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/{src/Animated.js → Animated.js} +0 -0
- package/lib/{src/ConfigHelper.js → ConfigHelper.js} +2 -2
- package/lib/{src/ReanimatedEventEmitter.js → ReanimatedEventEmitter.js} +0 -0
- package/lib/{src/ReanimatedModule.js → ReanimatedModule.js} +0 -0
- package/lib/{src/ReanimatedModule.macos.js → ReanimatedModule.macos.js} +0 -0
- package/lib/{src/ReanimatedModule.native.js → ReanimatedModule.native.js} +0 -0
- package/lib/{src/ReanimatedModule.windows.js → ReanimatedModule.windows.js} +0 -0
- package/lib/{src/ReanimatedModuleCompat.js → ReanimatedModuleCompat.js} +0 -0
- package/lib/{src/__mocks__ → __mocks__}/ReanimatedEventEmitter.js +0 -0
- package/lib/{src/__mocks__ → __mocks__}/ReanimatedModule.native.js +0 -0
- package/lib/{src/createAnimatedComponent.js → createAnimatedComponent.js} +3 -4
- package/lib/{src/index.js → index.js} +0 -0
- package/lib/{src/reanimated1 → reanimated1}/Easing.js +0 -0
- package/lib/{src/reanimated1 → reanimated1}/SpringConfig.js +0 -0
- package/lib/{src/reanimated1 → reanimated1}/Transitioning.js +0 -0
- package/lib/{src/reanimated1 → reanimated1}/animations/Animation.js +0 -0
- package/lib/{src/reanimated1 → reanimated1}/animations/SpringUtils.js +0 -0
- package/lib/{src/reanimated1 → reanimated1}/animations/backwardCompatibleAnimWrapper.js +0 -0
- package/lib/{src/reanimated1 → reanimated1}/animations/decay.js +0 -0
- package/lib/{src/reanimated1 → reanimated1}/animations/spring.js +0 -0
- package/lib/{src/reanimated1 → reanimated1}/animations/timing.js +0 -0
- package/lib/{src/reanimated1 → reanimated1}/base.js +0 -0
- package/lib/{src/reanimated1 → reanimated1}/core/AnimatedAlways.js +0 -0
- package/lib/{src/reanimated1 → reanimated1}/core/AnimatedBezier.js +0 -0
- package/lib/{src/reanimated1 → reanimated1}/core/AnimatedBlock.js +0 -0
- package/lib/{src/reanimated1 → reanimated1}/core/AnimatedCall.js +0 -0
- package/lib/{src/reanimated1 → reanimated1}/core/AnimatedCallFunc.js +0 -0
- package/lib/{src/reanimated1 → reanimated1}/core/AnimatedClock.js +0 -0
- package/lib/{src/reanimated1 → reanimated1}/core/AnimatedClockTest.js +0 -0
- package/lib/{src/reanimated1 → reanimated1}/core/AnimatedCode.js +0 -0
- package/lib/{src/reanimated1 → reanimated1}/core/AnimatedConcat.js +0 -0
- package/lib/{src/reanimated1 → reanimated1}/core/AnimatedCond.js +0 -0
- package/lib/{src/reanimated1 → reanimated1}/core/AnimatedDebug.js +0 -0
- package/lib/{src/reanimated1 → reanimated1}/core/AnimatedEvent.js +0 -0
- package/lib/{src/reanimated1 → reanimated1}/core/AnimatedFunction.js +1 -1
- package/lib/{src/reanimated1 → reanimated1}/core/AnimatedNode.js +0 -0
- package/lib/{src/reanimated1 → reanimated1}/core/AnimatedOperator.js +0 -0
- package/lib/{src/reanimated1 → reanimated1}/core/AnimatedParam.js +0 -0
- package/lib/{src/reanimated1 → reanimated1}/core/AnimatedProps.js +0 -0
- package/lib/{src/reanimated1 → reanimated1}/core/AnimatedSet.js +0 -0
- package/lib/{src/reanimated1 → reanimated1}/core/AnimatedStartClock.js +0 -0
- package/lib/{src/reanimated1 → reanimated1}/core/AnimatedStopClock.js +0 -0
- package/lib/{src/reanimated1 → reanimated1}/core/AnimatedStyle.js +0 -0
- package/lib/{src/reanimated1 → reanimated1}/core/AnimatedTransform.js +0 -0
- package/lib/{src/reanimated1 → reanimated1}/core/AnimatedValue.js +0 -0
- package/lib/{src/reanimated1 → reanimated1}/core/Core.test.js +0 -0
- package/lib/{src/reanimated1 → reanimated1}/core/InternalAnimatedValue.js +0 -0
- package/lib/{src/reanimated1 → reanimated1}/core/__mocks__/AnimatedProps.js +0 -0
- package/lib/{src/reanimated1 → reanimated1}/core/createEventObjectProxyPolyfill.js +0 -0
- package/lib/{src/reanimated1 → reanimated1}/derived/__mocks__/evaluateOnce.js +0 -0
- package/lib/{src/reanimated1 → reanimated1}/derived/acc.js +0 -0
- package/lib/{src/reanimated1 → reanimated1}/derived/color.js +0 -0
- package/lib/{src/reanimated1 → reanimated1}/derived/diff.js +0 -0
- package/lib/{src/reanimated1 → reanimated1}/derived/diffClamp.js +0 -0
- package/lib/{src/reanimated1 → reanimated1}/derived/evaluateOnce.js +0 -0
- package/lib/{src/reanimated1 → reanimated1}/derived/index.js +0 -0
- package/lib/{src/reanimated1 → reanimated1}/derived/interpolate.js +2 -4
- package/lib/{src/reanimated1 → reanimated1}/derived/interpolateColors.js +0 -0
- package/lib/{src/reanimated1 → reanimated1}/derived/onChange.js +0 -0
- package/lib/{src/reanimated1 → reanimated1}/derived/useCode.js +0 -0
- package/lib/{src/reanimated1 → reanimated1}/index.js +0 -0
- package/lib/{src/reanimated1 → reanimated1}/operators.js +0 -0
- package/lib/{src/reanimated1 → reanimated1}/useValue.js +0 -0
- package/lib/{src/reanimated1 → reanimated1}/val.js +0 -0
- package/lib/{src/reanimated2 → reanimated2}/Bezier.js +0 -0
- package/lib/{src/reanimated2 → reanimated2}/Colors.js +2 -1
- package/lib/{src/reanimated2 → reanimated2}/Easing.js +0 -0
- package/lib/{src/reanimated2 → reanimated2}/NativeMethods.js +0 -0
- package/lib/reanimated2/NativeReanimated/NativeReanimated.js +50 -0
- package/lib/{src/reanimated2 → reanimated2}/NativeReanimated/index.js +0 -4
- package/lib/{src/reanimated2 → reanimated2}/PlatformChecker.js +0 -0
- package/lib/{src/reanimated2 → reanimated2}/PropAdapters.js +0 -0
- package/lib/{src/reanimated2 → reanimated2}/UpdateProps.js +0 -0
- package/lib/{src/reanimated2 → reanimated2}/ViewDescriptorsSet.js +2 -2
- package/lib/{src/reanimated2 → reanimated2}/WorkletEventHandler.js +0 -0
- package/lib/{src/reanimated2 → reanimated2}/__mocks__/MutableValue.js +0 -0
- package/lib/{src/reanimated2 → reanimated2}/__mocks__/NativeReanimated.js +0 -0
- package/lib/{src/reanimated2 → reanimated2}/__mocks__/NativeReanimated.native.js +0 -0
- package/lib/{src/reanimated2 → reanimated2}/animation/commonTypes.js +0 -0
- package/lib/{src/reanimated2 → reanimated2}/animation/decay.js +0 -0
- package/lib/{src/reanimated2 → reanimated2}/animation/delay.js +0 -0
- package/lib/{src/reanimated2 → reanimated2}/animation/index.js +0 -0
- package/lib/{src/reanimated2 → reanimated2}/animation/repeat.js +0 -0
- package/lib/{src/reanimated2 → reanimated2}/animation/sequence.js +0 -0
- package/lib/{src/reanimated2 → reanimated2}/animation/spring.js +0 -0
- package/lib/{src/reanimated2 → reanimated2}/animation/styleAnimation.js +2 -1
- package/lib/{src/reanimated2 → reanimated2}/animation/timing.js +0 -0
- package/lib/{src/reanimated2 → reanimated2}/animation/util.js +0 -0
- package/lib/{src/reanimated2 → reanimated2}/commonTypes.js +0 -0
- package/lib/{src/reanimated2 → reanimated2}/component/FlatList.js +0 -0
- package/lib/{src/reanimated2 → reanimated2}/component/WrappedComponents.js +0 -0
- package/lib/{src/reanimated2 → reanimated2}/component/index.js +0 -0
- package/lib/{src/reanimated2 → reanimated2}/core.js +30 -24
- package/lib/{src/reanimated2 → reanimated2}/globals.d.ts +6 -0
- package/lib/{src/reanimated2 → reanimated2}/hook/Hooks.js +0 -0
- package/lib/{src/reanimated2 → reanimated2}/hook/commonTypes.js +0 -0
- package/lib/{src/reanimated2 → reanimated2}/hook/index.js +1 -0
- package/lib/{src/reanimated2 → reanimated2}/hook/useAnimatedGestureHandler.js +0 -0
- package/lib/{src/reanimated2 → reanimated2}/hook/useAnimatedReaction.js +0 -0
- package/lib/{src/reanimated2 → reanimated2}/hook/useAnimatedRef.js +0 -0
- package/lib/{src/reanimated2 → reanimated2}/hook/useAnimatedScrollHandler.js +0 -0
- package/lib/reanimated2/hook/useAnimatedSensor.js +66 -0
- package/lib/{src/reanimated2 → reanimated2}/hook/useAnimatedStyle.js +0 -0
- package/lib/{src/reanimated2 → reanimated2}/hook/useDerivedValue.js +0 -0
- package/lib/{src/reanimated2 → reanimated2}/hook/useSharedValue.js +0 -0
- package/lib/{src/reanimated2 → reanimated2}/hook/utils.js +0 -0
- package/lib/{src/reanimated2 → reanimated2}/index.js +0 -0
- package/lib/{src/reanimated2 → reanimated2}/interpolateColor.js +11 -11
- package/lib/{src/reanimated2 → reanimated2}/interpolation.js +1 -1
- package/lib/{src/reanimated2 → reanimated2}/jestUtils.js +9 -4
- package/lib/{src/reanimated2 → reanimated2}/js-reanimated/JSReanimated.js +23 -2
- package/lib/{src/reanimated2 → reanimated2}/js-reanimated/Mapper.js +0 -0
- package/lib/{src/reanimated2 → reanimated2}/js-reanimated/MapperRegistry.js +0 -0
- package/lib/{src/reanimated2 → reanimated2}/js-reanimated/MutableValue.js +0 -0
- package/lib/{src/reanimated2 → reanimated2}/js-reanimated/commonTypes.js +0 -0
- package/lib/{src/reanimated2 → reanimated2}/js-reanimated/index.js +3 -3
- package/lib/{src/reanimated2 → reanimated2}/layoutReanimation/LayoutAnimationRepository.js +0 -0
- package/lib/{src/reanimated2 → reanimated2}/layoutReanimation/animationBuilder/BaseAnimationBuilder.js +0 -0
- package/lib/{src/reanimated2 → reanimated2}/layoutReanimation/animationBuilder/ComplexAnimationBuilder.js +8 -0
- package/lib/{src/reanimated2 → reanimated2}/layoutReanimation/animationBuilder/Keyframe.js +2 -1
- package/lib/{src/reanimated2 → reanimated2}/layoutReanimation/animationBuilder/commonTypes.js +0 -0
- package/lib/{src/reanimated2 → reanimated2}/layoutReanimation/animationBuilder/index.js +0 -0
- package/lib/{src/reanimated2 → reanimated2}/layoutReanimation/defaultAnimations/Bounce.js +32 -42
- package/lib/{src/reanimated2 → reanimated2}/layoutReanimation/defaultAnimations/Default.js +0 -0
- package/lib/{src/reanimated2 → reanimated2}/layoutReanimation/defaultAnimations/Fade.js +20 -38
- package/lib/{src/reanimated2 → reanimated2}/layoutReanimation/defaultAnimations/Flip.js +32 -44
- package/lib/{src/reanimated2 → reanimated2}/layoutReanimation/defaultAnimations/Lightspeed.js +8 -16
- package/lib/{src/reanimated2 → reanimated2}/layoutReanimation/defaultAnimations/Pinwheel.js +6 -10
- package/lib/{src/reanimated2 → reanimated2}/layoutReanimation/defaultAnimations/Roll.js +8 -12
- package/lib/{src/reanimated2 → reanimated2}/layoutReanimation/defaultAnimations/Rotate.js +20 -36
- package/lib/{src/reanimated2 → reanimated2}/layoutReanimation/defaultAnimations/Slide.js +16 -20
- package/lib/{src/reanimated2 → reanimated2}/layoutReanimation/defaultAnimations/Stretch.js +8 -12
- package/lib/{src/reanimated2 → reanimated2}/layoutReanimation/defaultAnimations/Zoom.js +32 -48
- package/lib/{src/reanimated2 → reanimated2}/layoutReanimation/defaultAnimations/index.js +0 -0
- package/lib/{src/reanimated2 → reanimated2}/layoutReanimation/defaultTransitions/CurvedTransition.js +0 -0
- package/lib/{src/reanimated2 → reanimated2}/layoutReanimation/defaultTransitions/EntryExitTransition.js +22 -18
- package/lib/{src/reanimated2 → reanimated2}/layoutReanimation/defaultTransitions/FadingTransition.js +0 -0
- package/lib/{src/reanimated2 → reanimated2}/layoutReanimation/defaultTransitions/JumpingTransition.js +0 -0
- package/lib/{src/reanimated2 → reanimated2}/layoutReanimation/defaultTransitions/LinearTransition.js +0 -0
- package/lib/{src/reanimated2 → reanimated2}/layoutReanimation/defaultTransitions/SequencedTransition.js +0 -0
- package/lib/{src/reanimated2 → reanimated2}/layoutReanimation/defaultTransitions/index.js +0 -0
- package/lib/{src/reanimated2 → reanimated2}/layoutReanimation/index.js +0 -0
- package/lib/{src/reanimated2 → reanimated2}/mock.js +3 -2
- package/lib/{src/reanimated2 → reanimated2}/platform-specific/RNRenderer.js +0 -0
- package/lib/{src/reanimated2 → reanimated2}/platform-specific/RNRenderer.web.js +0 -0
- package/lib/{src/reanimated2 → reanimated2}/utils.js +0 -0
- package/lib/{src/setAndForwardRef.js → setAndForwardRef.js} +0 -0
- 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 +80 -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 +5 -4
- package/package.json +44 -38
- package/plugin.js +3 -0
- package/react-native-reanimated.d.ts +64 -34
- package/src/ConfigHelper.ts +4 -4
- 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/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 -0
- package/src/reanimated2/component/FlatList.tsx +3 -2
- package/src/reanimated2/core.ts +34 -26
- package/src/reanimated2/globals.d.ts +6 -0
- 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/lib/src/reanimated2/NativeReanimated/NativeReanimated.js +0 -37
- 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
|
@@ -228,17 +228,16 @@ function decorateAnimation<T extends AnimationObject | StyleLayoutAnimation>(
|
|
|
228
228
|
};
|
|
229
229
|
}
|
|
230
230
|
|
|
231
|
-
type AnimationToDecoration<
|
|
232
|
-
T extends
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
: AnimatableValue | T;
|
|
231
|
+
type AnimationToDecoration<T extends AnimationObject | StyleLayoutAnimation> =
|
|
232
|
+
T extends StyleLayoutAnimation
|
|
233
|
+
? Record<string, unknown>
|
|
234
|
+
: T extends DelayAnimation
|
|
235
|
+
? NextAnimation<DelayAnimation>
|
|
236
|
+
: T extends RepeatAnimation
|
|
237
|
+
? NextAnimation<RepeatAnimation>
|
|
238
|
+
: T extends SequenceAnimation
|
|
239
|
+
? NextAnimation<SequenceAnimation>
|
|
240
|
+
: AnimatableValue | T;
|
|
242
241
|
|
|
243
242
|
export function defineAnimation<
|
|
244
243
|
T extends AnimationObject | StyleLayoutAnimation
|
|
@@ -126,3 +126,23 @@ export type AnimationCallback = (
|
|
|
126
126
|
) => void;
|
|
127
127
|
|
|
128
128
|
export type Timestamp = number;
|
|
129
|
+
|
|
130
|
+
export type Value3D = {
|
|
131
|
+
x: number;
|
|
132
|
+
y: number;
|
|
133
|
+
z: number;
|
|
134
|
+
};
|
|
135
|
+
|
|
136
|
+
export type SensorValue3D = SharedValue<Value3D>;
|
|
137
|
+
|
|
138
|
+
export type ValueRotation = {
|
|
139
|
+
qw: number;
|
|
140
|
+
qx: number;
|
|
141
|
+
qy: number;
|
|
142
|
+
qz: number;
|
|
143
|
+
yaw: number;
|
|
144
|
+
pitch: number;
|
|
145
|
+
roll: number;
|
|
146
|
+
};
|
|
147
|
+
|
|
148
|
+
export type SensorValueRotation = SharedValue<ValueRotation>;
|
|
@@ -13,7 +13,8 @@ const createCellRenderer = (itemLayoutAnimation?: ILayoutAnimationBuilder) => {
|
|
|
13
13
|
return (
|
|
14
14
|
<WrappedComponents.View
|
|
15
15
|
layout={itemLayoutAnimation}
|
|
16
|
-
onLayout={props.onLayout}
|
|
16
|
+
onLayout={props.onLayout}
|
|
17
|
+
>
|
|
17
18
|
{props.children}
|
|
18
19
|
</WrappedComponents.View>
|
|
19
20
|
);
|
|
@@ -22,7 +23,7 @@ const createCellRenderer = (itemLayoutAnimation?: ILayoutAnimationBuilder) => {
|
|
|
22
23
|
return cellRenderer;
|
|
23
24
|
};
|
|
24
25
|
|
|
25
|
-
interface ReanimatedFlatlistProps<ItemT> extends FlatListProps<ItemT> {
|
|
26
|
+
export interface ReanimatedFlatlistProps<ItemT> extends FlatListProps<ItemT> {
|
|
26
27
|
itemLayoutAnimation?: ILayoutAnimationBuilder;
|
|
27
28
|
}
|
|
28
29
|
|
package/src/reanimated2/core.ts
CHANGED
|
@@ -63,7 +63,7 @@ export const checkPluginState: (throwError: boolean) => boolean = (
|
|
|
63
63
|
export const isConfigured: (throwError?: boolean) => boolean = (
|
|
64
64
|
throwError = false
|
|
65
65
|
) => {
|
|
66
|
-
return checkPluginState(throwError)
|
|
66
|
+
return checkPluginState(throwError);
|
|
67
67
|
};
|
|
68
68
|
|
|
69
69
|
export const isConfiguredCheck: () => void = () => {
|
|
@@ -362,32 +362,30 @@ export function runOnJS<A extends any[], R>(
|
|
|
362
362
|
}
|
|
363
363
|
}
|
|
364
364
|
|
|
365
|
-
|
|
366
|
-
NativeReanimatedModule.
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
);
|
|
365
|
+
NativeReanimatedModule.installCoreFunctions(
|
|
366
|
+
NativeReanimatedModule.native
|
|
367
|
+
? (workletValueSetter as <T>(value: T) => void)
|
|
368
|
+
: (workletValueSetterJS as <T>(value: T) => void)
|
|
369
|
+
);
|
|
371
370
|
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
}
|
|
371
|
+
if (!isWeb() && isConfigured()) {
|
|
372
|
+
const capturableConsole = console;
|
|
373
|
+
runOnUI(() => {
|
|
374
|
+
'worklet';
|
|
375
|
+
const console = {
|
|
376
|
+
debug: runOnJS(capturableConsole.debug),
|
|
377
|
+
log: runOnJS(capturableConsole.log),
|
|
378
|
+
warn: runOnJS(capturableConsole.warn),
|
|
379
|
+
error: runOnJS(capturableConsole.error),
|
|
380
|
+
info: runOnJS(capturableConsole.info),
|
|
381
|
+
};
|
|
382
|
+
_setGlobalConsole(console);
|
|
383
|
+
if (global.performance == null) {
|
|
384
|
+
global.performance = {
|
|
385
|
+
now: global._chronoNow,
|
|
386
|
+
} as any; // due to conflict with lib.dom.d.ts -> Performance
|
|
387
|
+
}
|
|
388
|
+
})();
|
|
391
389
|
}
|
|
392
390
|
|
|
393
391
|
type FeaturesConfig = {
|
|
@@ -418,3 +416,13 @@ export function enableLayoutAnimations(
|
|
|
418
416
|
NativeReanimatedModule.enableLayoutAnimations(flag);
|
|
419
417
|
}
|
|
420
418
|
}
|
|
419
|
+
|
|
420
|
+
export function configureProps(uiProps: string[], nativeProps: string[]): void {
|
|
421
|
+
if (!nativeShouldBeMock()) {
|
|
422
|
+
NativeReanimatedModule.configureProps(uiProps, nativeProps);
|
|
423
|
+
}
|
|
424
|
+
}
|
|
425
|
+
|
|
426
|
+
export function jestResetJsReanimatedModule() {
|
|
427
|
+
(NativeReanimatedModule as JSReanimated).jestResetModule();
|
|
428
|
+
}
|
|
@@ -27,6 +27,9 @@ declare global {
|
|
|
27
27
|
animated: boolean
|
|
28
28
|
) => void;
|
|
29
29
|
const _chronoNow: () => number;
|
|
30
|
+
const ReanimatedDataMock: {
|
|
31
|
+
now: () => number;
|
|
32
|
+
};
|
|
30
33
|
namespace NodeJS {
|
|
31
34
|
interface Global {
|
|
32
35
|
__reanimatedWorkletInit: (worklet: WorkletFunction) => void;
|
|
@@ -50,6 +53,9 @@ declare global {
|
|
|
50
53
|
yogaValues: unknown
|
|
51
54
|
): void;
|
|
52
55
|
};
|
|
56
|
+
ReanimatedDataMock: {
|
|
57
|
+
now: () => number;
|
|
58
|
+
};
|
|
53
59
|
}
|
|
54
60
|
}
|
|
55
61
|
}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { useEffect, useRef } from 'react';
|
|
2
|
+
import { makeMutable } from '../core';
|
|
3
|
+
import NativeReanimated from '../NativeReanimated';
|
|
4
|
+
import { SensorValue3D, SensorValueRotation } from '../commonTypes';
|
|
5
|
+
|
|
6
|
+
export enum SensorType {
|
|
7
|
+
ACCELEROMETER = 1,
|
|
8
|
+
GYROSCOPE = 2,
|
|
9
|
+
GRAVITY = 3,
|
|
10
|
+
MAGNETIC_FIELD = 4,
|
|
11
|
+
ROTATION = 5,
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export type SensorConfig = {
|
|
15
|
+
interval: number;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
export type AnimatedSensor = {
|
|
19
|
+
sensor: SensorValue3D | SensorValueRotation | null;
|
|
20
|
+
unregister: () => void;
|
|
21
|
+
isAvailable: boolean;
|
|
22
|
+
config: {
|
|
23
|
+
interval: number;
|
|
24
|
+
};
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
export function useAnimatedSensor(
|
|
28
|
+
sensorType: SensorType,
|
|
29
|
+
userConfig?: SensorConfig
|
|
30
|
+
): AnimatedSensor {
|
|
31
|
+
const ref = useRef({
|
|
32
|
+
sensor: null,
|
|
33
|
+
unregister: () => {
|
|
34
|
+
// NOOP
|
|
35
|
+
},
|
|
36
|
+
isAvailable: false,
|
|
37
|
+
config: {
|
|
38
|
+
interval: 0,
|
|
39
|
+
},
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
if (ref.current.sensor === null) {
|
|
43
|
+
ref.current.config = { interval: 10, ...userConfig };
|
|
44
|
+
let sensorData;
|
|
45
|
+
if (sensorType === SensorType.ROTATION) {
|
|
46
|
+
sensorData = {
|
|
47
|
+
qw: 0,
|
|
48
|
+
qx: 0,
|
|
49
|
+
qy: 0,
|
|
50
|
+
qz: 0,
|
|
51
|
+
yaw: 0,
|
|
52
|
+
pitch: 0,
|
|
53
|
+
roll: 0,
|
|
54
|
+
};
|
|
55
|
+
} else {
|
|
56
|
+
sensorData = {
|
|
57
|
+
x: 0,
|
|
58
|
+
y: 0,
|
|
59
|
+
z: 0,
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
ref.current.sensor = makeMutable(sensorData) as any;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
useEffect(() => {
|
|
66
|
+
ref.current.config = { interval: 10, ...userConfig };
|
|
67
|
+
const id = NativeReanimated.registerSensor(
|
|
68
|
+
sensorType,
|
|
69
|
+
ref.current.config.interval,
|
|
70
|
+
ref.current.sensor as any
|
|
71
|
+
);
|
|
72
|
+
|
|
73
|
+
if (id !== -1) {
|
|
74
|
+
// if sensor is available
|
|
75
|
+
ref.current.unregister = () => NativeReanimated.unregisterSensor(id);
|
|
76
|
+
ref.current.isAvailable = true;
|
|
77
|
+
} else {
|
|
78
|
+
// if sensor is unavailable
|
|
79
|
+
ref.current.unregister = () => {
|
|
80
|
+
// NOOP
|
|
81
|
+
};
|
|
82
|
+
ref.current.isAvailable = false;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
return () => {
|
|
86
|
+
ref.current.unregister();
|
|
87
|
+
};
|
|
88
|
+
}, [sensorType, userConfig]);
|
|
89
|
+
|
|
90
|
+
return ref.current;
|
|
91
|
+
}
|
|
@@ -187,7 +187,8 @@ export function isAnimated(prop: NestedObjectValues<AnimationObject>): boolean {
|
|
|
187
187
|
'worklet';
|
|
188
188
|
const propsToCheck: NestedObjectValues<AnimationObject>[] = [prop];
|
|
189
189
|
while (propsToCheck.length > 0) {
|
|
190
|
-
const currentProp: NestedObjectValues<AnimationObject> =
|
|
190
|
+
const currentProp: NestedObjectValues<AnimationObject> =
|
|
191
|
+
propsToCheck.pop() as NestedObjectValues<AnimationObject>;
|
|
191
192
|
if (Array.isArray(currentProp)) {
|
|
192
193
|
for (const item of currentProp) {
|
|
193
194
|
propsToCheck.push(item);
|
|
@@ -58,13 +58,13 @@ const getInterpolateRGB = (
|
|
|
58
58
|
const a = [];
|
|
59
59
|
for (let i = 0; i < colors.length; ++i) {
|
|
60
60
|
const color = colors[i];
|
|
61
|
-
const
|
|
61
|
+
const processedColor = processColor(color);
|
|
62
62
|
// explicit check in case if processedColor is 0
|
|
63
|
-
if (
|
|
64
|
-
r.push(red(
|
|
65
|
-
g.push(green(
|
|
66
|
-
b.push(blue(
|
|
67
|
-
a.push(opacity(
|
|
63
|
+
if (processedColor !== null && processedColor !== undefined) {
|
|
64
|
+
r.push(red(processedColor));
|
|
65
|
+
g.push(green(processedColor));
|
|
66
|
+
b.push(blue(processedColor));
|
|
67
|
+
a.push(opacity(processedColor));
|
|
68
68
|
}
|
|
69
69
|
}
|
|
70
70
|
return { r, g, b, a };
|
|
@@ -85,11 +85,11 @@ const getInterpolateHSV = (
|
|
|
85
85
|
const v = [];
|
|
86
86
|
for (let i = 0; i < colors.length; ++i) {
|
|
87
87
|
const color = colors[i];
|
|
88
|
-
const
|
|
89
|
-
if (
|
|
90
|
-
h.push(
|
|
91
|
-
s.push(
|
|
92
|
-
v.push(
|
|
88
|
+
const processedColor = RGBtoHSV(processColor(color) as any);
|
|
89
|
+
if (processedColor) {
|
|
90
|
+
h.push(processedColor.h);
|
|
91
|
+
s.push(processedColor.s);
|
|
92
|
+
v.push(processedColor.v);
|
|
93
93
|
}
|
|
94
94
|
}
|
|
95
95
|
return { h, s, v };
|
|
@@ -123,12 +123,8 @@ function internalInterpolate(
|
|
|
123
123
|
extrapolationConfig: RequiredExtrapolationConfig
|
|
124
124
|
) {
|
|
125
125
|
'worklet';
|
|
126
|
-
const {
|
|
127
|
-
|
|
128
|
-
rightEdgeInput,
|
|
129
|
-
leftEdgeOutput,
|
|
130
|
-
rightEdgeOutput,
|
|
131
|
-
} = narrowedInput;
|
|
126
|
+
const { leftEdgeInput, rightEdgeInput, leftEdgeOutput, rightEdgeOutput } =
|
|
127
|
+
narrowedInput;
|
|
132
128
|
if (rightEdgeInput - leftEdgeInput === 0) return leftEdgeOutput;
|
|
133
129
|
const progress = (x - leftEdgeInput) / (rightEdgeInput - leftEdgeInput);
|
|
134
130
|
const val = leftEdgeOutput + progress * (rightEdgeOutput - leftEdgeOutput);
|
|
@@ -1,6 +1,17 @@
|
|
|
1
1
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
2
2
|
// @ts-nocheck
|
|
3
|
-
|
|
3
|
+
import { jestResetJsReanimatedModule } from './core';
|
|
4
|
+
|
|
5
|
+
declare global {
|
|
6
|
+
// eslint-disable-next-line @typescript-eslint/no-namespace
|
|
7
|
+
namespace jest {
|
|
8
|
+
interface Matchers<R> {
|
|
9
|
+
toHaveAnimatedStyle(
|
|
10
|
+
style: Record<string, unknown>[] | Record<string, unknown>
|
|
11
|
+
): R;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
}
|
|
4
15
|
|
|
5
16
|
let config = {
|
|
6
17
|
fps: 60,
|
|
@@ -129,26 +140,30 @@ const compareStyle = (received, expectedStyle, config) => {
|
|
|
129
140
|
|
|
130
141
|
let frameTime = 1000 / config.fps;
|
|
131
142
|
let requestAnimationFrameCopy;
|
|
143
|
+
let currentTimestamp = 0;
|
|
132
144
|
|
|
133
145
|
const requestAnimationFrame = (callback) => {
|
|
134
146
|
setTimeout(callback, frameTime);
|
|
135
147
|
};
|
|
136
148
|
|
|
137
149
|
const beforeTest = () => {
|
|
150
|
+
jestResetJsReanimatedModule();
|
|
138
151
|
requestAnimationFrameCopy = global.requestAnimationFrame;
|
|
139
152
|
global.requestAnimationFrame = requestAnimationFrame;
|
|
140
|
-
|
|
153
|
+
global.ReanimatedDataMock = {
|
|
154
|
+
now: () => currentTimestamp,
|
|
155
|
+
};
|
|
156
|
+
currentTimestamp = 0;
|
|
141
157
|
jest.useFakeTimers();
|
|
142
158
|
};
|
|
143
159
|
|
|
144
160
|
const afterTest = () => {
|
|
145
|
-
MockDate.reset();
|
|
146
161
|
jest.useRealTimers();
|
|
147
162
|
global.requestAnimationFrame = requestAnimationFrameCopy;
|
|
148
163
|
};
|
|
149
164
|
|
|
150
165
|
const tickTravel = () => {
|
|
151
|
-
|
|
166
|
+
currentTimestamp += frameTime;
|
|
152
167
|
jest.advanceTimersByTime(frameTime);
|
|
153
168
|
};
|
|
154
169
|
|
|
@@ -174,6 +189,7 @@ export const advanceAnimationByFrame = (count) => {
|
|
|
174
189
|
|
|
175
190
|
export const setUpTests = (userConfig = {}) => {
|
|
176
191
|
const expect = require('expect');
|
|
192
|
+
require('setimmediate');
|
|
177
193
|
frameTime = Math.round(1000 / config.fps);
|
|
178
194
|
|
|
179
195
|
config = {
|
|
@@ -3,6 +3,7 @@ import Mapper from './Mapper';
|
|
|
3
3
|
import MutableValue from './MutableValue';
|
|
4
4
|
import { NativeReanimated } from '../NativeReanimated/NativeReanimated';
|
|
5
5
|
import { Timestamp, NestedObjectValues } from '../commonTypes';
|
|
6
|
+
import { isJest } from '../PlatformChecker';
|
|
6
7
|
|
|
7
8
|
export default class JSReanimated extends NativeReanimated {
|
|
8
9
|
_valueSetter?: <T>(value: T) => void = undefined;
|
|
@@ -14,8 +15,8 @@ export default class JSReanimated extends NativeReanimated {
|
|
|
14
15
|
|
|
15
16
|
constructor() {
|
|
16
17
|
super(false);
|
|
17
|
-
if (
|
|
18
|
-
this.timeProvider = { now: () =>
|
|
18
|
+
if (isJest()) {
|
|
19
|
+
this.timeProvider = { now: () => global.ReanimatedDataMock.now() };
|
|
19
20
|
} else {
|
|
20
21
|
this.timeProvider = { now: () => window.performance.now() };
|
|
21
22
|
}
|
|
@@ -103,4 +104,26 @@ export default class JSReanimated extends NativeReanimated {
|
|
|
103
104
|
'[Reanimated] enableLayoutAnimations is not available for WEB yet'
|
|
104
105
|
);
|
|
105
106
|
}
|
|
107
|
+
|
|
108
|
+
registerSensor(): number {
|
|
109
|
+
console.warn('[Reanimated] useAnimatedSensor is not available on web yet.');
|
|
110
|
+
return -1;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
unregisterSensor(): void {
|
|
114
|
+
// noop
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
jestResetModule() {
|
|
118
|
+
if (isJest()) {
|
|
119
|
+
/**
|
|
120
|
+
* If someone used timers to stop animation before the end,
|
|
121
|
+
* then _renderRequested was set as true
|
|
122
|
+
* and any new update from another test wasn't applied.
|
|
123
|
+
*/
|
|
124
|
+
this._renderRequested = false;
|
|
125
|
+
} else {
|
|
126
|
+
throw Error('This method can be only use in Jest testing.');
|
|
127
|
+
}
|
|
128
|
+
}
|
|
106
129
|
}
|
|
@@ -20,7 +20,7 @@ if (shouldBeUseWeb()) {
|
|
|
20
20
|
};
|
|
21
21
|
global._measure = () => {
|
|
22
22
|
console.warn(
|
|
23
|
-
"[Reanimated] You can't use
|
|
23
|
+
"[Reanimated] You can't use `measure` with Chrome Debugger or with web version"
|
|
24
24
|
);
|
|
25
25
|
return {
|
|
26
26
|
x: 0,
|
|
@@ -33,12 +33,12 @@ if (shouldBeUseWeb()) {
|
|
|
33
33
|
};
|
|
34
34
|
global._scrollTo = () => {
|
|
35
35
|
console.warn(
|
|
36
|
-
"[Reanimated] You can't use
|
|
36
|
+
"[Reanimated] You can't use `scrollTo` with Chrome Debugger or with web version"
|
|
37
37
|
);
|
|
38
38
|
};
|
|
39
39
|
global._setGestureState = () => {
|
|
40
40
|
console.warn(
|
|
41
|
-
"[Reanimated] You can't use
|
|
41
|
+
"[Reanimated] You can't use `setGestureState` with Chrome Debugger or with web version"
|
|
42
42
|
);
|
|
43
43
|
};
|
|
44
44
|
}
|
|
@@ -6,6 +6,8 @@ import {
|
|
|
6
6
|
} from './commonTypes';
|
|
7
7
|
import { EasingFn } from '../../Easing';
|
|
8
8
|
import { BaseAnimationBuilder } from './BaseAnimationBuilder';
|
|
9
|
+
import { StyleProps } from '../../commonTypes';
|
|
10
|
+
|
|
9
11
|
export class ComplexAnimationBuilder extends BaseAnimationBuilder {
|
|
10
12
|
easingV?: EasingFn;
|
|
11
13
|
rotateV?: string;
|
|
@@ -16,6 +18,7 @@ export class ComplexAnimationBuilder extends BaseAnimationBuilder {
|
|
|
16
18
|
overshootClampingV?: number;
|
|
17
19
|
restDisplacementThresholdV?: number;
|
|
18
20
|
restSpeedThresholdV?: number;
|
|
21
|
+
initialValues?: StyleProps;
|
|
19
22
|
|
|
20
23
|
static createInstance: () => ComplexAnimationBuilder;
|
|
21
24
|
|
|
@@ -115,6 +118,16 @@ export class ComplexAnimationBuilder extends BaseAnimationBuilder {
|
|
|
115
118
|
return this;
|
|
116
119
|
}
|
|
117
120
|
|
|
121
|
+
static withInitialValues(values: StyleProps): BaseAnimationBuilder {
|
|
122
|
+
const instance = this.createInstance();
|
|
123
|
+
return instance.withInitialValues(values);
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
withInitialValues(values: StyleProps): BaseAnimationBuilder {
|
|
127
|
+
this.initialValues = values;
|
|
128
|
+
return this;
|
|
129
|
+
}
|
|
130
|
+
|
|
118
131
|
getAnimationAndConfig(): LayoutAnimationAndConfig {
|
|
119
132
|
const duration = this.durationV;
|
|
120
133
|
const easing = this.easingV;
|
|
@@ -74,9 +74,8 @@ export class Keyframe implements IEntryExitAnimationBuilder {
|
|
|
74
74
|
if (styleProp === 'transform') {
|
|
75
75
|
initialValues[styleProp]?.forEach((transformStyle, index) => {
|
|
76
76
|
Object.keys(transformStyle).forEach((transformProp: string) => {
|
|
77
|
-
parsedKeyframes[
|
|
78
|
-
|
|
79
|
-
] = [];
|
|
77
|
+
parsedKeyframes[index.toString() + '_transform:' + transformProp] =
|
|
78
|
+
[];
|
|
80
79
|
});
|
|
81
80
|
});
|
|
82
81
|
} else {
|