登录练习

LoginView
import React, {Component} from 'react';
import {
    Platform,
    StyleSheet,
    Text,
    View,
    Image,
    TextInput
} from 'react-native';

var screenWidth = require('Dimensions').get('window').width;
var Left = (screenWidth - screenWidth*0.8)/2.0;
export default class LoginView extends Component {
    render() {
        return (
            <View style={styles.container}>
                {/*头像*/}
                <Image style={styles.headerStyle} source={require('./img/oldDoctor.png')}/>

                {/*/!*账号密码输入框*!/*/}
                <TextInput style={styles.textInputStyle} placeholder='请输入账号'/>
                <TextInput style={styles.textInputStyle} placeholder='请输入密码' password={true}/>

                {/*/!*登录*!/*/}
                <View style={styles.loginStyle}>
                    <Text>登录</Text>
                </View>

                {/*/!*无法登录,新用户*!/*/}
                <View style={styles.settingStyle}>
                    <Text style={{padding: (20, 20, 20, 20)}}>无法登录</Text>
                    <Text style={{padding: (20, 20, 20, 20)}}>新用户</Text>
                </View>

                {/*其他登录方式*/}
                <View style={styles.otherLoginStyle}>
                    <Text >其他登录方式</Text>
                    <Image source={require('./img/oldDoctor.png')} style={styles.otherLoinImgeStyle}/>
                    <Image source={require('./img/oldDoctor.png')} style={styles.otherLoinImgeStyle}/>
                    <Image source={require('./img/oldDoctor.png')} style={styles.otherLoinImgeStyle}/>
                </View>
            </View>
        )
    }
}

const styles = StyleSheet.create({
    container: {
        backgroundColor: '#F5FCFF',
        alignItems: 'center',
        flex:1,
    },

    // 头像
    headerStyle: {
        marginTop: 25,
        marginBottom: 20,
        width: 80,
        height: 80,
        borderRadius: 40,
        borderWidth: 1,
        borderColor: 'orange'
    },

    // 账号密码
    textInputStyle: {
        marginBottom: 1,
        backgroundColor: 'white',
        width: screenWidth,
        height: 22,
        textAlign: 'center'
    },

    //登录
    loginStyle: {
        marginTop: 19,
        marginBottom: 0,
        backgroundColor: 'blue',
        width: screenWidth * 0.8,
        height: 40,
        borderRadius: 8,

        justifyContent: 'center',
        alignItems: 'center'
    },

    //无法登录,新用户
    settingStyle: {
        width: screenWidth,
        flexDirection: 'row',
        justifyContent: 'space-between',
        alignItems: 'center',
    },

    //其他登录方式
    otherLoginStyle:{
        position:'absolute',
        left:Left,
        right:Left,
        bottom:5,
        flexDirection: 'row',
        alignItems:'center',
    },

    //其他登录方式图片
    otherLoinImgeStyle:{
        marginLeft:20,
        width:40,
        height:40,
    },
});
module.exports = LoginView;

App
import React, { Component } from 'react';
import {
    Platform,
    StyleSheet,
    Text,
    View,
    Image,
    TextInput
} from 'react-native';

//引入外部的js文件
var LoginView = require('./LoginView');

export default class App extends Component{
    render(){
        return(
            <LoginView/>
        );
    }
}
const styles = StyleSheet.create({
    container: {
        flex:1,
        backgroundColor:'#F5FCFF',
        justifyContent:'center',
        alignItems:'center'
    },

});

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值