我已经用 react-native
创建了一个应用程序,并有一个消息聊天选项。当我点击 TextInput 并输入两行文本时,上面的一行会被隐藏。为了解决这个问题,我在文档中看到了 numberOfLines 属性,但它没有起作用。
以下是我的代码:
<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}/>
我也在getDefaultProps
函数中尝试了它:
getDefaultProps() {
return {
placeholder: 'Type a message...',
navHeight: 70,
textInputHeight: 44,
numberOfLines:5,
maxHeight: Screen.height,
};
},
但是并没有起作用。