UNPKG

react-native-micro-interactions

Version:

Effortlessly enhance your React Native components with subtle micro-interactions and animations.

42 lines (39 loc) 1.23 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.default = void 0; var _reactNativeReanimated = _interopRequireDefault(require("react-native-reanimated")); var _useAnimation = require("../hooks/useAnimation.js"); var _react = require("react"); var _jsxRuntime = require("react/jsx-runtime"); function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; } function AnimatedChild({ animationType, animationOptions, addAnimation, children }) { const AnimatedComponent = _reactNativeReanimated.default.createAnimatedComponent(children.type); const { animatedStyle, runIndividualAnimation } = (0, _useAnimation.useAnimation)(animationType, animationOptions); (0, _react.useEffect)(() => { addAnimation(runIndividualAnimation); }, []); const { style, ...restProps } = children.props; const combinedStyle = [animatedStyle, style]; // same is_touchable logic should be implemented here return /*#__PURE__*/(0, _jsxRuntime.jsx)(AnimatedComponent, { ...restProps, style: combinedStyle, children: children.props.children }); } ; var _default = exports.default = AnimatedChild; //# sourceMappingURL=AnimatedChild.js.map