UNPKG

@razorpay/blade

Version:

The Design System that powers Razorpay

21 lines (18 loc) 1.58 kB
import React__default from 'react'; import Animated, { useSharedValue, useAnimatedStyle, withRepeat, withTiming, cancelAnimation } from 'react-native-reanimated'; import { motion } from './spinnerTokens.js'; import getIn from '../../../utils/lodashButBetter/get.js'; import 'styled-components/native'; import '@gorhom/portal'; import 'react-native-gesture-handler'; import useTheme from '../../BladeProvider/useTheme.js'; import 'react-native'; import '@babel/runtime/helpers/slicedToArray'; import { castNativeType } from '../../../utils/platform/castUtils.js'; import { makeMotionTime } from '../../../utils/makeMotionTime/makeMotionTime.native.js'; import '../../BottomSheet/BottomSheetStack.js'; import { jsx } from 'react/jsx-runtime'; import { BaseBox } from '../../Box/BaseBox/BaseBox.native.js'; var SpinningBox=function SpinningBox(_ref){var children=_ref.children;var _useTheme=useTheme(),theme=_useTheme.theme;var duration=castNativeType(makeMotionTime(getIn(theme.motion,motion.duration)));var easing=getIn(theme.motion,motion.easing);var rotation=useSharedValue(0);var animatedStyles=useAnimatedStyle(function(){return {transform:[{rotateZ:`${rotation.value}deg`}]};},[rotation.value]);React__default.useEffect(function(){rotation.value=withRepeat(withTiming(360,{duration:duration,easing:easing}),-1);return function(){cancelAnimation(rotation);};},[duration,easing,rotation]);return jsx(BaseBox,{alignSelf:"center",children:jsx(Animated.View,{style:animatedStyles,children:children})});}; export { SpinningBox }; //# sourceMappingURL=SpinningBox.native.js.map