[RN] React Native 实现 类似QQ 登陆页面

一、主页index.js

项目目录下index.js

/**
* @format
*/ import {AppRegistry} from 'react-native';
import App from './src/js/App';
import {name as appName} from './app.json'; AppRegistry.registerComponent(appName, () => App);

二、App.js

import React, {Component} from 'react';
import {Image, StyleSheet, Text, TextInput, TouchableOpacity, View} from 'react-native'; //屏幕信息
var dimensions = require('Dimensions');
//获取屏幕的宽度
var {width} = dimensions.get('window'); export default class App extends Component<Props> {
render() {
return (
<View style={styles.container}>
{/*头像*/}
<Image style={styles.circleImage} source={require('./logo.png')}/>
{/*账户*/}
<TextInput
style={styles.textInput}
placeholder={'请输入用户名'}
//输入框下划线
underlineColorAndroid={'transparent'}/>
{/*密码*/}
<TextInput
style={styles.textInput}
placeholder={'请输入密码'}
secureTextEntry={true}
underlineColorAndroid={'transparent'}/>
{/*无法登录 新用户*/}
{/*登录*/}
<TouchableOpacity style={styles.btnStyle}>
<Text style={styles.loginText}>登录</Text>
</TouchableOpacity>
{/*无法登录 新用户*/}
<View style={styles.canNot}>
<Text style={{color: '#4398ff'}}>无法登录</Text>
<Text style={{color: '#4398ff'}}>新用户</Text>
</View>
{/*其它登录方式*/}
<View style={styles.loginTheWay}>
<Text>其它登录方式:</Text>
<Image style={styles.image} source={require('./alipay.png')}/>
<Image style={styles.image} source={require('./wechat.png')}/>
</View>
</View>
);
}
} const styles = StyleSheet.create({
container: {
flex: ,
flexDirection: 'column',
backgroundColor: '#dddddd',
//设置次轴的对齐方式
alignItems: 'center',
},
circleImage: {
width: ,
height: ,
borderRadius: ,
borderWidth: ,
borderColor: 'white',
marginTop: ,
marginBottom: ,
},
textInput: {
height: ,
width: width,
marginBottom: ,
backgroundColor: 'white',
textAlign: 'left',
},
canNot: {
width: width - ,
marginTop: ,
flexDirection: 'row',
alignItems: 'center',
//设置主轴为两端对齐
justifyContent: 'space-between',
},
loginTheWay: {
flexDirection: 'row',
//设置次轴的对齐方式
alignItems: 'center',
justifyContent: 'flex-start',
//绝对定位
position: 'absolute',
// //距离底部还有30 距离左边还有10 这样的一个位置
bottom: ,
left: ,
},
image: {
width: ,
height: ,
marginLeft: ,
borderRadius: ,
},
btnStyle: {
height: ,
width: width - ,
borderRadius: ,
marginTop: ,
backgroundColor: '#4398ff',
justifyContent: 'center',
},
loginText: {
textAlign: 'center',
color: 'white',
textAlignVertical: 'center',
} });

具体代码见Github:

https://github.com/wukong1688/RN-BaseLoginPage

本博客地址: wukong1688

本文原文地址:https://www.cnblogs.com/wukong1688/p/10811163.html

转载请注明出处!谢谢~~

[RN] React Native 实现 类似QQ 登陆页面的更多相关文章

  1. [RN] React Native 实现 类似京东 的 沉浸式状态栏和搜索栏

    React Native 实现 类似京东 的 沉浸式状态栏和搜索栏 其原理其实就是在要 隐藏 部分的那个View 前面加入 StatusBar 代码! 代码如下: <StatusBar anim ...

  2. [RN] React Native 下实现底部标签(支持滑动切换)

    上一篇文章 [RN] React Native 下实现底部标签(不支持滑动切换) 总结了不支持滑动切换的方法,此篇文章总结出 支持滑动 的方法 准备工作之类的,跟上文类似,大家可点击上文查看相关内容. ...

  3. [RN] React Native 实现图片预览

    [RN] React Native 实现图片预览 效果预览: 代码如下: 'use strict'; import React, {Component} from 'react'; import {I ...

  4. [RN] React Native 常见基本问题归纳总结

    [RN] React Native  常见基本问题归纳总结 本问题总结涉及到版本为: "react": "16.8.3","react-native& ...

  5. [RN] React Native 关闭所有黄色警告

    [RN] React Native 关闭所有黄色警告 console.ignoredYellowBox = ['Warning: BackAndroid is deprecated. Please u ...

  6. [RN] React Native 幻灯片效果 Banner

    [RN] React Native 幻灯片效果 Banner 1.定义Banner import React, {Component} from 'react'; import {Image, Scr ...

  7. [RN] React Native 常用命令行

    [RN] React Native 常用命令行 1.查看当前版本 react-native --version 或 react-native -v 2.创建指定版本的React Native项目 1) ...

  8. [RN] React Native ScrollView去掉自带的间隔

    React Native ScrollView去掉自带的间隔 使用ScrollView时,自带了一个类似marginTop的效果,将其去掉 <ScrollView automaticallyAd ...

  9. [RN] React Native 使用 阿里 ant-design

    React Native 使用 阿里 ant-design 实例效果如图: 一.安装 npm install antd-mobile-rn --save npm install babel-plugi ...

随机推荐

  1. 在O(1)的时间内删除链表节点

    题目: 在O(1)的时间内删除链表节点.给定链表的头指针和待删除的节点指针,定义一个函数在O(1)的时间内删除该节点. 剑指offer的思路,顿时觉得极妙.删除节点node1,先把其下一个节点node ...

  2. linux上文件的上传和下载

    现整理一篇linux上文件的上传和下载 第一种方式就是在windos上安装工具 如: 工具如何使用我就不赘述了,easy 第二种方式就是使用liux的命令(首先是文件上传) 上传文件(首先创建文件夹如 ...

  3. 【leetcode-78 dfs+回溯】 子集

    子集 给定一组不含重复元素的整数数组 nums,返回该数组所有可能的子集(幂集). 说明:解集不能包含重复的子集. 示例: 输入: nums = [1,2,3] 输出: [ [3],   [1],   ...

  4. scanf加不加\n?

    近两天用vs2013敲代码碰到的问题 关于scanf小括号中加不加\n的区别 例程序如下所示: 第一个程序: int main(){ ; printf("你会去敲代码吗?(选择1 or 0) ...

  5. ASP.NET SignalR 系列(六)之连接事件

    本章主要介绍下SignalR自带的连接事件 其实再前面的示例中,有出现了一些事件的重载,比如 public override Task OnConnected() 下面简单介绍一下SignalR提供了 ...

  6. CephFS 使用

    原文:https://www.jianshu.com/p/c22ff79c4452 之前介绍了 RBD 的使用方法,有了 RBD,远程磁盘挂载的问题就解决了,但 RBD 的问题是不能多个主机共享一个磁 ...

  7. HTTP协议的认识

    1.内容回顾 1.HTTP协议消息的格式: 1.请求(request) 请求方法 路径 HTTP/1.1 \r\n k1:v1\r\n ...\r\n \r\n 请求体 <--这里可以有可以没有 ...

  8. Matlab责任链模式

    责任链模式(Chain of Responsibility Pattern)为请求创建了一个接收者对象的链.这种模式给予请求的类型,对请求的发送者和接收者进行解耦,本人根据https://www.ru ...

  9. webpack+vue-cil跨域配置接口地址代理

    在vue项目开发的时候,接口联调的时候一般都是同域名下,且不存在跨域的情况下进行接口联调,但是当我们现在使用vue-cli进行项目打包的时候,我们在本地启动服务器后,比如本地开发服务下是 http:/ ...

  10. c# 将两个表的有效数据合到一个表中

    <asp:DropDownList ID="ddlSpecialty" runat="server" > </asp:DropDownList ...