File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11import React , { useContext } from "react" ;
2- import { Keyboard , StatusBar } from "react-native" ;
2+ import { Keyboard , StatusBar , TextInput } from "react-native" ;
33
44import PropTypes from "prop-types" ;
55import {
@@ -10,8 +10,6 @@ import { ThemeContext } from "styled-components/native";
1010
1111import { Container } from "./Container" ;
1212
13- import { useKeyboard } from "../hooks/useKeyboard" ;
14-
1513/**
1614 *ParentView wraps the children with SafeAreaView.
1715 *
@@ -45,7 +43,6 @@ export const ParentView = ({
4543 ...rest
4644} ) => {
4745 const theme = useContext ( ThemeContext ) ;
48- const keyboardHeight = useKeyboard ( ) ;
4946
5047 const safeAreaViewProps = {
5148 edges : [
@@ -80,12 +77,11 @@ export const ParentView = ({
8077 { ...( shouldDismissKeyboardOnTap
8178 ? {
8279 onTouchStart : e => {
83- if (
84- keyboardHeight &&
85- e ?. target ?. _internalFiberInstanceHandleDEV ?. elementType ?. indexOf (
86- "TextInput"
87- ) === - 1
88- ) {
80+ // TextInput.State is the only architecture-agnostic way to
81+ // know a tap landed outside the focused input — Fabric event
82+ // targets don't carry the Paper fiber internals.
83+ const focusedInput = TextInput . State . currentlyFocusedInput ( ) ;
84+ if ( focusedInput && e . target !== focusedInput ) {
8985 Keyboard . dismiss ( ) ;
9086 }
9187 } ,
You can’t perform that action at this time.
0 commit comments