maxkordiyak / react-native-dropdown-autocomplete

Autocomplete input with dropdown modal component for React native. Useful for pages with multiple autocomplete's.
MIT License
100 stars 51 forks source link

OnChangeText clears the input when using useState hook #57

Open dislersd opened 3 years ago

dislersd commented 3 years ago

Updating local state through onChangeText, clears the input anytime I type.

 const [item, setItem] = useState("")

<Autocomplete
    key={uuidv4()}
    inputStyle={styles.inputContainer}
    placeholder="building"
    onChangeText={text => setItem(text)} // <-- This is not working
    handleSelectItem={(item, id) => console.log(item, id)}
    data={items}
    minimumCharactersCount={2}
    valueExtractor={item => item}
  />
nhasoenhasan commented 3 years ago

onChangeText={(text) => setItem(text)} change to this