react-native-micro-interactions
Version:
Effortlessly enhance your React Native components with subtle micro-interactions and animations.
37 lines (34 loc) • 933 B
JavaScript
;
import Animated from 'react-native-reanimated';
import { useAnimation } from "../hooks/useAnimation.js";
import { useEffect } from 'react';
import { jsx as _jsx } from "react/jsx-runtime";
function AnimatedChild({
animationType,
animationOptions,
addAnimation,
children
}) {
const AnimatedComponent = Animated.createAnimatedComponent(children.type);
const {
animatedStyle,
runIndividualAnimation
} = useAnimation(animationType, animationOptions);
useEffect(() => {
addAnimation(runIndividualAnimation);
}, []);
const {
style,
...restProps
} = children.props;
const combinedStyle = [animatedStyle, style];
// same is_touchable logic should be implemented here
return /*#__PURE__*/_jsx(AnimatedComponent, {
...restProps,
style: combinedStyle,
children: children.props.children
});
}
;
export default AnimatedChild;
//# sourceMappingURL=AnimatedChild.js.map