【发布时间】:2016-06-26 12:03:59
【问题描述】:
我在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,
};
},
但是没有用。
【问题讨论】:
标签: javascript android reactjs react-native textinput