React-native 关于键盘遮挡界面问题


//引入 KeyboardAvoidingView 
import { KeyboardAvoidingView } from 'react-native';

//使用 KeyboardAvoidingView 
render(){
    return <KeyboardAvoidingView behavior={'padding'} style={{flex: 1}}>
        {/*具体页面内容*/}
    </KeyboardAvoidingView>
}

//android 已经处理 其实只需要处理Ios 就可以了  

但是有个问题 当使用scrollView  时,再其中的元素依旧会被遮挡,需要注意

通常在框架搭建之初就应该添加适配写法

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM