react-native-micro-interactions
Version:
Effortlessly enhance your React Native components with subtle micro-interactions and animations.
32 lines (31 loc) • 1.1 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.textSlideHorizontal = void 0;
var _reactNativeReanimated = require("react-native-reanimated");
var _animOptionsFilter = require("../utils/animOptionsFilter.js");
var _react = require("react");
const textSlideHorizontal = (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: [{
translateX: offset.value
}]
};
}, [offset]);
return {
animatedStyle,
runIndividualAnimation
};
};
exports.textSlideHorizontal = textSlideHorizontal;
//# sourceMappingURL=text_slide_horizontal.js.map