首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >在React本机中,键盘没有用KeyboardAvoidingView显示

在React本机中,键盘没有用KeyboardAvoidingView显示
EN

Stack Overflow用户
提问于 2019-08-06 09:00:21
回答 1查看 168关注 0票数 0

我想知道我如何使用键盘与反应本机。

当我点击我的输入(在“发送”),我没有一个键盘显示。

我试着使用"KeyboardAvoidingView“,但键盘没有显示。

ChatScreen.js

代码语言:javascript
运行
复制
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

代码语言:javascript
运行
复制
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

代码语言:javascript
运行
复制
"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"
  },

你知道为什么我看不到键盘吗?

EN

Stack Overflow用户

回答已采纳

发布于 2019-08-08 11:47:42

如果使用模拟器,则必须在模拟器硬件设置中禁用键盘。

请去按一下键盘,你可能会再次看到键盘。

票数 2
EN
查看全部 1 条回答
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/57372466

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档