respond-framework
Version:
create as fast you think
25 lines (24 loc) • 745 B
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _react = require("react");
var _reactNative = require("react-native");
var _utils = require("../../../utils.js");
const useInfiniteSpin = (duration = 1500) => {
const anim = (0, _react.useRef)(new _reactNative.Animated.Value(0)).current;
(0, _react.useEffect)(() => {
_reactNative.Animated.loop(_reactNative.Animated.timing(anim, {
toValue: 1,
duration,
easing: _reactNative.Easing.linear,
useNativeDriver: _utils.useNativeDriver
})).start();
}, []);
return anim.interpolate({
inputRange: [0, 1],
outputRange: ['0deg', '360deg']
});
};
var _default = exports.default = useInfiniteSpin;