Autofocus search bar by default; closes #1532 (#1559)

This commit is contained in:
Amanda Bullington
2024-05-15 15:35:29 -07:00
committed by GitHub
parent 86054225d2
commit b841d0018d
2 changed files with 2 additions and 9 deletions

View File

@@ -9,7 +9,7 @@ import {
import { View } from "components/styledComponents";
import type { Node } from "react";
import React, {
useCallback, useLayoutEffect, useRef, useState
useCallback, useState
} from "react";
import { FlatList } from "react-native";
import { useIconicTaxa } from "sharedHooks";
@@ -24,12 +24,6 @@ const DROP_SHADOW = getShadowForColor( colors.darkGray, {
const ExploreTaxonSearch = ( ): Node => {
const [taxonQuery, setTaxonQuery] = useState( "" );
const navigation = useNavigation( );
// Ref for the input field
const inputRef = useRef( null );
// Focus input field on mount
useLayoutEffect( ( ) => {
inputRef.current?.focus();
}, [] );
const iconicTaxa = useIconicTaxa( { reload: false } );
const taxonList = useTaxonSearch( taxonQuery );
@@ -63,7 +57,6 @@ const ExploreTaxonSearch = ( ): Node => {
handleTextChange={setTaxonQuery}
value={taxonQuery}
testID="SearchTaxon"
input={inputRef}
/>
</View>

View File

@@ -27,7 +27,7 @@ type Props = {
// Ensure this component is placed outside of scroll views
const SearchBar = ( {
autoFocus = false,
autoFocus = true,
clearSearch,
containerClass,
handleTextChange,