[RN] React Native 实现 类似QQ 登陆页面
[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 登陆页面的更多相关文章
- [RN] React Native 实现 类似京东 的 沉浸式状态栏和搜索栏
React Native 实现 类似京东 的 沉浸式状态栏和搜索栏 其原理其实就是在要 隐藏 部分的那个View 前面加入 StatusBar 代码! 代码如下: <StatusBar anim ...
- [RN] React Native 下实现底部标签(支持滑动切换)
上一篇文章 [RN] React Native 下实现底部标签(不支持滑动切换) 总结了不支持滑动切换的方法,此篇文章总结出 支持滑动 的方法 准备工作之类的,跟上文类似,大家可点击上文查看相关内容. ...
- [RN] React Native 实现图片预览
[RN] React Native 实现图片预览 效果预览: 代码如下: 'use strict'; import React, {Component} from 'react'; import {I ...
- [RN] React Native 常见基本问题归纳总结
[RN] React Native 常见基本问题归纳总结 本问题总结涉及到版本为: "react": "16.8.3","react-native& ...
- [RN] React Native 关闭所有黄色警告
[RN] React Native 关闭所有黄色警告 console.ignoredYellowBox = ['Warning: BackAndroid is deprecated. Please u ...
- [RN] React Native 幻灯片效果 Banner
[RN] React Native 幻灯片效果 Banner 1.定义Banner import React, {Component} from 'react'; import {Image, Scr ...
- [RN] React Native 常用命令行
[RN] React Native 常用命令行 1.查看当前版本 react-native --version 或 react-native -v 2.创建指定版本的React Native项目 1) ...
- [RN] React Native ScrollView去掉自带的间隔
React Native ScrollView去掉自带的间隔 使用ScrollView时,自带了一个类似marginTop的效果,将其去掉 <ScrollView automaticallyAd ...
- [RN] React Native 使用 阿里 ant-design
React Native 使用 阿里 ant-design 实例效果如图: 一.安装 npm install antd-mobile-rn --save npm install babel-plugi ...
随机推荐
- 【题解】Luogu P5342 [TJOI2019]甲苯先生的线段树
原题传送门 挺有趣的一道题 \(c=1\),暴力求出点权和n即可 \(c=2\),先像\(c=1\)一样暴力求出点权和n,考虑有多少路径点权和也为n 考虑设x为路径的转折点,\(L\)为\(x\)向左 ...
- Spring Boot Freemarker特别篇之contextPath【从零开始学Spring Boot
需求缘起:有人在群里@我:请教群主大神一个问题,spring boot + freemarker 怎么获取contextPath 头疼死我了,网上没一个靠谱的 .我就看看之前博客中的 [Spri ...
- Ole操作帮助类
/// <summary> /// Ole操作类 /// </summary> public class OleDataBaseHandle { private static ...
- CSS控制DIV水平垂直居中
<div style="position:absolute; width: 600px; height: 200px; left: 50%; top: 50%; margin-left ...
- Java自学-数组 排序
Java 数组选择法,冒泡法排序 步骤 1 : 选择法排序 选择法排序的思路: 把第一位和其他所有的进行比较,只要比第一位小的,就换到第一个位置来 比较完后,第一位就是最小的 然后再从第二位和剩余的其 ...
- 谈谈MySQL中的锁
谈谈MySQL中的锁 锁的定义 在生活中锁的例子就非常多了,所以应该很容易理解锁的含义.在计算机领域,可以这样来概述,锁是计算机协调多个进行进程并发访问某一资源的机制. 在数据库中,锁也是一个 ...
- 又一个js乱码的秘密alert放在js文件里中文乱码,可是放在HTML里显示中文就很好
用文本文档打开你的js文件,文件-另存为,编码更改为UTF-8保存. 回复 | PFly | 园豆:94 (初学一级) | 2017-07-17 21:32 显示结果中文乱码 支持(0)反对(0)回复 ...
- 【转载】PC端微信设置操作快捷键方法
在电脑上使用微信的时候,有时候我们需要自定义PC版微信快捷键操作,支持自定义微信快捷键设置的有:发送消息快捷键.截屏快捷键.打开微信快捷键以及检测快捷键热键是否与其他软件设置冲突.并且自定义设置PC微 ...
- [Props] vue组件间的传值及校验
基本用法 Prop的基本用法很简单,只需要在子组件的Vue实例中定义该属性并把值设为目标属性的数组即可 Vue.component('child', { ... // 接收message props: ...
- MySQL数据库之互联网常用分库分表方案
一.数据库瓶颈 不管是IO瓶颈,还是CPU瓶颈,最终都会导致数据库的活跃连接数增加,进而逼近甚至达到数据库可承载活跃连接数的阈值.在业务Service来看就是,可用数据库连接少甚至无连接可用.接下来就 ...