How do I make this class accept arguments of pressable? interface ScalablePressProps {…
- User
How do I make this class accept arguments of pressable?
interface ScalablePressProps { onPressIn: () => void; onPressOut: () => void; onPress: () => void; style?: React.CSSProperties; }
// Adds more a press feeling to pressable objects const ScalablePress = (props, props : ScalablePressProps) => { const { children, onPress } = props;
- Assistant
To make your component accept properties defined in the interface, you need to properly type the props argument in the function signature. Additionally, you should ensure the component is correctly handling React props.