keyboardavoidingview无法与输入正常工作

时间:2018-09-27 15:13:07

标签: react-native

/**
 * Sample React Native App
 * https://github.com/facebook/react-native
 * @flow
 */

import React, { Component } from 'react';
import {
  Platform,
  StyleSheet,
  Text,
  View,
  Image,
  KeyboardAvoidingView,
  ScrollView
} from 'react-native';
import Loginform from './loginform'


export default class Login extends Component {
  render() {
    return (
        <KeyboardAvoidingView  style={styles.container}>
        <View style={styles.loginContainer}>
        <Image style={styles.logo} source={require('../images/logo.png')} />
         </View>

            <View style={styles.container}>


                <Loginform />    



            </View>
       </KeyboardAvoidingView>
    )
// define your styles
    }
}

const styles = StyleSheet.create({
    container: {
        flex: 1,
        backgroundColor: 'white',
    },
    loginContainer:{
        alignItems: 'flex-start',
        justifyContent: 'center',
        flexGrow: 1,
        marginTop:100,
    },
    logo: {
    }
  });

上面的代码是在android手机中打开键盘时表单的隐藏按钮上面的代码是简单的登录表单,它位于屏幕底部,当键盘打开时登录按钮是隐藏的。im与react 0.55

0 个答案:

没有答案