mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-04-08 17:46:35 +08:00
Don't dismiss keyboard when tapping another text input
Summary: When using text inputs inside a ScrollView with `keyboardShouldPersistTaps=false` (default behavior) tapping another text input dismisses the keyboard instead of keeping it open and focusing the new text input which I think is the better and expected behavior. See #10628 for more discussion about that. Note that this affects nothing but the behavior with text inputs unlike #10628. cc satya164 MaxLap ericvicenti Closes https://github.com/facebook/react-native/pull/10887 Differential Revision: D4178474 Pulled By: ericvicenti fbshipit-source-id: 0c62ea2fac0017d559d1f8674b0a686a5e1b3d2d
This commit is contained in:
committed by
Facebook Github Bot
parent
0e55f5b26d
commit
552c601921
@@ -200,6 +200,18 @@ public class TouchTargetHelper {
|
||||
float eventCoords[], View view) {
|
||||
PointerEvents pointerEvents = view instanceof ReactPointerEventsView ?
|
||||
((ReactPointerEventsView) view).getPointerEvents() : PointerEvents.AUTO;
|
||||
|
||||
// Views that are disabled should never be the target of pointer events. However, their children
|
||||
// can be because some views (SwipeRefreshLayout) use enabled but still have children that can
|
||||
// be valid targets.
|
||||
if (!view.isEnabled()) {
|
||||
if (pointerEvents == PointerEvents.AUTO) {
|
||||
pointerEvents = PointerEvents.BOX_NONE;
|
||||
} else if (pointerEvents == PointerEvents.BOX_ONLY) {
|
||||
pointerEvents = PointerEvents.NONE;
|
||||
}
|
||||
}
|
||||
|
||||
if (pointerEvents == PointerEvents.NONE) {
|
||||
// This view and its children can't be the target
|
||||
return null;
|
||||
@@ -209,7 +221,7 @@ public class TouchTargetHelper {
|
||||
return view;
|
||||
|
||||
} else if (pointerEvents == PointerEvents.BOX_NONE) {
|
||||
// This view can't be the target, but its children might
|
||||
// This view can't be the target, but its children might.
|
||||
if (view instanceof ViewGroup) {
|
||||
View targetView = findTouchTargetView(eventCoords, (ViewGroup) view);
|
||||
if (targetView != view) {
|
||||
|
||||
Reference in New Issue
Block a user