[fix] TextInput selectTextOnFocus for Safari

Close #1810
This commit is contained in:
Raibima Putra
2020-11-13 11:18:25 +07:00
committed by Nicolas Gallagher
parent 366f0e9923
commit 5f19b41928
+4 -1
View File
@@ -261,7 +261,10 @@ const TextInput = forwardRef<TextInputProps, *>((props, forwardedRef) => {
node.value = '';
}
if (selectTextOnFocus) {
node.select();
// Safari requires selection to occur in a setTimeout
setTimeout(() => {
node.select();
}, 0);
}
}
}