node_modules/@react-navigation/elements/lib/commonjs/PlatformPressable.js
/**
 * PlatformPressable provides an abstraction on top of Pressable to handle platform differences.
 */
PlatformPressable provides an abstraction on top of Pressable to handle platform differences.
PlatformPressable provides an abstraction on top of Pressable to handle platform differences .
function PlatformPressable({
  onPressIn,
  onPressOut,
  android_ripple,
  pressColor,
  pressOpacity = 0.3,
  style,
  ...rest
}) {
  const {
    dark
  } = (0, _native.useTheme)();
  const [opacity] = React.useState(() => new _reactNative.Animated.Value(1));
  const animateTo = (toValue, duration) => {
    if (ANDROID_SUPPORTS_RIPPLE) {
      return;
    }
    _reactNative.Animated.timing(opacity, {
      toValue,
      duration,
      easing: _reactNative.Easing.inOut(_reactNative.Easing.quad),
      useNativeDriver: true
    }).start();
  };
  const handlePressIn = e => {
    animateTo(pressOpacity, 0);
    onPressIn === null || onPressIn === void 0 ? void 0 : onPressIn(e);
  };
  const handlePressOut = e => {
    animateTo(1, 200);
    onPressOut === null || onPressOut === void 0 ? void 0 : onPressOut(e);
  };
  return React.createElement(AnimatedPressable, _extends({
    onPressIn: handlePressIn,
    onPressOut: handlePressOut,
    android_ripple: ANDROID_SUPPORTS_RIPPLE ? {
      color: pressColor !== undefined ? pressColor : dark ? 'rgba(255, 255, 255, .32)' : 'rgba(0, 0, 0, .32)',
      ...android_ripple
    } : undefined,
    style: [{
      opacity: !ANDROID_SUPPORTS_RIPPLE ? opacity : 1
    }, style]
  }, rest));
}
function PlatformPressable ( { onPressIn , onPressOut , android_ripple , pressColor , pressOpacity = 0.3 , style , ... rest } ) { const { dark } = ( 0 , _native . useTheme ) ( ) ; const [ opacity ] = React . useState ( ( ) => new _reactNative . Animated . Value ( 1 ) ) ; const animateTo = ( toValue , duration ) => { if ( ANDROID_SUPPORTS_RIPPLE ) { return ; } _reactNative . Animated . timing ( opacity , { toValue , duration , easing : _reactNative . Easing . inOut ( _reactNative . Easing . quad ) , useNativeDriver : true } ) . start ( ) ; } ; const handlePressIn = e => { animateTo ( pressOpacity , 0 ) ; onPressIn === null || onPressIn === void 0 ? void 0 : onPressIn ( e ) ; } ; const handlePressOut = e => { animateTo ( 1 , 200 ) ; onPressOut === null || onPressOut === void 0 ? void 0 : onPressOut ( e ) ; } ; return React . createElement ( AnimatedPressable , _extends ( { onPressIn : handlePressIn , onPressOut : handlePressOut , android_ripple : ANDROID_SUPPORTS_RIPPLE ? { color : pressColor !== undefined ? pressColor : dark ? 'rgba(255, 255, 255, .32)' : 'rgba(0, 0, 0, .32)' , ... android_ripple } : undefined , style : [ { opacity : ! ANDROID_SUPPORTS_RIPPLE ? opacity : 1 } , style ] } , rest ) ) ; }
PlatformPressable provides an abstraction on top of Pressable to handle platform differences.
PlatformPressable provides an abstraction on top of Pressable to handle platform differences .
/*#__PURE__*/