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