我需要在根目录上调用Keyboard.dismiss
,但是当我像这样包装它时,FlatList
并没有响应滚动。仅在显示键盘时滚动,如何解决此问题?
<TouchableWithoutFeedback onPress={Keyboard.dismiss}>
<View style={styles.container}>
<View>
<FlatList
style={styles.chatContainer}
keyExtractor={history => `chat_${history.id}`}
data={chatHistory}
contentContainerStyle={styles.chatInnerContainer}
inverted={true}
renderItem={/* ... */}
/>
</View>
</View>
</TouchableWithoutFeedback>
const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: color.white,
height: '100%',
},
chatContainer: {
width: '100%',
overflow: 'visible'
},
chatInnerContainer: {
width: '100%',
flexDirection: 'column-reverse',
padding: 10,
overflow: 'visible'
}
});
是这样的: