React Native 仿登录页面

loginView.js 页面

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

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

import LogoImage from "./img/icon.png";
import QQImage from "./img/img_qq.png";
import WeixinImage from "./img/img_weixin.png";
import SinaImage from "./img/img_sina.png";

var Dimensions = require('Dimensions');
var {width,height} = Dimensions.get('window');

export default class loginView extends Component {
  
  render() {
    return (
      <View style={styles.container}>
        {/*头像*/}
        <Image source={LogoImage} style={styles.iconStyle}/>
        {/* 输入账号*/}
        <TextInput style={styles.inputStyle} 
        underlineColorAndroid="transparent"
        />
        {/* 输入密码*/}
        <TextInput style={styles.inputStyle} 
         underlineColorAndroid="transparent"
         secureTextEntry={true}
         />
         {/*登录*/}
        <View style={styles.loginStyle}>
        <Text style={{color:'white',fontSize:25}}>
          登录
        </Text>
        </View>
        {/*设置*/}
        <View style={styles.textStyel}>
          <Text style={{fontSize:20}}>
             无法登陆
          </Text>
          <Text style={{fontSize:20}}>
             新用户
          </Text>
        </View>
        {/*其它登录方式*/}
        <View style={styles.otherStyle}>
          <Text>其它登录方式</Text>
           <Image source={QQImage} style={styles.otherImageStyle}/>
           <Image source={WeixinImage} style={styles.otherImageStyle}/>
           <Image source={SinaImage} style={styles.otherImageStyle}/>
        </View>
      </View>
    );
  }
}

const styles = StyleSheet.create({
  container: {
    flex: 1,
    //定义侧轴排列方式
    alignItems:'center',
    backgroundColor: '#dddddd'
  },
  iconStyle:{
    marginTop:80,
    marginBottom:30,
    width:80,
    height:80,
    borderRadius:40,
    borderWidth:2,
    borderColor:'white'
  },
  inputStyle: {
    width:width*0.99,
    height:50,
    fontSize:20,
    borderWidth:2,
    borderColor:'white',
    backgroundColor:'white',
    marginBottom:1,
    // 内容居中
    textAlign:'center'
    
  },
  loginStyle:{
    height:50,
    width:width*0.9,
    marginTop:30,
    marginBottom:20,
    borderRadius:8,
    backgroundColor:'blue',
    justifyContent:'center',
    alignItems:'center',
  },
  textStyel:{
    width:width*0.9,
    justifyContent:'space-between',
    flexDirection:'row',
  },
  otherStyle:{
    flexDirection:'row',
    // 设置侧轴的对齐方式
    alignItems:'center',
    // 绝对定位
    position:'absolute',
    bottom:20,
    left:20
  },
  otherImageStyle:{
    width:50,
    height:50,
    borderRadius:25,
    marginLeft:8
    }
}
index.android.js

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

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

import LoginView from "./loginView";

export default class CQQLoginDemo extends Component {
  render() {
    return (
     <LoginView/>
    );
  }
}

AppRegistry.registerComponent('CQQLoginDemo', () => CQQLoginDemo);


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
React Native 是一款跨平台移动应用开发框架,可以使用 JavaScript 和 React 编写原生移动应用。如果你想要实现天猫物流跟踪时间轴的功能,可以考虑使用 React Native 开发。 下面是一个简单的实现流程: 1. 安装 React Native 开发环境,可以参考官方文档进行安装。 2. 创建一个新的 React Native 项目,使用 `react-native init` 命令可以快速创建一个新项目。 3. 在项目中安装 `react-native-timeline-flatlist` 组件,这个组件可以帮助我们实现时间轴的效果。 ``` npm install react-native-timeline-flatlist --save ``` 4. 在项目中创建一个新的组件,例如 `TimeLine` 组件。 5. 在 `TimeLine` 组件中引入 `react-native-timeline-flatlist` 组件,并使用数据来渲染时间轴。 ```javascript import Timeline from 'react-native-timeline-flatlist'; const data = [ { time: '09:00', title: '快递已揽收', description: '您的快递已经被揽收' }, { time: '12:00', title: '到达深圳', description: '您的快递已经到达深圳' }, { time: '15:00', title: '派送中', description: '您的快递正在派送中' }, { time: '18:00', title: '已签收', description: '您的快递已经被签收' }, ]; const TimeLine = () => { return ( <Timeline data={data} circleSize={20} circleColor="#007aff" lineColor="#007aff" timeContainerStyle={{ minWidth: 52, marginTop: -5 }} timeStyle={{ textAlign: 'center', backgroundColor: '#ff9797', color: 'white', padding: 5, borderRadius: 13 }} descriptionStyle={{ color: 'gray' }} options={{ style: { paddingTop: 5 }, }} /> ); }; export default TimeLine; ``` 6. 在主界面中使用 `TimeLine` 组件,并传递数据来展示时间轴。 ```javascript import React from 'react'; import { View, StyleSheet } from 'react-native'; import TimeLine from './TimeLine'; const App = () => { return ( <View style={styles.container}> <TimeLine /> </View> ); }; const styles = StyleSheet.create({ container: { flex: 1, backgroundColor: '#fff', }, }); export default App; ``` 通过以上步骤,我们就可以实现一个简单的天猫物流跟踪时间轴功能。当然,如果你想要更加复杂的效果,可以根据自己的需求对组件进行自定义。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值