UNPKG

@madeja-studio/telar

Version:

UI component library by Madeja Studio

39 lines (38 loc) 1.08 kB
"use strict"; import * as Haptics from 'expo-haptics'; import React from 'react'; import { fade, push, useAnimation } from "../../animation/index.js"; import { useTheme } from "../../theme/ThemeContextProvider.js"; import { AnimatedPressable } from "./AnimatedPressable.js"; import { jsx as _jsx } from "react/jsx-runtime"; export const Container = ({ children, hasHapticFeedback, isDisabled, onPress, style, ...props }) => { const { animatedStyle, animationStart, animationStop } = useAnimation([fade(), push()]); const { theme } = useTheme(); const resolvedHasHapticFeedback = theme.button.defaults.hasHapticFeedback ?? hasHapticFeedback ?? true; return /*#__PURE__*/_jsx(AnimatedPressable, { disabled: isDisabled, onPress: async () => { if (resolvedHasHapticFeedback) await Haptics.impactAsync(); onPress?.(); }, onPressIn: () => animationStart(), onPressOut: () => animationStop(), style: [style, animatedStyle], ...props, children: children }); }; //# sourceMappingURL=Container.js.map