zoukankan      html  css  js  c++  java
  • React Native的键盘遮挡问题(input/webview里)

    2017-06-15

    1:使用keyVoaidView来解决 注意要设置behavio=“absolute”,哎。记性差 好像拼错了

    2:使用下面的代码,监听键盘,然后将webView拉高就可以了

    import React, { Component } from 'react';  
    import { Keyboard, TextInput } from 'react-native';  
      
    class Example extends Component {  
      componentWillMount () {  
        this.keyboardDidShowListener = Keyboard.addListener('keyboardDidShow', this._keyboardDidShow);  
        this.keyboardDidHideListener = Keyboard.addListener('keyboardDidHide', this._keyboardDidHide);  
      }  
      
      componentWillUnmount () {  
        this.keyboardDidShowListener.remove();  
        this.keyboardDidHideListener.remove();  
      }  
      
      _keyboardDidShow () {  
        alert('Keyboard Shown');  
      }  
      
      _keyboardDidHide () {  
        alert('Keyboard Hidden');  
      }  
      
      render() {  
        return (  
          <TextInput  
            onSubmitEditing={Keyboard.dismiss}  
          />  
        );  
      }  
    }  
    
  • 相关阅读:
    AC自动机学习笔记(模板)
    codeforces1328E
    Codeforces 1288E- Messenger Simulator (树状数组)
    线性基小记
    HDU3949
    矩阵快速幂小记
    5E
    5D
    5C
    5B
  • 原文地址:https://www.cnblogs.com/allenxieyusheng/p/7016345.html
Copyright © 2011-2022 走看看