import React, { forwardRef } from 'react' import { Pressable, TouchableOpacity, View, type ViewStyle } from 'react-native' import Animated from 'react-native-reanimated' const AnimatedView = Animated.createAnimatedComponent(View) interface BlockProps { onClick?: () => void onLongPress?: () => void animated?: boolean style?: ViewStyle children?: React.ReactNode opacity?: number touchProps?: any className?: string } const Block = forwardRef((props, ref) => { const { onClick = null, onLongPress, animated, children, opacity, touchProps, className = '', ...reset } = props const handlePress = () => { onClick && onClick() } if ((onClick || onLongPress) && opacity) { return ( {children} ) } else if (onClick || onLongPress) { return ( {children} ) } else if (animated) { return ( {children} ) } else { return ( {children} ) } }) // 添加displayName以便在React DevTools中显示组件名称 Block.displayName = 'Block' export default Block