【问题标题】:React Native keyboard aware scrollview?React Native 键盘感知滚动视图?
【发布时间】:2017-11-21 16:10:19
【问题描述】:

我想知道如何在不使用 popular library 的情况下制作键盘感知滚动视图,因为在 KeyboardAwareScrollView 中使用“受控”TextInputs 时,当前是 giving me a bug

有人成功了吗?也许使用 KeyboardAvoidingView? 该解决方案必须适用于 iOS 和 Android

【问题讨论】:

    标签: react-native keyboard


    【解决方案1】:

    您可以使用KeyboardAvoidingView 组件。从“react-native”中导入它以及您需要的所有其他组件,并将您的 UI 保留在该组件中。 例如,

    import {KeyboardAvoidingView} from 'react-native'
    export default class App extends React.Component{
        render(){
            return(
                <KeyboardAvoidingView  behavior="padding">
                    Your UI
                </KeyboardAvoidingView>
    );
    }
    }
    

    不要忘记添加道具behaviour="padding"。它在安卓设备上对我有用。我没有 iPhone 来测试它,但希望它能工作。 在此this link 上抢购以获取更多信息。希望这会有所帮助。

    【讨论】:

      猜你喜欢
      • 2018-05-05
      • 2018-01-09
      • 2019-02-08
      • 2022-06-14
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-01-25
      • 1970-01-01
      相关资源
      最近更新 更多