react-native-micro-interactions
Version:
Effortlessly enhance your React Native components with subtle micro-interactions and animations.
38 lines (37 loc) • 1.15 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.popIn = void 0;
var _reactNativeReanimated = require("react-native-reanimated");
var _animOptionsFilter = require("../utils/animOptionsFilter.js");
var _react = require("react");
const popIn = (config, props) => {
const animationOptions = (0, _animOptionsFilter.filterPopInAnimOptions)(config, props);
const size = (0, _reactNativeReanimated.useSharedValue)(0);
const runIndividualAnimation = (0, _react.useCallback)(() => {
size.value = 0;
if (animationOptions.withBounce) {
size.value = (0, _reactNativeReanimated.withSpring)(1, {
duration: animationOptions.duration
});
} else {
size.value = (0, _reactNativeReanimated.withTiming)(1, {
duration: animationOptions.duration
});
}
}, [animationOptions, size]);
const animatedStyle = (0, _reactNativeReanimated.useAnimatedStyle)(() => {
return {
transform: [{
scale: size.value
}]
};
}, [size]);
return {
animatedStyle,
runIndividualAnimation
};
};
exports.popIn = popIn;
//# sourceMappingURL=pop_in.js.map