I have created an application in react-native
and I have an option to chat in messages option. when I click inside TextInput and type two lines, the upper line gets hidden. To fix this I saw in the docs numberOfLines property but it did not work.
Here is my code:
<TextInput
ref='textInput'
multiline={true}
numberOfLines: {5}
onChangeText={this.onChangeText}
style={[styles.textInput, {height: context.props.textInputHeight}]}
placeholder={context.props.placeholder}
placeholderTextColor="#5A5A5A"
value={context.state.text}/>
I tried it in getDefaultProps
function too:
getDefaultProps() {
return {
placeholder: 'Type a message...',
navHeight: 70,
textInputHeight: 44,
numberOfLines:5,
maxHeight: Screen.height,
};
},
But did not worked.
To resume:
<TextInput
...
numberOfLines={Platform.OS === 'ios' ? null : numberOfLines}
minHeight={(Platform.OS === 'ios' && numberOfLines) ? (20 * numberOfLines) : null}
/>