If you are using Space then you don't need to use or interact directly with this class. It is used internally by Space along with Pressable to interpret and respond to press interactions.
On the other hand if you are using ViewPort without Space you may want to use this to make handling interactions easier.
It works by calling a DecidePressHandlingCallback callback whenever a press starts, and the callback decides how the press should be handled.
After you construct the PressInterpreter pass the pressHandlers to
the ViewPort's constructors (as part of the options
parameter).
- PressInterpreter
+ new PressInterpreter(onDecideHowToHandlePress
: DecidePressHandlingCallback): PressInterpreter
Parameters:
Name | Type | Description |
---|---|---|
onDecideHowToHandlePress |
DecidePressHandlingCallback | This callback decides how to handle presses. See DecidePressHandlingCallback for more info. |
Returns: PressInterpreter
• pressHandlers: Pick‹ViewPortOptions, "onPressStart" | "onPressMove" | "onPressEnd" | "onPressCancel"›
Pass this to the ViewPort as part of its ViewPortOptions.