Answer the question
In order to leave comments, you need to log in
How to optimize TextInput/TextArea in React Native (+expo)?
Hello, it re-renders with every new character in the TextInput/TextArea, searched the web for optimization, found something related to removing the value attribute, etc. But it turned out to be pointless, because. rendering still happens.
How can you optimize to make input faster? Can a separate screen be created for it so that there are fewer elements?
return (
<View style={styles.app}>
<View>
<TextInput
style={styles.input}
placeholder="Введите имя"
defaultValue={newPerson}
onChangeText={setNewPerson}/>
<Button style={styles.buttonAdd} onPress={addPerson} title="Добавить"></Button>
</View>
<ScrollView style={styles.scroll}>
{people.map(person => (
<TouchableOpacity
onPress={() => navigation.navigate('User', person)} key={person.id}>
<View style={styles.person}>
<Text style={styles.personName}>{person.name}</Text>
</View>
</TouchableOpacity>
))}
</ScrollView>
</View>
)
Answer the question
In order to leave comments, you need to log in
Why didn't you post all the code?
re-renders with every new character in TextInput/TextArea
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question