【发布时间】:2018-01-23 13:19:24
【问题描述】:
Here is my phone screen我用keyboardShouldPersistTaps尝试了ScrollView,但是没有用。我有一个用于自动完成建议的 ScrollView,当用户可以在那里输入时,他们也应该能够从建议中进行选择。但是,如果不关闭键盘,就我而言是不可能的。这是我的工作
<ScrollView
scrollEnabled={false}
keyboardShouldPersistTaps={true}>
<View style={{ maxHeight: 220 }}>
<ScrollView style={Style.suggestionContainer}
scrollEnabled={true} >
{this.state.showOptions.map(this.renderSuggestions)}
</ScrollView>
</View>
</ScrollView>
.
.
.
private renderSuggestions(option: MultiInputQuestionOption) {
return (
<TouchableOpacity onPress={this.addSelection.bind(this, option)} >
<Text style={Style.suggestions}>
{option[this.props.titleKey]}
</Text>
</TouchableOpacity >
)
}
有什么可能的解决办法吗?
【问题讨论】:
-
为什么会有两个滚动视图组件?试一试
-
这个错误有什么好运气吗?
标签: reactjs react-native keyboard