I am create a word count for a textinput in react native, I think I have been able to achieve the word count, however, when i type into the textinput, I am getting an error of 'invalid prop value of type number supplied to textinput expected string react native'. I have tried everything i can to no avail
constructor(props) {
super(props);
this.state = {
ModalVisibleStatus: false,
maxLength: 70,
charLength: 70,
messageValue: '',
};
}
onChangeMessage(messageValue) {
const input = messageValue;
const charLength = this.state.maxLength - input.length.toString();
this.setState({
charLength,
messageValue: charLength
});
}
<TextInput
placeholder={placeholder}
onChangeText={this.onChangeMessage.bind(this)}
value={this.state.messageValue}
autoFocus
autoCorrect
multiline
maxLength={this.state.maxLength}
style={styles.textInputStyle}
underlineColorAndroid='transparent'
/>
<Text style={{ textAlign: 'right', right: 5, }}>{this.state.messageValue}</Text>