【问题标题】:How to prevent React Native keyboard from shrinking when TextInput focused?TextInput 聚焦时如何防止 React Native 键盘缩小?
【发布时间】:2021-11-01 09:08:13
【问题描述】:

我真的是 React Native 的新手。

当我聚焦 TextInput 时,会导致这个可怕的场景:

[![在此处输入图片描述][1]][1]

我用Flex,觉得没问题。

那么你能告诉我我的问题在哪里,我应该怎么做?

【问题讨论】:

    标签: javascript node.js reactjs react-native


    【解决方案1】:

    使用 react-native 中的“KeyboardAvoidingView”

    import { KeyboardAvoidingView } from 'react-native';

    <KeyboardAvoidingView> //add form here </KeyboardAvoidingView>

    以下链接有一些解决方案

    https://www.freecodecamp.org/news/how-to-make-your-react-native-app-respond-gracefully-when-the-keyboard-pops-up-7442c1535580/

    【讨论】:

    • 请添加更多详细信息以扩展您的答案,例如工作代码或文档引用。
    • @MihirPanchal 我在问题中放了一张图片。它引起改革。
    【解决方案2】:

    还将 minHeight 添加到样式中。这样它就不会缩小超出限制

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2018-03-03
      • 2011-11-28
      • 1970-01-01
      • 2017-08-07
      • 2021-05-25
      • 2020-04-25
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多