Skip to content

Commit

Permalink
chore(android): fire "click" when TextField/TextArea was tapped witho…
Browse files Browse the repository at this point in the history
…ut focus
  • Loading branch information
jquick-axway authored and sgtcoolguy committed Mar 5, 2021
1 parent 1852e14 commit ba83d74
Showing 1 changed file with 7 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -353,6 +353,7 @@ public boolean onTouchEvent(MotionEvent event)
case MotionEvent.ACTION_CANCEL:
case MotionEvent.ACTION_UP: {
// Handle the touch release event.
boolean hadFocus = isFocused();
wasHandled = super.onTouchEvent(event);

// Stop nested-scrolling if active.
Expand All @@ -361,6 +362,12 @@ public boolean onTouchEvent(MotionEvent event)
stopNestedScroll();
this.scrollAxisDirection = ViewCompat.SCROLL_AXIS_NONE;
}

// If a tap was handled and gave this view the focus, then invoke the click listener.
// Note: Normally a click event is stolen in this case, but we want to match iOS' behavior.
if (wasHandled && !hadFocus && isFocused()) {
callOnClick();
}
break;
}
default: {
Expand Down

0 comments on commit ba83d74

Please sign in to comment.