react-native-micro-interactions
Version:
Effortlessly enhance your React Native components with subtle micro-interactions and animations.
32 lines (31 loc) • 1.09 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.textSlideVertical = void 0;
var _reactNativeReanimated = require("react-native-reanimated");
var _animOptionsFilter = require("../utils/animOptionsFilter.js");
var _react = require("react");
const textSlideVertical = (config, props) => {
const animationOptions = (0, _animOptionsFilter.filterTextSlideAnimOptions)(config, props);
let offset = (0, _reactNativeReanimated.useSharedValue)(animationOptions.offset);
const runIndividualAnimation = (0, _react.useCallback)(() => {
offset.value = animationOptions.offset;
offset.value = (0, _reactNativeReanimated.withTiming)(0, {
duration: animationOptions.duration
});
}, [animationOptions, offset]);
const animatedStyle = (0, _reactNativeReanimated.useAnimatedStyle)(() => {
return {
transform: [{
translateY: offset.value
}]
};
}, [offset]);
return {
animatedStyle,
runIndividualAnimation
};
};
exports.textSlideVertical = textSlideVertical;
//# sourceMappingURL=text_slide_vertical.js.map