Document touch event
This commit is contained in:
parent
17fb98ea85
commit
b917bb826c
|
@ -39,11 +39,24 @@ If the View returns true and attempts to become the responder, one of the follow
|
|||
|
||||
If the view is responding, the following handlers can be called:
|
||||
|
||||
- `View.props.onResponderMove: (moveEvt) => {}` - The user is moving their finger
|
||||
- `View.props.onResponderRelease: (releaseEvt) => {}` - Fired at the end of the touch, ie "touchUp"
|
||||
- `View.props.onResponderMove: (evt) => {}` - The user is moving their finger
|
||||
- `View.props.onResponderRelease: (evt) => {}` - Fired at the end of the touch, ie "touchUp"
|
||||
- `View.props.onResponderTerminationRequest: (evt) => true` - Something else wants to become responder. Should this view release the responder? Returning true allows release
|
||||
- `View.props.onResponderTerminate: (evt) => {}` - The responder has been taken from the View. Might be taken by other views after a call to `onResponderTerminationRequest`, or might be taken by the OS without asking (happens with control center/ notification center on iOS)
|
||||
|
||||
`evt` is a synthetic touch event with the following form:
|
||||
|
||||
- `nativeEvent`
|
||||
+ `changedTouches` - Array of all touch events that have changed since the last event
|
||||
+ `identifier` - The ID of the touch
|
||||
+ `locationX` - The X position of the touch, relative to the element
|
||||
+ `locationY` - The Y position of the touch, relative to the element
|
||||
+ `pageX` - The X position of the touch, relative to the screen
|
||||
+ `pageY` - The Y position of the touch, relative to the screen
|
||||
+ `target` - The node id of the element receiving the touch event
|
||||
+ `timestamp` - A time identifier for the touch, useful for velocity calculation
|
||||
+ `touches` - Array of all current touches on the screen
|
||||
|
||||
### Capture ShouldSet Handlers
|
||||
|
||||
`onStartShouldSetResponder` and `onMoveShouldSetResponder` are called with a bubbling pattern, where the deepest node is called first. That means that the deepest component will become responder when multiple Views return true for `*ShouldSetResponder` handlers. This is desirable in most cases, because it makes sure all controls and buttons are usable.
|
||||
|
|
Loading…
Reference in New Issue