Answer the question
In order to leave comments, you need to log in
React Native. Did I understand the Gesture Responder System correctly?
Please correct where I am wrong.
I didn’t figure out how and where to hang these handlers.
Is PanResponder a higher level abstraction?
And where is the handler for a single click or a double click (you can write it yourself, but still)?
I take any element.
If View.props.onStartShouldSetResponder
and/or View.props.onMoveShouldSetResponder
return true
, then called View.props.onResponderGrant
on success or View.props.onResponderReject
failure.
If it was successful (then it View.props.onResponderGrant
will return true), then events will be fired, on which handlers can be hung (or they can only be hung when true is returned, and not in any case, although they will not react ???).
Handlers: View.props.onResponderMove
- movement of the finger across the screen. View.props.onResponderRelease
- the finger is released.View.props.onResponderTerminationRequest
- on ascent - whether to allow further ascent. View.props.onResponderTerminate
- the event came at the ascent (the turn has come). View.props.onStartShouldSetResponderCapture
- prevent interception of the beginning of pressing. View.props.onMoveShouldSetResponderCapture
- prevent motion event interception.
changedTouches - массив событий после последнего события (это как???)
identifier - id тач-события.
locationX - позиция пальца относительно элемента на который нажат по X
locationY - позиция пальца относительно элемента на который нажат по Y
pageX - позиция пальца относительно родительского элемента X
pageY - позиция пальца относительно родительского элемента Y
target - Элемент на котором событие
timestamp - как быстро вызвался обработчик - сработало событие
touches - событие всех событий в данный момент (например, один палец нажимает, другой двигается по экрану)
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question