[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 ...
随机推荐
- 【sql笔记】oracle 循环
=============================================== 2019/12/21_第1次修改 ccb_warlock = ...
- python内存机制与垃圾回收、调优手段
目录 一.python的内存机制 二.python的垃圾回收 1. 引用计数 1.1 原理: 1.2 优缺点: 1.4 两种情况: 2. 标记清除 2.1 原理: 2.2 优缺点: 3. 分代回收 3 ...
- 【Maven基础入门】01 Maven的安装与环境变量的配置
写在前面: Mavne,作为一个优秀的项目构建工具,虽说我们平时在使用的时候或多或少的会使用到它,但了解仅限于它能构建项目,然后其他的就不知道了. 以及仓库.POM父类文件.等等. 工欲善其事,必先利 ...
- cas sso 单点登录
一些介绍: https://www.jianshu.com/p/b7de8e4cf217 https://blog.csdn.net/javaloveiphone/article/details/52 ...
- Visual Studio 2019 安装
目录 写在前面 官网下载 安装 等待安装 启动 写在前面 目前工作的开发环境还是旧版本的Visual Studio 2013版.个人感觉还是有点跟不上时代更新迭代的节奏了.毕竟,技术在进步.如果我们也 ...
- MPAndroid 的学习
1.MPAndroid 的github的地址: https://github.com/PhilJay/MPAndroidChart#documentation 2.使用步骤: 在build.gradl ...
- 用cProfile做性能分析【转】
原文地址: https://www.cnblogs.com/kaituorensheng/p/4453953.html
- python写文件无法换行的问题
python写文件无法换行的问题,用'\n' 不行,直接打印的出来了. 网上查了查,都说是用 ‘\r\n’ ,但是这样打出来,不仅换行了,还加了一个空行. windows平台最后结果是 直接 ...
- Fedora 30系统的升级方法
Fedora 30 已经发布了.你可能希望将系统升级到最新版本的 Fedora.Fedora 工作站版本有图形化升级的方法.另外,Fedora 也提供了一个命令行方法,用于将 Fedora 29 升级 ...
- Kubernetes第十一章--部署微服务电商平台