Button press
apstone opened this issue · 4 comments
I am curious how hard it would be to be able to tell onAction if a user pressed a button (touchableWithoutFeedback). I like and appreciate the default behavior of this component but am curious if it would be able to add some more context to onAction, specifically if the user has pressed a certain button and handle that differently.
My situation is that onAction, I want to dismiss a modal, but inside that modal there is a button to navigate. Currently I cannot press this button because it will hide the modal.
Do you have any suggestions?
Hi, sorry for the tremendous delay, the new version (1.0.0) is in progress and if we can come up with a nice and intuitive API for your request, I'll gladly add it (or accept a PR that does it).
Currently, the package relies on PanResponder
for detecting whether the user has touched a <View />
.
Do you have any idea on how to retrieve some additional context on the press action using PanResponder
?
@apstone I've found that each PanResponder method's first argument is an event, let's call it evt.
evt.nativeEvent.identifier
contains the ID of the touched area.
For instance, if the touched surface is the component <View style={styles.container} id="a123">
,
evt.nativeEvent.identifier
will be a123.