我想知道我如何使用键盘与反应本机。
当我点击我的输入(在“发送”),我没有一个键盘显示。

我试着使用"KeyboardAvoidingView“,但键盘没有显示。
ChatScreen.js
import React from 'react';
import { ScrollView, KeyboardAvoidingView, StyleSheet, Text, View } from 'react-native';
import MessageList from './MessageList';
import MessageForm from './MessageForm';
export default class ChatScreen extends React.Component {
render() {
return (
<KeyboardAvoidingView style={styles.container} behavior="padding" enabled>
<MessageList />
<MessageForm />
</KeyboardAvoidingView>
);
}
}
const styles = StyleSheet.create({
container: {
display: 'flex',
flexDirection: 'column',
flexGrow: 1,
backgroundColor: 'grey',
alignSelf: 'stretch',
},
});MessageForm.js
import React from 'react';
import { StyleSheet, Text, View, TextInput } from 'react-native';
import MessageFormStyles from './MessageFormStyles'
export default class MessageForm extends React.Component {
render() {
return (
<View style={MessageFormStyles.container}>
<TextInput
style={MessageFormStyles.input}
placeholder="Send">
</TextInput>
</View>
);
}
}Package.json
"dependencies": {
"axios": "0.19.0",
"expo": "31.0.2",
"react": "16.5.0",
"react-native": "https://github.com/expo/react-native/archive/sdk-32.0.0.tar.gz",
"react-native-gesture-handler": "^1.3.0",
"react-native-vector-icons": "^6.6.0",
"react-navigation": "3.11.1",
"react-redux": "6.0.1",
"redux": "4.0.4",
"redux-devtools-extension": "2.13.8",
"redux-immutable-state-invariant": "^2.1.0",
"redux-thunk": "^2.3.0"
},你知道为什么我看不到键盘吗?
发布于 2019-08-08 11:47:42
如果使用模拟器,则必须在模拟器硬件设置中禁用键盘。
请去按一下键盘,你可能会再次看到键盘。
https://stackoverflow.com/questions/57372466
复制相似问题