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;