From 1659c4d6130a3bd83100cd43a21dd1b5e39175bc Mon Sep 17 00:00:00 2001 From: Pedro Guerreiro Date: Fri, 4 Aug 2023 12:13:25 +0100 Subject: [PATCH] chore[TextInput]: fix broken test --- packages/react-native-web/src/exports/TextInput/index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/react-native-web/src/exports/TextInput/index.js b/packages/react-native-web/src/exports/TextInput/index.js index 9ddf46087..f342f65eb 100644 --- a/packages/react-native-web/src/exports/TextInput/index.js +++ b/packages/react-native-web/src/exports/TextInput/index.js @@ -192,11 +192,11 @@ const TextInput: React.AbstractComponent< const dimensions = React.useRef({ height: null, width: null }); const hostRef = React.useRef(null); - const prevSelection = React.useRef({ start: 0, end: 0 }); + const prevSelection = React.useRef(null); const prevSecureTextEntry = React.useRef(false); React.useEffect(() => { - if (hostRef.current) { + if (hostRef.current && prevSelection.current) { setSelection(hostRef.current, prevSelection.current); } prevSecureTextEntry.current = secureTextEntry;