I'm new in React Native and not sure why it shows unexpected result. If I type 'a' then 'a' it shows 'AAA', and so on.
export default class App extends Component {
constructor(props) {
super(props)
this.state = {
userName: ''
}
}
formatUserName = (textValue) => {
// If I remove toUpperCase() below, it shows expected result.
this.setState({ userName: textValue.toUpperCase() });
}
render() {
...
<TextInput
onChangeText={textValue => this.formatUserName(textValue)}
value={this.state.userName} />
...
}
}