react-native-reanimated 3.6.0 → 3.6.2
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/lib/module/createAnimatedComponent/createAnimatedComponent.js +12 -0
- package/lib/module/createAnimatedComponent/createAnimatedComponent.js.map +1 -1
- package/lib/module/createAnimatedComponent/setAndForwardRef.js +2 -0
- package/lib/module/createAnimatedComponent/setAndForwardRef.js.map +1 -1
- package/lib/module/reanimated2/Easing.js +3 -3
- package/lib/module/reanimated2/Easing.js.map +1 -1
- package/lib/module/reanimated2/PlatformChecker.js.map +1 -1
- package/lib/module/reanimated2/animation/decay/decay.js +9 -0
- package/lib/module/reanimated2/animation/decay/decay.js.map +1 -1
- package/lib/module/reanimated2/animation/decay/utils.js +13 -0
- package/lib/module/reanimated2/animation/decay/utils.js.map +1 -1
- package/lib/module/reanimated2/animation/delay.js +9 -0
- package/lib/module/reanimated2/animation/delay.js.map +1 -1
- package/lib/module/reanimated2/animation/repeat.js +11 -0
- package/lib/module/reanimated2/animation/repeat.js.map +1 -1
- package/lib/module/reanimated2/animation/sequence.js +10 -0
- package/lib/module/reanimated2/animation/sequence.js.map +1 -1
- package/lib/module/reanimated2/animation/spring.js +9 -0
- package/lib/module/reanimated2/animation/spring.js.map +1 -1
- package/lib/module/reanimated2/animation/springUtils.js +16 -0
- package/lib/module/reanimated2/animation/springUtils.js.map +1 -1
- package/lib/module/reanimated2/animation/timing.js +18 -0
- package/lib/module/reanimated2/animation/timing.js.map +1 -1
- package/lib/module/reanimated2/animation/util.js +7 -0
- package/lib/module/reanimated2/animation/util.js.map +1 -1
- package/lib/module/reanimated2/commonTypes.js +30 -7
- package/lib/module/reanimated2/commonTypes.js.map +1 -1
- package/lib/module/reanimated2/component/FlatList.js.map +1 -1
- package/lib/module/reanimated2/component/LayoutAnimationConfig.js +7 -0
- package/lib/module/reanimated2/component/LayoutAnimationConfig.js.map +1 -1
- package/lib/module/reanimated2/component/ScrollView.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/useAnimatedKeyboard.js +8 -0
- package/lib/module/reanimated2/hook/useAnimatedKeyboard.js.map +1 -1
- package/lib/module/reanimated2/hook/useAnimatedProps.js +9 -0
- package/lib/module/reanimated2/hook/useAnimatedProps.js.map +1 -1
- package/lib/module/reanimated2/hook/useAnimatedReaction.js +6 -4
- package/lib/module/reanimated2/hook/useAnimatedReaction.js.map +1 -1
- package/lib/module/reanimated2/hook/useAnimatedRef.js +7 -0
- package/lib/module/reanimated2/hook/useAnimatedRef.js.map +1 -1
- package/lib/module/reanimated2/hook/useAnimatedScrollHandler.js +10 -2
- package/lib/module/reanimated2/hook/useAnimatedScrollHandler.js.map +1 -1
- package/lib/module/reanimated2/hook/useAnimatedSensor.js +10 -0
- package/lib/module/reanimated2/hook/useAnimatedSensor.js.map +1 -1
- package/lib/module/reanimated2/hook/useAnimatedStyle.js +8 -0
- package/lib/module/reanimated2/hook/useAnimatedStyle.js.map +1 -1
- package/lib/module/reanimated2/hook/useDerivedValue.js +14 -8
- package/lib/module/reanimated2/hook/useDerivedValue.js.map +1 -1
- package/lib/module/reanimated2/hook/useEvent.js +7 -6
- package/lib/module/reanimated2/hook/useEvent.js.map +1 -1
- package/lib/module/reanimated2/hook/useFrameCallback.js +17 -0
- package/lib/module/reanimated2/hook/useFrameCallback.js.map +1 -1
- package/lib/module/reanimated2/hook/useHandler.js +8 -2
- package/lib/module/reanimated2/hook/useHandler.js.map +1 -1
- package/lib/module/reanimated2/hook/useReducedMotion.js +9 -0
- package/lib/module/reanimated2/hook/useReducedMotion.js.map +1 -1
- package/lib/module/reanimated2/hook/useScrollViewOffset.js +8 -0
- package/lib/module/reanimated2/hook/useScrollViewOffset.js.map +1 -1
- package/lib/module/reanimated2/hook/useSharedValue.js +11 -3
- package/lib/module/reanimated2/hook/useSharedValue.js.map +1 -1
- package/lib/module/reanimated2/hook/useWorkletCallback.js +3 -0
- package/lib/module/reanimated2/hook/useWorkletCallback.js.map +1 -1
- package/lib/module/reanimated2/index.js +1 -1
- package/lib/module/reanimated2/index.js.map +1 -1
- package/lib/module/reanimated2/interpolateColor.js +21 -0
- package/lib/module/reanimated2/interpolateColor.js.map +1 -1
- package/lib/module/reanimated2/interpolation.js +51 -21
- package/lib/module/reanimated2/interpolation.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/animationBuilder/BaseAnimationBuilder.js +29 -2
- package/lib/module/reanimated2/layoutReanimation/animationBuilder/BaseAnimationBuilder.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/animationBuilder/ComplexAnimationBuilder.js +67 -2
- package/lib/module/reanimated2/layoutReanimation/animationBuilder/ComplexAnimationBuilder.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/animationBuilder/Keyframe.js +6 -3
- package/lib/module/reanimated2/layoutReanimation/animationBuilder/Keyframe.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/animationBuilder/commonTypes.js +4 -0
- package/lib/module/reanimated2/layoutReanimation/animationBuilder/commonTypes.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Bounce.js +80 -0
- package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Bounce.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Fade.js +79 -0
- package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Fade.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Flip.js +96 -0
- package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Flip.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Lightspeed.js +31 -0
- package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Lightspeed.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Pinwheel.js +15 -0
- package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Pinwheel.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Roll.js +31 -0
- package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Roll.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Rotate.js +63 -0
- package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Rotate.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Slide.js +64 -0
- package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Slide.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Stretch.js +32 -0
- package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Stretch.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Zoom.js +128 -0
- package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Zoom.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/defaultTransitions/CurvedTransition.js +8 -0
- package/lib/module/reanimated2/layoutReanimation/defaultTransitions/CurvedTransition.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/defaultTransitions/EntryExitTransition.js +9 -0
- package/lib/module/reanimated2/layoutReanimation/defaultTransitions/EntryExitTransition.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/defaultTransitions/FadingTransition.js +8 -0
- package/lib/module/reanimated2/layoutReanimation/defaultTransitions/FadingTransition.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/defaultTransitions/JumpingTransition.js +8 -0
- package/lib/module/reanimated2/layoutReanimation/defaultTransitions/JumpingTransition.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/defaultTransitions/LinearTransition.js +10 -3
- package/lib/module/reanimated2/layoutReanimation/defaultTransitions/LinearTransition.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/defaultTransitions/SequencedTransition.js +8 -0
- package/lib/module/reanimated2/layoutReanimation/defaultTransitions/SequencedTransition.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/sharedTransitions/SharedTransition.js +49 -3
- package/lib/module/reanimated2/layoutReanimation/sharedTransitions/SharedTransition.js.map +1 -1
- package/lib/module/reanimated2/layoutReanimation/web/createAnimation.js +4 -4
- package/lib/module/reanimated2/layoutReanimation/web/createAnimation.js.map +1 -1
- package/lib/module/reanimated2/platform-specific/checkCppVersion.js +0 -2
- 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 +9 -0
- package/lib/module/reanimated2/platformFunctions/dispatchCommand.js.map +1 -1
- package/lib/module/reanimated2/platformFunctions/getRelativeCoords.js +14 -4
- package/lib/module/reanimated2/platformFunctions/getRelativeCoords.js.map +1 -1
- package/lib/module/reanimated2/platformFunctions/measure.js +7 -0
- package/lib/module/reanimated2/platformFunctions/measure.js.map +1 -1
- package/lib/module/reanimated2/platformFunctions/scrollTo.js +9 -0
- package/lib/module/reanimated2/platformFunctions/scrollTo.js.map +1 -1
- package/lib/module/reanimated2/platformFunctions/setNativeProps.js +8 -0
- package/lib/module/reanimated2/platformFunctions/setNativeProps.js.map +1 -1
- package/lib/module/reanimated2/runtimes.js +8 -0
- package/lib/module/reanimated2/runtimes.js.map +1 -1
- package/lib/module/reanimated2/threads.js +16 -6
- package/lib/module/reanimated2/threads.js.map +1 -1
- package/lib/typescript/createAnimatedComponent/createAnimatedComponent.d.ts +12 -0
- package/lib/typescript/reanimated2/Easing.d.ts +3 -3
- package/lib/typescript/reanimated2/animation/decay/decay.d.ts +8 -0
- package/lib/typescript/reanimated2/animation/decay/utils.d.ts +12 -0
- package/lib/typescript/reanimated2/animation/delay.d.ts +9 -0
- package/lib/typescript/reanimated2/animation/repeat.d.ts +11 -0
- package/lib/typescript/reanimated2/animation/sequence.d.ts +8 -0
- package/lib/typescript/reanimated2/animation/spring.d.ts +9 -0
- package/lib/typescript/reanimated2/animation/springUtils.d.ts +15 -0
- package/lib/typescript/reanimated2/animation/timing.d.ts +17 -0
- package/lib/typescript/reanimated2/animation/util.d.ts +6 -0
- package/lib/typescript/reanimated2/commonTypes.d.ts +25 -7
- package/lib/typescript/reanimated2/component/FlatList.d.ts +6 -0
- package/lib/typescript/reanimated2/component/LayoutAnimationConfig.d.ts +7 -0
- package/lib/typescript/reanimated2/component/ScrollView.d.ts +3 -2
- package/lib/typescript/reanimated2/helperTypes.d.ts +45 -3
- package/lib/typescript/reanimated2/hook/useAnimatedKeyboard.d.ts +7 -0
- package/lib/typescript/reanimated2/hook/useAnimatedProps.d.ts +9 -0
- package/lib/typescript/reanimated2/hook/useAnimatedReaction.d.ts +6 -4
- package/lib/typescript/reanimated2/hook/useAnimatedRef.d.ts +6 -0
- package/lib/typescript/reanimated2/hook/useAnimatedScrollHandler.d.ts +10 -0
- package/lib/typescript/reanimated2/hook/useAnimatedSensor.d.ts +8 -0
- package/lib/typescript/reanimated2/hook/useAnimatedStyle.d.ts +8 -0
- package/lib/typescript/reanimated2/hook/useDerivedValue.d.ts +9 -1
- package/lib/typescript/reanimated2/hook/useEvent.d.ts +8 -5
- package/lib/typescript/reanimated2/hook/useFrameCallback.d.ts +14 -0
- package/lib/typescript/reanimated2/hook/useHandler.d.ts +8 -0
- package/lib/typescript/reanimated2/hook/useReducedMotion.d.ts +8 -0
- package/lib/typescript/reanimated2/hook/useScrollViewOffset.d.ts +7 -0
- package/lib/typescript/reanimated2/hook/useSharedValue.d.ts +8 -1
- package/lib/typescript/reanimated2/hook/useWorkletCallback.d.ts +3 -0
- package/lib/typescript/reanimated2/index.d.ts +1 -1
- package/lib/typescript/reanimated2/interpolateColor.d.ts +17 -0
- package/lib/typescript/reanimated2/interpolation.d.ts +30 -2
- package/lib/typescript/reanimated2/layoutReanimation/animationBuilder/BaseAnimationBuilder.d.ts +25 -2
- package/lib/typescript/reanimated2/layoutReanimation/animationBuilder/ComplexAnimationBuilder.d.ts +56 -1
- package/lib/typescript/reanimated2/layoutReanimation/animationBuilder/commonTypes.d.ts +4 -0
- package/lib/typescript/reanimated2/layoutReanimation/defaultAnimations/Bounce.d.ts +70 -0
- package/lib/typescript/reanimated2/layoutReanimation/defaultAnimations/Fade.d.ts +70 -0
- package/lib/typescript/reanimated2/layoutReanimation/defaultAnimations/Flip.d.ts +84 -0
- package/lib/typescript/reanimated2/layoutReanimation/defaultAnimations/Lightspeed.d.ts +28 -0
- package/lib/typescript/reanimated2/layoutReanimation/defaultAnimations/Pinwheel.d.ts +14 -0
- package/lib/typescript/reanimated2/layoutReanimation/defaultAnimations/Roll.d.ts +28 -0
- package/lib/typescript/reanimated2/layoutReanimation/defaultAnimations/Rotate.d.ts +56 -0
- package/lib/typescript/reanimated2/layoutReanimation/defaultAnimations/Slide.d.ts +56 -0
- package/lib/typescript/reanimated2/layoutReanimation/defaultAnimations/Stretch.d.ts +28 -0
- package/lib/typescript/reanimated2/layoutReanimation/defaultAnimations/Zoom.d.ts +112 -0
- package/lib/typescript/reanimated2/layoutReanimation/defaultTransitions/CurvedTransition.d.ts +7 -0
- package/lib/typescript/reanimated2/layoutReanimation/defaultTransitions/EntryExitTransition.d.ts +8 -0
- package/lib/typescript/reanimated2/layoutReanimation/defaultTransitions/FadingTransition.d.ts +7 -0
- package/lib/typescript/reanimated2/layoutReanimation/defaultTransitions/JumpingTransition.d.ts +7 -0
- package/lib/typescript/reanimated2/layoutReanimation/defaultTransitions/LinearTransition.d.ts +10 -0
- package/lib/typescript/reanimated2/layoutReanimation/defaultTransitions/SequencedTransition.d.ts +7 -0
- package/lib/typescript/reanimated2/layoutReanimation/sharedTransitions/SharedTransition.d.ts +43 -1
- package/lib/typescript/reanimated2/layoutReanimation/web/createAnimation.d.ts +4 -4
- package/lib/typescript/reanimated2/platform-specific/jsVersion.d.ts +1 -1
- package/lib/typescript/reanimated2/platformFunctions/dispatchCommand.d.ts +8 -0
- package/lib/typescript/reanimated2/platformFunctions/getRelativeCoords.d.ts +11 -3
- package/lib/typescript/reanimated2/platformFunctions/measure.d.ts +7 -0
- package/lib/typescript/reanimated2/platformFunctions/scrollTo.d.ts +9 -0
- package/lib/typescript/reanimated2/platformFunctions/setNativeProps.d.ts +7 -0
- package/lib/typescript/reanimated2/runtimes.d.ts +8 -0
- package/lib/typescript/reanimated2/threads.d.ts +17 -2
- package/package.json +2 -1
- package/src/createAnimatedComponent/createAnimatedComponent.tsx +18 -0
- package/src/createAnimatedComponent/setAndForwardRef.ts +2 -0
- package/src/reanimated2/Easing.ts +3 -3
- package/src/reanimated2/PlatformChecker.ts +1 -1
- package/src/reanimated2/animation/decay/decay.ts +8 -0
- package/src/reanimated2/animation/decay/utils.ts +12 -0
- package/src/reanimated2/animation/delay.ts +9 -0
- package/src/reanimated2/animation/repeat.ts +11 -0
- package/src/reanimated2/animation/sequence.ts +8 -0
- package/src/reanimated2/animation/spring.ts +9 -0
- package/src/reanimated2/animation/springUtils.ts +15 -0
- package/src/reanimated2/animation/timing.ts +17 -0
- package/src/reanimated2/animation/util.ts +6 -0
- package/src/reanimated2/commonTypes.ts +25 -7
- package/src/reanimated2/component/FlatList.tsx +6 -0
- package/src/reanimated2/component/LayoutAnimationConfig.tsx +7 -0
- package/src/reanimated2/component/ScrollView.tsx +3 -1
- package/src/reanimated2/globals.d.ts +1 -1
- package/src/reanimated2/helperTypes.ts +45 -3
- package/src/reanimated2/hook/useAnimatedKeyboard.ts +7 -0
- package/src/reanimated2/hook/useAnimatedProps.ts +9 -0
- package/src/reanimated2/hook/useAnimatedReaction.ts +6 -4
- package/src/reanimated2/hook/useAnimatedRef.ts +6 -0
- package/src/reanimated2/hook/useAnimatedScrollHandler.ts +10 -0
- package/src/reanimated2/hook/useAnimatedSensor.ts +8 -0
- package/src/reanimated2/hook/useAnimatedStyle.ts +8 -0
- package/src/reanimated2/hook/useDerivedValue.ts +15 -7
- package/src/reanimated2/hook/useEvent.ts +9 -6
- package/src/reanimated2/hook/useFrameCallback.ts +14 -0
- package/src/reanimated2/hook/useHandler.ts +8 -0
- package/src/reanimated2/hook/useReducedMotion.ts +8 -0
- package/src/reanimated2/hook/useScrollViewOffset.ts +7 -0
- package/src/reanimated2/hook/useSharedValue.ts +12 -3
- package/src/reanimated2/hook/useWorkletCallback.ts +3 -0
- package/src/reanimated2/index.ts +1 -1
- package/src/reanimated2/interpolateColor.ts +17 -0
- package/src/reanimated2/interpolation.ts +48 -22
- package/src/reanimated2/layoutReanimation/animationBuilder/BaseAnimationBuilder.ts +26 -3
- package/src/reanimated2/layoutReanimation/animationBuilder/ComplexAnimationBuilder.ts +57 -2
- package/src/reanimated2/layoutReanimation/animationBuilder/Keyframe.ts +7 -6
- package/src/reanimated2/layoutReanimation/animationBuilder/commonTypes.ts +4 -0
- package/src/reanimated2/layoutReanimation/defaultAnimations/Bounce.ts +71 -0
- package/src/reanimated2/layoutReanimation/defaultAnimations/Fade.ts +70 -1
- package/src/reanimated2/layoutReanimation/defaultAnimations/Flip.ts +84 -0
- package/src/reanimated2/layoutReanimation/defaultAnimations/Lightspeed.ts +28 -0
- package/src/reanimated2/layoutReanimation/defaultAnimations/Pinwheel.ts +14 -0
- package/src/reanimated2/layoutReanimation/defaultAnimations/Roll.ts +28 -0
- package/src/reanimated2/layoutReanimation/defaultAnimations/Rotate.ts +56 -0
- package/src/reanimated2/layoutReanimation/defaultAnimations/Slide.ts +56 -0
- package/src/reanimated2/layoutReanimation/defaultAnimations/Stretch.ts +28 -0
- package/src/reanimated2/layoutReanimation/defaultAnimations/Zoom.ts +112 -0
- package/src/reanimated2/layoutReanimation/defaultTransitions/CurvedTransition.ts +7 -0
- package/src/reanimated2/layoutReanimation/defaultTransitions/EntryExitTransition.ts +8 -0
- package/src/reanimated2/layoutReanimation/defaultTransitions/FadingTransition.ts +7 -0
- package/src/reanimated2/layoutReanimation/defaultTransitions/JumpingTransition.ts +8 -0
- package/src/reanimated2/layoutReanimation/defaultTransitions/LinearTransition.ts +10 -3
- package/src/reanimated2/layoutReanimation/defaultTransitions/SequencedTransition.ts +7 -0
- package/src/reanimated2/layoutReanimation/sharedTransitions/SharedTransition.ts +45 -3
- package/src/reanimated2/layoutReanimation/web/createAnimation.ts +4 -4
- package/src/reanimated2/platform-specific/checkCppVersion.ts +0 -4
- package/src/reanimated2/platform-specific/jsVersion.ts +1 -1
- package/src/reanimated2/platformFunctions/dispatchCommand.ts +8 -0
- package/src/reanimated2/platformFunctions/getRelativeCoords.ts +12 -4
- package/src/reanimated2/platformFunctions/measure.ts +7 -0
- package/src/reanimated2/platformFunctions/scrollTo.ts +9 -0
- package/src/reanimated2/platformFunctions/setNativeProps.ts +7 -0
- package/src/reanimated2/runtimes.ts +8 -0
- package/src/reanimated2/threads.ts +18 -7
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_extends","Object","assign","bind","target","i","arguments","length","source","key","prototype","hasOwnProperty","call","apply","React","forwardRef","FlatList","AnimatedView","createAnimatedComponent","LayoutAnimationConfig","AnimatedFlatList","createCellRendererComponent","itemLayoutAnimation","CellRendererComponent","props","createElement","layout","onLayout","style","children","ReanimatedFlatList","ref","skipEnteringExitingAnimations","restProps","scrollEventThrottle","useMemo","animatedFlatList","undefined","skipEntering","skipExiting"],"sources":["FlatList.tsx"],"sourcesContent":["'use strict';\nimport type { ForwardedRef } from 'react';\nimport React, { forwardRef } from 'react';\nimport type {\n FlatListProps,\n LayoutChangeEvent,\n StyleProp,\n ViewStyle,\n} from 'react-native';\nimport { FlatList } from 'react-native';\nimport { AnimatedView } from './View';\nimport { createAnimatedComponent } from '../../createAnimatedComponent';\nimport type { ILayoutAnimationBuilder } from '../layoutReanimation/animationBuilder/commonTypes';\nimport { LayoutAnimationConfig } from './LayoutAnimationConfig';\nimport type { AnimatedProps, AnimatedStyle } from '../helperTypes';\n\nconst AnimatedFlatList = createAnimatedComponent(FlatList);\n\ninterface CellRendererComponentProps {\n onLayout?: ((event: LayoutChangeEvent) => void) | undefined;\n children: React.ReactNode;\n style?: StyleProp<AnimatedStyle<ViewStyle>>;\n}\n\nconst createCellRendererComponent = (\n itemLayoutAnimation?: ILayoutAnimationBuilder\n) => {\n const CellRendererComponent = (props: CellRendererComponentProps) => {\n return (\n <AnimatedView\n // TODO TYPESCRIPT This is temporary cast is to get rid of .d.ts file.\n layout={itemLayoutAnimation as any}\n onLayout={props.onLayout}\n style={props.style}>\n {props.children}\n </AnimatedView>\n );\n };\n\n return CellRendererComponent;\n};\n\ninterface ReanimatedFlatListPropsWithLayout<T>\n extends AnimatedProps<FlatListProps<T>> {\n itemLayoutAnimation?: ILayoutAnimationBuilder;\n skipEnteringExitingAnimations?: boolean;\n}\n\nexport type FlatListPropsWithLayout<T> = ReanimatedFlatListPropsWithLayout<T>;\n\n// Since createAnimatedComponent return type is ComponentClass that has the props of the argument,\n// but not things like NativeMethods, etc. we need to add them manually by extending the type.\ninterface AnimatedFlatListComplement<T> extends FlatList<T> {\n getNode(): FlatList<T>;\n}\n\nexport const ReanimatedFlatList = forwardRef(\n (\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n props: ReanimatedFlatListPropsWithLayout<any>,\n ref: ForwardedRef<FlatList>\n ) => {\n const { itemLayoutAnimation, skipEnteringExitingAnimations, ...restProps } =\n props;\n\n // Set default scrollEventThrottle, because user expects\n // to have continuous scroll events and\n // react-native defaults it to 50 for FlatLists.\n // We set it to 1 so we have peace until\n // there are 960 fps screens.\n if (!('scrollEventThrottle' in restProps)) {\n restProps.scrollEventThrottle = 1;\n }\n\n const CellRendererComponent = React.useMemo(\n () => createCellRendererComponent(itemLayoutAnimation),\n []\n );\n\n const animatedFlatList = (\n <AnimatedFlatList\n ref={ref}\n {...restProps}\n CellRendererComponent={CellRendererComponent}\n />\n );\n\n if (skipEnteringExitingAnimations === undefined) {\n return animatedFlatList;\n }\n\n return (\n <LayoutAnimationConfig skipEntering skipExiting>\n {animatedFlatList}\n </LayoutAnimationConfig>\n );\n }\n);\n\nexport type ReanimatedFlatList<T> = typeof AnimatedFlatList &\n AnimatedFlatListComplement<T>;\n"],"mappings":"AAAA,YAAY;;AAAC,SAAAA,SAAA,IAAAA,QAAA,GAAAC,MAAA,CAAAC,MAAA,GAAAD,MAAA,CAAAC,MAAA,CAAAC,IAAA,eAAAC,MAAA,aAAAC,CAAA,MAAAA,CAAA,GAAAC,SAAA,CAAAC,MAAA,EAAAF,CAAA,UAAAG,MAAA,GAAAF,SAAA,CAAAD,CAAA,YAAAI,GAAA,IAAAD,MAAA,QAAAP,MAAA,CAAAS,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAJ,MAAA,EAAAC,GAAA,KAAAL,MAAA,CAAAK,GAAA,IAAAD,MAAA,CAAAC,GAAA,gBAAAL,MAAA,YAAAJ,QAAA,CAAAa,KAAA,OAAAP,SAAA;AAEb,OAAOQ,KAAK,IAAIC,UAAU,QAAQ,OAAO;AAOzC,SAASC,QAAQ,QAAQ,cAAc;AACvC,SAASC,YAAY,QAAQ,QAAQ;AACrC,SAASC,uBAAuB,QAAQ,+BAA+B;AAEvE,SAASC,qBAAqB,QAAQ,yBAAyB;AAG/D,MAAMC,gBAAgB,GAAGF,uBAAuB,CAACF,QAAQ,CAAC;AAQ1D,MAAMK,2BAA2B,GAC/BC,mBAA6C,IAC1C;EACH,MAAMC,qBAAqB,GAAIC,KAAiC,IAAK;IACnE,oBACEV,KAAA,CAAAW,aAAA,CAACR;IACC;IAAA;MACAS,MAAM,EAAEJ,mBAA2B;MACnCK,QAAQ,EAAEH,KAAK,CAACG,QAAS;MACzBC,KAAK,EAAEJ,KAAK,CAACI;IAAM,GAClBJ,KAAK,CAACK,QAAQ,CACF;EAEnB,CAAC;EAED,OAAON,qBAAqB;AAC9B,CAAC;;
|
|
1
|
+
{"version":3,"names":["_extends","Object","assign","bind","target","i","arguments","length","source","key","prototype","hasOwnProperty","call","apply","React","forwardRef","FlatList","AnimatedView","createAnimatedComponent","LayoutAnimationConfig","AnimatedFlatList","createCellRendererComponent","itemLayoutAnimation","CellRendererComponent","props","createElement","layout","onLayout","style","children","ReanimatedFlatList","ref","skipEnteringExitingAnimations","restProps","scrollEventThrottle","useMemo","animatedFlatList","undefined","skipEntering","skipExiting"],"sources":["FlatList.tsx"],"sourcesContent":["'use strict';\nimport type { ForwardedRef } from 'react';\nimport React, { forwardRef } from 'react';\nimport type {\n FlatListProps,\n LayoutChangeEvent,\n StyleProp,\n ViewStyle,\n} from 'react-native';\nimport { FlatList } from 'react-native';\nimport { AnimatedView } from './View';\nimport { createAnimatedComponent } from '../../createAnimatedComponent';\nimport type { ILayoutAnimationBuilder } from '../layoutReanimation/animationBuilder/commonTypes';\nimport { LayoutAnimationConfig } from './LayoutAnimationConfig';\nimport type { AnimatedProps, AnimatedStyle } from '../helperTypes';\n\nconst AnimatedFlatList = createAnimatedComponent(FlatList);\n\ninterface CellRendererComponentProps {\n onLayout?: ((event: LayoutChangeEvent) => void) | undefined;\n children: React.ReactNode;\n style?: StyleProp<AnimatedStyle<ViewStyle>>;\n}\n\nconst createCellRendererComponent = (\n itemLayoutAnimation?: ILayoutAnimationBuilder\n) => {\n const CellRendererComponent = (props: CellRendererComponentProps) => {\n return (\n <AnimatedView\n // TODO TYPESCRIPT This is temporary cast is to get rid of .d.ts file.\n layout={itemLayoutAnimation as any}\n onLayout={props.onLayout}\n style={props.style}>\n {props.children}\n </AnimatedView>\n );\n };\n\n return CellRendererComponent;\n};\n\ninterface ReanimatedFlatListPropsWithLayout<T>\n extends AnimatedProps<FlatListProps<T>> {\n /**\n * Lets you pass layout animation directly to the FlatList item.\n */\n itemLayoutAnimation?: ILayoutAnimationBuilder;\n /**\n * Lets you skip entering and exiting animations of FlatList items when on FlatList mount or unmount.\n */\n skipEnteringExitingAnimations?: boolean;\n}\n\nexport type FlatListPropsWithLayout<T> = ReanimatedFlatListPropsWithLayout<T>;\n\n// Since createAnimatedComponent return type is ComponentClass that has the props of the argument,\n// but not things like NativeMethods, etc. we need to add them manually by extending the type.\ninterface AnimatedFlatListComplement<T> extends FlatList<T> {\n getNode(): FlatList<T>;\n}\n\nexport const ReanimatedFlatList = forwardRef(\n (\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n props: ReanimatedFlatListPropsWithLayout<any>,\n ref: ForwardedRef<FlatList>\n ) => {\n const { itemLayoutAnimation, skipEnteringExitingAnimations, ...restProps } =\n props;\n\n // Set default scrollEventThrottle, because user expects\n // to have continuous scroll events and\n // react-native defaults it to 50 for FlatLists.\n // We set it to 1 so we have peace until\n // there are 960 fps screens.\n if (!('scrollEventThrottle' in restProps)) {\n restProps.scrollEventThrottle = 1;\n }\n\n const CellRendererComponent = React.useMemo(\n () => createCellRendererComponent(itemLayoutAnimation),\n []\n );\n\n const animatedFlatList = (\n <AnimatedFlatList\n ref={ref}\n {...restProps}\n CellRendererComponent={CellRendererComponent}\n />\n );\n\n if (skipEnteringExitingAnimations === undefined) {\n return animatedFlatList;\n }\n\n return (\n <LayoutAnimationConfig skipEntering skipExiting>\n {animatedFlatList}\n </LayoutAnimationConfig>\n );\n }\n);\n\nexport type ReanimatedFlatList<T> = typeof AnimatedFlatList &\n AnimatedFlatListComplement<T>;\n"],"mappings":"AAAA,YAAY;;AAAC,SAAAA,SAAA,IAAAA,QAAA,GAAAC,MAAA,CAAAC,MAAA,GAAAD,MAAA,CAAAC,MAAA,CAAAC,IAAA,eAAAC,MAAA,aAAAC,CAAA,MAAAA,CAAA,GAAAC,SAAA,CAAAC,MAAA,EAAAF,CAAA,UAAAG,MAAA,GAAAF,SAAA,CAAAD,CAAA,YAAAI,GAAA,IAAAD,MAAA,QAAAP,MAAA,CAAAS,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAJ,MAAA,EAAAC,GAAA,KAAAL,MAAA,CAAAK,GAAA,IAAAD,MAAA,CAAAC,GAAA,gBAAAL,MAAA,YAAAJ,QAAA,CAAAa,KAAA,OAAAP,SAAA;AAEb,OAAOQ,KAAK,IAAIC,UAAU,QAAQ,OAAO;AAOzC,SAASC,QAAQ,QAAQ,cAAc;AACvC,SAASC,YAAY,QAAQ,QAAQ;AACrC,SAASC,uBAAuB,QAAQ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the wrapper is unmounted to prevent the animation.
|
|
25
25
|
// Since `ReactNode` can be a list of nodes, we wrap every child with our wrapper
|
|
26
26
|
// so we are able to access its tag with `findNodeHandle`.
|
|
27
|
+
/**
|
|
28
|
+
* A component that lets you skip entering and exiting animations.
|
|
29
|
+
*
|
|
30
|
+
* @param skipEntering - A boolean indicating whether children's entering animations should be skipped when `LayoutAnimationConfig` is mounted.
|
|
31
|
+
* @param skipExiting - A boolean indicating whether children's exiting animations should be skipped when LayoutAnimationConfig is unmounted.
|
|
32
|
+
* @see https://docs.swmansion.com/react-native-reanimated/docs/layout-animations/layout-animation-config/
|
|
33
|
+
*/
|
|
27
34
|
export class LayoutAnimationConfig extends Component {
|
|
28
35
|
getMaybeWrappedChildren() {
|
|
29
36
|
return Children.count(this.props.children) > 1 && this.props.skipExiting ? Children.map(this.props.children, child => /*#__PURE__*/React.createElement(LayoutAnimationConfig, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","Children","Component","createContext","useEffect","useRef","setShouldAnimateExitingForTag","findNodeHandle","SkipEnteringContext","SkipEntering","props","skipValueRef","shouldSkip","current","createElement","Provider","value","children","LayoutAnimationConfig","getMaybeWrappedChildren","count","skipExiting","map","child","setShouldAnimateExiting","tag","componentWillUnmount","undefined","render","skipEntering"],"sources":["LayoutAnimationConfig.tsx"],"sourcesContent":["'use strict';\nimport React, {\n Children,\n Component,\n createContext,\n useEffect,\n useRef,\n} from 'react';\nimport type { ReactNode } from 'react';\nimport { setShouldAnimateExitingForTag } from '../core';\nimport { findNodeHandle } from 'react-native';\n\nexport const SkipEnteringContext =\n createContext<React.MutableRefObject<boolean> | null>(null);\n\n// skipEntering - don't animate entering of children on wrapper mount\n// skipExiting - don't animate exiting of children on wrapper unmount\ninterface LayoutAnimationConfigProps {\n skipEntering?: boolean;\n skipExiting?: boolean;\n children: ReactNode;\n}\n\nfunction SkipEntering(props: { shouldSkip: boolean; children: ReactNode }) {\n const skipValueRef = useRef(props.shouldSkip);\n\n useEffect(() => {\n skipValueRef.current = false;\n }, [skipValueRef]);\n\n return (\n <SkipEnteringContext.Provider value={skipValueRef}>\n {props.children}\n </SkipEnteringContext.Provider>\n );\n}\n\n// skipExiting (unlike skipEntering) cannot be done by conditionally\n// configuring the animation in `createAnimatedComponent`, since at this stage\n// we don't know if the wrapper is going to be unmounted or not.\n// That's why we need to pass the skipExiting flag to the native side\n// when the wrapper is unmounted to prevent the animation.\n// Since `ReactNode` can be a list of nodes, we wrap every child with our wrapper\n// so we are able to access its tag with `findNodeHandle`.\nexport class LayoutAnimationConfig extends Component<LayoutAnimationConfigProps> {\n getMaybeWrappedChildren() {\n return Children.count(this.props.children) > 1 && this.props.skipExiting\n ? Children.map(this.props.children, (child) => (\n <LayoutAnimationConfig skipExiting>{child}</LayoutAnimationConfig>\n ))\n : this.props.children;\n }\n\n setShouldAnimateExiting() {\n if (Children.count(this.props.children) === 1) {\n const tag = findNodeHandle(this);\n if (tag) {\n setShouldAnimateExitingForTag(tag, !this.props.skipExiting);\n }\n }\n }\n\n componentWillUnmount(): void {\n if (this.props.skipExiting !== undefined) {\n this.setShouldAnimateExiting();\n }\n }\n\n render(): ReactNode {\n const children = this.getMaybeWrappedChildren();\n\n if (this.props.skipEntering === undefined) {\n return children;\n }\n\n return (\n <SkipEntering shouldSkip={this.props.skipEntering}>\n {children}\n </SkipEntering>\n );\n }\n}\n"],"mappings":"AAAA,YAAY;;AACZ,OAAOA,KAAK,IACVC,QAAQ,EACRC,SAAS,EACTC,aAAa,EACbC,SAAS,EACTC,MAAM,QACD,OAAO;AAEd,SAASC,6BAA6B,QAAQ,SAAS;AACvD,SAASC,cAAc,QAAQ,cAAc;AAE7C,OAAO,MAAMC,mBAAmB,gBAC9BL,aAAa,CAAyC,IAAI,CAAC;;AAE7D;AACA;AAOA,SAASM,YAAYA,CAACC,KAAmD,EAAE;EACzE,MAAMC,YAAY,GAAGN,MAAM,CAACK,KAAK,CAACE,UAAU,CAAC;EAE7CR,SAAS,C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,SAAS,EAAE;MACzC,OAAOV,QAAQ;IACjB;IAEA,oBACEjB,KAAA,CAAAc,aAAA,CAACL,YAAY;MAACG,UAAU,EAAE,IAAI,CAACF,KAAK,CAACmB;IAAa,GAC/CZ,QAAQ,CACI;EAEnB;AACF"}
|
|
1
|
+
{"version":3,"names":["React","Children","Component","createContext","useEffect","useRef","setShouldAnimateExitingForTag","findNodeHandle","SkipEnteringContext","SkipEntering","props","skipValueRef","shouldSkip","current","createElement","Provider","value","children","LayoutAnimationConfig","getMaybeWrappedChildren","count","skipExiting","map","child","setShouldAnimateExiting","tag","componentWillUnmount","undefined","render","skipEntering"],"sources":["LayoutAnimationConfig.tsx"],"sourcesContent":["'use strict';\nimport React, {\n Children,\n Component,\n createContext,\n useEffect,\n useRef,\n} from 'react';\nimport type { ReactNode } from 'react';\nimport { setShouldAnimateExitingForTag } from '../core';\nimport { findNodeHandle } from 'react-native';\n\nexport const SkipEnteringContext =\n createContext<React.MutableRefObject<boolean> | null>(null);\n\n// skipEntering - don't animate entering of children on wrapper mount\n// skipExiting - don't animate exiting of children on wrapper unmount\ninterface LayoutAnimationConfigProps {\n skipEntering?: boolean;\n skipExiting?: boolean;\n children: ReactNode;\n}\n\nfunction SkipEntering(props: { shouldSkip: boolean; children: ReactNode }) {\n const skipValueRef = useRef(props.shouldSkip);\n\n useEffect(() => {\n skipValueRef.current = false;\n }, [skipValueRef]);\n\n return (\n <SkipEnteringContext.Provider value={skipValueRef}>\n {props.children}\n </SkipEnteringContext.Provider>\n );\n}\n\n// skipExiting (unlike skipEntering) cannot be done by conditionally\n// configuring the animation in `createAnimatedComponent`, since at this stage\n// we don't know if the wrapper is going to be unmounted or not.\n// That's why we need to pass the skipExiting flag to the native side\n// when the wrapper is unmounted to prevent the animation.\n// Since `ReactNode` can be a list of nodes, we wrap every child with our wrapper\n// so we are able to access its tag with `findNodeHandle`.\n/**\n * A component that lets you skip entering and exiting animations.\n *\n * @param skipEntering - A boolean indicating whether children's entering animations should be skipped when `LayoutAnimationConfig` is mounted.\n * @param skipExiting - A boolean indicating whether children's exiting animations should be skipped when LayoutAnimationConfig is unmounted.\n * @see https://docs.swmansion.com/react-native-reanimated/docs/layout-animations/layout-animation-config/\n */\nexport class LayoutAnimationConfig extends Component<LayoutAnimationConfigProps> {\n getMaybeWrappedChildren() {\n return Children.count(this.props.children) > 1 && this.props.skipExiting\n ? Children.map(this.props.children, (child) => (\n <LayoutAnimationConfig skipExiting>{child}</LayoutAnimationConfig>\n ))\n : this.props.children;\n }\n\n setShouldAnimateExiting() {\n if (Children.count(this.props.children) === 1) {\n const tag = findNodeHandle(this);\n if (tag) {\n setShouldAnimateExitingForTag(tag, !this.props.skipExiting);\n }\n }\n }\n\n componentWillUnmount(): void {\n if (this.props.skipExiting !== undefined) {\n this.setShouldAnimateExiting();\n }\n }\n\n render(): ReactNode {\n const children = this.getMaybeWrappedChildren();\n\n if (this.props.skipEntering === undefined) {\n return children;\n }\n\n return (\n <SkipEntering shouldSkip={this.props.skipEntering}>\n {children}\n </SkipEntering>\n );\n }\n}\n"],"mappings":"AAAA,YAAY;;AACZ,OAAOA,KAAK,IACVC,QAAQ,EACRC,SAAS,EACTC,aAAa,EACbC,SAAS,EACTC,MAAM,QACD,OAAO;AAEd,SAASC,6BAA6B,QAAQ,SAAS;AACvD,SAASC,cAAc,QAAQ,cAAc;AAE7C,OAAO,MAAMC,mBAAmB,gBAC9BL,aAAa,CAAyC,IAAI,CAAC;;AAE7D;AACA;AAOA,SAASM,YAAYA,CAACC,KAAmD,EAAE;EACzE,MAAMC,YAAY,GAAGN,MAAM,CAACK,KAAK,CAACE,UAAU,CAAC;EAE7CR,SAAS,CAAC,MAAM;IACdO,YAAY,CAACE,OAAO,GAAG,KAAK;EAC9B,CAAC,EAAE,CAACF,YAAY,CAAC,CAAC;EAElB,oBACEX,KAAA,CAAAc,aAAA,CAACN,mBAAmB,CAACO,QAAQ;IAACC,KAAK,EAAEL;EAAa,GAC/CD,KAAK,CAACO,QAAQ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}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_extends","Object","assign","bind","target","i","arguments","length","source","key","prototype","hasOwnProperty","call","apply","React","forwardRef","ScrollView","createAnimatedComponent","useAnimatedRef","useScrollViewOffset","AnimatedScrollViewComponent","AnimatedScrollView","props","ref","scrollViewOffset","restProps","animatedRef","scrollEventThrottle","createElement"],"sources":["ScrollView.tsx"],"sourcesContent":["'use strict';\nimport type { ForwardedRef } from 'react';\nimport React, { forwardRef } from 'react';\nimport type { ScrollViewProps } from 'react-native';\nimport { ScrollView } from 'react-native';\nimport { createAnimatedComponent } from '../../createAnimatedComponent';\nimport type { SharedValue } from '../commonTypes';\nimport type { AnimatedRef } from '../hook';\nimport { useAnimatedRef, useScrollViewOffset } from '../hook';\n\nexport interface AnimatedScrollViewProps
|
|
1
|
+
{"version":3,"names":["_extends","Object","assign","bind","target","i","arguments","length","source","key","prototype","hasOwnProperty","call","apply","React","forwardRef","ScrollView","createAnimatedComponent","useAnimatedRef","useScrollViewOffset","AnimatedScrollViewComponent","AnimatedScrollView","props","ref","scrollViewOffset","restProps","animatedRef","scrollEventThrottle","createElement"],"sources":["ScrollView.tsx"],"sourcesContent":["'use strict';\nimport type { ForwardedRef } from 'react';\nimport React, { forwardRef } from 'react';\nimport type { ScrollViewProps } from 'react-native';\nimport { ScrollView } from 'react-native';\nimport { createAnimatedComponent } from '../../createAnimatedComponent';\nimport type { SharedValue } from '../commonTypes';\nimport type { AnimatedRef } from '../hook';\nimport { useAnimatedRef, useScrollViewOffset } from '../hook';\nimport type { AnimatedProps } from '../helperTypes';\n\nexport interface AnimatedScrollViewProps\n extends AnimatedProps<ScrollViewProps> {\n scrollViewOffset?: SharedValue<number>;\n}\n\n// Since createAnimatedComponent return type is ComponentClass that has the props of the argument,\n// but not things like NativeMethods, etc. we need to add them manually by extending the type.\ninterface AnimatedScrollViewComplement extends ScrollView {\n getNode(): ScrollView;\n}\n\nconst AnimatedScrollViewComponent = createAnimatedComponent(ScrollView);\n\nexport const AnimatedScrollView = forwardRef(\n (props: AnimatedScrollViewProps, ref: ForwardedRef<AnimatedScrollView>) => {\n const { scrollViewOffset, ...restProps } = props;\n const animatedRef = (\n ref === null\n ? // eslint-disable-next-line react-hooks/rules-of-hooks\n useAnimatedRef<ScrollView>()\n : ref\n ) as AnimatedRef<AnimatedScrollView>;\n\n if (scrollViewOffset) {\n // eslint-disable-next-line react-hooks/rules-of-hooks\n useScrollViewOffset(animatedRef, scrollViewOffset);\n }\n\n // Set default scrollEventThrottle, because user expects\n // to have continuous scroll events.\n // We set it to 1 so we have peace until\n // there are 960 fps screens.\n if (!('scrollEventThrottle' in restProps)) {\n restProps.scrollEventThrottle = 1;\n }\n\n return <AnimatedScrollViewComponent ref={animatedRef} {...restProps} />;\n }\n);\n\nexport type AnimatedScrollView = AnimatedScrollViewComplement &\n typeof AnimatedScrollViewComponent;\n"],"mappings":"AAAA,YAAY;;AAAC,SAAAA,SAAA,IAAAA,QAAA,GAAAC,MAAA,CAAAC,MAAA,GAAAD,MAAA,CAAAC,MAAA,CAAAC,IAAA,eAAAC,MAAA,aAAAC,CAAA,MAAAA,CAAA,GAAAC,SAAA,CAAAC,MAAA,EAAAF,CAAA,UAAAG,MAAA,GAAAF,SAAA,CAAAD,CAAA,YAAAI,GAAA,IAAAD,MAAA,QAAAP,MAAA,CAAAS,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAJ,MAAA,EAAAC,GAAA,KAAAL,MAAA,CAAAK,GAAA,IAAAD,MAAA,CAAAC,GAAA,gBAAAL,MAAA,YAAAJ,QAAA,CAAAa,KAAA,OAAAP,SAAA;AAEb,OAAOQ,KAAK,IAAIC,UAAU,QAAQ,OAAO;AAEzC,SAASC,UAAU,QAAQ,cAAc;AACzC,SAASC,uBAAuB,QAAQ,+BAA+B;AAGvE,SAASC,cAAc,EAAEC,mBAAmB,QAAQ,SAAS;;AAQ7D;AACA;AAKA,MAAMC,2BAA2B,GAAGH,uBAAuB,CAACD,UAAU,CAAC;AAEvE,OAAO,MAAMK,kBAAkB,gBAAGN,UAAU,CAC1C,CAACO,KAA8B,EAAEC,GAAqC,KAAK;EACzE,MAAM;IAAEC,gBAAgB;IAAE,GAAGC;EAAU,CAAC,GAAGH,KAAK;EAChD,MAAMI,WAAW,GACfH,GAAG,KAAK,IAAI;EACR;EACAL,cAAc,EAAc,GAC5BK,GAC8B;EAEpC,IAAIC,gBAAgB,EAAE;IACpB;IACAL,mBAAmB,CAACO,WAAW,EAAEF,gBAAgB,CAAC;EACpD;;EAEA;EACA;EACA;EACA;EACA,IAAI,EAAE,qBAAqB,IAAIC,SAAS,CAAC,EAAE;IACzCA,SAAS,CAACE,mBAAmB,GAAG,CAAC;EACnC;EAEA,oBAAOb,KAAA,CAAAc,aAAA,CAACR,2BAA2B,EAAApB,QAAA;IAACuB,GAAG,EAAEG;EAAY,GAAKD,SAAS,EAAI;AACzE,CAAC,CACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["globals.d.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\n/* eslint-disable no-var */\n'use strict';\nimport type {\n StyleProps,\n MeasuredDimensions,\n MapperRegistry,\n ShareableRef,\n ShareableSyncDataHolderRef,\n ShadowNodeWrapper,\n __ComplexWorkletFunction,\n FlatShareableRef,\n} from './commonTypes';\nimport type { AnimatedStyle } from './helperTypes';\nimport type { FrameCallbackRegistryUI } from './frameCallback/FrameCallbackRegistryUI';\nimport type { NativeReanimatedModule } from './NativeReanimated/NativeReanimated';\nimport type { SensorContainer } from './SensorContainer';\nimport type { LayoutAnimationsManager } from './layoutReanimation/animationsManager';\nimport type { ProgressTransitionRegister } from './layoutReanimation/sharedTransitions';\nimport type { UpdatePropsManager } from './UpdateProps';\nimport type { callGuardDEV } from './initializers';\nimport type { WorkletRuntime } from './runtimes';\n\ndeclare global {\n var _REANIMATED_IS_REDUCED_MOTION: boolean | undefined;\n var _IS_FABRIC: boolean | undefined;\n var _REANIMATED_VERSION_CPP: string | undefined;\n var _REANIMATED_VERSION_JS: string | undefined;\n var _REANIMATED_VERSION_BABEL_PLUGIN: string | undefined;\n var __reanimatedModuleProxy: NativeReanimatedModule | undefined;\n var __callGuardDEV: typeof callGuardDEV | undefined;\n var evalWithSourceMap:\n | ((js: string, sourceURL: string, sourceMap: string) => any)\n | undefined;\n var evalWithSourceUrl: ((js: string, sourceURL: string) => any) | undefined;\n var _log: (
|
|
1
|
+
{"version":3,"names":[],"sources":["globals.d.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\n/* eslint-disable no-var */\n'use strict';\nimport type {\n StyleProps,\n MeasuredDimensions,\n MapperRegistry,\n ShareableRef,\n ShareableSyncDataHolderRef,\n ShadowNodeWrapper,\n __ComplexWorkletFunction,\n FlatShareableRef,\n} from './commonTypes';\nimport type { AnimatedStyle } from './helperTypes';\nimport type { FrameCallbackRegistryUI } from './frameCallback/FrameCallbackRegistryUI';\nimport type { NativeReanimatedModule } from './NativeReanimated/NativeReanimated';\nimport type { SensorContainer } from './SensorContainer';\nimport type { LayoutAnimationsManager } from './layoutReanimation/animationsManager';\nimport type { ProgressTransitionRegister } from './layoutReanimation/sharedTransitions';\nimport type { UpdatePropsManager } from './UpdateProps';\nimport type { callGuardDEV } from './initializers';\nimport type { WorkletRuntime } from './runtimes';\n\ndeclare global {\n var _REANIMATED_IS_REDUCED_MOTION: boolean | undefined;\n var _IS_FABRIC: boolean | undefined;\n var _REANIMATED_VERSION_CPP: string | undefined;\n var _REANIMATED_VERSION_JS: string | undefined;\n var _REANIMATED_VERSION_BABEL_PLUGIN: string | undefined;\n var __reanimatedModuleProxy: NativeReanimatedModule | undefined;\n var __callGuardDEV: typeof callGuardDEV | undefined;\n var evalWithSourceMap:\n | ((js: string, sourceURL: string, sourceMap: string) => any)\n | undefined;\n var evalWithSourceUrl: ((js: string, sourceURL: string) => any) | undefined;\n var _log: (value: unknown) => void;\n var _toString: (value: unknown) => string;\n var _notifyAboutProgress: (\n tag: number,\n value: Record<string, unknown>,\n isSharedTransition: boolean\n ) => void;\n var _notifyAboutEnd: (tag: number, removeView: boolean) => void;\n var _setGestureState: (handlerTag: number, newState: number) => void;\n var _makeShareableClone: <T>(value: T) => FlatShareableRef<T>;\n var _updateDataSynchronously: (\n dataHolder: ShareableSyncDataHolderRef<any>,\n data: ShareableRef<any>\n ) => void;\n var _getDataSynchronously: <T>(\n dataHolder: ShareableSyncDataHolderRef<T>\n ) => ShareableRef<T>;\n var _scheduleOnJS: (\n fun: __ComplexWorkletFunction<A, R>,\n args?: unknown[]\n ) => void;\n var _scheduleOnRuntime: (\n runtime: WorkletRuntime,\n worklet: ShareableRef<() => void>\n ) => void;\n var _updatePropsPaper:\n | ((\n operations: {\n tag: number;\n name: string;\n updates: StyleProps | AnimatedStyle<any>;\n }[]\n ) => void)\n | undefined;\n var _updatePropsFabric:\n | ((\n operations: {\n shadowNodeWrapper: ShadowNodeWrapper;\n updates: StyleProps | AnimatedStyle<any>;\n }[]\n ) => void)\n | undefined;\n var _removeFromPropsRegistry: (viewTags: number[]) => void | undefined;\n var _measurePaper: ((viewTag: number) => MeasuredDimensions) | undefined;\n var _measureFabric:\n | ((shadowNodeWrapper: ShadowNodeWrapper) => MeasuredDimensions)\n | undefined;\n var _scrollToPaper:\n | ((viewTag: number, x: number, y: number, animated: boolean) => void)\n | undefined;\n var _dispatchCommandPaper:\n | ((viewTag: number, commandName: string, args: Array<unknown>) => void)\n | undefined;\n var _dispatchCommandFabric:\n | ((\n shadowNodeWrapper: ShadowNodeWrapper,\n commandName: string,\n args: Array<unknown>\n ) => void)\n | undefined;\n var _getAnimationTimestamp: () => number;\n var __ErrorUtils: {\n reportFatalError: (error: Error) => void;\n };\n var _frameCallbackRegistry: FrameCallbackRegistryUI;\n var console: Console;\n var __frameTimestamp: number | undefined;\n var __flushAnimationFrame: (timestamp: number) => void;\n var __workletsCache: Map<string, any>;\n var __handleCache: WeakMap<object, any>;\n var __callMicrotasks: () => void;\n var __mapperRegistry: MapperRegistry;\n var __sensorContainer: SensorContainer;\n var _maybeFlushUIUpdatesQueue: () => void;\n var LayoutAnimationsManager: LayoutAnimationsManager;\n var UpdatePropsManager: UpdatePropsManager;\n var ProgressTransitionRegister: ProgressTransitionRegister;\n var updateJSProps: (viewTag: number, props: Record<string, unknown>) => void;\n}\n"],"mappings":"AAAA;AACA;AACA,YAAY;;AAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["helperTypes.ts"],"sourcesContent":["'use strict';\n/*\nThis file is a legacy remainder of manual types from react-native-reanimated.d.ts file. \nI wasn't able to get rid of all of them from the code. \nThey should be treated as a temporary solution\nuntil time comes to refactor the code and get necessary types right. \nThis will not be easy though! \n*/\n\nimport type {\n ImageStyle,\n RegisteredStyle,\n StyleProp,\n TextStyle,\n TransformsStyle,\n ViewStyle,\n} from 'react-native';\nimport type { AnimatableValue, SharedValue } from './commonTypes';\nimport type { BaseAnimationBuilder } from './layoutReanimation/animationBuilder/BaseAnimationBuilder';\nimport type {\n EntryExitAnimationFunction,\n LayoutAnimationFunction,\n} from './layoutReanimation/animationBuilder/commonTypes';\nimport type { ReanimatedKeyframe } from './layoutReanimation/animationBuilder/Keyframe';\nimport type { SharedTransition } from './layoutReanimation/sharedTransitions';\nimport type { DependencyList } from './hook/commonTypes';\n\nexport type TransformArrayItem = Extract<\n TransformsStyle['transform'],\n Array<unknown>\n>[number];\n\nexport type AnimatedTransform = MaybeSharedValueRecursive<\n TransformsStyle['transform']\n>;\n\ntype MaybeSharedValue<Value> = Value | Value extends AnimatableValue\n ? SharedValue<Value>\n : never;\n\ntype MaybeSharedValueRecursive<Value> = Value extends (infer Item)[]\n ? SharedValue<Item[]> | (MaybeSharedValueRecursive<Item> | Item)[]\n : Value extends object\n ?\n | SharedValue<Value>\n | {\n [Key in keyof Value]:\n | MaybeSharedValueRecursive<Value[Key]>\n | Value[Key];\n }\n : MaybeSharedValue<Value>;\n\ntype DefaultStyle = ViewStyle & ImageStyle & TextStyle;\n\n// Ideally we want AnimatedStyle to not be generic, but there are\n// so many depenedencies on it being generic that it's not feasible at the moment.\nexport type AnimatedStyle<Style = DefaultStyle> =\n | Style\n | MaybeSharedValueRecursive<Style>;\n\ntype EntryOrExitLayoutType =\n | BaseAnimationBuilder\n | typeof BaseAnimationBuilder\n | EntryExitAnimationFunction\n | ReanimatedKeyframe;\n\n/*\n Style type properties (properties that extends StyleProp<ViewStyle>)\n can be defined with other property names than \"style\". For example `contentContainerStyle` in FlatList.\n Type definition for all style type properties should act similarly, hence we\n pick keys with 'Style' substring with the use of this utility type.\n*/\ntype PickStyleProps<Props> = Pick<\n Props,\n {\n [Key in keyof Props]-?: Key extends `${string}Style` | 'style'\n ? Key\n : never;\n }[keyof Props]\n>;\n\ntype AnimatedStyleProps<Props extends object> = {\n [Key in keyof PickStyleProps<Props>]: StyleProp<AnimatedStyle<Props[Key]>>;\n};\n\n/**\n * Component props that are not specially handled by us.\n */\ntype RestProps<Props extends object> = {\n [K in keyof Omit<Props, keyof PickStyleProps<Props> | 'style'>]:\n | Props[K]\n | SharedValue<Props[K]>;\n};\n\ntype LayoutProps = {\n layout?:\n | BaseAnimationBuilder\n | LayoutAnimationFunction\n | typeof BaseAnimationBuilder;\n entering?: EntryOrExitLayoutType;\n exiting?: EntryOrExitLayoutType;\n};\n\ntype SharedTransitionProps = {\n sharedTransitionTag?: string;\n sharedTransitionStyle?: SharedTransition;\n};\n\ntype AnimatedPropsProp<Props extends object> = RestProps<Props> &\n AnimatedStyleProps<Props> &\n LayoutProps &\n SharedTransitionProps;\n\nexport type AnimatedProps<Props extends object> = RestProps<Props> &\n AnimatedStyleProps<Props> &\n LayoutProps &\n SharedTransitionProps & {\n animatedProps?: Partial<AnimatedPropsProp<Props>>;\n };\n\nexport type AnimatedPropsAdapterFunction = (\n props: Record<string, unknown>\n) => void;\n\nexport type useAnimatedPropsType = <Props extends object>(\n updater: () => Partial<Props>,\n deps?: DependencyList | null,\n adapters?:\n | AnimatedPropsAdapterFunction\n | AnimatedPropsAdapterFunction[]\n | null,\n isAnimatedProps?: boolean\n) => Partial<Props>;\n\n// THE LAND OF THE DEPRECATED\n\n/**\n * @deprecated This type is no longer relevant.\n */\nexport type Adaptable<T> =\n | T\n | ReadonlyArray<T | ReadonlyArray<T>>\n | SharedValue<T>;\n\n/**\n * @deprecated This type is no longer relevant.\n */\nexport type AdaptTransforms<T> = {\n [P in keyof T]: Adaptable<T[P]>;\n};\n\n/**\n * @deprecated Please use
|
|
1
|
+
{"version":3,"names":[],"sources":["helperTypes.ts"],"sourcesContent":["'use strict';\n/*\nThis file is a legacy remainder of manual types from react-native-reanimated.d.ts file. \nI wasn't able to get rid of all of them from the code. \nThey should be treated as a temporary solution\nuntil time comes to refactor the code and get necessary types right. \nThis will not be easy though! \n*/\n\nimport type {\n ImageStyle,\n RegisteredStyle,\n StyleProp,\n TextStyle,\n TransformsStyle,\n ViewStyle,\n} from 'react-native';\nimport type { AnimatableValue, SharedValue } from './commonTypes';\nimport type { BaseAnimationBuilder } from './layoutReanimation/animationBuilder/BaseAnimationBuilder';\nimport type {\n EntryExitAnimationFunction,\n LayoutAnimationFunction,\n} from './layoutReanimation/animationBuilder/commonTypes';\nimport type { ReanimatedKeyframe } from './layoutReanimation/animationBuilder/Keyframe';\nimport type { SharedTransition } from './layoutReanimation/sharedTransitions';\nimport type { DependencyList } from './hook/commonTypes';\n\nexport type TransformArrayItem = Extract<\n TransformsStyle['transform'],\n Array<unknown>\n>[number];\n\nexport type AnimatedTransform = MaybeSharedValueRecursive<\n TransformsStyle['transform']\n>;\n\ntype MaybeSharedValue<Value> = Value | Value extends AnimatableValue\n ? SharedValue<Value>\n : never;\n\ntype MaybeSharedValueRecursive<Value> = Value extends (infer Item)[]\n ? SharedValue<Item[]> | (MaybeSharedValueRecursive<Item> | Item)[]\n : Value extends object\n ?\n | SharedValue<Value>\n | {\n [Key in keyof Value]:\n | MaybeSharedValueRecursive<Value[Key]>\n | Value[Key];\n }\n : MaybeSharedValue<Value>;\n\ntype DefaultStyle = ViewStyle & ImageStyle & TextStyle;\n\n// Ideally we want AnimatedStyle to not be generic, but there are\n// so many depenedencies on it being generic that it's not feasible at the moment.\nexport type AnimatedStyle<Style = DefaultStyle> =\n | Style\n | MaybeSharedValueRecursive<Style>;\n\ntype EntryOrExitLayoutType =\n | BaseAnimationBuilder\n | typeof BaseAnimationBuilder\n | EntryExitAnimationFunction\n | ReanimatedKeyframe;\n\n/*\n Style type properties (properties that extends StyleProp<ViewStyle>)\n can be defined with other property names than \"style\". For example `contentContainerStyle` in FlatList.\n Type definition for all style type properties should act similarly, hence we\n pick keys with 'Style' substring with the use of this utility type.\n*/\ntype PickStyleProps<Props> = Pick<\n Props,\n {\n [Key in keyof Props]-?: Key extends `${string}Style` | 'style'\n ? Key\n : never;\n }[keyof Props]\n>;\n\ntype AnimatedStyleProps<Props extends object> = {\n [Key in keyof PickStyleProps<Props>]: StyleProp<AnimatedStyle<Props[Key]>>;\n};\n\n/**\n * Component props that are not specially handled by us.\n */\ntype RestProps<Props extends object> = {\n [K in keyof Omit<Props, keyof PickStyleProps<Props> | 'style'>]:\n | Props[K]\n | SharedValue<Props[K]>;\n};\n\ntype LayoutProps = {\n /**\n * Lets you animate the layout changes when components are added to or removed from the view hierarchy.\n *\n * You can use the predefined layout transitions (eg. `LinearTransition`, `FadingTransition`) or create your own ones.\n *\n * @see https://docs.swmansion.com/react-native-reanimated/docs/layout-animations/layout-transitions\n */\n layout?:\n | BaseAnimationBuilder\n | LayoutAnimationFunction\n | typeof BaseAnimationBuilder;\n /**\n * Lets you animate an element when it's added to or removed from the view hierarchy.\n *\n * You can use the predefined entering animations (eg. `FadeIn`, `SlideInLeft`) or create your own ones.\n *\n * @see https://docs.swmansion.com/react-native-reanimated/docs/layout-animations/entering-exiting-animations\n */\n entering?: EntryOrExitLayoutType;\n /**\n * Lets you animate an element when it's added to or removed from the view hierarchy.\n *\n * You can use the predefined entering animations (eg. `FadeOut`, `SlideOutRight`) or create your own ones.\n *\n * @see https://docs.swmansion.com/react-native-reanimated/docs/layout-animations/entering-exiting-animations\n */\n exiting?: EntryOrExitLayoutType;\n};\n\ntype SharedTransitionProps = {\n /**\n * Lets you animate components between two navigation screens.\n *\n * Assign the same `sharedTransitionTag` to [animated components](https://docs.swmansion.com/react-native-reanimated/docs/fundamentals/glossary#animated-component) on two different navigation screens to create a shared transition.\n *\n * @see https://docs.swmansion.com/react-native-reanimated/docs/shared-element-transitions/overview\n * @experimental\n */\n sharedTransitionTag?: string;\n /**\n * Lets you create a custom shared transition animation.\n *\n * Used alongside `SharedTransition.custom()` method.\n *\n * @see https://docs.swmansion.com/react-native-reanimated/docs/shared-element-transitions/overview\n * @experimental\n */\n sharedTransitionStyle?: SharedTransition;\n};\n\ntype AnimatedPropsProp<Props extends object> = RestProps<Props> &\n AnimatedStyleProps<Props> &\n LayoutProps &\n SharedTransitionProps;\n\nexport type AnimatedProps<Props extends object> = RestProps<Props> &\n AnimatedStyleProps<Props> &\n LayoutProps &\n SharedTransitionProps & {\n /**\n * Lets you animate component props.\n *\n * @see https://docs.swmansion.com/react-native-reanimated/docs/core/useAnimatedProps\n */\n animatedProps?: Partial<AnimatedPropsProp<Props>>;\n };\n\nexport type AnimatedPropsAdapterFunction = (\n props: Record<string, unknown>\n) => void;\n\nexport type useAnimatedPropsType = <Props extends object>(\n updater: () => Partial<Props>,\n deps?: DependencyList | null,\n adapters?:\n | AnimatedPropsAdapterFunction\n | AnimatedPropsAdapterFunction[]\n | null,\n isAnimatedProps?: boolean\n) => Partial<Props>;\n\n// THE LAND OF THE DEPRECATED\n\n/**\n * @deprecated This type is no longer relevant.\n */\nexport type Adaptable<T> =\n | T\n | ReadonlyArray<T | ReadonlyArray<T>>\n | SharedValue<T>;\n\n/**\n * @deprecated This type is no longer relevant.\n */\nexport type AdaptTransforms<T> = {\n [P in keyof T]: Adaptable<T[P]>;\n};\n\n/**\n * @deprecated Please use {@link TransformArrayItem} type instead.\n */\nexport type TransformStyleTypes = TransformArrayItem;\n\n/**\n * @deprecated Please use {@link AnimatedStyle} type instead.\n */\nexport type AnimateStyle<Style = DefaultStyle> = AnimatedStyle<Style>;\n\n/**\n * @deprecated This type is no longer relevant.\n */\nexport type StylesOrDefault<T> = 'style' extends keyof T\n ? MaybeSharedValueRecursive<T['style']>\n : Record<string, unknown>;\n\n/**\n * @deprecated This type is no longer relevant.\n */\nexport type AnimatedStyleProp<T> =\n | AnimatedStyle<T>\n | RegisteredStyle<AnimatedStyle<T>>;\n\n/**\n * @deprecated Please use {@link AnimatedProps} type instead.\n */\nexport type AnimateProps<Props extends object> = AnimatedProps<Props>;\n"],"mappings":"AAAA,YAAY;;AACZ;AACA;AACA;AACA;AACA;AACA;AACA;AANA"}
|
|
@@ -3,6 +3,14 @@
|
|
|
3
3
|
import { useEffect, useRef } from 'react';
|
|
4
4
|
import { makeMutable, subscribeForKeyboardEvents, unsubscribeFromKeyboardEvents } from '../core';
|
|
5
5
|
import { KeyboardState } from '../commonTypes';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Lets you synchronously get the position and state of the keyboard.
|
|
9
|
+
*
|
|
10
|
+
* @param options - An additional keyboard configuration options.
|
|
11
|
+
* @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).
|
|
12
|
+
* @see https://docs.swmansion.com/react-native-reanimated/docs/device/useAnimatedKeyboard
|
|
13
|
+
*/
|
|
6
14
|
export function useAnimatedKeyboard() {
|
|
7
15
|
let options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {
|
|
8
16
|
isStatusBarTranslucentAndroid: false
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["useEffect","useRef","makeMutable","subscribeForKeyboardEvents","unsubscribeFromKeyboardEvents","KeyboardState","useAnimatedKeyboard","options","arguments","length","undefined","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\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;
|
|
1
|
+
{"version":3,"names":["useEffect","useRef","makeMutable","subscribeForKeyboardEvents","unsubscribeFromKeyboardEvents","KeyboardState","useAnimatedKeyboard","options","arguments","length","undefined","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,Q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AiB,CAACG,MAAM,CAACC,KAAK,GAAGD,MAAM;MACzC,CAAC,EAAEZ,OAAO,CAAC;MACXO,YAAY,CAACC,OAAO,GAAG,IAAI;IAC7B;IACA,OAAO,MAAM;MACXX,6BAA6B,CAACS,UAAU,CAACE,OAAO,CAAC;MACjDD,YAAY,CAACC,OAAO,GAAG,KAAK;IAC9B,CAAC;EACH,CAAC,EAAE,EAAE,CAAC;EACN,OAAOH,GAAG,CAACG,OAAO;AACpB"}
|
|
@@ -7,6 +7,15 @@ import { shouldBeUseWeb } from '../PlatformChecker';
|
|
|
7
7
|
// when you need styles to animated you should always use useAS
|
|
8
8
|
// TODO TYPESCRIPT This is a temporary cast to get rid of .d.ts file.
|
|
9
9
|
|
|
10
|
+
/**
|
|
11
|
+
* Lets you create an animated props object which can be animated using shared values.
|
|
12
|
+
*
|
|
13
|
+
* @param updater - A function returning an object with properties you want to animate.
|
|
14
|
+
* @param dependencies - An optional array of dependencies. Only relevant when using Reanimated without the Babel plugin on the Web.
|
|
15
|
+
* @param adapters - An optional function or array of functions allowing to adopt prop naming between JS and the native side.
|
|
16
|
+
* @returns An animated props object which has to be passed to `animatedProps` property of an Animated component that you want to animate.
|
|
17
|
+
* @see https://docs.swmansion.com/react-native-reanimated/docs/core/useAnimatedProps
|
|
18
|
+
*/
|
|
10
19
|
export let useAnimatedProps;
|
|
11
20
|
if (shouldBeUseWeb()) {
|
|
12
21
|
useAnimatedProps = function (updater, deps, adapters) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["useAnimatedStyle","shouldBeUseWeb","useAnimatedProps","updater","deps","adapters"],"sources":["useAnimatedProps.ts"],"sourcesContent":["'use strict';\nimport { useAnimatedStyle } from './useAnimatedStyle';\nimport type { DependencyList } from './commonTypes';\nimport type {\n AnimatedPropsAdapterFunction,\n useAnimatedPropsType,\n} from '../helperTypes';\nimport { shouldBeUseWeb } from '../PlatformChecker';\n\n// TODO: we should make sure that when useAP is used we are not assigning styles\n// when you need styles to animated you should always use useAS\n// TODO TYPESCRIPT This is a temporary cast to get rid of .d.ts file.\n\nexport let useAnimatedProps: useAnimatedPropsType;\n\nif (shouldBeUseWeb()) {\n useAnimatedProps = function <T extends object>(\n updater: () => Partial<T>,\n deps?: DependencyList | null,\n adapters?:\n | AnimatedPropsAdapterFunction\n | AnimatedPropsAdapterFunction[]\n | null\n ) {\n return (useAnimatedStyle as useAnimatedPropsType)(\n updater,\n deps,\n adapters,\n true\n );\n };\n} else {\n useAnimatedProps = useAnimatedStyle as useAnimatedPropsType;\n}\n"],"mappings":"AAAA,YAAY;;AACZ,SAASA,gBAAgB,QAAQ,oBAAoB;AAMrD,SAASC,cAAc,QAAQ,oBAAoB;;AAEnD;AACA;AACA;;AAEA,OAAO,IAAIC,gBAAsC;AAEjD,IAAID,cAAc,EAAE,EAAE;EACpBC,gBAAgB,GAAG,SAAAA,CACjBC,OAAyB,EACzBC,IAA4B,EAC5BC,QAGQ,EACR;IACA,OAAQL,gBAAgB,CACtBG,OAAO,EACPC,IAAI,EACJC,QAAQ,EACR,IAAI,CACL;EACH,CAAC;AACH,CAAC,MAAM;EACLH,gBAAgB,GAAGF,gBAAwC;AAC7D"}
|
|
1
|
+
{"version":3,"names":["useAnimatedStyle","shouldBeUseWeb","useAnimatedProps","updater","deps","adapters"],"sources":["useAnimatedProps.ts"],"sourcesContent":["'use strict';\nimport { useAnimatedStyle } from './useAnimatedStyle';\nimport type { DependencyList } from './commonTypes';\nimport type {\n AnimatedPropsAdapterFunction,\n useAnimatedPropsType,\n} from '../helperTypes';\nimport { shouldBeUseWeb } from '../PlatformChecker';\n\n// TODO: we should make sure that when useAP is used we are not assigning styles\n// when you need styles to animated you should always use useAS\n// TODO TYPESCRIPT This is a temporary cast to get rid of .d.ts file.\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 let useAnimatedProps: useAnimatedPropsType;\n\nif (shouldBeUseWeb()) {\n useAnimatedProps = function <T extends object>(\n updater: () => Partial<T>,\n deps?: DependencyList | null,\n adapters?:\n | AnimatedPropsAdapterFunction\n | AnimatedPropsAdapterFunction[]\n | null\n ) {\n return (useAnimatedStyle as useAnimatedPropsType)(\n updater,\n deps,\n adapters,\n true\n );\n };\n} else {\n useAnimatedProps = useAnimatedStyle as useAnimatedPropsType;\n}\n"],"mappings":"AAAA,YAAY;;AACZ,SAASA,gBAAgB,QAAQ,oBAAoB;AAMrD,SAASC,cAAc,QAAQ,oBAAoB;;AAEnD;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,IAAIC,gBAAsC;AAEjD,IAAID,cAAc,EAAE,EAAE;EACpBC,gBAAgB,GAAG,SAAAA,CACjBC,OAAyB,EACzBC,IAA4B,EAC5BC,QAGQ,EACR;IACA,OAAQL,gBAAgB,CACtBG,OAAO,EACPC,IAAI,EACJC,QAAQ,EACR,IAAI,CACL;EACH,CAAC;AACH,CAAC,MAAM;EACLH,gBAAgB,GAAGF,gBAAwC;AAC7D"}
|
|
@@ -6,10 +6,12 @@ import { useSharedValue } from './useSharedValue';
|
|
|
6
6
|
import { shouldBeUseWeb } from '../PlatformChecker';
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
9
|
+
* 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.
|
|
10
|
+
*
|
|
11
|
+
* @param prepare - A function that should return a value to which you'd like to react.
|
|
12
|
+
* @param react - A function that reacts to changes in the value returned by the `prepare` function.
|
|
13
|
+
* @param dependencies - an optional array of dependencies. Only relevant when using Reanimated without the Babel plugin on the Web.
|
|
14
|
+
* @see https://docs.swmansion.com/react-native-reanimated/docs/advanced/useAnimatedReaction
|
|
13
15
|
*/
|
|
14
16
|
// @ts-expect-error This overload is required by our API.
|
|
15
17
|
export function useAnimatedReaction(prepare, react, dependencies) {
|
|
@@ -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 *
|
|
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, true);\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,EAAE,IAAI,CAAC;EAElE,IAAIO,MAAM,GAAGC,MAAM,CAACC,MAAM,CAACN,OAAO,CAACO,SAAS,IAAI,CAAC,CAAC,CAAC;EAEnD,IAAIT,cAAc,EAAE,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,EAAE;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,EAAE,EAAE,CAAC;IAC7C,OAAO,MAAM;MACXR,UAAU,CAACoB,QAAQ,CAAC;IACtB,CAAC;EACH,CAAC,EAAEd,YAAY,CAAC;AAClB"}
|
|
@@ -16,6 +16,13 @@ function getComponentOrScrollable(component) {
|
|
|
16
16
|
return component;
|
|
17
17
|
}
|
|
18
18
|
const getTagValueFunction = IS_FABRIC ? getShadowNodeWrapperFromRef : findNodeHandle;
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Lets you get a reference of a view that you can use inside a worklet.
|
|
22
|
+
*
|
|
23
|
+
* @returns An object with a `.current` property which contains an instance of a component.
|
|
24
|
+
* @see https://docs.swmansion.com/react-native-reanimated/docs/core/useAnimatedRef
|
|
25
|
+
*/
|
|
19
26
|
export function useAnimatedRef() {
|
|
20
27
|
const tag = useSharedValue(-1);
|
|
21
28
|
const viewName = useSharedValue(null);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["useRef","useSharedValue","getShadowNodeWrapperFromRef","makeShareableCloneRecursive","registerShareableMapping","Platform","findNodeHandle","isFabric","IS_FABRIC","getComponentOrScrollable","component","getNativeScrollRef","getScrollableNode","getTagValueFunction","useAnimatedRef","tag","viewName","ref","current","fun","value","OS","_viewConfig","viewConfig","uiViewClassName","remoteRef","__init","f"],"sources":["useAnimatedRef.ts"],"sourcesContent":["'use strict';\nimport type { Component } from 'react';\nimport { useRef } from 'react';\nimport { useSharedValue } from './useSharedValue';\nimport type { AnimatedRef } from './commonTypes';\nimport type { ShadowNodeWrapper } from '../commonTypes';\nimport { getShadowNodeWrapperFromRef } from '../fabricUtils';\nimport {\n makeShareableCloneRecursive,\n registerShareableMapping,\n} from '../shareables';\nimport { Platform, findNodeHandle } from 'react-native';\nimport { isFabric } from '../PlatformChecker';\n\nconst IS_FABRIC = isFabric();\n\ninterface MaybeScrollableComponent extends Component {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n getNativeScrollRef?: any;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n getScrollableNode?: any;\n viewConfig?: {\n uiViewClassName?: string;\n };\n}\n\nfunction getComponentOrScrollable(component: MaybeScrollableComponent) {\n if (IS_FABRIC && component.getNativeScrollRef) {\n return component.getNativeScrollRef();\n } else if (!IS_FABRIC && component.getScrollableNode) {\n return component.getScrollableNode();\n }\n return component;\n}\n\nconst getTagValueFunction = IS_FABRIC\n ? getShadowNodeWrapperFromRef\n : findNodeHandle;\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 tag.value = getTagValueFunction(getComponentOrScrollable(component));\n fun.current = component;\n // viewName is required only on iOS with Paper\n if (Platform.OS === 'ios' && !IS_FABRIC) {\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 remoteRef = makeShareableCloneRecursive({\n __init: () => {\n 'worklet';\n const f = () => tag.value;\n f.viewName = viewName;\n return f;\n },\n });\n registerShareableMapping(fun, remoteRef);\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,SACEC,2BAA2B,EAC3BC,wBAAwB,QACnB,eAAe;AACtB,SAASC,QAAQ,EAAEC,cAAc,QAAQ,cAAc;AACvD,SAASC,QAAQ,QAAQ,oBAAoB;AAE7C,MAAMC,SAAS,GAAGD,QAAQ,EAAE;AAY5B,SAASE,wBAAwBA,CAACC,SAAmC,EAAE;EACrE,IAAIF,SAAS,IAAIE,SAAS,CAACC,kBAAkB,EAAE;IAC7C,OAAOD,SAAS,CAACC,kBAAkB,EAAE;EACvC,CAAC,MAAM,IAAI,CAACH,SAAS,IAAIE,SAAS,CAACE,iBAAiB,EAAE;IACpD,OAAOF,SAAS,CAACE,iBAAiB,EAAE;EACtC;EACA,OAAOF,SAAS;AAClB;AAEA,MAAMG,mBAAmB,GAAGL,SAAS,GACjCN,2BAA2B,GAC3BI,cAAc;
|
|
1
|
+
{"version":3,"names":["useRef","useSharedValue","getShadowNodeWrapperFromRef","makeShareableCloneRecursive","registerShareableMapping","Platform","findNodeHandle","isFabric","IS_FABRIC","getComponentOrScrollable","component","getNativeScrollRef","getScrollableNode","getTagValueFunction","useAnimatedRef","tag","viewName","ref","current","fun","value","OS","_viewConfig","viewConfig","uiViewClassName","remoteRef","__init","f"],"sources":["useAnimatedRef.ts"],"sourcesContent":["'use strict';\nimport type { Component } from 'react';\nimport { useRef } from 'react';\nimport { useSharedValue } from './useSharedValue';\nimport type { AnimatedRef } from './commonTypes';\nimport type { ShadowNodeWrapper } from '../commonTypes';\nimport { getShadowNodeWrapperFromRef } from '../fabricUtils';\nimport {\n makeShareableCloneRecursive,\n registerShareableMapping,\n} from '../shareables';\nimport { Platform, findNodeHandle } from 'react-native';\nimport { isFabric } from '../PlatformChecker';\n\nconst IS_FABRIC = isFabric();\n\ninterface MaybeScrollableComponent extends Component {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n getNativeScrollRef?: any;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n getScrollableNode?: any;\n viewConfig?: {\n uiViewClassName?: string;\n };\n}\n\nfunction getComponentOrScrollable(component: MaybeScrollableComponent) {\n if (IS_FABRIC && component.getNativeScrollRef) {\n return component.getNativeScrollRef();\n } else if (!IS_FABRIC && component.getScrollableNode) {\n return component.getScrollableNode();\n }\n return component;\n}\n\nconst getTagValueFunction = IS_FABRIC\n ? getShadowNodeWrapperFromRef\n : findNodeHandle;\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 tag.value = getTagValueFunction(getComponentOrScrollable(component));\n fun.current = component;\n // viewName is required only on iOS with Paper\n if (Platform.OS === 'ios' && !IS_FABRIC) {\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 remoteRef = makeShareableCloneRecursive({\n __init: () => {\n 'worklet';\n const f = () => tag.value;\n f.viewName = viewName;\n return f;\n },\n });\n registerShareableMapping(fun, remoteRef);\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,SACEC,2BAA2B,EAC3BC,wBAAwB,QACnB,eAAe;AACtB,SAASC,QAAQ,EAAEC,cAAc,QAAQ,cAAc;AACvD,SAASC,QAAQ,QAAQ,oBAAoB;AAE7C,MAAMC,SAAS,GAAGD,QAAQ,EAAE;AAY5B,SAASE,wBAAwBA,CAACC,SAAmC,EAAE;EACrE,IAAIF,SAAS,IAAIE,SAAS,CAACC,kBAAkB,EAAE;IAC7C,OAAOD,SAAS,CAACC,kBAAkB,EAAE;EACvC,CAAC,MAAM,IAAI,CAACH,SAAS,IAAIE,SAAS,CAACE,iBAAiB,EAAE;IACpD,OAAOF,SAAS,CAACE,iBAAiB,EAAE;EACtC;EACA,OAAOF,SAAS;AAClB;AAEA,MAAMG,mBAAmB,GAAGL,SAAS,GACjCN,2BAA2B,GAC3BI,cAAc;;AAElB;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASQ,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,EAA2B;EAE7C,IAAI,CAACiB,GAAG,CAACC,OAAO,EAAE;IAChB,MAAMC,GAA4B,GAChCT,SAAS,IACN;MACH;MACA,IAAIA,SAAS,EAAE;QACbK,GAAG,CAACK,KAAK,GAAGP,mBAAmB,CAACJ,wBAAwB,CAACC,SAAS,CAAC,CAAC;QACpES,GAAG,CAACD,OAAO,GAAGR,SAAS;QACvB;QACA,IAAIL,QAAQ,CAACgB,EAAE,KAAK,KAAK,IAAI,CAACb,SAAS,EAAE;UAAA,IAAAc,WAAA;UACvCN,QAAQ,CAACI,KAAK,GACZ,CAACV,SAAS,aAATA,SAAS,wBAAAY,WAAA,GAATZ,SAAS,CAA+Ba,UAAU,cAAAD,WAAA,uBAAnDA,WAAA,CACIE,eAAe,KAAI,SAAS;QACpC;MACF;MACA,OAAOT,GAAG,CAACK,KAAK;IAClB,CAAE;IAEFD,GAAG,CAACD,OAAO,GAAG,IAAI;IAElB,MAAMO,SAAS,GAAGtB,2BAA2B,CAAC;MAC5CuB,MAAM,EAAEA,CAAA,KAAM;QACZ,SAAS;;QACT,MAAMC,CAAC,GAAGA,CAAA,KAAMZ,GAAG,CAACK,KAAK;QACzBO,CAAC,CAACX,QAAQ,GAAGA,QAAQ;QACrB,OAAOW,CAAC;MACV;IACF,CAAC,CAAC;IACFvB,wBAAwB,CAACe,GAAG,EAAEM,SAAS,CAAC;IACxCR,GAAG,CAACC,OAAO,GAAGC,GAAG;EACnB;EAEA,OAAOF,GAAG,CAACC,OAAO;AACpB"}
|
|
@@ -3,8 +3,16 @@
|
|
|
3
3
|
import { useHandler } from './useHandler';
|
|
4
4
|
import { useEvent } from './useEvent';
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
/**
|
|
7
|
+
* Lets you run callbacks on ScrollView events. Supports `onScroll`, `onBeginDrag`, `onEndDrag`, `onMomentumBegin`, and `onMomentumEnd` events.
|
|
8
|
+
*
|
|
9
|
+
* These callbacks are automatically workletized and ran on the UI thread.
|
|
10
|
+
*
|
|
11
|
+
* @param handlers - An object containing event handlers.
|
|
12
|
+
* @param dependencies - An optional array of dependencies. Only relevant when using Reanimated without the Babel plugin on the Web.
|
|
13
|
+
* @returns An object you need to pass to `onScroll` prop on the `Animated.ScrollView` component.
|
|
14
|
+
* @see https://docs.swmansion.com/react-native-reanimated/docs/scroll/useAnimatedScrollHandler
|
|
15
|
+
*/ // @ts-expect-error This overload is required by our API.
|
|
8
16
|
export function useAnimatedScrollHandler(handlers, dependencies) {
|
|
9
17
|
// case when handlers is a function
|
|
10
18
|
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// @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
|
|
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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AACC,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;EAAA,CACD;AACH"}
|
|
@@ -67,6 +67,16 @@ function adjustVectorToInterfaceOrientation(data) {
|
|
|
67
67
|
}
|
|
68
68
|
return data;
|
|
69
69
|
}
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* Lets you create animations based on data from the device's sensors.
|
|
73
|
+
*
|
|
74
|
+
* @param sensorType - Type of the sensor to use. Configured with {@link SensorType} enum.
|
|
75
|
+
* @param config - The sensor configuration - {@link SensorConfig}.
|
|
76
|
+
* @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
|
|
77
|
+
* @see https://docs.swmansion.com/react-native-reanimated/docs/device/useAnimatedSensor
|
|
78
|
+
*/
|
|
79
|
+
|
|
70
80
|
export function useAnimatedSensor(sensorType, userConfig) {
|
|
71
81
|
const config = {
|
|
72
82
|
interval: 'auto',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["useEffect","useRef","initializeSensor","registerSensor","unregisterSensor","SensorType","IOSReferenceFrame","callMicrotasks","eulerToQuaternion","pitch","roll","yaw","c1","Math","cos","s1","sin","c2","s2","c3","s3","adjustRotationToInterfaceOrientation","data","interfaceOrientation","PI","q","qx","qy","qz","qw","adjustVectorToInterfaceOrientation","x","y","useAnimatedSensor","sensorType","userConfig","config","interval","adjustToInterfaceOrientation","iosReferenceFrame","Auto","ref","sensor","unregister","isAvailable","newConfig","current","sensorData","id","ROTATION","value"],"sources":["useAnimatedSensor.ts"],"sourcesContent":["'use strict';\nimport { useEffect, useRef } from 'react';\nimport { initializeSensor, registerSensor, unregisterSensor } from '../core';\nimport type {\n SensorConfig,\n AnimatedSensor,\n Value3D,\n ValueRotation,\n} from '../commonTypes';\nimport { SensorType, IOSReferenceFrame } 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 === 90) {\n data.pitch = roll;\n data.roll = -pitch;\n data.yaw = yaw - Math.PI / 2;\n } else if (interfaceOrientation === 270) {\n data.pitch = -roll;\n data.roll = pitch;\n data.yaw = yaw + Math.PI / 2;\n } else if (interfaceOrientation === 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 === 90) {\n data.x = -y;\n data.y = x;\n } else if (interfaceOrientation === 270) {\n data.x = y;\n data.y = -x;\n } else if (interfaceOrientation === 180) {\n data.x *= -1;\n data.y *= -1;\n }\n return data;\n}\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 | Value3D> {\n const config: SensorConfig = {\n interval: 'auto',\n adjustToInterfaceOrientation: true,\n iosReferenceFrame: IOSReferenceFrame.Auto,\n ...userConfig,\n };\n const ref = useRef<AnimatedSensor<Value3D | ValueRotation>>({\n sensor: initializeSensor(sensorType, config),\n unregister: () => {\n // NOOP\n },\n isAvailable: false,\n config: config,\n });\n\n useEffect(() => {\n const newConfig = {\n ...config,\n ...userConfig,\n };\n ref.current.sensor = initializeSensor(sensorType, newConfig);\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, userConfig]);\n\n return ref.current;\n}\n"],"mappings":"AAAA,YAAY;;AACZ,SAASA,SAAS,EAAEC,MAAM,QAAQ,OAAO;AACzC,SAASC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AGC,CAAC;IACVV,IAAI,CAACU,CAAC,GAAG,CAACD,CAAC;EACb,CAAC,MAAM,IAAIR,oBAAoB,KAAK,GAAG,EAAE;IACvCD,IAAI,CAACS,CAAC,IAAI,CAAC,CAAC;IACZT,IAAI,CAACU,CAAC,IAAI,CAAC,CAAC;EACd;EACA,OAAOV,IAAI;AACb;
|
|
1
|
+
{"version":3,"names":["useEffect","useRef","initializeSensor","registerSensor","unregisterSensor","SensorType","IOSReferenceFrame","callMicrotasks","eulerToQuaternion","pitch","roll","yaw","c1","Math","cos","s1","sin","c2","s2","c3","s3","adjustRotationToInterfaceOrientation","data","interfaceOrientation","PI","q","qx","qy","qz","qw","adjustVectorToInterfaceOrientation","x","y","useAnimatedSensor","sensorType","userConfig","config","interval","adjustToInterfaceOrientation","iosReferenceFrame","Auto","ref","sensor","unregister","isAvailable","newConfig","current","sensorData","id","ROTATION","value"],"sources":["useAnimatedSensor.ts"],"sourcesContent":["'use strict';\nimport { useEffect, useRef } from 'react';\nimport { initializeSensor, registerSensor, unregisterSensor } from '../core';\nimport type {\n SensorConfig,\n AnimatedSensor,\n Value3D,\n ValueRotation,\n} from '../commonTypes';\nimport { SensorType, IOSReferenceFrame } 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 === 90) {\n data.pitch = roll;\n data.roll = -pitch;\n data.yaw = yaw - Math.PI / 2;\n } else if (interfaceOrientation === 270) {\n data.pitch = -roll;\n data.roll = pitch;\n data.yaw = yaw + Math.PI / 2;\n } else if (interfaceOrientation === 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 === 90) {\n data.x = -y;\n data.y = x;\n } else if (interfaceOrientation === 270) {\n data.x = y;\n data.y = -x;\n } else if (interfaceOrientation === 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 | Value3D> {\n const config: SensorConfig = {\n interval: 'auto',\n adjustToInterfaceOrientation: true,\n iosReferenceFrame: IOSReferenceFrame.Auto,\n ...userConfig,\n };\n const ref = useRef<AnimatedSensor<Value3D | ValueRotation>>({\n sensor: initializeSensor(sensorType, config),\n unregister: () => {\n // NOOP\n },\n isAvailable: false,\n config: config,\n });\n\n useEffect(() => {\n const newConfig = {\n ...config,\n ...userConfig,\n };\n ref.current.sensor = initializeSensor(sensorType, newConfig);\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, userConfig]);\n\n return ref.current;\n}\n"],"mappings":"AAAA,YAAY;;AACZ,SAASA,SAAS,EAAEC,MAAM,QAAQ,OAAO;AACzC,SAASC,gBAAgB,EAAEC,cAAc,EAAEC,gBAAgB,QAAQ,SAAS;AAO5E,SAASC,UAAU,EAAEC,iBAAiB,QAAQ,gBAAgB;AAC9D,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,EAAE,GAAGJ,IAAI,CAACC,GAAG,CAACJ,IAAI,GAAG,CAAC,CAAC;EAC7B,MAAMQ,EAAE,GAAGL,IAAI,CAACG,GAAG,CAACN,IAAI,GAAG,CA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AU,EAAE;IAC1B,CAAC;EACH,CAAC,EAAE,CAACT,UAAU,EAAEC,UAAU,CAAC,CAAC;EAE5B,OAAOM,GAAG,CAACK,OAAO;AACpB"}
|
|
@@ -263,6 +263,14 @@ function checkSharedValueUsage(prop, currentKey) {
|
|
|
263
263
|
}
|
|
264
264
|
}
|
|
265
265
|
|
|
266
|
+
/**
|
|
267
|
+
* Lets you create a styles object, similar to StyleSheet styles, which can be animated using shared values.
|
|
268
|
+
*
|
|
269
|
+
* @param updater - A function returning an object with style properties you want to animate.
|
|
270
|
+
* @param dependencies - An optional array of dependencies. Only relevant when using Reanimated without the Babel plugin on the Web.
|
|
271
|
+
* @returns An animated style object which has to be passed to the `style` property of an Animated component you want to animate.
|
|
272
|
+
* @see https://docs.swmansion.com/react-native-reanimated/docs/core/useAnimatedStyle
|
|
273
|
+
*/
|
|
266
274
|
// You cannot pass Shared Values to `useAnimatedStyle` directly.
|
|
267
275
|
// @ts-expect-error This overload is required by our API.
|
|
268
276
|
export function useAnimatedStyle(updater, dependencies, adapters) {
|