feat: select all text when focus search bar

This commit is contained in:
EnixCoda 2020-05-29 22:44:58 +08:00
parent c5cb36377a
commit 89e3f24e29
No known key found for this signature in database
GPG key ID: 0C1A07377913A1DD

View file

@ -16,7 +16,10 @@ export function SearchBar({ onSearch, onFocus, searchKey }: Props) {
<TextInput
backgroundColor="white"
icon={SearchIcon as any}
onFocus={onFocus}
onFocus={e => {
onFocus(e)
e.target.select()
}}
tabIndex={0}
className={cx('search-input', {
error: !isValidRegexpSource(searchKey),