this is my first stackoverflow question, please bare with me if I do anyhting wrong. Here goes my question: how do I restrict the number of lines in a textInput using react? I have to say im new to react and dont know if i am doing it wrong. I have searched for this question before asking this one and they recommend to use maxheight. Ive tried it and it doesnt work. this is my code. I am trying to restrict the number of written lines to 4. Currently, a textInput appears but i can write more thatn 4 lines.
import React, { Component } from 'react';
import { TextInput } from 'react-native';
export default class UselessTextInput extends Component {
constructor(props) {
super(props);
this.state = { text: 'Write something' };
}
render() {
return (
<TextInput
style={{height: 40, borderColor: 'gray', borderWidth: 1}}
onChangeText={(text) => this.setState({text})}
value={this.state.text}
multiline={true}
numberOfLines={5}
/>
);
}
}
Any type of help is very much appreciated.