React Native TextInput value keep on refreshing while typing something inside it

Viewed 139

I have written this code, while typing inside it screen gets refreshed multiple times and the <TextInput/> component get cleared automatically.

<TextInput
    onChangeText={(value) =>setsearchTerm(value) }
    style={styles.searchInput}
    placeholder="Type a message"
    value={searchTerm}
/>
1 Answers

Try to replace your onChangeText prop with:

onChangeText={ setsearchTerm }

Hope this works for you

Related