Reputation: 41
so i created and imported a component that is text input. however, it is not setting the text on change. any ideas?
<Email onChangeText={(email) => setEmail(email)}/>
import React from 'react';
import {TextInput} from 'react-native';
function Email() {
return (
<TextInput
label="Email"
placeholder="Email"
placeholderTextColor="black"
style = {{ width: 310, padding:20, marginBottom:10, backgroundColor:"#ebecff", borderRadius:10 }}
/>
);
}
export default Email;
Upvotes: 0
Views: 33
Reputation: 6967
This might help
function Email(props) {
return (
<TextInput
...
onChangeText={text => props.onChangeText(text)} // add this code
/>
);
}
Upvotes: 1