Skip to content

Commit 5f19b41

Browse files
raibimanecolas
authored andcommitted
[fix] TextInput selectTextOnFocus for Safari
Close #1810
1 parent 366f0e9 commit 5f19b41

File tree

1 file changed

+4
-1
lines changed
  • packages/react-native-web/src/exports/TextInput

1 file changed

+4
-1
lines changed

packages/react-native-web/src/exports/TextInput/index.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,10 @@ const TextInput = forwardRef<TextInputProps, *>((props, forwardedRef) => {
261261
node.value = '';
262262
}
263263
if (selectTextOnFocus) {
264-
node.select();
264+
// Safari requires selection to occur in a setTimeout
265+
setTimeout(() => {
266+
node.select();
267+
}, 0);
265268
}
266269
}
267270
}

0 commit comments

Comments
 (0)