react-Native键盘收起、textInput键盘遮挡问题

点击界面任意处键盘收起

import {
    Keyboard,
    TouchableOpacity,
} from 'react-native';
  { Keyboard.dismiss(); }} 
activeOpacity={1} style={{flex: 1}}>
            

键盘遮挡问题:
1.使用KeyboardAvoidingView

import {KeyboardAvoidingView} from 'react-native';
 @observable top = getPixel(100);
 
                        
                             { this.top = getPixel(40); }}/>
                             { this.top = getPixel(100); }}/>
                             { this.top = getPixel(100); }}/>
                        
                    

LoginInput.js

onFocus=() => {
        const {onFocus} = this.props;
        onFocus && onFocus();
    }

render(){
    return(
            
    )
}

2.使用第三方库:KeyboardAwareScrollView

 import {KeyboardAwareScrollView} from 'react-native-keyboard-aware-scroll-view';
 


参考借鉴:
KeyboardAwareScrollView详细见react-native-keyboard-aware-scroll-view git

你可能感兴趣的:(react-Native键盘收起、textInput键盘遮挡问题)