react-native-reanimated 3.9.0-rc.0 → 3.9.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/Fabric/ShadowTreeCloner.cpp +2 -1
- package/Common/cpp/NativeModules/NativeReanimatedModule.cpp +11 -4
- package/android/src/main/java/com/swmansion/reanimated/NodesManager.java +5 -3
- package/apple/REAModule.mm +14 -29
- package/apple/REANodesManager.mm +7 -6
- package/lib/module/Animated.js.map +1 -1
- package/lib/module/ConfigHelper.js.map +1 -1
- package/lib/module/animationBuilder.js.map +1 -1
- package/lib/module/createAnimatedComponent/InlinePropManager.js +2 -2
- package/lib/module/createAnimatedComponent/InlinePropManager.js.map +1 -1
- package/lib/module/createAnimatedComponent/JSPropsUpdater.js +4 -4
- package/lib/module/createAnimatedComponent/JSPropsUpdater.js.map +1 -1
- package/lib/module/createAnimatedComponent/JSPropsUpdater.web.js.map +1 -1
- package/lib/module/createAnimatedComponent/PropsFilter.js +5 -5
- package/lib/module/createAnimatedComponent/PropsFilter.js.map +1 -1
- package/lib/module/createAnimatedComponent/commonTypes.js.map +1 -1
- package/lib/module/createAnimatedComponent/createAnimatedComponent.js +33 -33
- package/lib/module/createAnimatedComponent/createAnimatedComponent.js.map +1 -1
- package/lib/module/createAnimatedComponent/getViewInfo.js +2 -2
- package/lib/module/createAnimatedComponent/getViewInfo.js.map +1 -1
- package/lib/module/createAnimatedComponent/index.js.map +1 -1
- package/lib/module/createAnimatedComponent/setAndForwardRef.js +4 -5
- package/lib/module/createAnimatedComponent/setAndForwardRef.js.map +1 -1
- package/lib/module/createAnimatedComponent/utils.js.map +1 -1
- package/lib/module/index.js.map +1 -1
- package/lib/module/index.web.js +1 -2
- package/lib/module/index.web.js.map +1 -1
- package/lib/module/mock.js +3 -8
- package/lib/module/mock.js.map +1 -1
- package/lib/module/propsAllowlists.js.map +1 -1
- package/lib/module/reanimated2/Bezier.js.map +1 -1
- package/lib/module/reanimated2/Colors.js +4 -11
- package/lib/module/reanimated2/Colors.js.map +1 -1
- package/lib/module/reanimated2/Easing.js +3 -7
- package/lib/module/reanimated2/Easing.js.map +1 -1
- package/lib/module/reanimated2/NativeReanimated/NativeReanimated.js +3 -3
- package/lib/module/reanimated2/NativeReanimated/NativeReanimated.js.map +1 -1
- package/lib/module/reanimated2/NativeReanimated/index.js.map +1 -1
- package/lib/module/reanimated2/NativeReanimated/index.web.js.map +1 -1
- package/lib/module/reanimated2/PlatformChecker.js +1 -0
- package/lib/module/reanimated2/PlatformChecker.js.map +1 -1
- package/lib/module/reanimated2/PropAdapters.js +1 -1
- package/lib/module/reanimated2/PropAdapters.js.map +1 -1
- package/lib/module/reanimated2/PropsRegistry.js.map +1 -1
- package/lib/module/reanimated2/Sensor.js +2 -2
- package/lib/module/reanimated2/Sensor.js.map +1 -1
- package/lib/module/reanimated2/SensorContainer.js +2 -2
- package/lib/module/reanimated2/SensorContainer.js.map +1 -1
- package/lib/module/reanimated2/UpdateLayoutAnimations.js.map +1 -1
- package/lib/module/reanimated2/UpdateProps.js.map +1 -1
- package/lib/module/reanimated2/ViewDescriptorsSet.js.map +1 -1
- package/lib/module/reanimated2/WorkletEventHandler.js +74 -31
- package/lib/module/reanimated2/WorkletEventHandler.js.map +1 -1
- package/lib/module/reanimated2/animation/clamp.js.map +1 -1
- package/lib/module/reanimated2/animation/commonTypes.js.map +1 -1
- package/lib/module/reanimated2/animation/decay/decay.js.map +1 -1
- package/lib/module/reanimated2/animation/decay/index.js.map +1 -1
- package/lib/module/reanimated2/animation/decay/rigidDecay.js.map +1 -1
- package/lib/module/reanimated2/animation/decay/rubberBandDecay.js.map +1 -1
- package/lib/module/reanimated2/animation/decay/utils.js.map +1 -1
- package/lib/module/reanimated2/animation/delay.js.map +1 -1
- package/lib/module/reanimated2/animation/index.js.map +1 -1
- package/lib/module/reanimated2/animation/repeat.js +1 -6
- package/lib/module/reanimated2/animation/repeat.js.map +1 -1
- package/lib/module/reanimated2/animation/sequence.js +1 -5
- package/lib/module/reanimated2/animation/sequence.js.map +1 -1
- package/lib/module/reanimated2/animation/spring.js.map +1 -1
- package/lib/module/reanimated2/animation/springUtils.js +8 -10
- package/lib/module/reanimated2/animation/springUtils.js.map +1 -1
- package/lib/module/reanimated2/animation/styleAnimation.js +5 -4
- package/lib/module/reanimated2/animation/styleAnimation.js.map +1 -1
- package/lib/module/reanimated2/animation/timing.js.map +1 -1
- package/lib/module/reanimated2/animation/transformationMatrix/matrixUtils.js +1 -2
- package/lib/module/reanimated2/animation/transformationMatrix/matrixUtils.js.map +1 -1
- package/lib/module/reanimated2/animation/util.js.map +1 -1
- package/lib/module/reanimated2/commonTypes.js +2 -0
- package/lib/module/reanimated2/commonTypes.js.map +1 -1
- package/lib/module/reanimated2/component/FlatList.js +1 -0
- package/lib/module/reanimated2/component/FlatList.js.map +1 -1
- package/lib/module/reanimated2/component/Image.js +1 -0
- package/lib/module/reanimated2/component/Image.js.map +1 -1
- package/lib/module/reanimated2/component/LayoutAnimationConfig.js +1 -0
- package/lib/module/reanimated2/component/LayoutAnimationConfig.js.map +1 -1
- package/lib/module/reanimated2/component/PerformanceMonitor.js +3 -4
- package/lib/module/reanimated2/component/PerformanceMonitor.js.map +1 -1
- package/lib/module/reanimated2/component/ScrollView.js +1 -0
- package/lib/module/reanimated2/component/ScrollView.js.map +1 -1
- package/lib/module/reanimated2/component/Text.js +1 -0
- package/lib/module/reanimated2/component/Text.js.map +1 -1
- package/lib/module/reanimated2/component/View.js +1 -0
- package/lib/module/reanimated2/component/View.js.map +1 -1
- package/lib/module/reanimated2/core.js +2 -4
- package/lib/module/reanimated2/core.js.map +1 -1
- package/lib/module/reanimated2/errors.js +7 -8
- package/lib/module/reanimated2/errors.js.map +1 -1
- package/lib/module/reanimated2/fabricUtils.js +4 -4
- package/lib/module/reanimated2/fabricUtils.js.map +1 -1
- package/lib/module/reanimated2/fabricUtils.web.js.map +1 -1
- package/lib/module/reanimated2/frameCallback/FrameCallbackRegistryJS.js +2 -2
- package/lib/module/reanimated2/frameCallback/FrameCallbackRegistryJS.js.map +1 -1
- package/lib/module/reanimated2/frameCallback/FrameCallbackRegistryUI.js.map +1 -1
- package/lib/module/reanimated2/frameCallback/index.js.map +1 -1
- package/lib/module/reanimated2/globals.d.js.map +1 -1
- package/lib/module/reanimated2/helperTypes.js.map +1 -1
- package/lib/module/reanimated2/hook/commonTypes.js.map +1 -1
- package/lib/module/reanimated2/hook/index.js.map +1 -1
- package/lib/module/reanimated2/hook/useAnimatedGestureHandler.js +1 -0
- package/lib/module/reanimated2/hook/useAnimatedGestureHandler.js.map +1 -1
- package/lib/module/reanimated2/hook/useAnimatedKeyboard.js +3 -4
- package/lib/module/reanimated2/hook/useAnimatedKeyboard.js.map +1 -1
- package/lib/module/reanimated2/hook/useAnimatedProps.js.map +1 -1
- package/lib/module/reanimated2/hook/useAnimatedReaction.js +1 -0
- package/lib/module/reanimated2/hook/useAnimatedReaction.js.map +1 -1
- package/lib/module/reanimated2/hook/useAnimatedRef.js +1 -1
- package/lib/module/reanimated2/hook/useAnimatedRef.js.map +1 -1
- package/lib/module/reanimated2/hook/useAnimatedScrollHandler.js +3 -1
- package/lib/module/reanimated2/hook/useAnimatedScrollHandler.js.map +1 -1
- package/lib/module/reanimated2/hook/useAnimatedSensor.js.map +1 -1
- package/lib/module/reanimated2/hook/useAnimatedStyle.js +3 -6
- package/lib/module/reanimated2/hook/useAnimatedStyle.js.map +1 -1
- package/lib/module/reanimated2/hook/useDerivedValue.js +3 -1
- package/lib/module/reanimated2/hook/useDerivedValue.js.map +1 -1
- package/lib/module/reanimated2/hook/useEvent.js +4 -5
- package/lib/module/reanimated2/hook/useEvent.js.map +1 -1
- package/lib/module/reanimated2/hook/useFrameCallback.js +1 -2
- package/lib/module/reanimated2/hook/useFrameCallback.js.map +1 -1
- package/lib/module/reanimated2/hook/useHandler.js +3 -1
- package/lib/module/reanimated2/hook/useHandler.js.map +1 -1
- package/lib/module/reanimated2/hook/useReducedMotion.js.map +1 -1
- package/lib/module/reanimated2/hook/useScrollViewOffset.js +14 -6
- package/lib/module/reanimated2/hook/useScrollViewOffset.js.map +1 -1
- package/lib/module/reanimated2/hook/useSharedValue.js.map +1 -1
- package/lib/module/reanimated2/hook/useWorkletCallback.js.map +1 -1
- package/lib/module/reanimated2/hook/utils.js.map +1 -1
- package/lib/module/reanimated2/index.js.map +1 -1
- package/lib/module/reanimated2/initializers.js +1 -5
- package/lib/module/reanimated2/initializers.js.map +1 -1
- package/lib/module/reanimated2/interpolateColor.js +2 -6
- package/lib/module/reanimated2/interpolateColor.js.map +1 -1
- package/lib/module/reanimated2/interpolation.js +1 -1
- package/lib/module/reanimated2/interpolation.js.map +1 -1
- package/lib/module/reanimated2/isSharedValue.js.map +1 -1
- package/lib/module/reanimated2/jestUtils.js +3 -6
- package/lib/module/reanimated2/jestUtils.js.map +1 -1
- package/lib/module/reanimated2/jestUtils.web.js.map +1 -1
- package/lib/module/reanimated2/js-reanimated/JSReanimated.js +4 -5
- package/lib/module/reanimated2/js-reanimated/JSReanimated.js.map +1 -1
- package/lib/module/reanimated2/js-reanimated/WebSensor.js.map +1 -1
- package/lib/module/reanimated2/js-reanimated/index.js +2 -2
- package/lib/module/reanimated2/js-reanimated/index.js.map +1 -1
- package/lib/module/reanimated2/js-reanimated/react-native-web.d.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/animationBuilder/BaseAnimationBuilder.js +4 -2
- package/lib/module/reanimated2/layoutReanimation/animationBuilder/BaseAnimationBuilder.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/animationBuilder/ComplexAnimationBuilder.js +8 -11
- package/lib/module/reanimated2/layoutReanimation/animationBuilder/ComplexAnimationBuilder.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/animationBuilder/Keyframe.js +8 -9
- package/lib/module/reanimated2/layoutReanimation/animationBuilder/Keyframe.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/animationBuilder/commonTypes.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/animationBuilder/index.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/animationsManager.js +1 -2
- package/lib/module/reanimated2/layoutReanimation/animationsManager.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Bounce.js +22 -22
- package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Bounce.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Fade.js +22 -22
- package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Fade.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Flip.js +26 -26
- package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Flip.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Lightspeed.js +10 -10
- package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Lightspeed.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Pinwheel.js +6 -6
- package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Pinwheel.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Roll.js +10 -10
- package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Roll.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Rotate.js +18 -18
- package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Rotate.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Slide.js +18 -18
- package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Slide.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Stretch.js +10 -10
- package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Stretch.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Zoom.js +34 -34
- package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Zoom.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/defaultAnimations/index.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/defaultTransitions/CurvedTransition.js +4 -4
- package/lib/module/reanimated2/layoutReanimation/defaultTransitions/CurvedTransition.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/defaultTransitions/EntryExitTransition.js +4 -4
- package/lib/module/reanimated2/layoutReanimation/defaultTransitions/EntryExitTransition.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/defaultTransitions/FadingTransition.js +4 -4
- package/lib/module/reanimated2/layoutReanimation/defaultTransitions/FadingTransition.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/defaultTransitions/JumpingTransition.js +4 -4
- package/lib/module/reanimated2/layoutReanimation/defaultTransitions/JumpingTransition.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/defaultTransitions/LinearTransition.js +4 -4
- package/lib/module/reanimated2/layoutReanimation/defaultTransitions/LinearTransition.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/defaultTransitions/SequencedTransition.js +4 -4
- package/lib/module/reanimated2/layoutReanimation/defaultTransitions/SequencedTransition.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/defaultTransitions/index.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/index.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/sharedTransitions/ProgressTransitionManager.js +4 -6
- package/lib/module/reanimated2/layoutReanimation/sharedTransitions/ProgressTransitionManager.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/sharedTransitions/SharedTransition.js +4 -6
- package/lib/module/reanimated2/layoutReanimation/sharedTransitions/SharedTransition.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/sharedTransitions/SharedTransition.web.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/sharedTransitions/index.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/web/animation/Bounce.web.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/web/animation/Fade.web.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/web/animation/Flip.web.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/web/animation/Lightspeed.web.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/web/animation/Pinwheel.web.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/web/animation/Roll.web.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/web/animation/Rotate.web.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/web/animation/Slide.web.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/web/animation/Stretch.web.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/web/animation/Zoom.web.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/web/animationParser.js +0 -2
- package/lib/module/reanimated2/layoutReanimation/web/animationParser.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/web/animationsManager.js +1 -2
- package/lib/module/reanimated2/layoutReanimation/web/animationsManager.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/web/componentStyle.js +3 -1
- package/lib/module/reanimated2/layoutReanimation/web/componentStyle.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/web/componentUtils.js +6 -7
- package/lib/module/reanimated2/layoutReanimation/web/componentUtils.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/web/config.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/web/createAnimation.js +2 -2
- package/lib/module/reanimated2/layoutReanimation/web/createAnimation.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/web/domUtils.js +4 -4
- package/lib/module/reanimated2/layoutReanimation/web/domUtils.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/web/index.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/web/transition/Fading.web.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/web/transition/Linear.web.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/web/transition/Sequenced.web.js.map +1 -1
- package/lib/module/reanimated2/mappers.js +2 -4
- package/lib/module/reanimated2/mappers.js.map +1 -1
- package/lib/module/reanimated2/mockedRequestAnimationFrame.js.map +1 -1
- package/lib/module/reanimated2/mutables.js +2 -4
- package/lib/module/reanimated2/mutables.js.map +1 -1
- package/lib/module/reanimated2/platform-specific/RNRenderer.js.map +1 -1
- package/lib/module/reanimated2/platform-specific/RNRenderer.web.js.map +1 -1
- package/lib/module/reanimated2/platform-specific/checkCppVersion.js.map +1 -1
- package/lib/module/reanimated2/platform-specific/jsVersion.js +1 -1
- package/lib/module/reanimated2/platform-specific/jsVersion.js.map +1 -1
- package/lib/module/reanimated2/platformFunctions/dispatchCommand.js +2 -4
- package/lib/module/reanimated2/platformFunctions/dispatchCommand.js.map +1 -1
- package/lib/module/reanimated2/platformFunctions/dispatchCommand.web.js.map +1 -1
- package/lib/module/reanimated2/platformFunctions/getRelativeCoords.js +2 -2
- package/lib/module/reanimated2/platformFunctions/getRelativeCoords.js.map +1 -1
- package/lib/module/reanimated2/platformFunctions/index.js.map +1 -1
- package/lib/module/reanimated2/platformFunctions/measure.js.map +1 -1
- package/lib/module/reanimated2/platformFunctions/measure.web.js.map +1 -1
- package/lib/module/reanimated2/platformFunctions/scrollTo.js.map +1 -1
- package/lib/module/reanimated2/platformFunctions/scrollTo.web.js +1 -1
- package/lib/module/reanimated2/platformFunctions/scrollTo.web.js.map +1 -1
- package/lib/module/reanimated2/platformFunctions/setGestureState.js.map +1 -1
- package/lib/module/reanimated2/platformFunctions/setGestureState.web.js.map +1 -1
- package/lib/module/reanimated2/platformFunctions/setNativeProps.js.map +1 -1
- package/lib/module/reanimated2/platformFunctions/setNativeProps.web.js.map +1 -1
- package/lib/module/reanimated2/pluginUtils.js.map +1 -1
- package/lib/module/reanimated2/publicGlobals.js.map +1 -1
- package/lib/module/reanimated2/runtimes.js +11 -19
- package/lib/module/reanimated2/runtimes.js.map +1 -1
- package/lib/module/reanimated2/screenTransition/RNScreensTurboModule.js.map +1 -1
- package/lib/module/reanimated2/screenTransition/animationManager.js.map +1 -1
- package/lib/module/reanimated2/screenTransition/commonTypes.js.map +1 -1
- package/lib/module/reanimated2/screenTransition/index.js.map +1 -1
- package/lib/module/reanimated2/screenTransition/presets.js.map +1 -1
- package/lib/module/reanimated2/screenTransition/styleUpdater.js.map +1 -1
- package/lib/module/reanimated2/screenTransition/swipeSimulator.js +1 -1
- package/lib/module/reanimated2/screenTransition/swipeSimulator.js.map +1 -1
- package/lib/module/reanimated2/shareableMappingCache.js.map +1 -1
- package/lib/module/reanimated2/shareables.js +2 -4
- package/lib/module/reanimated2/shareables.js.map +1 -1
- package/lib/module/reanimated2/threads.js +9 -34
- package/lib/module/reanimated2/threads.js.map +1 -1
- package/lib/module/reanimated2/valueSetter.js +1 -2
- package/lib/module/reanimated2/valueSetter.js.map +1 -1
- package/lib/module/reanimated2/valueUnpacker.js.map +1 -1
- package/lib/module/specs/NativeReanimatedModule.js.map +1 -1
- package/lib/typescript/reanimated2/WorkletEventHandler.d.ts +16 -9
- package/lib/typescript/reanimated2/component/LayoutAnimationConfig.d.ts +1 -1
- package/lib/typescript/reanimated2/component/PerformanceMonitor.d.ts +2 -1
- package/lib/typescript/reanimated2/hook/commonTypes.d.ts +5 -0
- package/lib/typescript/reanimated2/hook/useEvent.d.ts +2 -3
- package/lib/typescript/reanimated2/platform-specific/jsVersion.d.ts +1 -1
- package/package.json +18 -14
- package/plugin/build/plugin.js +7 -2
- package/src/createAnimatedComponent/PropsFilter.tsx +1 -1
- package/src/createAnimatedComponent/createAnimatedComponent.tsx +29 -33
- package/src/reanimated2/WorkletEventHandler.ts +98 -39
- package/src/reanimated2/animation/styleAnimation.ts +8 -6
- package/src/reanimated2/hook/commonTypes.ts +9 -0
- package/src/reanimated2/hook/useEvent.ts +4 -4
- package/src/reanimated2/hook/useScrollViewOffset.ts +21 -5
- package/src/reanimated2/js-reanimated/JSReanimated.ts +6 -3
- package/src/reanimated2/layoutReanimation/web/animationsManager.ts +1 -1
- package/src/reanimated2/layoutReanimation/web/componentStyle.ts +3 -1
- package/src/reanimated2/layoutReanimation/web/componentUtils.ts +1 -1
- package/src/reanimated2/layoutReanimation/web/createAnimation.ts +2 -2
- package/src/reanimated2/platform-specific/jsVersion.ts +1 -1
- package/src/reanimated2/platformFunctions/getRelativeCoords.ts +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["useEffect","useRef","makeMutable","subscribeForKeyboardEvents","unsubscribeFromKeyboardEvents","KeyboardState","useAnimatedKeyboard","options","
|
|
1
|
+
{"version":3,"names":["useEffect","useRef","makeMutable","subscribeForKeyboardEvents","unsubscribeFromKeyboardEvents","KeyboardState","useAnimatedKeyboard","options","isStatusBarTranslucentAndroid","ref","listenerId","isSubscribed","current","keyboardEventData","state","UNKNOWN","height","value"],"sources":["useAnimatedKeyboard.ts"],"sourcesContent":["'use strict';\nimport { useEffect, useRef } from 'react';\nimport {\n makeMutable,\n subscribeForKeyboardEvents,\n unsubscribeFromKeyboardEvents,\n} from '../core';\nimport type {\n AnimatedKeyboardInfo,\n AnimatedKeyboardOptions,\n} from '../commonTypes';\nimport { KeyboardState } from '../commonTypes';\n\n/**\n * Lets you synchronously get the position and state of the keyboard.\n *\n * @param options - An additional keyboard configuration options.\n * @returns An object with the current keyboard `height` and `state` as [shared values](https://docs.swmansion.com/react-native-reanimated/docs/fundamentals/glossary#shared-value).\n * @see https://docs.swmansion.com/react-native-reanimated/docs/device/useAnimatedKeyboard\n */\nexport function useAnimatedKeyboard(\n options: AnimatedKeyboardOptions = { isStatusBarTranslucentAndroid: false }\n): AnimatedKeyboardInfo {\n const ref = useRef<AnimatedKeyboardInfo | null>(null);\n const listenerId = useRef<number>(-1);\n const isSubscribed = useRef<boolean>(false);\n\n if (ref.current === null) {\n const keyboardEventData: AnimatedKeyboardInfo = {\n state: makeMutable<KeyboardState>(KeyboardState.UNKNOWN),\n height: makeMutable(0),\n };\n listenerId.current = subscribeForKeyboardEvents((state, height) => {\n 'worklet';\n keyboardEventData.state.value = state;\n keyboardEventData.height.value = height;\n }, options);\n ref.current = keyboardEventData;\n isSubscribed.current = true;\n }\n useEffect(() => {\n if (isSubscribed.current === false && ref.current !== null) {\n const keyboardEventData = ref.current;\n // subscribe again after Fast Refresh\n listenerId.current = subscribeForKeyboardEvents((state, height) => {\n 'worklet';\n keyboardEventData.state.value = state;\n keyboardEventData.height.value = height;\n }, options);\n isSubscribed.current = true;\n }\n return () => {\n unsubscribeFromKeyboardEvents(listenerId.current);\n isSubscribed.current = false;\n };\n }, []);\n return ref.current;\n}\n"],"mappings":"AAAA,YAAY;;AACZ,SAASA,SAAS,EAAEC,MAAM,QAAQ,OAAO;AACzC,SACEC,WAAW,EACXC,0BAA0B,EAC1BC,6BAA6B,QACxB,SAAS;AAKhB,SAASC,aAAa,QAAQ,gBAAgB;;AAE9C;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,mBAAmBA,CACjCC,OAAgC,GAAG;EAAEC,6BAA6B,EAAE;AAAM,CAAC,EACrD;EACtB,MAAMC,GAAG,GAAGR,MAAM,CAA8B,IAAI,CAAC;EACrD,MAAMS,UAAU,GAAGT,MAAM,CAAS,CAAC,CAAC,CAAC;EACrC,MAAMU,YAAY,GAAGV,MAAM,CAAU,KAAK,CAAC;EAE3C,IAAIQ,GAAG,CAACG,OAAO,KAAK,IAAI,EAAE;IACxB,MAAMC,iBAAuC,GAAG;MAC9CC,KAAK,EAAEZ,WAAW,CAAgBG,aAAa,CAACU,OAAO,CAAC;MACxDC,MAAM,EAAEd,WAAW,CAAC,CAAC;IACvB,CAAC;IACDQ,UAAU,CAACE,OAAO,GAAGT,0BAA0B,CAAC,CAACW,KAAK,EAAEE,MAAM,KAAK;MACjE,SAAS;;MACTH,iBAAiB,CAACC,KAAK,CAACG,KAAK,GAAGH,KAAK;MACrCD,iBAAiB,CAACG,MAAM,CAACC,KAAK,GAAGD,MAAM;IACzC,CAAC,EAAET,OAAO,CAAC;IACXE,GAAG,CAACG,OAAO,GAAGC,iBAAiB;IAC/BF,YAAY,CAACC,OAAO,GAAG,IAAI;EAC7B;EACAZ,SAAS,CAAC,MAAM;IACd,IAAIW,YAAY,CAACC,OAAO,KAAK,KAAK,IAAIH,GAAG,CAACG,OAAO,KAAK,IAAI,EAAE;MAC1D,MAAMC,iBAAiB,GAAGJ,GAAG,CAACG,OAAO;MACrC;MACAF,UAAU,CAACE,OAAO,GAAGT,0BAA0B,CAAC,CAACW,KAAK,EAAEE,MAAM,KAAK;QACjE,SAAS;;QACTH,iBAAiB,CAACC,KAAK,CAACG,KAAK,GAAGH,KAAK;QACrCD,iBAAiB,CAACG,MAAM,CAACC,KAAK,GAAGD,MAAM;MACzC,CAAC,EAAET,OAAO,CAAC;MACXI,YAAY,CAACC,OAAO,GAAG,IAAI;IAC7B;IACA,OAAO,MAAM;MACXR,6BAA6B,CAACM,UAAU,CAACE,OAAO,CAAC;MACjDD,YAAY,CAACC,OAAO,GAAG,KAAK;IAC9B,CAAC;EACH,CAAC,EAAE,EAAE,CAAC;EACN,OAAOH,GAAG,CAACG,OAAO;AACpB","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["useAnimatedStyle","shouldBeUseWeb","useAnimatedPropsJS","updater","deps","adapters","useAnimatedPropsNative","useAnimatedProps"],"sources":["useAnimatedProps.ts"],"sourcesContent":["'use strict';\nimport { useAnimatedStyle } from './useAnimatedStyle';\nimport type { DependencyList, UseAnimatedStyleInternal } from './commonTypes';\nimport { shouldBeUseWeb } from '../PlatformChecker';\nimport type { AnimatedPropsAdapterFunction } from '../commonTypes';\n\n// TODO: we should make sure that when useAP is used we are not assigning styles\n\ntype UseAnimatedProps = <Props extends object>(\n updater: () => Partial<Props>,\n dependencies?: DependencyList | null,\n adapters?:\n | AnimatedPropsAdapterFunction\n | AnimatedPropsAdapterFunction[]\n | null,\n isAnimatedProps?: boolean\n) => Partial<Props>;\n\nfunction useAnimatedPropsJS<Props extends object>(\n updater: () => Props,\n deps?: DependencyList | null,\n adapters?:\n | AnimatedPropsAdapterFunction\n | AnimatedPropsAdapterFunction[]\n | null\n) {\n return (useAnimatedStyle as UseAnimatedStyleInternal<Props>)(\n updater,\n deps,\n adapters,\n true\n );\n}\n\nconst useAnimatedPropsNative = useAnimatedStyle;\n\n/**\n * Lets you create an animated props object which can be animated using shared values.\n *\n * @param updater - A function returning an object with properties you want to animate.\n * @param dependencies - An optional array of dependencies. Only relevant when using Reanimated without the Babel plugin on the Web.\n * @param adapters - An optional function or array of functions allowing to adopt prop naming between JS and the native side.\n * @returns An animated props object which has to be passed to `animatedProps` property of an Animated component that you want to animate.\n * @see https://docs.swmansion.com/react-native-reanimated/docs/core/useAnimatedProps\n */\nexport const useAnimatedProps: UseAnimatedProps = shouldBeUseWeb()\n ? (useAnimatedPropsJS as UseAnimatedProps)\n : useAnimatedPropsNative;\n"],"mappings":"AAAA,YAAY;;AACZ,SAASA,gBAAgB,QAAQ,oBAAoB;AAErD,SAASC,cAAc,QAAQ,oBAAoB;;AAGnD;;AAYA,SAASC,kBAAkBA,CACzBC,OAAoB,EACpBC,IAA4B,EAC5BC,QAGQ,EACR;EACA,OAAQL,gBAAgB,CACtBG,OAAO,EACPC,IAAI,EACJC,QAAQ,EACR,
|
|
1
|
+
{"version":3,"names":["useAnimatedStyle","shouldBeUseWeb","useAnimatedPropsJS","updater","deps","adapters","useAnimatedPropsNative","useAnimatedProps"],"sources":["useAnimatedProps.ts"],"sourcesContent":["'use strict';\nimport { useAnimatedStyle } from './useAnimatedStyle';\nimport type { DependencyList, UseAnimatedStyleInternal } from './commonTypes';\nimport { shouldBeUseWeb } from '../PlatformChecker';\nimport type { AnimatedPropsAdapterFunction } from '../commonTypes';\n\n// TODO: we should make sure that when useAP is used we are not assigning styles\n\ntype UseAnimatedProps = <Props extends object>(\n updater: () => Partial<Props>,\n dependencies?: DependencyList | null,\n adapters?:\n | AnimatedPropsAdapterFunction\n | AnimatedPropsAdapterFunction[]\n | null,\n isAnimatedProps?: boolean\n) => Partial<Props>;\n\nfunction useAnimatedPropsJS<Props extends object>(\n updater: () => Props,\n deps?: DependencyList | null,\n adapters?:\n | AnimatedPropsAdapterFunction\n | AnimatedPropsAdapterFunction[]\n | null\n) {\n return (useAnimatedStyle as UseAnimatedStyleInternal<Props>)(\n updater,\n deps,\n adapters,\n true\n );\n}\n\nconst useAnimatedPropsNative = useAnimatedStyle;\n\n/**\n * Lets you create an animated props object which can be animated using shared values.\n *\n * @param updater - A function returning an object with properties you want to animate.\n * @param dependencies - An optional array of dependencies. Only relevant when using Reanimated without the Babel plugin on the Web.\n * @param adapters - An optional function or array of functions allowing to adopt prop naming between JS and the native side.\n * @returns An animated props object which has to be passed to `animatedProps` property of an Animated component that you want to animate.\n * @see https://docs.swmansion.com/react-native-reanimated/docs/core/useAnimatedProps\n */\nexport const useAnimatedProps: UseAnimatedProps = shouldBeUseWeb()\n ? (useAnimatedPropsJS as UseAnimatedProps)\n : useAnimatedPropsNative;\n"],"mappings":"AAAA,YAAY;;AACZ,SAASA,gBAAgB,QAAQ,oBAAoB;AAErD,SAASC,cAAc,QAAQ,oBAAoB;;AAGnD;;AAYA,SAASC,kBAAkBA,CACzBC,OAAoB,EACpBC,IAA4B,EAC5BC,QAGQ,EACR;EACA,OAAQL,gBAAgB,CACtBG,OAAO,EACPC,IAAI,EACJC,QAAQ,EACR,IACF,CAAC;AACH;AAEA,MAAMC,sBAAsB,GAAGN,gBAAgB;;AAE/C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMO,gBAAkC,GAAGN,cAAc,CAAC,CAAC,GAC7DC,kBAAkB,GACnBI,sBAAsB","ignoreList":[]}
|
|
@@ -14,6 +14,7 @@ import { shouldBeUseWeb } from '../PlatformChecker';
|
|
|
14
14
|
* @see https://docs.swmansion.com/react-native-reanimated/docs/advanced/useAnimatedReaction
|
|
15
15
|
*/
|
|
16
16
|
// @ts-expect-error This overload is required by our API.
|
|
17
|
+
|
|
17
18
|
export function useAnimatedReaction(prepare, react, dependencies) {
|
|
18
19
|
const previous = useSharedValue(null);
|
|
19
20
|
let inputs = Object.values(prepare.__closure ?? {});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["useEffect","startMapper","stopMapper","useSharedValue","shouldBeUseWeb","useAnimatedReaction","prepare","react","dependencies","previous","inputs","Object","values","__closure","_dependencies","length","undefined","__workletHash","push","fun","input","value","mapperId"],"sources":["useAnimatedReaction.ts"],"sourcesContent":["'use strict';\nimport { useEffect } from 'react';\nimport type { WorkletFunction } from '../commonTypes';\nimport { startMapper, stopMapper } from '../core';\nimport type { DependencyList } from './commonTypes';\nimport { useSharedValue } from './useSharedValue';\nimport { shouldBeUseWeb } from '../PlatformChecker';\n\n/**\n * Lets you to respond to changes in a [shared value](https://docs.swmansion.com/react-native-reanimated/docs/fundamentals/glossary#shared-value). It's especially useful when comparing values previously stored in the shared value with the current one.\n *\n * @param prepare - A function that should return a value to which you'd like to react.\n * @param react - A function that reacts to changes in the value returned by the `prepare` function.\n * @param dependencies - an optional array of dependencies. Only relevant when using Reanimated without the Babel plugin on the Web.\n * @see https://docs.swmansion.com/react-native-reanimated/docs/advanced/useAnimatedReaction\n */\n// @ts-expect-error This overload is required by our API.\nexport function useAnimatedReaction<PreparedResult>(\n prepare: () => PreparedResult,\n react: (prepared: PreparedResult, previous: PreparedResult | null) => void,\n dependencies?: DependencyList\n): void;\n\nexport function useAnimatedReaction<PreparedResult>(\n prepare: WorkletFunction<[], PreparedResult>,\n react: WorkletFunction<\n [prepare: PreparedResult, previous: PreparedResult | null],\n void\n >,\n dependencies?: DependencyList\n) {\n const previous = useSharedValue<PreparedResult | null>(null);\n\n let inputs = Object.values(prepare.__closure ?? {});\n\n if (shouldBeUseWeb()) {\n if (!inputs.length && dependencies?.length) {\n // let web work without a Reanimated Babel plugin\n inputs = dependencies;\n }\n }\n\n if (dependencies === undefined) {\n dependencies = [\n ...Object.values(prepare.__closure ?? {}),\n ...Object.values(react.__closure ?? {}),\n prepare.__workletHash,\n react.__workletHash,\n ];\n } else {\n dependencies.push(prepare.__workletHash, react.__workletHash);\n }\n\n useEffect(() => {\n const fun = () => {\n 'worklet';\n const input = prepare();\n react(input, previous.value);\n previous.value = input;\n };\n const mapperId = startMapper(fun, inputs);\n return () => {\n stopMapper(mapperId);\n };\n }, dependencies);\n}\n"],"mappings":"AAAA,YAAY;;AACZ,SAASA,SAAS,QAAQ,OAAO;AAEjC,SAASC,WAAW,EAAEC,UAAU,QAAQ,SAAS;AAEjD,SAASC,cAAc,QAAQ,kBAAkB;AACjD,SAASC,cAAc,QAAQ,oBAAoB;;AAEnD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA
|
|
1
|
+
{"version":3,"names":["useEffect","startMapper","stopMapper","useSharedValue","shouldBeUseWeb","useAnimatedReaction","prepare","react","dependencies","previous","inputs","Object","values","__closure","_dependencies","length","undefined","__workletHash","push","fun","input","value","mapperId"],"sources":["useAnimatedReaction.ts"],"sourcesContent":["'use strict';\nimport { useEffect } from 'react';\nimport type { WorkletFunction } from '../commonTypes';\nimport { startMapper, stopMapper } from '../core';\nimport type { DependencyList } from './commonTypes';\nimport { useSharedValue } from './useSharedValue';\nimport { shouldBeUseWeb } from '../PlatformChecker';\n\n/**\n * Lets you to respond to changes in a [shared value](https://docs.swmansion.com/react-native-reanimated/docs/fundamentals/glossary#shared-value). It's especially useful when comparing values previously stored in the shared value with the current one.\n *\n * @param prepare - A function that should return a value to which you'd like to react.\n * @param react - A function that reacts to changes in the value returned by the `prepare` function.\n * @param dependencies - an optional array of dependencies. Only relevant when using Reanimated without the Babel plugin on the Web.\n * @see https://docs.swmansion.com/react-native-reanimated/docs/advanced/useAnimatedReaction\n */\n// @ts-expect-error This overload is required by our API.\nexport function useAnimatedReaction<PreparedResult>(\n prepare: () => PreparedResult,\n react: (prepared: PreparedResult, previous: PreparedResult | null) => void,\n dependencies?: DependencyList\n): void;\n\nexport function useAnimatedReaction<PreparedResult>(\n prepare: WorkletFunction<[], PreparedResult>,\n react: WorkletFunction<\n [prepare: PreparedResult, previous: PreparedResult | null],\n void\n >,\n dependencies?: DependencyList\n) {\n const previous = useSharedValue<PreparedResult | null>(null);\n\n let inputs = Object.values(prepare.__closure ?? {});\n\n if (shouldBeUseWeb()) {\n if (!inputs.length && dependencies?.length) {\n // let web work without a Reanimated Babel plugin\n inputs = dependencies;\n }\n }\n\n if (dependencies === undefined) {\n dependencies = [\n ...Object.values(prepare.__closure ?? {}),\n ...Object.values(react.__closure ?? {}),\n prepare.__workletHash,\n react.__workletHash,\n ];\n } else {\n dependencies.push(prepare.__workletHash, react.__workletHash);\n }\n\n useEffect(() => {\n const fun = () => {\n 'worklet';\n const input = prepare();\n react(input, previous.value);\n previous.value = input;\n };\n const mapperId = startMapper(fun, inputs);\n return () => {\n stopMapper(mapperId);\n };\n }, dependencies);\n}\n"],"mappings":"AAAA,YAAY;;AACZ,SAASA,SAAS,QAAQ,OAAO;AAEjC,SAASC,WAAW,EAAEC,UAAU,QAAQ,SAAS;AAEjD,SAASC,cAAc,QAAQ,kBAAkB;AACjD,SAASC,cAAc,QAAQ,oBAAoB;;AAEnD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAOA,OAAO,SAASC,mBAAmBA,CACjCC,OAA4C,EAC5CC,KAGC,EACDC,YAA6B,EAC7B;EACA,MAAMC,QAAQ,GAAGN,cAAc,CAAwB,IAAI,CAAC;EAE5D,IAAIO,MAAM,GAAGC,MAAM,CAACC,MAAM,CAACN,OAAO,CAACO,SAAS,IAAI,CAAC,CAAC,CAAC;EAEnD,IAAIT,cAAc,CAAC,CAAC,EAAE;IAAA,IAAAU,aAAA;IACpB,IAAI,CAACJ,MAAM,CAACK,MAAM,KAAAD,aAAA,GAAIN,YAAY,cAAAM,aAAA,eAAZA,aAAA,CAAcC,MAAM,EAAE;MAC1C;MACAL,MAAM,GAAGF,YAAY;IACvB;EACF;EAEA,IAAIA,YAAY,KAAKQ,SAAS,EAAE;IAC9BR,YAAY,GAAG,CACb,GAAGG,MAAM,CAACC,MAAM,CAACN,OAAO,CAACO,SAAS,IAAI,CAAC,CAAC,CAAC,EACzC,GAAGF,MAAM,CAACC,MAAM,CAACL,KAAK,CAACM,SAAS,IAAI,CAAC,CAAC,CAAC,EACvCP,OAAO,CAACW,aAAa,EACrBV,KAAK,CAACU,aAAa,CACpB;EACH,CAAC,MAAM;IACLT,YAAY,CAACU,IAAI,CAACZ,OAAO,CAACW,aAAa,EAAEV,KAAK,CAACU,aAAa,CAAC;EAC/D;EAEAjB,SAAS,CAAC,MAAM;IACd,MAAMmB,GAAG,GAAGA,CAAA,KAAM;MAChB,SAAS;;MACT,MAAMC,KAAK,GAAGd,OAAO,CAAC,CAAC;MACvBC,KAAK,CAACa,KAAK,EAAEX,QAAQ,CAACY,KAAK,CAAC;MAC5BZ,QAAQ,CAACY,KAAK,GAAGD,KAAK;IACxB,CAAC;IACD,MAAME,QAAQ,GAAGrB,WAAW,CAACkB,GAAG,EAAET,MAAM,CAAC;IACzC,OAAO,MAAM;MACXR,UAAU,CAACoB,QAAQ,CAAC;IACtB,CAAC;EACH,CAAC,EAAEd,YAAY,CAAC;AAClB","ignoreList":[]}
|
|
@@ -43,7 +43,7 @@ export function useAnimatedRef() {
|
|
|
43
43
|
// viewName is required only on iOS with Paper
|
|
44
44
|
if (Platform.OS === 'ios' && !isFabric()) {
|
|
45
45
|
var _viewConfig;
|
|
46
|
-
viewName.value = (component === null || component === void 0
|
|
46
|
+
viewName.value = (component === null || component === void 0 || (_viewConfig = component.viewConfig) === null || _viewConfig === void 0 ? void 0 : _viewConfig.uiViewClassName) || 'RCTView';
|
|
47
47
|
}
|
|
48
48
|
}
|
|
49
49
|
return tag.value;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["useRef","useSharedValue","getShadowNodeWrapperFromRef","makeShareableCloneRecursive","shareableMappingCache","Platform","findNodeHandle","isFabric","isWeb","IS_WEB","getComponentOrScrollable","component","getNativeScrollRef","getScrollableNode","useAnimatedRef","tag","viewName","ref","current","fun","getTagValueFunction","getTagOrShadowNodeWrapper","value","getTag","OS","_viewConfig","viewConfig","uiViewClassName","animatedRefShareableHandle","__init","f","set"],"sources":["useAnimatedRef.ts"],"sourcesContent":["'use strict';\nimport type { Component } from 'react';\nimport { useRef } from 'react';\nimport { useSharedValue } from './useSharedValue';\nimport type { AnimatedRef, AnimatedRefOnUI } from './commonTypes';\nimport type { ShadowNodeWrapper } from '../commonTypes';\nimport { getShadowNodeWrapperFromRef } from '../fabricUtils';\nimport { makeShareableCloneRecursive } from '../shareables';\nimport { shareableMappingCache } from '../shareableMappingCache';\nimport { Platform, findNodeHandle } from 'react-native';\nimport type { ScrollView, FlatList } from 'react-native';\nimport { isFabric, isWeb } from '../PlatformChecker';\n\nconst IS_WEB = isWeb();\n\ninterface MaybeScrollableComponent extends Component {\n getNativeScrollRef?: FlatList['getNativeScrollRef'];\n getScrollableNode?:\n | ScrollView['getScrollableNode']\n | FlatList['getScrollableNode'];\n viewConfig?: {\n uiViewClassName?: string;\n };\n}\n\nfunction getComponentOrScrollable(component: MaybeScrollableComponent) {\n if (isFabric() && component.getNativeScrollRef) {\n return component.getNativeScrollRef();\n } else if (!isFabric() && component.getScrollableNode) {\n return component.getScrollableNode();\n }\n return component;\n}\n\n/**\n * Lets you get a reference of a view that you can use inside a worklet.\n *\n * @returns An object with a `.current` property which contains an instance of a component.\n * @see https://docs.swmansion.com/react-native-reanimated/docs/core/useAnimatedRef\n */\nexport function useAnimatedRef<\n TComponent extends Component\n>(): AnimatedRef<TComponent> {\n const tag = useSharedValue<number | ShadowNodeWrapper | null>(-1);\n const viewName = useSharedValue<string | null>(null);\n\n const ref = useRef<AnimatedRef<TComponent>>();\n\n if (!ref.current) {\n const fun: AnimatedRef<TComponent> = <AnimatedRef<TComponent>>((\n component\n ) => {\n // enters when ref is set by attaching to a component\n if (component) {\n const getTagValueFunction = isFabric()\n ? getShadowNodeWrapperFromRef\n : findNodeHandle;\n\n const getTagOrShadowNodeWrapper = () => {\n return IS_WEB\n ? getComponentOrScrollable(component)\n : getTagValueFunction(getComponentOrScrollable(component));\n };\n\n tag.value = getTagOrShadowNodeWrapper();\n\n // On Fabric we have to unwrap the tag from the shadow node wrapper\n fun.getTag = isFabric()\n ? () => findNodeHandle(getComponentOrScrollable(component))\n : getTagOrShadowNodeWrapper;\n\n fun.current = component;\n // viewName is required only on iOS with Paper\n if (Platform.OS === 'ios' && !isFabric()) {\n viewName.value =\n (component as MaybeScrollableComponent)?.viewConfig\n ?.uiViewClassName || 'RCTView';\n }\n }\n return tag.value;\n });\n\n fun.current = null;\n\n const animatedRefShareableHandle = makeShareableCloneRecursive({\n __init: () => {\n 'worklet';\n const f: AnimatedRefOnUI = () => tag.value;\n f.viewName = viewName;\n return f;\n },\n });\n shareableMappingCache.set(fun, animatedRefShareableHandle);\n ref.current = fun;\n }\n\n return ref.current;\n}\n"],"mappings":"AAAA,YAAY;;AAEZ,SAASA,MAAM,QAAQ,OAAO;AAC9B,SAASC,cAAc,QAAQ,kBAAkB;AAGjD,SAASC,2BAA2B,QAAQ,gBAAgB;AAC5D,SAASC,2BAA2B,QAAQ,eAAe;AAC3D,SAASC,qBAAqB,QAAQ,0BAA0B;AAChE,SAASC,QAAQ,EAAEC,cAAc,QAAQ,cAAc;AAEvD,SAASC,QAAQ,EAAEC,KAAK,QAAQ,oBAAoB;AAEpD,MAAMC,MAAM,GAAGD,KAAK,
|
|
1
|
+
{"version":3,"names":["useRef","useSharedValue","getShadowNodeWrapperFromRef","makeShareableCloneRecursive","shareableMappingCache","Platform","findNodeHandle","isFabric","isWeb","IS_WEB","getComponentOrScrollable","component","getNativeScrollRef","getScrollableNode","useAnimatedRef","tag","viewName","ref","current","fun","getTagValueFunction","getTagOrShadowNodeWrapper","value","getTag","OS","_viewConfig","viewConfig","uiViewClassName","animatedRefShareableHandle","__init","f","set"],"sources":["useAnimatedRef.ts"],"sourcesContent":["'use strict';\nimport type { Component } from 'react';\nimport { useRef } from 'react';\nimport { useSharedValue } from './useSharedValue';\nimport type { AnimatedRef, AnimatedRefOnUI } from './commonTypes';\nimport type { ShadowNodeWrapper } from '../commonTypes';\nimport { getShadowNodeWrapperFromRef } from '../fabricUtils';\nimport { makeShareableCloneRecursive } from '../shareables';\nimport { shareableMappingCache } from '../shareableMappingCache';\nimport { Platform, findNodeHandle } from 'react-native';\nimport type { ScrollView, FlatList } from 'react-native';\nimport { isFabric, isWeb } from '../PlatformChecker';\n\nconst IS_WEB = isWeb();\n\ninterface MaybeScrollableComponent extends Component {\n getNativeScrollRef?: FlatList['getNativeScrollRef'];\n getScrollableNode?:\n | ScrollView['getScrollableNode']\n | FlatList['getScrollableNode'];\n viewConfig?: {\n uiViewClassName?: string;\n };\n}\n\nfunction getComponentOrScrollable(component: MaybeScrollableComponent) {\n if (isFabric() && component.getNativeScrollRef) {\n return component.getNativeScrollRef();\n } else if (!isFabric() && component.getScrollableNode) {\n return component.getScrollableNode();\n }\n return component;\n}\n\n/**\n * Lets you get a reference of a view that you can use inside a worklet.\n *\n * @returns An object with a `.current` property which contains an instance of a component.\n * @see https://docs.swmansion.com/react-native-reanimated/docs/core/useAnimatedRef\n */\nexport function useAnimatedRef<\n TComponent extends Component\n>(): AnimatedRef<TComponent> {\n const tag = useSharedValue<number | ShadowNodeWrapper | null>(-1);\n const viewName = useSharedValue<string | null>(null);\n\n const ref = useRef<AnimatedRef<TComponent>>();\n\n if (!ref.current) {\n const fun: AnimatedRef<TComponent> = <AnimatedRef<TComponent>>((\n component\n ) => {\n // enters when ref is set by attaching to a component\n if (component) {\n const getTagValueFunction = isFabric()\n ? getShadowNodeWrapperFromRef\n : findNodeHandle;\n\n const getTagOrShadowNodeWrapper = () => {\n return IS_WEB\n ? getComponentOrScrollable(component)\n : getTagValueFunction(getComponentOrScrollable(component));\n };\n\n tag.value = getTagOrShadowNodeWrapper();\n\n // On Fabric we have to unwrap the tag from the shadow node wrapper\n fun.getTag = isFabric()\n ? () => findNodeHandle(getComponentOrScrollable(component))\n : getTagOrShadowNodeWrapper;\n\n fun.current = component;\n // viewName is required only on iOS with Paper\n if (Platform.OS === 'ios' && !isFabric()) {\n viewName.value =\n (component as MaybeScrollableComponent)?.viewConfig\n ?.uiViewClassName || 'RCTView';\n }\n }\n return tag.value;\n });\n\n fun.current = null;\n\n const animatedRefShareableHandle = makeShareableCloneRecursive({\n __init: () => {\n 'worklet';\n const f: AnimatedRefOnUI = () => tag.value;\n f.viewName = viewName;\n return f;\n },\n });\n shareableMappingCache.set(fun, animatedRefShareableHandle);\n ref.current = fun;\n }\n\n return ref.current;\n}\n"],"mappings":"AAAA,YAAY;;AAEZ,SAASA,MAAM,QAAQ,OAAO;AAC9B,SAASC,cAAc,QAAQ,kBAAkB;AAGjD,SAASC,2BAA2B,QAAQ,gBAAgB;AAC5D,SAASC,2BAA2B,QAAQ,eAAe;AAC3D,SAASC,qBAAqB,QAAQ,0BAA0B;AAChE,SAASC,QAAQ,EAAEC,cAAc,QAAQ,cAAc;AAEvD,SAASC,QAAQ,EAAEC,KAAK,QAAQ,oBAAoB;AAEpD,MAAMC,MAAM,GAAGD,KAAK,CAAC,CAAC;AAYtB,SAASE,wBAAwBA,CAACC,SAAmC,EAAE;EACrE,IAAIJ,QAAQ,CAAC,CAAC,IAAII,SAAS,CAACC,kBAAkB,EAAE;IAC9C,OAAOD,SAAS,CAACC,kBAAkB,CAAC,CAAC;EACvC,CAAC,MAAM,IAAI,CAACL,QAAQ,CAAC,CAAC,IAAII,SAAS,CAACE,iBAAiB,EAAE;IACrD,OAAOF,SAAS,CAACE,iBAAiB,CAAC,CAAC;EACtC;EACA,OAAOF,SAAS;AAClB;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASG,cAAcA,CAAA,EAED;EAC3B,MAAMC,GAAG,GAAGd,cAAc,CAAoC,CAAC,CAAC,CAAC;EACjE,MAAMe,QAAQ,GAAGf,cAAc,CAAgB,IAAI,CAAC;EAEpD,MAAMgB,GAAG,GAAGjB,MAAM,CAA0B,CAAC;EAE7C,IAAI,CAACiB,GAAG,CAACC,OAAO,EAAE;IAChB,MAA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AAG,CAACC,OAAO;AACpB","ignoreList":[]}
|
|
@@ -12,7 +12,9 @@ import { useEvent } from './useEvent';
|
|
|
12
12
|
* @param dependencies - An optional array of dependencies. Only relevant when using Reanimated without the Babel plugin on the Web.
|
|
13
13
|
* @returns An object you need to pass to `onScroll` prop on the `Animated.ScrollView` component.
|
|
14
14
|
* @see https://docs.swmansion.com/react-native-reanimated/docs/scroll/useAnimatedScrollHandler
|
|
15
|
-
*/
|
|
15
|
+
*/
|
|
16
|
+
// @ts-expect-error This overload is required by our API.
|
|
17
|
+
|
|
16
18
|
export function useAnimatedScrollHandler(handlers, dependencies) {
|
|
17
19
|
// case when handlers is a function
|
|
18
20
|
const scrollHandlers = typeof handlers === 'function' ? {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["useHandler","useEvent","useAnimatedScrollHandler","handlers","dependencies","scrollHandlers","onScroll","context","doDependenciesDiffer","subscribeForEvents","onBeginDrag","undefined","push","onEndDrag","onMomentumBegin","onMomentumEnd","event","eventName","endsWith"],"sources":["useAnimatedScrollHandler.ts"],"sourcesContent":["'use strict';\nimport type {\n DependencyList,\n RNNativeScrollEvent,\n ReanimatedScrollEvent,\n} from './commonTypes';\nimport { useHandler } from './useHandler';\nimport type { EventHandlerInternal, EventHandlerProcessed } from './useEvent';\nimport { useEvent } from './useEvent';\n\nexport type ScrollHandler<\n Context extends Record<string, unknown> = Record<string, unknown>\n> = (event: ReanimatedScrollEvent, context: Context) => void;\nexport interface ScrollHandlers<Context extends Record<string, unknown>> {\n onScroll?: ScrollHandler<Context>;\n onBeginDrag?: ScrollHandler<Context>;\n onEndDrag?: ScrollHandler<Context>;\n onMomentumBegin?: ScrollHandler<Context>;\n onMomentumEnd?: ScrollHandler<Context>;\n}\n\nexport type ScrollHandlerProcessed<\n Context extends Record<string, unknown> = Record<string, unknown>\n> = EventHandlerProcessed<RNNativeScrollEvent, Context>;\n\nexport type ScrollHandlerInternal = EventHandlerInternal<RNNativeScrollEvent>;\n\n/**\n * Lets you run callbacks on ScrollView events. Supports `onScroll`, `onBeginDrag`, `onEndDrag`, `onMomentumBegin`, and `onMomentumEnd` events.\n *\n * These callbacks are automatically workletized and ran on the UI thread.\n *\n * @param handlers - An object containing event handlers.\n * @param dependencies - An optional array of dependencies. Only relevant when using Reanimated without the Babel plugin on the Web.\n * @returns An object you need to pass to `onScroll` prop on the `Animated.ScrollView` component.\n * @see https://docs.swmansion.com/react-native-reanimated/docs/scroll/useAnimatedScrollHandler\n */\n// @ts-expect-error This overload is required by our API.\nexport function useAnimatedScrollHandler<\n Context extends Record<string, unknown>\n>(\n handlers: ScrollHandler<Context> | ScrollHandlers<Context>,\n dependencies?: DependencyList\n): ScrollHandlerProcessed<Context>;\n\nexport function useAnimatedScrollHandler<\n Context extends Record<string, unknown>\n>(\n handlers: ScrollHandlers<Context> | ScrollHandler<Context>,\n dependencies?: DependencyList\n) {\n // case when handlers is a function\n const scrollHandlers: ScrollHandlers<Context> =\n typeof handlers === 'function' ? { onScroll: handlers } : handlers;\n const { context, doDependenciesDiffer } = useHandler<\n RNNativeScrollEvent,\n Context\n >(scrollHandlers as Record<string, ScrollHandler<Context>>, dependencies);\n\n // build event subscription array\n const subscribeForEvents = ['onScroll'];\n if (scrollHandlers.onBeginDrag !== undefined) {\n subscribeForEvents.push('onScrollBeginDrag');\n }\n if (scrollHandlers.onEndDrag !== undefined) {\n subscribeForEvents.push('onScrollEndDrag');\n }\n if (scrollHandlers.onMomentumBegin !== undefined) {\n subscribeForEvents.push('onMomentumScrollBegin');\n }\n if (scrollHandlers.onMomentumEnd !== undefined) {\n subscribeForEvents.push('onMomentumScrollEnd');\n }\n\n return useEvent<RNNativeScrollEvent, Context>(\n (event: ReanimatedScrollEvent) => {\n 'worklet';\n const {\n onScroll,\n onBeginDrag,\n onEndDrag,\n onMomentumBegin,\n onMomentumEnd,\n } = scrollHandlers;\n if (onScroll && event.eventName.endsWith('onScroll')) {\n onScroll(event, context);\n } else if (onBeginDrag && event.eventName.endsWith('onScrollBeginDrag')) {\n onBeginDrag(event, context);\n } else if (onEndDrag && event.eventName.endsWith('onScrollEndDrag')) {\n onEndDrag(event, context);\n } else if (\n onMomentumBegin &&\n event.eventName.endsWith('onMomentumScrollBegin')\n ) {\n onMomentumBegin(event, context);\n } else if (\n onMomentumEnd &&\n event.eventName.endsWith('onMomentumScrollEnd')\n ) {\n onMomentumEnd(event, context);\n }\n },\n subscribeForEvents,\n doDependenciesDiffer\n // Read https://github.com/software-mansion/react-native-reanimated/pull/5056\n // for more information about this cast.\n ) as unknown as ScrollHandlerInternal;\n}\n"],"mappings":"AAAA,YAAY;;AAMZ,SAASA,UAAU,QAAQ,cAAc;AAEzC,SAASC,QAAQ,QAAQ,YAAY;;AAmBrC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA
|
|
1
|
+
{"version":3,"names":["useHandler","useEvent","useAnimatedScrollHandler","handlers","dependencies","scrollHandlers","onScroll","context","doDependenciesDiffer","subscribeForEvents","onBeginDrag","undefined","push","onEndDrag","onMomentumBegin","onMomentumEnd","event","eventName","endsWith"],"sources":["useAnimatedScrollHandler.ts"],"sourcesContent":["'use strict';\nimport type {\n DependencyList,\n RNNativeScrollEvent,\n ReanimatedScrollEvent,\n} from './commonTypes';\nimport { useHandler } from './useHandler';\nimport type { EventHandlerInternal, EventHandlerProcessed } from './useEvent';\nimport { useEvent } from './useEvent';\n\nexport type ScrollHandler<\n Context extends Record<string, unknown> = Record<string, unknown>\n> = (event: ReanimatedScrollEvent, context: Context) => void;\nexport interface ScrollHandlers<Context extends Record<string, unknown>> {\n onScroll?: ScrollHandler<Context>;\n onBeginDrag?: ScrollHandler<Context>;\n onEndDrag?: ScrollHandler<Context>;\n onMomentumBegin?: ScrollHandler<Context>;\n onMomentumEnd?: ScrollHandler<Context>;\n}\n\nexport type ScrollHandlerProcessed<\n Context extends Record<string, unknown> = Record<string, unknown>\n> = EventHandlerProcessed<RNNativeScrollEvent, Context>;\n\nexport type ScrollHandlerInternal = EventHandlerInternal<RNNativeScrollEvent>;\n\n/**\n * Lets you run callbacks on ScrollView events. Supports `onScroll`, `onBeginDrag`, `onEndDrag`, `onMomentumBegin`, and `onMomentumEnd` events.\n *\n * These callbacks are automatically workletized and ran on the UI thread.\n *\n * @param handlers - An object containing event handlers.\n * @param dependencies - An optional array of dependencies. Only relevant when using Reanimated without the Babel plugin on the Web.\n * @returns An object you need to pass to `onScroll` prop on the `Animated.ScrollView` component.\n * @see https://docs.swmansion.com/react-native-reanimated/docs/scroll/useAnimatedScrollHandler\n */\n// @ts-expect-error This overload is required by our API.\nexport function useAnimatedScrollHandler<\n Context extends Record<string, unknown>\n>(\n handlers: ScrollHandler<Context> | ScrollHandlers<Context>,\n dependencies?: DependencyList\n): ScrollHandlerProcessed<Context>;\n\nexport function useAnimatedScrollHandler<\n Context extends Record<string, unknown>\n>(\n handlers: ScrollHandlers<Context> | ScrollHandler<Context>,\n dependencies?: DependencyList\n) {\n // case when handlers is a function\n const scrollHandlers: ScrollHandlers<Context> =\n typeof handlers === 'function' ? { onScroll: handlers } : handlers;\n const { context, doDependenciesDiffer } = useHandler<\n RNNativeScrollEvent,\n Context\n >(scrollHandlers as Record<string, ScrollHandler<Context>>, dependencies);\n\n // build event subscription array\n const subscribeForEvents = ['onScroll'];\n if (scrollHandlers.onBeginDrag !== undefined) {\n subscribeForEvents.push('onScrollBeginDrag');\n }\n if (scrollHandlers.onEndDrag !== undefined) {\n subscribeForEvents.push('onScrollEndDrag');\n }\n if (scrollHandlers.onMomentumBegin !== undefined) {\n subscribeForEvents.push('onMomentumScrollBegin');\n }\n if (scrollHandlers.onMomentumEnd !== undefined) {\n subscribeForEvents.push('onMomentumScrollEnd');\n }\n\n return useEvent<RNNativeScrollEvent, Context>(\n (event: ReanimatedScrollEvent) => {\n 'worklet';\n const {\n onScroll,\n onBeginDrag,\n onEndDrag,\n onMomentumBegin,\n onMomentumEnd,\n } = scrollHandlers;\n if (onScroll && event.eventName.endsWith('onScroll')) {\n onScroll(event, context);\n } else if (onBeginDrag && event.eventName.endsWith('onScrollBeginDrag')) {\n onBeginDrag(event, context);\n } else if (onEndDrag && event.eventName.endsWith('onScrollEndDrag')) {\n onEndDrag(event, context);\n } else if (\n onMomentumBegin &&\n event.eventName.endsWith('onMomentumScrollBegin')\n ) {\n onMomentumBegin(event, context);\n } else if (\n onMomentumEnd &&\n event.eventName.endsWith('onMomentumScrollEnd')\n ) {\n onMomentumEnd(event, context);\n }\n },\n subscribeForEvents,\n doDependenciesDiffer\n // Read https://github.com/software-mansion/react-native-reanimated/pull/5056\n // for more information about this cast.\n ) as unknown as ScrollHandlerInternal;\n}\n"],"mappings":"AAAA,YAAY;;AAMZ,SAASA,UAAU,QAAQ,cAAc;AAEzC,SAASC,QAAQ,QAAQ,YAAY;;AAmBrC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAQA,OAAO,SAASC,wBAAwBA,CAGtCC,QAA0D,EAC1DC,YAA6B,EAC7B;EACA;EACA,MAAMC,cAAuC,GAC3C,OAAOF,QAAQ,KAAK,UAAU,GAAG;IAAEG,QAAQ,EAAEH;EAAS,CAAC,GAAGA,QAAQ;EACpE,MAAM;IAAEI,OAAO;IAAEC;EAAqB,CAAC,GAAGR,UAAU,CAGlDK,cAAc,EAA4CD,YAAY,CAAC;;EAEzE;EACA,MAAMK,kBAAkB,GAAG,CAAC,UAAU,CAAC;EACvC,IAAIJ,cAAc,CAACK,WAAW,KAAKC,SAAS,EAAE;IAC5CF,kBAAkB,CAACG,IAAI,CAAC,mBAAmB,CAAC;EAC9C;EACA,IAAIP,cAAc,CAACQ,SAAS,KAAKF,SAAS,EAAE;IAC1CF,kBAAkB,CAACG,IAAI,CAAC,iBAAiB,CAAC;EAC5C;EACA,IAAIP,cAAc,CAACS,eAAe,KAAKH,SAAS,EAAE;IAChDF,kBAAkB,CAACG,IAAI,CAAC,uBAAuB,CAAC;EAClD;EACA,IAAIP,cAAc,CAACU,aAAa,KAAKJ,SAAS,EAAE;IAC9CF,kBAAkB,CAACG,IAAI,CAAC,qBAAqB,CAAC;EAChD;EAEA,OAAOX,QAAQ,CACZe,KAA4B,IAAK;IAChC,SAAS;;IACT,MAAM;MACJV,QAAQ;MACRI,WAAW;MACXG,SAAS;MACTC,eAAe;MACfC;IACF,CAAC,GAAGV,cAAc;IAClB,IAAIC,QAAQ,IAAIU,KAAK,CAACC,SAAS,CAACC,QAAQ,CAAC,UAAU,CAAC,EAAE;MACpDZ,QAAQ,CAACU,KAAK,EAAET,OAAO,CAAC;IAC1B,CAAC,MAAM,IAAIG,WAAW,IAAIM,KAAK,CAACC,SAAS,CAACC,QAAQ,CAAC,mBAAmB,CAAC,EAAE;MACvER,WAAW,CAACM,KAAK,EAAET,OAAO,CAAC;IAC7B,CAAC,MAAM,IAAIM,SAAS,IAAIG,KAAK,CAACC,SAAS,CAACC,QAAQ,CAAC,iBAAiB,CAAC,EAAE;MACnEL,SAAS,CAACG,KAAK,EAAET,OAAO,CAAC;IAC3B,CAAC,MAAM,IACLO,eAAe,IACfE,KAAK,CAACC,SAAS,CAACC,QAAQ,CAAC,uBAAuB,CAAC,EACjD;MACAJ,eAAe,CAACE,KAAK,EAAET,OAAO,CAAC;IACjC,CAAC,MAAM,IACLQ,aAAa,IACbC,KAAK,CAACC,SAAS,CAACC,QAAQ,CAAC,qBAAqB,CAAC,EAC/C;MACAH,aAAa,CAACC,KAAK,EAAET,OAAO,CAAC;IAC/B;EACF,CAAC,EACDE,kBAAkB,EAClBD;EACA;EACA;EACF,CAAC;AACH","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["useEffect","useMemo","useRef","initializeSensor","registerSensor","unregisterSensor","SensorType","IOSReferenceFrame","InterfaceOrientation","callMicrotasks","eulerToQuaternion","pitch","roll","yaw","c1","Math","cos","s1","sin","c2","s2","c3","s3","adjustRotationToInterfaceOrientation","data","interfaceOrientation","ROTATION_90","PI","ROTATION_270","ROTATION_180","q","qx","qy","qz","qw","adjustVectorToInterfaceOrientation","x","y","useAnimatedSensor","sensorType","userConfig","_userConfigRef$curren","_userConfigRef$curren2","_userConfigRef$curren3","userConfigRef","hasConfigChanged","current","adjustToInterfaceOrientation","interval","iosReferenceFrame","config","Auto","ref","sensor","unregister","isAvailable","sensorData","id","ROTATION","value"],"sources":["useAnimatedSensor.ts"],"sourcesContent":["'use strict';\nimport { useEffect, useMemo, useRef } from 'react';\nimport { initializeSensor, registerSensor, unregisterSensor } from '../core';\nimport type {\n SensorConfig,\n AnimatedSensor,\n Value3D,\n ValueRotation,\n} from '../commonTypes';\nimport {\n SensorType,\n IOSReferenceFrame,\n InterfaceOrientation,\n} from '../commonTypes';\nimport { callMicrotasks } from '../threads';\n\n// euler angles are in order ZXY, z = yaw, x = pitch, y = roll\n// https://github.com/mrdoob/three.js/blob/dev/src/math/Quaternion.js#L237\nfunction eulerToQuaternion(pitch: number, roll: number, yaw: number) {\n 'worklet';\n const c1 = Math.cos(pitch / 2);\n const s1 = Math.sin(pitch / 2);\n const c2 = Math.cos(roll / 2);\n const s2 = Math.sin(roll / 2);\n const c3 = Math.cos(yaw / 2);\n const s3 = Math.sin(yaw / 2);\n\n return [\n s1 * c2 * c3 - c1 * s2 * s3,\n c1 * s2 * c3 + s1 * c2 * s3,\n c1 * c2 * s3 + s1 * s2 * c3,\n c1 * c2 * c3 - s1 * s2 * s3,\n ];\n}\n\nfunction adjustRotationToInterfaceOrientation(data: ValueRotation) {\n 'worklet';\n const { interfaceOrientation, pitch, roll, yaw } = data;\n if (interfaceOrientation === InterfaceOrientation.ROTATION_90) {\n data.pitch = roll;\n data.roll = -pitch;\n data.yaw = yaw - Math.PI / 2;\n } else if (interfaceOrientation === InterfaceOrientation.ROTATION_270) {\n data.pitch = -roll;\n data.roll = pitch;\n data.yaw = yaw + Math.PI / 2;\n } else if (interfaceOrientation === InterfaceOrientation.ROTATION_180) {\n data.pitch *= -1;\n data.roll *= -1;\n data.yaw *= -1;\n }\n\n const q = eulerToQuaternion(data.pitch, data.roll, data.yaw);\n data.qx = q[0];\n data.qy = q[1];\n data.qz = q[2];\n data.qw = q[3];\n return data;\n}\n\nfunction adjustVectorToInterfaceOrientation(data: Value3D) {\n 'worklet';\n const { interfaceOrientation, x, y } = data;\n if (interfaceOrientation === InterfaceOrientation.ROTATION_90) {\n data.x = -y;\n data.y = x;\n } else if (interfaceOrientation === InterfaceOrientation.ROTATION_270) {\n data.x = y;\n data.y = -x;\n } else if (interfaceOrientation === InterfaceOrientation.ROTATION_180) {\n data.x *= -1;\n data.y *= -1;\n }\n return data;\n}\n\n/**\n * Lets you create animations based on data from the device's sensors.\n *\n * @param sensorType - Type of the sensor to use. Configured with {@link SensorType} enum.\n * @param config - The sensor configuration - {@link SensorConfig}.\n * @returns An object containing the sensor measurements [shared value](https://docs.swmansion.com/react-native-reanimated/docs/fundamentals/glossary#shared-value) and a function to unregister the sensor\n * @see https://docs.swmansion.com/react-native-reanimated/docs/device/useAnimatedSensor\n */\nexport function useAnimatedSensor(\n sensorType: SensorType.ROTATION,\n userConfig?: Partial<SensorConfig>\n): AnimatedSensor<ValueRotation>;\nexport function useAnimatedSensor(\n sensorType: Exclude<SensorType, SensorType.ROTATION>,\n userConfig?: Partial<SensorConfig>\n): AnimatedSensor<Value3D>;\nexport function useAnimatedSensor(\n sensorType: SensorType,\n userConfig?: Partial<SensorConfig>\n): AnimatedSensor<ValueRotation> | AnimatedSensor<Value3D> {\n const userConfigRef = useRef(userConfig);\n\n const hasConfigChanged =\n userConfigRef.current?.adjustToInterfaceOrientation !==\n userConfig?.adjustToInterfaceOrientation ||\n userConfigRef.current?.interval !== userConfig?.interval ||\n userConfigRef.current?.iosReferenceFrame !== userConfig?.iosReferenceFrame;\n\n if (hasConfigChanged) {\n userConfigRef.current = { ...userConfig };\n }\n\n const config: SensorConfig = useMemo(\n () => ({\n interval: 'auto',\n adjustToInterfaceOrientation: true,\n iosReferenceFrame: IOSReferenceFrame.Auto,\n ...userConfigRef.current,\n }),\n [userConfigRef.current]\n );\n\n const ref = useRef<AnimatedSensor<Value3D | ValueRotation>>({\n sensor: initializeSensor(sensorType, config),\n unregister: () => {\n // NOOP\n },\n isAvailable: false,\n config,\n });\n\n useEffect(() => {\n ref.current = {\n sensor: initializeSensor(sensorType, config),\n unregister: () => {\n // NOOP\n },\n isAvailable: false,\n config,\n };\n\n const sensorData = ref.current.sensor;\n const adjustToInterfaceOrientation =\n ref.current.config.adjustToInterfaceOrientation;\n\n const id = registerSensor(sensorType, config, (data) => {\n 'worklet';\n if (adjustToInterfaceOrientation) {\n if (sensorType === SensorType.ROTATION) {\n data = adjustRotationToInterfaceOrientation(data as ValueRotation);\n } else {\n data = adjustVectorToInterfaceOrientation(data as Value3D);\n }\n }\n sensorData.value = data;\n callMicrotasks();\n });\n\n if (id !== -1) {\n // if sensor is available\n ref.current.unregister = () => unregisterSensor(id);\n ref.current.isAvailable = true;\n } else {\n // if sensor is unavailable\n ref.current.unregister = () => {\n // NOOP\n };\n ref.current.isAvailable = false;\n }\n\n return () => {\n ref.current.unregister();\n };\n }, [sensorType, config]);\n\n return ref.current as AnimatedSensor<ValueRotation> | AnimatedSensor<Value3D>;\n}\n"],"mappings":"AAAA,YAAY;;AACZ,SAASA,SAAS,EAAEC,OAAO,EAAEC,MAAM,QAAQ,OAAO;AAClD,SAASC,gBAAgB,EAAEC,cAAc,EAAEC,gBAAgB,QAAQ,SAAS;AAO5E,SACEC,UAAU,EACVC,iBAAiB,EACjBC,oBAAoB,QACf,gBAAgB;AACvB,SAASC,cAAc,QAAQ,YAAY;;AAE3C;AACA;AACA,SAASC,iBAAiBA,CAACC,KAAa,EAAEC,IAAY,EAAEC,GAAW,EAAE;EACnE,SAAS;;EACT,MAAMC,EAAE,GAAGC,IAAI,CAACC,GAAG,CAACL,KAAK,GAAG,CAAC,CAAC;EAC9B,MAAMM,EAAE,GAAGF,IAAI,CAACG,GAAG,CAACP,KAAK,GAAG,CAAC,CAAC;EAC9B,MAAMQ,E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oC,UAAU,EAAEW,MAAM,CAAC;MAC5CI,UAAU,EAAEA,CAAA,KAAM;QAChB;MAAA,CACD;MACDC,WAAW,EAAE,KAAK;MAClBL;IACF,CAAC;IAED,MAAMM,UAAU,GAAGJ,GAAG,CAACN,OAAO,CAACO,MAAM;IACrC,MAAMN,4BAA4B,GAChCK,GAAG,CAACN,OAAO,CAACI,MAAM,CAACH,4BAA4B;IAEjD,MAAMU,EAAE,GAAGrD,cAAc,CAACmC,UAAU,EAAEW,MAAM,EAAG1B,IAAI,IAAK;MACtD,SAAS;;MACT,IAAIuB,4BAA4B,EAAE;QAChC,IAAIR,UAAU,KAAKjC,UAAU,CAACoD,QAAQ,EAAE;UACtClC,IAAI,GAAGD,oCAAoC,CAACC,IAAI,CAAkB;QACpE,CAAC,MAAM;UACLA,IAAI,GAAGW,kCAAkC,CAACX,IAAI,CAAY;QAC5D;MACF;MACAgC,UAAU,CAACG,KAAK,GAAGnC,IAAI;MACvBf,cAAc,EAAE;IAClB,CAAC,CAAC;IAEF,IAAIgD,EAAE,KAAK,CAAC,CAAC,EAAE;MACb;MACAL,GAAG,CAACN,OAAO,CAACQ,UAAU,GAAG,MAAMjD,gBAAgB,CAACoD,EAAE,CAAC;MACnDL,GAAG,CAACN,OAAO,CAACS,WAAW,GAAG,IAAI;IAChC,CAAC,MAAM;MACL;MACAH,GAAG,CAACN,OAAO,CAACQ,UAAU,GAAG,MAAM;QAC7B;MAAA,CACD;MACDF,GAAG,CAACN,OAAO,CAACS,WAAW,GAAG,KAAK;IACjC;IAEA,OAAO,MAAM;MACXH,GAAG,CAACN,OAAO,CAACQ,UAAU,EAAE;IAC1B,CAAC;EACH,CAAC,EAAE,CAACf,UAAU,EAAEW,MAAM,CAAC,CAAC;EAExB,OAAOE,GAAG,CAACN,OAAO;AACpB"}
|
|
1
|
+
{"version":3,"names":["useEffect","useMemo","useRef","initializeSensor","registerSensor","unregisterSensor","SensorType","IOSReferenceFrame","InterfaceOrientation","callMicrotasks","eulerToQuaternion","pitch","roll","yaw","c1","Math","cos","s1","sin","c2","s2","c3","s3","adjustRotationToInterfaceOrientation","data","interfaceOrientation","ROTATION_90","PI","ROTATION_270","ROTATION_180","q","qx","qy","qz","qw","adjustVectorToInterfaceOrientation","x","y","useAnimatedSensor","sensorType","userConfig","_userConfigRef$curren","_userConfigRef$curren2","_userConfigRef$curren3","userConfigRef","hasConfigChanged","current","adjustToInterfaceOrientation","interval","iosReferenceFrame","config","Auto","ref","sensor","unregister","isAvailable","sensorData","id","ROTATION","value"],"sources":["useAnimatedSensor.ts"],"sourcesContent":["'use strict';\nimport { useEffect, useMemo, useRef } from 'react';\nimport { initializeSensor, registerSensor, unregisterSensor } from '../core';\nimport type {\n SensorConfig,\n AnimatedSensor,\n Value3D,\n ValueRotation,\n} from '../commonTypes';\nimport {\n SensorType,\n IOSReferenceFrame,\n InterfaceOrientation,\n} from '../commonTypes';\nimport { callMicrotasks } from '../threads';\n\n// euler angles are in order ZXY, z = yaw, x = pitch, y = roll\n// https://github.com/mrdoob/three.js/blob/dev/src/math/Quaternion.js#L237\nfunction eulerToQuaternion(pitch: number, roll: number, yaw: number) {\n 'worklet';\n const c1 = Math.cos(pitch / 2);\n const s1 = Math.sin(pitch / 2);\n const c2 = Math.cos(roll / 2);\n const s2 = Math.sin(roll / 2);\n const c3 = Math.cos(yaw / 2);\n const s3 = Math.sin(yaw / 2);\n\n return [\n s1 * c2 * c3 - c1 * s2 * s3,\n c1 * s2 * c3 + s1 * c2 * s3,\n c1 * c2 * s3 + s1 * s2 * c3,\n c1 * c2 * c3 - s1 * s2 * s3,\n ];\n}\n\nfunction adjustRotationToInterfaceOrientation(data: ValueRotation) {\n 'worklet';\n const { interfaceOrientation, pitch, roll, yaw } = data;\n if (interfaceOrientation === InterfaceOrientation.ROTATION_90) {\n data.pitch = roll;\n data.roll = -pitch;\n data.yaw = yaw - Math.PI / 2;\n } else if (interfaceOrientation === InterfaceOrientation.ROTATION_270) {\n data.pitch = -roll;\n data.roll = pitch;\n data.yaw = yaw + Math.PI / 2;\n } else if (interfaceOrientation === InterfaceOrientation.ROTATION_180) {\n data.pitch *= -1;\n data.roll *= -1;\n data.yaw *= -1;\n }\n\n const q = eulerToQuaternion(data.pitch, data.roll, data.yaw);\n data.qx = q[0];\n data.qy = q[1];\n data.qz = q[2];\n data.qw = q[3];\n return data;\n}\n\nfunction adjustVectorToInterfaceOrientation(data: Value3D) {\n 'worklet';\n const { interfaceOrientation, x, y } = data;\n if (interfaceOrientation === InterfaceOrientation.ROTATION_90) {\n data.x = -y;\n data.y = x;\n } else if (interfaceOrientation === InterfaceOrientation.ROTATION_270) {\n data.x = y;\n data.y = -x;\n } else if (interfaceOrientation === InterfaceOrientation.ROTATION_180) {\n data.x *= -1;\n data.y *= -1;\n }\n return data;\n}\n\n/**\n * Lets you create animations based on data from the device's sensors.\n *\n * @param sensorType - Type of the sensor to use. Configured with {@link SensorType} enum.\n * @param config - The sensor configuration - {@link SensorConfig}.\n * @returns An object containing the sensor measurements [shared value](https://docs.swmansion.com/react-native-reanimated/docs/fundamentals/glossary#shared-value) and a function to unregister the sensor\n * @see https://docs.swmansion.com/react-native-reanimated/docs/device/useAnimatedSensor\n */\nexport function useAnimatedSensor(\n sensorType: SensorType.ROTATION,\n userConfig?: Partial<SensorConfig>\n): AnimatedSensor<ValueRotation>;\nexport function useAnimatedSensor(\n sensorType: Exclude<SensorType, SensorType.ROTATION>,\n userConfig?: Partial<SensorConfig>\n): AnimatedSensor<Value3D>;\nexport function useAnimatedSensor(\n sensorType: SensorType,\n userConfig?: Partial<SensorConfig>\n): AnimatedSensor<ValueRotation> | AnimatedSensor<Value3D> {\n const userConfigRef = useRef(userConfig);\n\n const hasConfigChanged =\n userConfigRef.current?.adjustToInterfaceOrientation !==\n userConfig?.adjustToInterfaceOrientation ||\n userConfigRef.current?.interval !== userConfig?.interval ||\n userConfigRef.current?.iosReferenceFrame !== userConfig?.iosReferenceFrame;\n\n if (hasConfigChanged) {\n userConfigRef.current = { ...userConfig };\n }\n\n const config: SensorConfig = useMemo(\n () => ({\n interval: 'auto',\n adjustToInterfaceOrientation: true,\n iosReferenceFrame: IOSReferenceFrame.Auto,\n ...userConfigRef.current,\n }),\n [userConfigRef.current]\n );\n\n const ref = useRef<AnimatedSensor<Value3D | ValueRotation>>({\n sensor: initializeSensor(sensorType, config),\n unregister: () => {\n // NOOP\n },\n isAvailable: false,\n config,\n });\n\n useEffect(() => {\n ref.current = {\n sensor: initializeSensor(sensorType, config),\n unregister: () => {\n // NOOP\n },\n isAvailable: false,\n config,\n };\n\n const sensorData = ref.current.sensor;\n const adjustToInterfaceOrientation =\n ref.current.config.adjustToInterfaceOrientation;\n\n const id = registerSensor(sensorType, config, (data) => {\n 'worklet';\n if (adjustToInterfaceOrientation) {\n if (sensorType === SensorType.ROTATION) {\n data = adjustRotationToInterfaceOrientation(data as ValueRotation);\n } else {\n data = adjustVectorToInterfaceOrientation(data as Value3D);\n }\n }\n sensorData.value = data;\n callMicrotasks();\n });\n\n if (id !== -1) {\n // if sensor is available\n ref.current.unregister = () => unregisterSensor(id);\n ref.current.isAvailable = true;\n } else {\n // if sensor is unavailable\n ref.current.unregister = () => {\n // NOOP\n };\n ref.current.isAvailable = false;\n }\n\n return () => {\n ref.current.unregister();\n };\n }, [sensorType, config]);\n\n return ref.current as AnimatedSensor<ValueRotation> | AnimatedSensor<Value3D>;\n}\n"],"mappings":"AAAA,YAAY;;AACZ,SAASA,SAAS,EAAEC,OAAO,EAAEC,MAAM,QAAQ,OAAO;AAClD,SAASC,gBAAgB,EAAEC,cAAc,EAAEC,gBAAgB,QAAQ,SAAS;AAO5E,SACEC,UAAU,EACVC,iBAAiB,EACjBC,oBAAoB,QACf,gBAAgB;AACvB,SAASC,cAAc,QAAQ,YAAY;;AAE3C;AACA;AACA,SAASC,iBAAiBA,CAACC,KAAa,EAAEC,IAAY,EAAEC,GAAW,EAAE;EACnE,SAAS;;EACT,MAAMC,EAAE,GAAGC,IAAI,CAACC,GAAG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AG,CAACN,OAAO;AACpB","ignoreList":[]}
|
|
@@ -19,7 +19,6 @@ function prepareAnimation(frameTimestamp, animatedProp, lastAnimation, lastValue
|
|
|
19
19
|
});
|
|
20
20
|
// return animatedProp;
|
|
21
21
|
}
|
|
22
|
-
|
|
23
22
|
if (typeof animatedProp === 'object' && animatedProp.onFrame) {
|
|
24
23
|
const animation = animatedProp;
|
|
25
24
|
let value = animation.current;
|
|
@@ -81,7 +80,6 @@ function runAnimations(animation, timestamp, key, result, animationsActive) {
|
|
|
81
80
|
animation.callback && animation.callback(true /* finished */);
|
|
82
81
|
}
|
|
83
82
|
}
|
|
84
|
-
|
|
85
83
|
result[key] = animation.current;
|
|
86
84
|
return finished;
|
|
87
85
|
} else if (typeof animation === 'object') {
|
|
@@ -98,10 +96,9 @@ function runAnimations(animation, timestamp, key, result, animationsActive) {
|
|
|
98
96
|
return true;
|
|
99
97
|
}
|
|
100
98
|
}
|
|
101
|
-
function styleUpdater(viewDescriptors, updater, state, maybeViewRef, animationsActive) {
|
|
99
|
+
function styleUpdater(viewDescriptors, updater, state, maybeViewRef, animationsActive, isAnimatedProps = false) {
|
|
102
100
|
'worklet';
|
|
103
101
|
|
|
104
|
-
let isAnimatedProps = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : false;
|
|
105
102
|
const animations = state.animations ?? {};
|
|
106
103
|
const newValues = updater() ?? {};
|
|
107
104
|
const oldValues = state.last;
|
|
@@ -275,8 +272,8 @@ function checkSharedValueUsage(prop, currentKey) {
|
|
|
275
272
|
*/
|
|
276
273
|
// You cannot pass Shared Values to `useAnimatedStyle` directly.
|
|
277
274
|
// @ts-expect-error This overload is required by our API.
|
|
278
|
-
|
|
279
|
-
|
|
275
|
+
|
|
276
|
+
export function useAnimatedStyle(updater, dependencies, adapters, isAnimatedProps = false) {
|
|
280
277
|
const viewsRef = useViewRefSet();
|
|
281
278
|
const animatedUpdaterData = useRef();
|
|
282
279
|
let inputs = Object.values(updater.__closure ?? {});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["useEffect","useRef","makeShareable","startMapper","stopMapper","updateProps","updatePropsJestWrapper","initialUpdaterRun","useSharedValue","buildWorkletsHash","isAnimated","shallowEqual","validateAnimatedStyles","makeViewDescriptorsSet","useViewRefSet","isJest","shouldBeUseWeb","isWorkletFunction","SHOULD_BE_USE_WEB","prepareAnimation","frameTimestamp","animatedProp","lastAnimation","lastValue","Array","isArray","forEach","prop","index","onFrame","animation","value","current","undefined","callStart","timestamp","onStart","Object","keys","key","runAnimations","result","animationsActive","allFinished","entry","finished","callback","k","styleUpdater","viewDescriptors","updater","state","maybeViewRef","isAnimatedProps","arguments","length","animations","newValues","oldValues","last","nonAnimatedNewValues","hasAnimations","hasNonAnimatedValues","global","__frameTimestamp","_getAnimationTimestamp","frame","isAnimationCancelled","isAnimationRunning","updates","propName","requestAnimationFrame","jestStyleUpdater","animatedStyle","adapters","checkSharedValueUsage","currentKey","element","Error","useAnimatedStyle","dependencies","viewsRef","animatedUpdaterData","inputs","values","__closure","_dependencies","__DEV__","adaptersArray","adaptersHash","areAnimationsActive","jestAnimatedStyle","__workletHash","push","initialStyle","initial","remoteState","shareableViewDescriptors","fun","updaterFn","adapter","mapperId","animatedStyleHandle"],"sources":["useAnimatedStyle.ts"],"sourcesContent":["'use strict';\nimport type { MutableRefObject } from 'react';\nimport { useEffect, useRef } from 'react';\n\nimport { makeShareable, startMapper, stopMapper } from '../core';\nimport updateProps, { updatePropsJestWrapper } from '../UpdateProps';\nimport { initialUpdaterRun } from '../animation';\nimport { useSharedValue } from './useSharedValue';\nimport {\n buildWorkletsHash,\n isAnimated,\n shallowEqual,\n validateAnimatedStyles,\n} from './utils';\nimport type {\n AnimatedStyleHandle,\n DefaultStyle,\n DependencyList,\n Descriptor,\n JestAnimatedStyleHandle,\n} from './commonTypes';\nimport type { ViewDescriptorsSet, ViewRefSet } from '../ViewDescriptorsSet';\nimport { makeViewDescriptorsSet, useViewRefSet } from '../ViewDescriptorsSet';\nimport { isJest, shouldBeUseWeb } from '../PlatformChecker';\nimport type {\n AnimationObject,\n Timestamp,\n NestedObjectValues,\n SharedValue,\n StyleProps,\n WorkletFunction,\n AnimatedPropsAdapterFunction,\n AnimatedPropsAdapterWorklet,\n} from '../commonTypes';\nimport type { AnimatedStyle } from '../helperTypes';\nimport { isWorkletFunction } from '../commonTypes';\n\nconst SHOULD_BE_USE_WEB = shouldBeUseWeb();\n\ninterface AnimatedState {\n last: AnimatedStyle<any>;\n animations: AnimatedStyle<any>;\n isAnimationRunning: boolean;\n isAnimationCancelled: boolean;\n}\n\ninterface AnimatedUpdaterData {\n initial: {\n value: AnimatedStyle<any>;\n updater: () => AnimatedStyle<any>;\n };\n remoteState: AnimatedState;\n viewDescriptors: ViewDescriptorsSet;\n}\n\nfunction prepareAnimation(\n frameTimestamp: number,\n animatedProp: AnimatedStyle<any>,\n lastAnimation: AnimatedStyle<any>,\n lastValue: AnimatedStyle<any>\n): void {\n 'worklet';\n if (Array.isArray(animatedProp)) {\n animatedProp.forEach((prop, index) => {\n prepareAnimation(\n frameTimestamp,\n prop,\n lastAnimation && lastAnimation[index],\n lastValue && lastValue[index]\n );\n });\n // return animatedProp;\n }\n if (typeof animatedProp === 'object' && animatedProp.onFrame) {\n const animation = animatedProp;\n\n let value = animation.current;\n if (lastValue !== undefined && lastValue !== null) {\n if (typeof lastValue === 'object') {\n if (lastValue.value !== undefined) {\n // previously it was a shared value\n value = lastValue.value;\n } else if (lastValue.onFrame !== undefined) {\n if (lastAnimation?.current !== undefined) {\n // it was an animation before, copy its state\n value = lastAnimation.current;\n } else if (lastValue?.current !== undefined) {\n // it was initialized\n value = lastValue.current;\n }\n }\n } else {\n // previously it was a plain value, just set it as starting point\n value = lastValue;\n }\n }\n\n animation.callStart = (timestamp: Timestamp) => {\n animation.onStart(animation, value, timestamp, lastAnimation);\n };\n animation.callStart(frameTimestamp);\n animation.callStart = null;\n } else if (typeof animatedProp === 'object') {\n // it is an object\n Object.keys(animatedProp).forEach((key) =>\n prepareAnimation(\n frameTimestamp,\n animatedProp[key],\n lastAnimation && lastAnimation[key],\n lastValue && lastValue[key]\n )\n );\n }\n}\n\nfunction runAnimations(\n animation: AnimatedStyle<any>,\n timestamp: Timestamp,\n key: number | string,\n result: AnimatedStyle<any>,\n animationsActive: SharedValue<boolean>\n): boolean {\n 'worklet';\n if (!animationsActive.value) {\n return true;\n }\n if (Array.isArray(animation)) {\n result[key] = [];\n let allFinished = true;\n animation.forEach((entry, index) => {\n if (\n !runAnimations(entry, timestamp, index, result[key], animationsActive)\n ) {\n allFinished = false;\n }\n });\n return allFinished;\n } else if (typeof animation === 'object' && animation.onFrame) {\n let finished = true;\n if (!animation.finished) {\n if (animation.callStart) {\n animation.callStart(timestamp);\n animation.callStart = null;\n }\n finished = animation.onFrame(animation, timestamp);\n animation.timestamp = timestamp;\n if (finished) {\n animation.finished = true;\n animation.callback && animation.callback(true /* finished */);\n }\n }\n result[key] = animation.current;\n return finished;\n } else if (typeof animation === 'object') {\n result[key] = {};\n let allFinished = true;\n Object.keys(animation).forEach((k) => {\n if (\n !runAnimations(\n animation[k],\n timestamp,\n k,\n result[key],\n animationsActive\n )\n ) {\n allFinished = false;\n }\n });\n return allFinished;\n } else {\n result[key] = animation;\n return true;\n }\n}\n\nfunction styleUpdater(\n viewDescriptors: SharedValue<Descriptor[]>,\n updater: WorkletFunction<[], AnimatedStyle<any>> | (() => AnimatedStyle<any>),\n state: AnimatedState,\n maybeViewRef: ViewRefSet<any> | undefined,\n animationsActive: SharedValue<boolean>,\n isAnimatedProps = false\n): void {\n 'worklet';\n const animations = state.animations ?? {};\n const newValues = updater() ?? {};\n const oldValues = state.last;\n const nonAnimatedNewValues: StyleProps = {};\n\n let hasAnimations = false;\n let frameTimestamp: number | undefined;\n let hasNonAnimatedValues = false;\n for (const key in newValues) {\n const value = newValues[key];\n if (isAnimated(value)) {\n frameTimestamp =\n global.__frameTimestamp || global._getAnimationTimestamp();\n prepareAnimation(frameTimestamp, value, animations[key], oldValues[key]);\n animations[key] = value;\n hasAnimations = true;\n } else {\n hasNonAnimatedValues = true;\n nonAnimatedNewValues[key] = value;\n delete animations[key];\n }\n }\n\n if (hasAnimations) {\n const frame = (timestamp: Timestamp) => {\n // eslint-disable-next-line @typescript-eslint/no-shadow\n const { animations, last, isAnimationCancelled } = state;\n if (isAnimationCancelled) {\n state.isAnimationRunning = false;\n return;\n }\n\n const updates: AnimatedStyle<any> = {};\n let allFinished = true;\n for (const propName in animations) {\n const finished = runAnimations(\n animations[propName],\n timestamp,\n propName,\n updates,\n animationsActive\n );\n if (finished) {\n last[propName] = updates[propName];\n delete animations[propName];\n } else {\n allFinished = false;\n }\n }\n\n if (updates) {\n updateProps(viewDescriptors, updates, maybeViewRef);\n }\n\n if (!allFinished) {\n requestAnimationFrame(frame);\n } else {\n state.isAnimationRunning = false;\n }\n };\n\n state.animations = animations;\n if (!state.isAnimationRunning) {\n state.isAnimationCancelled = false;\n state.isAnimationRunning = true;\n frame(frameTimestamp!);\n }\n\n if (hasNonAnimatedValues) {\n updateProps(viewDescriptors, nonAnimatedNewValues, maybeViewRef);\n }\n } else {\n state.isAnimationCancelled = true;\n state.animations = [];\n\n if (!shallowEqual(oldValues, newValues)) {\n updateProps(viewDescriptors, newValues, maybeViewRef, isAnimatedProps);\n }\n }\n state.last = newValues;\n}\n\nfunction jestStyleUpdater(\n viewDescriptors: SharedValue<Descriptor[]>,\n updater: WorkletFunction<[], AnimatedStyle<any>> | (() => AnimatedStyle<any>),\n state: AnimatedState,\n maybeViewRef: ViewRefSet<any> | undefined,\n animationsActive: SharedValue<boolean>,\n animatedStyle: MutableRefObject<AnimatedStyle<any>>,\n adapters: AnimatedPropsAdapterFunction[]\n): void {\n 'worklet';\n const animations: AnimatedStyle<any> = state.animations ?? {};\n const newValues = updater() ?? {};\n const oldValues = state.last;\n\n // extract animated props\n let hasAnimations = false;\n let frameTimestamp: number | undefined;\n Object.keys(animations).forEach((key) => {\n const value = newValues[key];\n if (!isAnimated(value)) {\n delete animations[key];\n }\n });\n Object.keys(newValues).forEach((key) => {\n const value = newValues[key];\n if (isAnimated(value)) {\n frameTimestamp =\n global.__frameTimestamp || global._getAnimationTimestamp();\n prepareAnimation(frameTimestamp, value, animations[key], oldValues[key]);\n animations[key] = value;\n hasAnimations = true;\n }\n });\n\n function frame(timestamp: Timestamp) {\n // eslint-disable-next-line @typescript-eslint/no-shadow\n const { animations, last, isAnimationCancelled } = state;\n if (isAnimationCancelled) {\n state.isAnimationRunning = false;\n return;\n }\n\n const updates: AnimatedStyle<any> = {};\n let allFinished = true;\n Object.keys(animations).forEach((propName) => {\n const finished = runAnimations(\n animations[propName],\n timestamp,\n propName,\n updates,\n animationsActive\n );\n if (finished) {\n last[propName] = updates[propName];\n delete animations[propName];\n } else {\n allFinished = false;\n }\n });\n\n if (Object.keys(updates).length) {\n updatePropsJestWrapper(\n viewDescriptors,\n updates,\n maybeViewRef,\n animatedStyle,\n adapters\n );\n }\n\n if (!allFinished) {\n requestAnimationFrame(frame);\n } else {\n state.isAnimationRunning = false;\n }\n }\n\n if (hasAnimations) {\n state.animations = animations;\n if (!state.isAnimationRunning) {\n state.isAnimationCancelled = false;\n state.isAnimationRunning = true;\n frame(frameTimestamp!);\n }\n } else {\n state.isAnimationCancelled = true;\n state.animations = [];\n }\n\n // calculate diff\n state.last = newValues;\n\n if (!shallowEqual(oldValues, newValues)) {\n updatePropsJestWrapper(\n viewDescriptors,\n newValues,\n maybeViewRef,\n animatedStyle,\n adapters\n );\n }\n}\n\n// check for invalid usage of shared values in returned object\nfunction checkSharedValueUsage(\n prop: NestedObjectValues<AnimationObject>,\n currentKey?: string\n): void {\n if (Array.isArray(prop)) {\n // if it's an array (i.ex. transform) validate all its elements\n for (const element of prop) {\n checkSharedValueUsage(element, currentKey);\n }\n } else if (\n typeof prop === 'object' &&\n prop !== null &&\n prop.value === undefined\n ) {\n // if it's a nested object, run validation for all its props\n for (const key of Object.keys(prop)) {\n checkSharedValueUsage(prop[key], key);\n }\n } else if (\n currentKey !== undefined &&\n typeof prop === 'object' &&\n prop !== null &&\n prop.value !== undefined\n ) {\n // if shared value is passed insted of its value, throw an error\n throw new Error(\n `[Reanimated] Invalid value passed to \\`${currentKey}\\`, maybe you forgot to use \\`.value\\`?`\n );\n }\n}\n\n/**\n * Lets you create a styles object, similar to StyleSheet styles, which can be animated using shared values.\n *\n * @param updater - A function returning an object with style properties you want to animate.\n * @param dependencies - An optional array of dependencies. Only relevant when using Reanimated without the Babel plugin on the Web.\n * @returns An animated style object which has to be passed to the `style` property of an Animated component you want to animate.\n * @see https://docs.swmansion.com/react-native-reanimated/docs/core/useAnimatedStyle\n */\n// You cannot pass Shared Values to `useAnimatedStyle` directly.\n// @ts-expect-error This overload is required by our API.\nexport function useAnimatedStyle<Style extends DefaultStyle>(\n updater: () => Style,\n dependencies?: DependencyList | null\n): Style;\n\nexport function useAnimatedStyle<Style extends DefaultStyle>(\n updater:\n | WorkletFunction<[], Style>\n | ((() => Style) & Record<string, unknown>),\n dependencies?: DependencyList | null,\n adapters?: AnimatedPropsAdapterWorklet | AnimatedPropsAdapterWorklet[] | null,\n isAnimatedProps = false\n): AnimatedStyleHandle<Style> | JestAnimatedStyleHandle<Style> {\n const viewsRef: ViewRefSet<unknown> | undefined = useViewRefSet();\n const animatedUpdaterData = useRef<AnimatedUpdaterData>();\n let inputs = Object.values(updater.__closure ?? {});\n if (SHOULD_BE_USE_WEB) {\n if (!inputs.length && dependencies?.length) {\n // let web work without a Babel plugin\n inputs = dependencies;\n }\n if (\n __DEV__ &&\n !inputs.length &&\n !dependencies &&\n !isWorkletFunction(updater)\n ) {\n throw new Error(\n `[Reanimated] \\`useAnimatedStyle\\` was used without a dependency array or Babel plugin. Please explicitly pass a dependency array, or enable the Babel plugin.\nFor more, see the docs: \\`https://docs.swmansion.com/react-native-reanimated/docs/guides/web-support#web-without-the-babel-plugin\\`.`\n );\n }\n }\n const adaptersArray = adapters\n ? Array.isArray(adapters)\n ? adapters\n : [adapters]\n : [];\n const adaptersHash = adapters ? buildWorkletsHash(adaptersArray) : null;\n const areAnimationsActive = useSharedValue<boolean>(true);\n const jestAnimatedStyle = useRef<Style>({} as Style);\n\n // build dependencies\n if (!dependencies) {\n dependencies = [...inputs, updater.__workletHash];\n } else {\n dependencies.push(updater.__workletHash);\n }\n adaptersHash && dependencies.push(adaptersHash);\n\n if (!animatedUpdaterData.current) {\n const initialStyle = initialUpdaterRun(updater);\n if (__DEV__) {\n validateAnimatedStyles(initialStyle);\n }\n animatedUpdaterData.current = {\n initial: {\n value: initialStyle,\n updater,\n },\n remoteState: makeShareable({\n last: initialStyle,\n animations: {},\n isAnimationCancelled: false,\n isAnimationRunning: false,\n }),\n viewDescriptors: makeViewDescriptorsSet(),\n };\n }\n\n const { initial, remoteState, viewDescriptors } = animatedUpdaterData.current;\n const shareableViewDescriptors = viewDescriptors.shareableViewDescriptors;\n\n dependencies.push(shareableViewDescriptors);\n\n useEffect(() => {\n let fun;\n let updaterFn = updater;\n if (adapters) {\n updaterFn = (() => {\n 'worklet';\n const newValues = updater();\n adaptersArray.forEach((adapter) => {\n adapter(newValues as Record<string, unknown>);\n });\n return newValues;\n }) as WorkletFunction<[], Style>;\n }\n\n if (isJest()) {\n fun = () => {\n 'worklet';\n jestStyleUpdater(\n shareableViewDescriptors,\n updater,\n remoteState,\n viewsRef,\n areAnimationsActive,\n jestAnimatedStyle,\n adaptersArray\n );\n };\n } else {\n fun = () => {\n 'worklet';\n styleUpdater(\n shareableViewDescriptors,\n updaterFn,\n remoteState,\n viewsRef,\n areAnimationsActive,\n isAnimatedProps\n );\n };\n }\n const mapperId = startMapper(fun, inputs);\n return () => {\n stopMapper(mapperId);\n };\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, dependencies);\n\n useEffect(() => {\n areAnimationsActive.value = true;\n return () => {\n areAnimationsActive.value = false;\n };\n }, [areAnimationsActive]);\n\n checkSharedValueUsage(initial.value);\n\n const animatedStyleHandle = useRef<\n AnimatedStyleHandle<Style> | JestAnimatedStyleHandle<Style> | null\n >(null);\n\n if (!animatedStyleHandle.current) {\n animatedStyleHandle.current = isJest()\n ? { viewDescriptors, initial, viewsRef, jestAnimatedStyle }\n : { initial, viewsRef, viewDescriptors };\n }\n\n return animatedStyleHandle.current;\n}\n"],"mappings":"AAAA,YAAY;;AAEZ,SAASA,SAAS,EAAEC,MAAM,QAAQ,OAAO;AAEzC,SAASC,aAAa,EAAEC,WAAW,EAAEC,UAAU,QAAQ,SAAS;AAChE,OAAOC,WAAW,IAAIC,sBAAsB,QAAQ,gBAAgB;AACpE,SAASC,iBAAiB,QAAQ,cAAc;AAChD,SAASC,cAAc,QAAQ,kBAAkB;AACjD,SACEC,iBAAiB,EACjBC,UAAU,EACVC,YAAY,EACZC,sBAAsB,QACjB,SAAS;AAShB,SAASC,sBAAsB,EAAEC,aAAa,QAAQ,uBAAuB;AAC7E,SAASC,MAAM,EAAEC,cAAc,QAAQ,oBAAoB;AAY3D,SAASC,iBAAiB,QAAQ,gBAAgB;AAElD,MAAMC,iBAAiB,GAAGF,cAAc,EAAE;AAkB1C,SAASG,gBAAgBA,CACvBC,cAAsB,EACtBC,YAAgC,EAChCC,aAAiC,EACjCC,SAA6B,EACvB;EACN,SAAS;;EACT,IAAIC,KAAK,CAACC,OAAO,CAACJ,YAAY,CAAC,EAAE;IAC/BA,YAAY,CAACK,OAAO,CAAC,CAACC,IAAI,EAAEC,KAAK,KAAK;MACpCT,gBAAgB,CACdC,cAAc,EACdO,IAAI,EACJL,aAAa,IAAIA,aAAa,CAACM,KAAK,CAAC,EACrCL,SAAS,IAAIA,SAAS,CAACK,KAAK,CAAC,CAC9B;IACH,CAAC,CAAC;IACF;EACF;;EACA,IAAI,OAAOP,YAAY,KAAK,QAAQ,IAAIA,YAAY,CAACQ,OAAO,EAAE;IAC5D,MAAMC,SAAS,GAAGT,YAAY;IAE9B,IAAIU,KAAK,GAAGD,SAAS,CAACE,OAAO;IAC7B,IAAIT,SAAS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AAS;MAClB,CAAgC;IAClC;IAEA,IAAI1C,MAAM,EAAE,EAAE;MACZmF,GAAG,GAAGA,CAAA,KAAM;QACV,SAAS;;QACT1B,gBAAgB,CACdyB,wBAAwB,EACxB/C,OAAO,EACP8C,WAAW,EACXf,QAAQ,EACRS,mBAAmB,EACnBC,iBAAiB,EACjBH,aAAa,CACd;MACH,CAAC;IACH,CAAC,MAAM;MACLU,GAAG,GAAGA,CAAA,KAAM;QACV,SAAS;;QACTlD,YAAY,CACViD,wBAAwB,EACxBE,SAAS,EACTH,WAAW,EACXf,QAAQ,EACRS,mBAAmB,EACnBrC,eAAe,CAChB;MACH,CAAC;IACH;IACA,MAAMgD,QAAQ,GAAGlG,WAAW,CAAC+F,GAAG,EAAEf,MAAM,CAAC;IACzC,OAAO,MAAM;MACX/E,UAAU,CAACiG,QAAQ,CAAC;IACtB,CAAC;IACD;EACF,CAAC,EAAErB,YAAY,CAAC;EAEhBhF,SAAS,CAAC,MAAM;IACd0F,mBAAmB,CAAC3D,KAAK,GAAG,IAAI;IAChC,OAAO,MAAM;MACX2D,mBAAmB,CAAC3D,KAAK,GAAG,KAAK;IACnC,CAAC;EACH,CAAC,EAAE,CAAC2D,mBAAmB,CAAC,CAAC;EAEzBf,qBAAqB,CAACoB,OAAO,CAAChE,KAAK,CAAC;EAEpC,MAAMuE,mBAAmB,GAAGrG,MAAM,CAEhC,IAAI,CAAC;EAEP,IAAI,CAACqG,mBAAmB,CAACtE,OAAO,EAAE;IAChCsE,mBAAmB,CAACtE,OAAO,GAAGjB,MAAM,EAAE,GAClC;MAAEkC,eAAe;MAAE8C,OAAO;MAAEd,QAAQ;MAAEU;IAAkB,CAAC,GACzD;MAAEI,OAAO;MAAEd,QAAQ;MAAEhC;IAAgB,CAAC;EAC5C;EAEA,OAAOqD,mBAAmB,CAACtE,OAAO;AACpC"}
|
|
1
|
+
{"version":3,"names":["useEffect","useRef","makeShareable","startMapper","stopMapper","updateProps","updatePropsJestWrapper","initialUpdaterRun","useSharedValue","buildWorkletsHash","isAnimated","shallowEqual","validateAnimatedStyles","makeViewDescriptorsSet","useViewRefSet","isJest","shouldBeUseWeb","isWorkletFunction","SHOULD_BE_USE_WEB","prepareAnimation","frameTimestamp","animatedProp","lastAnimation","lastValue","Array","isArray","forEach","prop","index","onFrame","animation","value","current","undefined","callStart","timestamp","onStart","Object","keys","key","runAnimations","result","animationsActive","allFinished","entry","finished","callback","k","styleUpdater","viewDescriptors","updater","state","maybeViewRef","isAnimatedProps","animations","newValues","oldValues","last","nonAnimatedNewValues","hasAnimations","hasNonAnimatedValues","global","__frameTimestamp","_getAnimationTimestamp","frame","isAnimationCancelled","isAnimationRunning","updates","propName","requestAnimationFrame","jestStyleUpdater","animatedStyle","adapters","length","checkSharedValueUsage","currentKey","element","Error","useAnimatedStyle","dependencies","viewsRef","animatedUpdaterData","inputs","values","__closure","_dependencies","__DEV__","adaptersArray","adaptersHash","areAnimationsActive","jestAnimatedStyle","__workletHash","push","initialStyle","initial","remoteState","shareableViewDescriptors","fun","updaterFn","adapter","mapperId","animatedStyleHandle"],"sources":["useAnimatedStyle.ts"],"sourcesContent":["'use strict';\nimport type { MutableRefObject } from 'react';\nimport { useEffect, useRef } from 'react';\n\nimport { makeShareable, startMapper, stopMapper } from '../core';\nimport updateProps, { updatePropsJestWrapper } from '../UpdateProps';\nimport { initialUpdaterRun } from '../animation';\nimport { useSharedValue } from './useSharedValue';\nimport {\n buildWorkletsHash,\n isAnimated,\n shallowEqual,\n validateAnimatedStyles,\n} from './utils';\nimport type {\n AnimatedStyleHandle,\n DefaultStyle,\n DependencyList,\n Descriptor,\n JestAnimatedStyleHandle,\n} from './commonTypes';\nimport type { ViewDescriptorsSet, ViewRefSet } from '../ViewDescriptorsSet';\nimport { makeViewDescriptorsSet, useViewRefSet } from '../ViewDescriptorsSet';\nimport { isJest, shouldBeUseWeb } from '../PlatformChecker';\nimport type {\n AnimationObject,\n Timestamp,\n NestedObjectValues,\n SharedValue,\n StyleProps,\n WorkletFunction,\n AnimatedPropsAdapterFunction,\n AnimatedPropsAdapterWorklet,\n} from '../commonTypes';\nimport type { AnimatedStyle } from '../helperTypes';\nimport { isWorkletFunction } from '../commonTypes';\n\nconst SHOULD_BE_USE_WEB = shouldBeUseWeb();\n\ninterface AnimatedState {\n last: AnimatedStyle<any>;\n animations: AnimatedStyle<any>;\n isAnimationRunning: boolean;\n isAnimationCancelled: boolean;\n}\n\ninterface AnimatedUpdaterData {\n initial: {\n value: AnimatedStyle<any>;\n updater: () => AnimatedStyle<any>;\n };\n remoteState: AnimatedState;\n viewDescriptors: ViewDescriptorsSet;\n}\n\nfunction prepareAnimation(\n frameTimestamp: number,\n animatedProp: AnimatedStyle<any>,\n lastAnimation: AnimatedStyle<any>,\n lastValue: AnimatedStyle<any>\n): void {\n 'worklet';\n if (Array.isArray(animatedProp)) {\n animatedProp.forEach((prop, index) => {\n prepareAnimation(\n frameTimestamp,\n prop,\n lastAnimation && lastAnimation[index],\n lastValue && lastValue[index]\n );\n });\n // return animatedProp;\n }\n if (typeof animatedProp === 'object' && animatedProp.onFrame) {\n const animation = animatedProp;\n\n let value = animation.current;\n if (lastValue !== undefined && lastValue !== null) {\n if (typeof lastValue === 'object') {\n if (lastValue.value !== undefined) {\n // previously it was a shared value\n value = lastValue.value;\n } else if (lastValue.onFrame !== undefined) {\n if (lastAnimation?.current !== undefined) {\n // it was an animation before, copy its state\n value = lastAnimation.current;\n } else if (lastValue?.current !== undefined) {\n // it was initialized\n value = lastValue.current;\n }\n }\n } else {\n // previously it was a plain value, just set it as starting point\n value = lastValue;\n }\n }\n\n animation.callStart = (timestamp: Timestamp) => {\n animation.onStart(animation, value, timestamp, lastAnimation);\n };\n animation.callStart(frameTimestamp);\n animation.callStart = null;\n } else if (typeof animatedProp === 'object') {\n // it is an object\n Object.keys(animatedProp).forEach((key) =>\n prepareAnimation(\n frameTimestamp,\n animatedProp[key],\n lastAnimation && lastAnimation[key],\n lastValue && lastValue[key]\n )\n );\n }\n}\n\nfunction runAnimations(\n animation: AnimatedStyle<any>,\n timestamp: Timestamp,\n key: number | string,\n result: AnimatedStyle<any>,\n animationsActive: SharedValue<boolean>\n): boolean {\n 'worklet';\n if (!animationsActive.value) {\n return true;\n }\n if (Array.isArray(animation)) {\n result[key] = [];\n let allFinished = true;\n animation.forEach((entry, index) => {\n if (\n !runAnimations(entry, timestamp, index, result[key], animationsActive)\n ) {\n allFinished = false;\n }\n });\n return allFinished;\n } else if (typeof animation === 'object' && animation.onFrame) {\n let finished = true;\n if (!animation.finished) {\n if (animation.callStart) {\n animation.callStart(timestamp);\n animation.callStart = null;\n }\n finished = animation.onFrame(animation, timestamp);\n animation.timestamp = timestamp;\n if (finished) {\n animation.finished = true;\n animation.callback && animation.callback(true /* finished */);\n }\n }\n result[key] = animation.current;\n return finished;\n } else if (typeof animation === 'object') {\n result[key] = {};\n let allFinished = true;\n Object.keys(animation).forEach((k) => {\n if (\n !runAnimations(\n animation[k],\n timestamp,\n k,\n result[key],\n animationsActive\n )\n ) {\n allFinished = false;\n }\n });\n return allFinished;\n } else {\n result[key] = animation;\n return true;\n }\n}\n\nfunction styleUpdater(\n viewDescriptors: SharedValue<Descriptor[]>,\n updater: WorkletFunction<[], AnimatedStyle<any>> | (() => AnimatedStyle<any>),\n state: AnimatedState,\n maybeViewRef: ViewRefSet<any> | undefined,\n animationsActive: SharedValue<boolean>,\n isAnimatedProps = false\n): void {\n 'worklet';\n const animations = state.animations ?? {};\n const newValues = updater() ?? {};\n const oldValues = state.last;\n const nonAnimatedNewValues: StyleProps = {};\n\n let hasAnimations = false;\n let frameTimestamp: number | undefined;\n let hasNonAnimatedValues = false;\n for (const key in newValues) {\n const value = newValues[key];\n if (isAnimated(value)) {\n frameTimestamp =\n global.__frameTimestamp || global._getAnimationTimestamp();\n prepareAnimation(frameTimestamp, value, animations[key], oldValues[key]);\n animations[key] = value;\n hasAnimations = true;\n } else {\n hasNonAnimatedValues = true;\n nonAnimatedNewValues[key] = value;\n delete animations[key];\n }\n }\n\n if (hasAnimations) {\n const frame = (timestamp: Timestamp) => {\n // eslint-disable-next-line @typescript-eslint/no-shadow\n const { animations, last, isAnimationCancelled } = state;\n if (isAnimationCancelled) {\n state.isAnimationRunning = false;\n return;\n }\n\n const updates: AnimatedStyle<any> = {};\n let allFinished = true;\n for (const propName in animations) {\n const finished = runAnimations(\n animations[propName],\n timestamp,\n propName,\n updates,\n animationsActive\n );\n if (finished) {\n last[propName] = updates[propName];\n delete animations[propName];\n } else {\n allFinished = false;\n }\n }\n\n if (updates) {\n updateProps(viewDescriptors, updates, maybeViewRef);\n }\n\n if (!allFinished) {\n requestAnimationFrame(frame);\n } else {\n state.isAnimationRunning = false;\n }\n };\n\n state.animations = animations;\n if (!state.isAnimationRunning) {\n state.isAnimationCancelled = false;\n state.isAnimationRunning = true;\n frame(frameTimestamp!);\n }\n\n if (hasNonAnimatedValues) {\n updateProps(viewDescriptors, nonAnimatedNewValues, maybeViewRef);\n }\n } else {\n state.isAnimationCancelled = true;\n state.animations = [];\n\n if (!shallowEqual(oldValues, newValues)) {\n updateProps(viewDescriptors, newValues, maybeViewRef, isAnimatedProps);\n }\n }\n state.last = newValues;\n}\n\nfunction jestStyleUpdater(\n viewDescriptors: SharedValue<Descriptor[]>,\n updater: WorkletFunction<[], AnimatedStyle<any>> | (() => AnimatedStyle<any>),\n state: AnimatedState,\n maybeViewRef: ViewRefSet<any> | undefined,\n animationsActive: SharedValue<boolean>,\n animatedStyle: MutableRefObject<AnimatedStyle<any>>,\n adapters: AnimatedPropsAdapterFunction[]\n): void {\n 'worklet';\n const animations: AnimatedStyle<any> = state.animations ?? {};\n const newValues = updater() ?? {};\n const oldValues = state.last;\n\n // extract animated props\n let hasAnimations = false;\n let frameTimestamp: number | undefined;\n Object.keys(animations).forEach((key) => {\n const value = newValues[key];\n if (!isAnimated(value)) {\n delete animations[key];\n }\n });\n Object.keys(newValues).forEach((key) => {\n const value = newValues[key];\n if (isAnimated(value)) {\n frameTimestamp =\n global.__frameTimestamp || global._getAnimationTimestamp();\n prepareAnimation(frameTimestamp, value, animations[key], oldValues[key]);\n animations[key] = value;\n hasAnimations = true;\n }\n });\n\n function frame(timestamp: Timestamp) {\n // eslint-disable-next-line @typescript-eslint/no-shadow\n const { animations, last, isAnimationCancelled } = state;\n if (isAnimationCancelled) {\n state.isAnimationRunning = false;\n return;\n }\n\n const updates: AnimatedStyle<any> = {};\n let allFinished = true;\n Object.keys(animations).forEach((propName) => {\n const finished = runAnimations(\n animations[propName],\n timestamp,\n propName,\n updates,\n animationsActive\n );\n if (finished) {\n last[propName] = updates[propName];\n delete animations[propName];\n } else {\n allFinished = false;\n }\n });\n\n if (Object.keys(updates).length) {\n updatePropsJestWrapper(\n viewDescriptors,\n updates,\n maybeViewRef,\n animatedStyle,\n adapters\n );\n }\n\n if (!allFinished) {\n requestAnimationFrame(frame);\n } else {\n state.isAnimationRunning = false;\n }\n }\n\n if (hasAnimations) {\n state.animations = animations;\n if (!state.isAnimationRunning) {\n state.isAnimationCancelled = false;\n state.isAnimationRunning = true;\n frame(frameTimestamp!);\n }\n } else {\n state.isAnimationCancelled = true;\n state.animations = [];\n }\n\n // calculate diff\n state.last = newValues;\n\n if (!shallowEqual(oldValues, newValues)) {\n updatePropsJestWrapper(\n viewDescriptors,\n newValues,\n maybeViewRef,\n animatedStyle,\n adapters\n );\n }\n}\n\n// check for invalid usage of shared values in returned object\nfunction checkSharedValueUsage(\n prop: NestedObjectValues<AnimationObject>,\n currentKey?: string\n): void {\n if (Array.isArray(prop)) {\n // if it's an array (i.ex. transform) validate all its elements\n for (const element of prop) {\n checkSharedValueUsage(element, currentKey);\n }\n } else if (\n typeof prop === 'object' &&\n prop !== null &&\n prop.value === undefined\n ) {\n // if it's a nested object, run validation for all its props\n for (const key of Object.keys(prop)) {\n checkSharedValueUsage(prop[key], key);\n }\n } else if (\n currentKey !== undefined &&\n typeof prop === 'object' &&\n prop !== null &&\n prop.value !== undefined\n ) {\n // if shared value is passed insted of its value, throw an error\n throw new Error(\n `[Reanimated] Invalid value passed to \\`${currentKey}\\`, maybe you forgot to use \\`.value\\`?`\n );\n }\n}\n\n/**\n * Lets you create a styles object, similar to StyleSheet styles, which can be animated using shared values.\n *\n * @param updater - A function returning an object with style properties you want to animate.\n * @param dependencies - An optional array of dependencies. Only relevant when using Reanimated without the Babel plugin on the Web.\n * @returns An animated style object which has to be passed to the `style` property of an Animated component you want to animate.\n * @see https://docs.swmansion.com/react-native-reanimated/docs/core/useAnimatedStyle\n */\n// You cannot pass Shared Values to `useAnimatedStyle` directly.\n// @ts-expect-error This overload is required by our API.\nexport function useAnimatedStyle<Style extends DefaultStyle>(\n updater: () => Style,\n dependencies?: DependencyList | null\n): Style;\n\nexport function useAnimatedStyle<Style extends DefaultStyle>(\n updater:\n | WorkletFunction<[], Style>\n | ((() => Style) & Record<string, unknown>),\n dependencies?: DependencyList | null,\n adapters?: AnimatedPropsAdapterWorklet | AnimatedPropsAdapterWorklet[] | null,\n isAnimatedProps = false\n): AnimatedStyleHandle<Style> | JestAnimatedStyleHandle<Style> {\n const viewsRef: ViewRefSet<unknown> | undefined = useViewRefSet();\n const animatedUpdaterData = useRef<AnimatedUpdaterData>();\n let inputs = Object.values(updater.__closure ?? {});\n if (SHOULD_BE_USE_WEB) {\n if (!inputs.length && dependencies?.length) {\n // let web work without a Babel plugin\n inputs = dependencies;\n }\n if (\n __DEV__ &&\n !inputs.length &&\n !dependencies &&\n !isWorkletFunction(updater)\n ) {\n throw new Error(\n `[Reanimated] \\`useAnimatedStyle\\` was used without a dependency array or Babel plugin. Please explicitly pass a dependency array, or enable the Babel plugin.\nFor more, see the docs: \\`https://docs.swmansion.com/react-native-reanimated/docs/guides/web-support#web-without-the-babel-plugin\\`.`\n );\n }\n }\n const adaptersArray = adapters\n ? Array.isArray(adapters)\n ? adapters\n : [adapters]\n : [];\n const adaptersHash = adapters ? buildWorkletsHash(adaptersArray) : null;\n const areAnimationsActive = useSharedValue<boolean>(true);\n const jestAnimatedStyle = useRef<Style>({} as Style);\n\n // build dependencies\n if (!dependencies) {\n dependencies = [...inputs, updater.__workletHash];\n } else {\n dependencies.push(updater.__workletHash);\n }\n adaptersHash && dependencies.push(adaptersHash);\n\n if (!animatedUpdaterData.current) {\n const initialStyle = initialUpdaterRun(updater);\n if (__DEV__) {\n validateAnimatedStyles(initialStyle);\n }\n animatedUpdaterData.current = {\n initial: {\n value: initialStyle,\n updater,\n },\n remoteState: makeShareable({\n last: initialStyle,\n animations: {},\n isAnimationCancelled: false,\n isAnimationRunning: false,\n }),\n viewDescriptors: makeViewDescriptorsSet(),\n };\n }\n\n const { initial, remoteState, viewDescriptors } = animatedUpdaterData.current;\n const shareableViewDescriptors = viewDescriptors.shareableViewDescriptors;\n\n dependencies.push(shareableViewDescriptors);\n\n useEffect(() => {\n let fun;\n let updaterFn = updater;\n if (adapters) {\n updaterFn = (() => {\n 'worklet';\n const newValues = updater();\n adaptersArray.forEach((adapter) => {\n adapter(newValues as Record<string, unknown>);\n });\n return newValues;\n }) as WorkletFunction<[], Style>;\n }\n\n if (isJest()) {\n fun = () => {\n 'worklet';\n jestStyleUpdater(\n shareableViewDescriptors,\n updater,\n remoteState,\n viewsRef,\n areAnimationsActive,\n jestAnimatedStyle,\n adaptersArray\n );\n };\n } else {\n fun = () => {\n 'worklet';\n styleUpdater(\n shareableViewDescriptors,\n updaterFn,\n remoteState,\n viewsRef,\n areAnimationsActive,\n isAnimatedProps\n );\n };\n }\n const mapperId = startMapper(fun, inputs);\n return () => {\n stopMapper(mapperId);\n };\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, dependencies);\n\n useEffect(() => {\n areAnimationsActive.value = true;\n return () => {\n areAnimationsActive.value = false;\n };\n }, [areAnimationsActive]);\n\n checkSharedValueUsage(initial.value);\n\n const animatedStyleHandle = useRef<\n AnimatedStyleHandle<Style> | JestAnimatedStyleHandle<Style> | null\n >(null);\n\n if (!animatedStyleHandle.current) {\n animatedStyleHandle.current = isJest()\n ? { viewDescriptors, initial, viewsRef, jestAnimatedStyle }\n : { initial, viewsRef, viewDescriptors };\n }\n\n return animatedStyleHandle.current;\n}\n"],"mappings":"AAAA,YAAY;;AAEZ,SAASA,SAAS,EAAEC,MAAM,QAAQ,OAAO;AAEzC,SAASC,aAAa,EAAEC,WAAW,EAAEC,UAAU,QAAQ,SAAS;AAChE,OAAOC,WAAW,IAAIC,sBAAsB,QAAQ,gBAAgB;AACpE,SAASC,iBAAiB,QAAQ,cAAc;AAChD,SAASC,cAAc,QAAQ,kBAAkB;AACjD,SACEC,iBAAiB,EACjBC,UAAU,EACVC,YAAY,EACZC,sBAAsB,QACjB,SAAS;AAShB,SAASC,sBAAsB,EAAEC,aAAa,QAAQ,uBAAuB;AAC7E,SAASC,MAAM,EAAEC,cAAc,QAAQ,oBAAoB;AAY3D,SAASC,iBAAiB,QAAQ,gBAAgB;AAElD,MAAMC,iBAAiB,GAAGF,cAAc,CAAC,CAAC;AAkB1C,SAASG,gBAAgBA,CACvBC,cAAsB,EACtBC,YAAgC,EAChCC,aAAiC,EACjCC,SAA6B,EACvB;EACN,SAAS;;EACT,IAAIC,KAAK,CAACC,OAAO,CAACJ,YAAY,CAAC,EAAE;IAC/BA,YAAY,CAACK,OAAO,CAAC,CAACC,IAAI,EAAEC,KAAK,KAAK;MACpCT,gBAAgB,CACdC,cAAc,EACdO,IAAI,EACJL,aAAa,IAAIA,aAAa,CAACM,KAAK,CAAC,EACrCL,SAAS,IAAIA,SAAS,CAACK,KAAK,CAC9B,CAAC;IACH,CAAC,CAAC;IACF;EACF;EACA,IAAI,OAAOP,YAAY,KAAK,QAAQ,IAAIA,YAAY,CAACQ,OAAO,EAAE;IAC5D,MAAMC,SAAS,GAAGT,YAAY;IAE9B,IAAIU,KAAK,GAAGD,SAAS,CAACE,OAAO;IAC7B,IAAIT,SAAS,KAAKU,SAAS,IAAIV,SAAS,KAAK,IAAI,EAAE;MACjD,IAAI,OAAOA,SAAS,KAAK,QAAQ,EAAE;QACjC,IAA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GAAG,GAAGA,CAAA,KAAM;QACV,SAAS;;QACTjD,YAAY,CACVgD,wBAAwB,EACxBE,SAAS,EACTH,WAAW,EACXf,QAAQ,EACRS,mBAAmB,EACnBpC,eACF,CAAC;MACH,CAAC;IACH;IACA,MAAM+C,QAAQ,GAAGjG,WAAW,CAAC8F,GAAG,EAAEf,MAAM,CAAC;IACzC,OAAO,MAAM;MACX9E,UAAU,CAACgG,QAAQ,CAAC;IACtB,CAAC;IACD;EACF,CAAC,EAAErB,YAAY,CAAC;EAEhB/E,SAAS,CAAC,MAAM;IACdyF,mBAAmB,CAAC1D,KAAK,GAAG,IAAI;IAChC,OAAO,MAAM;MACX0D,mBAAmB,CAAC1D,KAAK,GAAG,KAAK;IACnC,CAAC;EACH,CAAC,EAAE,CAAC0D,mBAAmB,CAAC,CAAC;EAEzBf,qBAAqB,CAACoB,OAAO,CAAC/D,KAAK,CAAC;EAEpC,MAAMsE,mBAAmB,GAAGpG,MAAM,CAEhC,IAAI,CAAC;EAEP,IAAI,CAACoG,mBAAmB,CAACrE,OAAO,EAAE;IAChCqE,mBAAmB,CAACrE,OAAO,GAAGjB,MAAM,CAAC,CAAC,GAClC;MAAEkC,eAAe;MAAE6C,OAAO;MAAEd,QAAQ;MAAEU;IAAkB,CAAC,GACzD;MAAEI,OAAO;MAAEd,QAAQ;MAAE/B;IAAgB,CAAC;EAC5C;EAEA,OAAOoD,mBAAmB,CAACrE,OAAO;AACpC","ignoreList":[]}
|
|
@@ -12,7 +12,9 @@ import { shouldBeUseWeb } from '../PlatformChecker';
|
|
|
12
12
|
* @param dependencies - An optional array of dependencies. Only relevant when using Reanimated without the Babel plugin on the Web.
|
|
13
13
|
* @returns A new readonly shared value based on a value returned from the updater function
|
|
14
14
|
* @see https://docs.swmansion.com/react-native-reanimated/docs/core/useDerivedValue
|
|
15
|
-
*/
|
|
15
|
+
*/
|
|
16
|
+
// @ts-expect-error This overload is required by our API.
|
|
17
|
+
|
|
16
18
|
export function useDerivedValue(updater, dependencies) {
|
|
17
19
|
const initRef = useRef(null);
|
|
18
20
|
let inputs = Object.values(updater.__closure ?? {});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["useEffect","useRef","initialUpdaterRun","makeMutable","startMapper","stopMapper","shouldBeUseWeb","useDerivedValue","updater","dependencies","initRef","inputs","Object","values","__closure","_dependencies","length","undefined","__workletHash","push","current","sharedValue","fun","value","mapperId"],"sources":["useDerivedValue.ts"],"sourcesContent":["'use strict';\nimport { useEffect, useRef } from 'react';\nimport { initialUpdaterRun } from '../animation';\nimport type { SharedValue, WorkletFunction } from '../commonTypes';\nimport { makeMutable, startMapper, stopMapper } from '../core';\nimport type { DependencyList } from './commonTypes';\nimport { shouldBeUseWeb } from '../PlatformChecker';\n\nexport type DerivedValue<Value> = Readonly<SharedValue<Value>>;\n\n/**\n * Lets you create new shared values based on existing ones while keeping them reactive.\n *\n * @param updater - A function called whenever at least one of the shared values or state used in the function body changes.\n * @param dependencies - An optional array of dependencies. Only relevant when using Reanimated without the Babel plugin on the Web.\n * @returns A new readonly shared value based on a value returned from the updater function\n * @see https://docs.swmansion.com/react-native-reanimated/docs/core/useDerivedValue\n */\n// @ts-expect-error This overload is required by our API.\nexport function useDerivedValue<Value>(\n updater: () => Value,\n dependencies?: DependencyList\n): DerivedValue<Value>;\n\nexport function useDerivedValue<Value>(\n updater: WorkletFunction<[], Value>,\n dependencies?: DependencyList\n): DerivedValue<Value> {\n const initRef = useRef<SharedValue<Value> | null>(null);\n let inputs = Object.values(updater.__closure ?? {});\n if (shouldBeUseWeb()) {\n if (!inputs.length && dependencies?.length) {\n // let web work without a Babel/SWC plugin\n inputs = dependencies;\n }\n }\n\n // build dependencies\n if (dependencies === undefined) {\n dependencies = [...inputs, updater.__workletHash];\n } else {\n dependencies.push(updater.__workletHash);\n }\n\n if (initRef.current === null) {\n initRef.current = makeMutable(initialUpdaterRun(updater));\n }\n\n const sharedValue: SharedValue<Value> = initRef.current;\n\n useEffect(() => {\n const fun = () => {\n 'worklet';\n sharedValue.value = updater();\n };\n const mapperId = startMapper(fun, inputs, [sharedValue]);\n return () => {\n stopMapper(mapperId);\n };\n }, dependencies);\n\n useEffect(() => {\n return () => {\n initRef.current = null;\n };\n }, []);\n\n return sharedValue;\n}\n"],"mappings":"AAAA,YAAY;;AACZ,SAASA,SAAS,EAAEC,MAAM,QAAQ,OAAO;AACzC,SAASC,iBAAiB,QAAQ,cAAc;AAEhD,SAASC,WAAW,EAAEC,WAAW,EAAEC,UAAU,QAAQ,SAAS;AAE9D,SAASC,cAAc,QAAQ,oBAAoB;;AAInD;AACA;AACA;AACA;AACA;AACA;AACA;AACA
|
|
1
|
+
{"version":3,"names":["useEffect","useRef","initialUpdaterRun","makeMutable","startMapper","stopMapper","shouldBeUseWeb","useDerivedValue","updater","dependencies","initRef","inputs","Object","values","__closure","_dependencies","length","undefined","__workletHash","push","current","sharedValue","fun","value","mapperId"],"sources":["useDerivedValue.ts"],"sourcesContent":["'use strict';\nimport { useEffect, useRef } from 'react';\nimport { initialUpdaterRun } from '../animation';\nimport type { SharedValue, WorkletFunction } from '../commonTypes';\nimport { makeMutable, startMapper, stopMapper } from '../core';\nimport type { DependencyList } from './commonTypes';\nimport { shouldBeUseWeb } from '../PlatformChecker';\n\nexport type DerivedValue<Value> = Readonly<SharedValue<Value>>;\n\n/**\n * Lets you create new shared values based on existing ones while keeping them reactive.\n *\n * @param updater - A function called whenever at least one of the shared values or state used in the function body changes.\n * @param dependencies - An optional array of dependencies. Only relevant when using Reanimated without the Babel plugin on the Web.\n * @returns A new readonly shared value based on a value returned from the updater function\n * @see https://docs.swmansion.com/react-native-reanimated/docs/core/useDerivedValue\n */\n// @ts-expect-error This overload is required by our API.\nexport function useDerivedValue<Value>(\n updater: () => Value,\n dependencies?: DependencyList\n): DerivedValue<Value>;\n\nexport function useDerivedValue<Value>(\n updater: WorkletFunction<[], Value>,\n dependencies?: DependencyList\n): DerivedValue<Value> {\n const initRef = useRef<SharedValue<Value> | null>(null);\n let inputs = Object.values(updater.__closure ?? {});\n if (shouldBeUseWeb()) {\n if (!inputs.length && dependencies?.length) {\n // let web work without a Babel/SWC plugin\n inputs = dependencies;\n }\n }\n\n // build dependencies\n if (dependencies === undefined) {\n dependencies = [...inputs, updater.__workletHash];\n } else {\n dependencies.push(updater.__workletHash);\n }\n\n if (initRef.current === null) {\n initRef.current = makeMutable(initialUpdaterRun(updater));\n }\n\n const sharedValue: SharedValue<Value> = initRef.current;\n\n useEffect(() => {\n const fun = () => {\n 'worklet';\n sharedValue.value = updater();\n };\n const mapperId = startMapper(fun, inputs, [sharedValue]);\n return () => {\n stopMapper(mapperId);\n };\n }, dependencies);\n\n useEffect(() => {\n return () => {\n initRef.current = null;\n };\n }, []);\n\n return sharedValue;\n}\n"],"mappings":"AAAA,YAAY;;AACZ,SAASA,SAAS,EAAEC,MAAM,QAAQ,OAAO;AACzC,SAASC,iBAAiB,QAAQ,cAAc;AAEhD,SAASC,WAAW,EAAEC,WAAW,EAAEC,UAAU,QAAQ,SAAS;AAE9D,SAASC,cAAc,QAAQ,oBAAoB;;AAInD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAMA,OAAO,SAASC,eAAeA,CAC7BC,OAAmC,EACnCC,YAA6B,EACR;EACrB,MAAMC,OAAO,GAAGT,MAAM,CAA4B,IAAI,CAAC;EACvD,IAAIU,MAAM,GAAGC,MAAM,CAACC,MAAM,CAACL,OAAO,CAACM,SAAS,IAAI,CAAC,CAAC,CAAC;EACnD,IAAIR,cAAc,CAAC,CAAC,EAAE;IAAA,IAAAS,aAAA;IACpB,IAAI,CAACJ,MAAM,CAACK,MAAM,KAAAD,aAAA,GAAIN,YAAY,cAAAM,aAAA,eAAZA,aAAA,CAAcC,MAAM,EAAE;MAC1C;MACAL,MAAM,GAAGF,YAAY;IACvB;EACF;;EAEA;EACA,IAAIA,YAAY,KAAKQ,SAAS,EAAE;IAC9BR,YAAY,GAAG,CAAC,GAAGE,MAAM,EAAEH,OAAO,CAACU,aAAa,CAAC;EACnD,CAAC,MAAM;IACLT,YAAY,CAACU,IAAI,CAACX,OAAO,CAACU,aAAa,CAAC;EAC1C;EAEA,IAAIR,OAAO,CAACU,OAAO,KAAK,IAAI,EAAE;IAC5BV,OAAO,CAACU,OAAO,GAAGjB,WAAW,CAACD,iBAAiB,CAACM,OAAO,CAAC,CAAC;EAC3D;EAEA,MAAMa,WAA+B,GAAGX,OAAO,CAACU,OAAO;EAEvDpB,SAAS,CAAC,MAAM;IACd,MAAMsB,GAAG,GAAGA,CAAA,KAAM;MAChB,SAAS;;MACTD,WAAW,CAACE,KAAK,GAAGf,OAAO,CAAC,CAAC;IAC/B,CAAC;IACD,MAAMgB,QAAQ,GAAGpB,WAAW,CAACkB,GAAG,EAAEX,MAAM,EAAE,CAACU,WAAW,CAAC,CAAC;IACxD,OAAO,MAAM;MACXhB,UAAU,CAACmB,QAAQ,CAAC;IACtB,CAAC;EACH,CAAC,EAAEf,YAAY,CAAC;EAEhBT,SAAS,CAAC,MAAM;IACd,OAAO,MAAM;MACXU,OAAO,CAACU,OAAO,GAAG,IAAI;IACxB,CAAC;EACH,CAAC,EAAE,EAAE,CAAC;EAEN,OAAOC,WAAW;AACpB","ignoreList":[]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
import { useRef } from 'react';
|
|
4
|
-
import WorkletEventHandler from '../WorkletEventHandler';
|
|
4
|
+
import { WorkletEventHandler } from '../WorkletEventHandler';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* Worklet to provide as an argument to `useEvent` hook.
|
|
@@ -21,9 +21,8 @@ import WorkletEventHandler from '../WorkletEventHandler';
|
|
|
21
21
|
// an AnimatedComponent are event handlers and we don't want to force the user to define it.
|
|
22
22
|
// Therefore we disguise `useEvent` return type as a simple function and we handle
|
|
23
23
|
// it being a React Ref in `createAnimatedComponent`.
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
let rebuild = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
24
|
+
|
|
25
|
+
export function useEvent(handler, eventNames = [], rebuild = false) {
|
|
27
26
|
const initRef = useRef(null);
|
|
28
27
|
if (initRef.current === null) {
|
|
29
28
|
const workletEventHandler = new WorkletEventHandler(handler, eventNames);
|
|
@@ -32,7 +31,7 @@ export function useEvent(handler) {
|
|
|
32
31
|
};
|
|
33
32
|
} else if (rebuild) {
|
|
34
33
|
const workletEventHandler = initRef.current.workletEventHandler;
|
|
35
|
-
workletEventHandler.
|
|
34
|
+
workletEventHandler.updateEventHandler(handler, eventNames);
|
|
36
35
|
initRef.current = {
|
|
37
36
|
workletEventHandler
|
|
38
37
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["useRef","WorkletEventHandler","useEvent","handler","eventNames","
|
|
1
|
+
{"version":3,"names":["useRef","WorkletEventHandler","useEvent","handler","eventNames","rebuild","initRef","current","workletEventHandler","updateEventHandler"],"sources":["useEvent.ts"],"sourcesContent":["'use strict';\nimport { useRef } from 'react';\nimport { WorkletEventHandler } from '../WorkletEventHandler';\nimport type { IWorkletEventHandler, ReanimatedEvent } from './commonTypes';\n\n/**\n * Worklet to provide as an argument to `useEvent` hook.\n */\nexport type EventHandler<\n Event extends object,\n Context extends Record<string, unknown> = never\n> = (event: ReanimatedEvent<Event>, context?: Context) => void;\n\nexport type EventHandlerProcessed<\n Event extends object,\n Context extends Record<string, unknown> = never\n> = (event: Event, context?: Context) => void;\n\nexport type EventHandlerInternal<Event extends object> = {\n workletEventHandler: IWorkletEventHandler<Event>;\n};\n\n/**\n * Lets you run a function whenever a specified native event occurs.\n *\n * @param handler - A function that receives an event object with event data - {@link EventHandler}.\n * @param eventNames - An array of event names the `handler` callback will react to.\n * @param rebuild - Whether the event handler should be rebuilt. Defaults to `false`.\n * @returns A function that will be called when the event occurs - {@link EventHandlerProcessed}.\n * @see https://docs.swmansion.com/react-native-reanimated/docs/advanced/useEvent\n */\n// @ts-expect-error This overload is required by our API.\n// We don't know which properites of a component that is made into\n// an AnimatedComponent are event handlers and we don't want to force the user to define it.\n// Therefore we disguise `useEvent` return type as a simple function and we handle\n// it being a React Ref in `createAnimatedComponent`.\nexport function useEvent<\n Event extends object,\n Context extends Record<string, unknown> = never\n>(\n handler: EventHandler<Event, Context>,\n eventNames?: string[],\n rebuild?: boolean\n): EventHandlerProcessed<Event, Context>;\n\nexport function useEvent<Event extends object, Context = never>(\n handler: (event: ReanimatedEvent<Event>, context?: Context) => void,\n eventNames: string[] = [],\n rebuild = false\n): EventHandlerInternal<Event> {\n const initRef = useRef<EventHandlerInternal<Event>>(null!);\n if (initRef.current === null) {\n const workletEventHandler = new WorkletEventHandler<Event>(\n handler,\n eventNames\n );\n initRef.current = { workletEventHandler };\n } else if (rebuild) {\n const workletEventHandler = initRef.current.workletEventHandler;\n workletEventHandler.updateEventHandler(handler, eventNames);\n initRef.current = { workletEventHandler };\n }\n\n return initRef.current;\n}\n"],"mappings":"AAAA,YAAY;;AACZ,SAASA,MAAM,QAAQ,OAAO;AAC9B,SAASC,mBAAmB,QAAQ,wBAAwB;;AAG5D;AACA;AACA;;AAeA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAUA,OAAO,SAASC,QAAQA,CACtBC,OAAmE,EACnEC,UAAoB,GAAG,EAAE,EACzBC,OAAO,GAAG,KAAK,EACc;EAC7B,MAAMC,OAAO,GAAGN,MAAM,CAA8B,IAAK,CAAC;EAC1D,IAAIM,OAAO,CAACC,OAAO,KAAK,IAAI,EAAE;IAC5B,MAAMC,mBAAmB,GAAG,IAAIP,mBAAmB,CACjDE,OAAO,EACPC,UACF,CAAC;IACDE,OAAO,CAACC,OAAO,GAAG;MAAEC;IAAoB,CAAC;EAC3C,CAAC,MAAM,IAAIH,OAAO,EAAE;IAClB,MAAMG,mBAAmB,GAAGF,OAAO,CAACC,OAAO,CAACC,mBAAmB;IAC/DA,mBAAmB,CAACC,kBAAkB,CAACN,OAAO,EAAEC,UAAU,CAAC;IAC3DE,OAAO,CAACC,OAAO,GAAG;MAAEC;IAAoB,CAAC;EAC3C;EAEA,OAAOF,OAAO,CAACC,OAAO;AACxB","ignoreList":[]}
|
|
@@ -20,8 +20,7 @@ const frameCallbackRegistry = new FrameCallbackRegistryJS();
|
|
|
20
20
|
* @returns A frame callback object - {@link FrameCallback}.
|
|
21
21
|
* @see https://docs.swmansion.com/react-native-reanimated/docs/advanced/useFrameCallback
|
|
22
22
|
*/
|
|
23
|
-
export function useFrameCallback(callback) {
|
|
24
|
-
let autostart = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
|
23
|
+
export function useFrameCallback(callback, autostart = true) {
|
|
25
24
|
const ref = useRef({
|
|
26
25
|
setActive: isActive => {
|
|
27
26
|
frameCallbackRegistry.manageStateFrameCallback(ref.current.callbackId, isActive);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["useEffect","useRef","FrameCallbackRegistryJS","frameCallbackRegistry","useFrameCallback","callback","autostart","
|
|
1
|
+
{"version":3,"names":["useEffect","useRef","FrameCallbackRegistryJS","frameCallbackRegistry","useFrameCallback","callback","autostart","ref","setActive","isActive","manageStateFrameCallback","current","callbackId","registerFrameCallback","unregisterFrameCallback"],"sources":["useFrameCallback.ts"],"sourcesContent":["'use strict';\nimport { useEffect, useRef } from 'react';\nimport FrameCallbackRegistryJS from '../frameCallback/FrameCallbackRegistryJS';\nimport type { FrameInfo } from '../frameCallback/FrameCallbackRegistryUI';\n\n/**\n * @param setActive - A function that lets you start the frame callback or stop it from running.\n * @param isActive - A boolean indicating whether a callback is running.\n * @param callbackId - A number indicating a unique identifier of the frame callback.\n * @see https://docs.swmansion.com/react-native-reanimated/docs/advanced/useFrameCallback#returns\n */\nexport type FrameCallback = {\n setActive: (isActive: boolean) => void;\n isActive: boolean;\n callbackId: number;\n};\nconst frameCallbackRegistry = new FrameCallbackRegistryJS();\n\n/**\n * Lets you run a function on every frame update.\n *\n * @param callback - A function executed on every frame update.\n * @param autostart - Whether the callback should start automatically. Defaults to `true`.\n * @returns A frame callback object - {@link FrameCallback}.\n * @see https://docs.swmansion.com/react-native-reanimated/docs/advanced/useFrameCallback\n */\nexport function useFrameCallback(\n callback: (frameInfo: FrameInfo) => void,\n autostart = true\n): FrameCallback {\n const ref = useRef<FrameCallback>({\n setActive: (isActive: boolean) => {\n frameCallbackRegistry.manageStateFrameCallback(\n ref.current.callbackId,\n isActive\n );\n ref.current.isActive = isActive;\n },\n isActive: autostart,\n callbackId: -1,\n });\n\n useEffect(() => {\n ref.current.callbackId =\n frameCallbackRegistry.registerFrameCallback(callback);\n ref.current.setActive(ref.current.isActive);\n\n return () => {\n frameCallbackRegistry.unregisterFrameCallback(ref.current.callbackId);\n ref.current.callbackId = -1;\n };\n }, [callback, autostart]);\n\n return ref.current;\n}\n"],"mappings":"AAAA,YAAY;;AACZ,SAASA,SAAS,EAAEC,MAAM,QAAQ,OAAO;AACzC,OAAOC,uBAAuB,MAAM,0CAA0C;;AAG9E;AACA;AACA;AACA;AACA;AACA;;AAMA,MAAMC,qBAAqB,GAAG,IAAID,uBAAuB,CAAC,CAAC;;AAE3D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASE,gBAAgBA,CAC9BC,QAAwC,EACxCC,SAAS,GAAG,IAAI,EACD;EACf,MAAMC,GAAG,GAAGN,MAAM,CAAgB;IAChCO,SAAS,EAAGC,QAAiB,IAAK;MAChCN,qBAAqB,CAACO,wBAAwB,CAC5CH,GAAG,CAACI,OAAO,CAACC,UAAU,EACtBH,QACF,CAAC;MACDF,GAAG,CAACI,OAAO,CAACF,QAAQ,GAAGA,QAAQ;IACjC,CAAC;IACDA,QAAQ,EAAEH,SAAS;IACnBM,UAAU,EAAE,CAAC;EACf,CAAC,CAAC;EAEFZ,SAAS,CAAC,MAAM;IACdO,GAAG,CAACI,OAAO,CAACC,UAAU,GACpBT,qBAAqB,CAACU,qBAAqB,CAACR,QAAQ,CAAC;IACvDE,GAAG,CAACI,OAAO,CAACH,SAAS,CAACD,GAAG,CAACI,OAAO,CAACF,QAAQ,CAAC;IAE3C,OAAO,MAAM;MACXN,qBAAqB,CAACW,uBAAuB,CAACP,GAAG,CAACI,OAAO,CAACC,UAAU,CAAC;MACrEL,GAAG,CAACI,OAAO,CAACC,UAAU,GAAG,CAAC,CAAC;IAC7B,CAAC;EACH,CAAC,EAAE,CAACP,QAAQ,EAAEC,SAAS,CAAC,CAAC;EAEzB,OAAOC,GAAG,CAACI,OAAO;AACpB","ignoreList":[]}
|
|
@@ -12,7 +12,9 @@ import { makeShareable } from '../shareables';
|
|
|
12
12
|
* @param dependencies - An optional array of dependencies.
|
|
13
13
|
* @returns An object containing a boolean indicating whether the dependencies have changed, and a boolean indicating whether the code is running on the web.
|
|
14
14
|
* @see https://docs.swmansion.com/react-native-reanimated/docs/advanced/useHandler
|
|
15
|
-
*/
|
|
15
|
+
*/
|
|
16
|
+
// @ts-expect-error This overload is required by our API.
|
|
17
|
+
|
|
16
18
|
export function useHandler(handlers, dependencies) {
|
|
17
19
|
const initRef = useRef(null);
|
|
18
20
|
if (initRef.current === null) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["useEffect","useRef","isWeb","isJest","areDependenciesEqual","buildDependencies","makeShareable","useHandler","handlers","dependencies","initRef","current","context","savedDependencies","doDependenciesDiffer","useWeb"],"sources":["useHandler.ts"],"sourcesContent":["'use strict';\nimport { useEffect, useRef } from 'react';\nimport type { WorkletFunction } from '../commonTypes';\nimport { isWeb, isJest } from '../PlatformChecker';\nimport type { DependencyList, ReanimatedEvent } from './commonTypes';\nimport { areDependenciesEqual, buildDependencies } from './utils';\nimport { makeShareable } from '../shareables';\n\ninterface GeneralHandler<\n Event extends object,\n Context extends Record<string, unknown>\n> {\n (event: ReanimatedEvent<Event>, context: Context): void;\n}\n\ntype GeneralWorkletHandler<\n Event extends object,\n Context extends Record<string, unknown>\n> = WorkletFunction<[event: ReanimatedEvent<Event>, context: Context]>;\n\ntype GeneralHandlers<\n Event extends object,\n Context extends Record<string, unknown>\n> = Record<string, GeneralHandler<Event, Context> | undefined>;\n\ntype GeneralWorkletHandlers<\n Event extends object,\n Context extends Record<string, unknown>\n> = Record<string, GeneralWorkletHandler<Event, Context> | undefined>;\n\ninterface ContextWithDependencies<Context extends Record<string, unknown>> {\n context: Context;\n savedDependencies: DependencyList;\n}\n\nexport interface UseHandlerContext<Context extends Record<string, unknown>> {\n context: Context;\n doDependenciesDiffer: boolean;\n useWeb: boolean;\n}\n\n/**\n * Lets you find out whether the event handler dependencies have changed.\n *\n * @param handlers - An object of event handlers.\n * @param dependencies - An optional array of dependencies.\n * @returns An object containing a boolean indicating whether the dependencies have changed, and a boolean indicating whether the code is running on the web.\n * @see https://docs.swmansion.com/react-native-reanimated/docs/advanced/useHandler\n */\n// @ts-expect-error This overload is required by our API.\nexport function useHandler<\n Event extends object,\n Context extends Record<string, unknown>\n>(\n handlers: GeneralHandlers<Event, Context>,\n dependencies?: DependencyList\n): UseHandlerContext<Context>;\n\nexport function useHandler<\n Event extends object,\n Context extends Record<string, unknown>\n>(\n handlers: GeneralWorkletHandlers<Event, Context>,\n dependencies?: DependencyList\n): UseHandlerContext<Context> {\n const initRef = useRef<ContextWithDependencies<Context> | null>(null);\n if (initRef.current === null) {\n const context = makeShareable({} as Context);\n initRef.current = {\n context,\n savedDependencies: [],\n };\n }\n\n useEffect(() => {\n return () => {\n initRef.current = null;\n };\n }, []);\n\n const { context, savedDependencies } = initRef.current;\n\n dependencies = buildDependencies(\n dependencies,\n handlers as Record<string, WorkletFunction | undefined>\n );\n\n const doDependenciesDiffer = !areDependenciesEqual(\n dependencies,\n savedDependencies\n );\n initRef.current.savedDependencies = dependencies;\n const useWeb = isWeb() || isJest();\n\n return { context, doDependenciesDiffer, useWeb };\n}\n"],"mappings":"AAAA,YAAY;;AACZ,SAASA,SAAS,EAAEC,MAAM,QAAQ,OAAO;AAEzC,SAASC,KAAK,EAAEC,MAAM,QAAQ,oBAAoB;AAElD,SAASC,oBAAoB,EAAEC,iBAAiB,QAAQ,SAAS;AACjE,SAASC,aAAa,QAAQ,eAAe;;AAmC7C;AACA;AACA;AACA;AACA;AACA;AACA;AACA
|
|
1
|
+
{"version":3,"names":["useEffect","useRef","isWeb","isJest","areDependenciesEqual","buildDependencies","makeShareable","useHandler","handlers","dependencies","initRef","current","context","savedDependencies","doDependenciesDiffer","useWeb"],"sources":["useHandler.ts"],"sourcesContent":["'use strict';\nimport { useEffect, useRef } from 'react';\nimport type { WorkletFunction } from '../commonTypes';\nimport { isWeb, isJest } from '../PlatformChecker';\nimport type { DependencyList, ReanimatedEvent } from './commonTypes';\nimport { areDependenciesEqual, buildDependencies } from './utils';\nimport { makeShareable } from '../shareables';\n\ninterface GeneralHandler<\n Event extends object,\n Context extends Record<string, unknown>\n> {\n (event: ReanimatedEvent<Event>, context: Context): void;\n}\n\ntype GeneralWorkletHandler<\n Event extends object,\n Context extends Record<string, unknown>\n> = WorkletFunction<[event: ReanimatedEvent<Event>, context: Context]>;\n\ntype GeneralHandlers<\n Event extends object,\n Context extends Record<string, unknown>\n> = Record<string, GeneralHandler<Event, Context> | undefined>;\n\ntype GeneralWorkletHandlers<\n Event extends object,\n Context extends Record<string, unknown>\n> = Record<string, GeneralWorkletHandler<Event, Context> | undefined>;\n\ninterface ContextWithDependencies<Context extends Record<string, unknown>> {\n context: Context;\n savedDependencies: DependencyList;\n}\n\nexport interface UseHandlerContext<Context extends Record<string, unknown>> {\n context: Context;\n doDependenciesDiffer: boolean;\n useWeb: boolean;\n}\n\n/**\n * Lets you find out whether the event handler dependencies have changed.\n *\n * @param handlers - An object of event handlers.\n * @param dependencies - An optional array of dependencies.\n * @returns An object containing a boolean indicating whether the dependencies have changed, and a boolean indicating whether the code is running on the web.\n * @see https://docs.swmansion.com/react-native-reanimated/docs/advanced/useHandler\n */\n// @ts-expect-error This overload is required by our API.\nexport function useHandler<\n Event extends object,\n Context extends Record<string, unknown>\n>(\n handlers: GeneralHandlers<Event, Context>,\n dependencies?: DependencyList\n): UseHandlerContext<Context>;\n\nexport function useHandler<\n Event extends object,\n Context extends Record<string, unknown>\n>(\n handlers: GeneralWorkletHandlers<Event, Context>,\n dependencies?: DependencyList\n): UseHandlerContext<Context> {\n const initRef = useRef<ContextWithDependencies<Context> | null>(null);\n if (initRef.current === null) {\n const context = makeShareable({} as Context);\n initRef.current = {\n context,\n savedDependencies: [],\n };\n }\n\n useEffect(() => {\n return () => {\n initRef.current = null;\n };\n }, []);\n\n const { context, savedDependencies } = initRef.current;\n\n dependencies = buildDependencies(\n dependencies,\n handlers as Record<string, WorkletFunction | undefined>\n );\n\n const doDependenciesDiffer = !areDependenciesEqual(\n dependencies,\n savedDependencies\n );\n initRef.current.savedDependencies = dependencies;\n const useWeb = isWeb() || isJest();\n\n return { context, doDependenciesDiffer, useWeb };\n}\n"],"mappings":"AAAA,YAAY;;AACZ,SAASA,SAAS,EAAEC,MAAM,QAAQ,OAAO;AAEzC,SAASC,KAAK,EAAEC,MAAM,QAAQ,oBAAoB;AAElD,SAASC,oBAAoB,EAAEC,iBAAiB,QAAQ,SAAS;AACjE,SAASC,aAAa,QAAQ,eAAe;;AAmC7C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AASA,OAAO,SAASC,UAAUA,CAIxBC,QAAgD,EAChDC,YAA6B,EACD;EAC5B,MAAMC,OAAO,GAAGT,MAAM,CAA0C,IAAI,CAAC;EACrE,IAAIS,OAAO,CAACC,OAAO,KAAK,IAAI,EAAE;IAC5B,MAAMC,OAAO,GAAGN,aAAa,CAAC,CAAC,CAAY,CAAC;IAC5CI,OAAO,CAACC,OAAO,GAAG;MAChBC,OAAO;MACPC,iBAAiB,EAAE;IACrB,CAAC;EACH;EAEAb,SAAS,CAAC,MAAM;IACd,OAAO,MAAM;MACXU,OAAO,CAACC,OAAO,GAAG,IAAI;IACxB,CAAC;EACH,CAAC,EAAE,EAAE,CAAC;EAEN,MAAM;IAAEC,OAAO;IAAEC;EAAkB,CAAC,GAAGH,OAAO,CAACC,OAAO;EAEtDF,YAAY,GAAGJ,iBAAiB,CAC9BI,YAAY,EACZD,QACF,CAAC;EAED,MAAMM,oBAAoB,GAAG,CAACV,oBAAoB,CAChDK,YAAY,EACZI,iBACF,CAAC;EACDH,OAAO,CAACC,OAAO,CAACE,iBAAiB,GAAGJ,YAAY;EAChD,MAAMM,MAAM,GAAGb,KAAK,CAAC,CAAC,IAAIC,MAAM,CAAC,CAAC;EAElC,OAAO;IAAES,OAAO;IAAEE,oBAAoB;IAAEC;EAAO,CAAC;AAClD","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["isReducedMotion","IS_REDUCED_MOTION","useReducedMotion"],"sources":["useReducedMotion.ts"],"sourcesContent":["'use strict';\nimport { isReducedMotion } from '../PlatformChecker';\n\nconst IS_REDUCED_MOTION = isReducedMotion();\n\n/**\n * Lets you query the reduced motion system setting.\n *\n * Changing the reduced motion system setting doesn't cause your components to rerender.\n *\n * @returns A boolean indicating whether the reduced motion setting was enabled when the app started.\n * @see https://docs.swmansion.com/react-native-reanimated/docs/device/useReducedMotion\n */\nexport function useReducedMotion() {\n return IS_REDUCED_MOTION;\n}\n"],"mappings":"AAAA,YAAY;;AACZ,SAASA,eAAe,QAAQ,oBAAoB;AAEpD,MAAMC,iBAAiB,GAAGD,eAAe,
|
|
1
|
+
{"version":3,"names":["isReducedMotion","IS_REDUCED_MOTION","useReducedMotion"],"sources":["useReducedMotion.ts"],"sourcesContent":["'use strict';\nimport { isReducedMotion } from '../PlatformChecker';\n\nconst IS_REDUCED_MOTION = isReducedMotion();\n\n/**\n * Lets you query the reduced motion system setting.\n *\n * Changing the reduced motion system setting doesn't cause your components to rerender.\n *\n * @returns A boolean indicating whether the reduced motion setting was enabled when the app started.\n * @see https://docs.swmansion.com/react-native-reanimated/docs/device/useReducedMotion\n */\nexport function useReducedMotion() {\n return IS_REDUCED_MOTION;\n}\n"],"mappings":"AAAA,YAAY;;AACZ,SAASA,eAAe,QAAQ,oBAAoB;AAEpD,MAAMC,iBAAiB,GAAGD,eAAe,CAAC,CAAC;;AAE3C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASE,gBAAgBA,CAAA,EAAG;EACjC,OAAOD,iBAAiB;AAC1B","ignoreList":[]}
|