feat: add onPressIn, onPressOut, onHoverIn, onHoverOut to FAB and Button#3750
feat: add onPressIn, onPressOut, onHoverIn, onHoverOut to FAB and Button#3750RichardLindhout wants to merge 1 commit intocallstack:mainfrom web-ridge:feature/on-press-in-hover
Conversation
| * Function to execute on press. | ||
| */ | ||
| onPress?: (e: GestureResponderEvent) => void; | ||
|
|
pac-guerreiro
left a comment
There was a problem hiding this comment.
Left some comments regarding the new types.
Overall, thank you for these new changes with comments describing what functions do 😄
| /** | ||
| * Called when the hover is activated to provide visual feedback. | ||
| */ | ||
| onHoverIn?: (e: MouseEvent) => void; |
There was a problem hiding this comment.
This type is valid for web but for native the right type is ({nativeEvent: MouseEvent}) => void
There was a problem hiding this comment.
There was a problem hiding this comment.
Then React Native docs are outdated -> https://reactnative.dev/docs/pressable#onhoverin
| /** | ||
| * Called when the hover is deactivated to undo visual feedback. | ||
| */ | ||
| onHoverOut?: (e: MouseEvent) => void; |
There was a problem hiding this comment.
This type is valid for web but for native the right type is ({nativeEvent: MouseEvent}) => void
| * Function to execute on long press. | ||
| */ | ||
| onLongPress?: () => void; | ||
| onLongPress?: (e: GestureResponderEvent) => void; |
There was a problem hiding this comment.
According to the web docs, the current type is the correct type for web.
For native the right type is ({nativeEvent: PressEvent}) => void
| @@ -88,14 +89,30 @@ export type Props = $RemoveChildren<typeof Surface> & { | |||
| * Function to execute on press. | |||
| */ | |||
| onPress?: (e: GestureResponderEvent) => void; | |||
There was a problem hiding this comment.
According to the web docs, the correct type for web is (e: ResponderEvent) => void;.
For native the right type is ({nativeEvent: PressEvent}) => void
| /** | ||
| * Function to execute as soon as the touchable element is pressed and invoked even before onPress. | ||
| */ | ||
| onPressIn?: (e: GestureResponderEvent) => void; |
There was a problem hiding this comment.
According to the web docs, the correct type for web is (e: ResponderEvent) => void;.
For native the right type is ({nativeEvent: PressEvent}) => void
| /** | ||
| * Function to execute as soon as the touch is released even before onPress. | ||
| */ | ||
| onPressOut?: (e: GestureResponderEvent) => void; |
There was a problem hiding this comment.
According to the web docs, the correct type for web is (e: ResponderEvent) => void;.
For native the right type is ({nativeEvent: PressEvent}) => void
| /** | ||
| * Called when the hover is activated to provide visual feedback. | ||
| */ | ||
| onHoverIn?: (e: MouseEvent) => void; |
There was a problem hiding this comment.
This type is valid for web but for native the right type is ({nativeEvent: MouseEvent}) => void
| /** | ||
| * Called when the hover is deactivated to undo visual feedback. | ||
| */ | ||
| onHoverOut?: (e: MouseEvent) => void; |
There was a problem hiding this comment.
This type is valid for web but for native the right type is ({nativeEvent: MouseEvent}) => void
Summary
The other components like IconButton and ListItem already supports these props as they use Pressable props and spread them.
Fixes: #3748