Button
is an element that receives pointer-like interactions. It can't be styled at all: it is designed to simply get out of the way and provide handlers for the interaction in the area covered by its children.
onPointerEnter
: triggered when the pointer goes above the area of the componentonPointerLeave
: triggered when the pointer goes out of the area of the componentThese map to Web only:
onPointerEnter
-> onMouseEnter
onPointerLeave
-> onMouseLeave
React Native does not currently support hover-like actions.
onToggle
: triggered when a complete press action is done on the componentonPressIn
: triggered when the component is being pressedonPressOut
: triggered when the component stops being pressedIn Web:
onToggle
-> onClick
onPressIn
-> onMouseDown
onPressOut
-> onMouseUp
In Native:
onToggle
-> onValueChange
onPressIn
-> onPressIn
onPressOut
-> onPressOut
onFocus
: triggered when the component gets the focusonBlur
: triggered when the component looses the focusThese map to Web only:
onFocus
-> onFocus
onBlur
-> onBlur
React Native does not currently support focus-like actions on Touchable components.
export type TIsHoveredHandlers = {
onPointerEnter?: () => void,
onPointerLeave?: () => void
}
export type TIsPressedHandlers = {
onPressIn?: () => void,
onPressOut?: () => void
}
export type TIsFocusedHandlers = {
onFocus?: () => void
onBlur?: () => void
}
export type TButtonProps = {
id?: string,
accessibilityLabel?: string,
isDisabled?: boolean,
shouldStretch?: boolean,
onToggle?: () => void
} & TIsHoveredHandlers & TIsPressedHandlers & TIsFocusedHandlers
Version | Tag | Published |
---|---|---|
3.1.0 | latest | 1yr ago |