This is my code :
onChangeTextPrice(value) {
const newPrice = parseInt(value, 10).toLocaleString(['ban', 'id']);
return this.setState({ price: formatted });
}
If I console.log(newPrice)
, it will give me the format, for example : 10.000.000
but for some reason react native textinput doesn't use this value instead it show 10000000
.
but if I change TextInput
value like this:
<TextInput
keyboardType="numeric"
value={'10.000.000'}
multiline={false}
underlineColorAndroid="transparent"
onChange={val => this.onChangeTextPrice(val)}
It works. Why is that ?