【水滴石穿】AB-B-Clone
地址:
源码
运行效果

无别的效果,代码如下
//index.js
/**
* @format
* @lint-ignore-every XPLATJSCOPYRIGHT1
*/
import {AppRegistry} from 'react-native';
import App from './App';
AppRegistry.registerComponent('ABNB_clone', () => App);
import React, {Component} from 'react';
import { AppRegistry, View } from 'react-native';
import LoggedOut from './src/screens/LoggedOut';
// 登陆组件
class App extends Component {
render() {
return (
<View>
<LoggedOut />
</View>
)
}
}
AppRegistry.registerComponent('App', () => App);
export default App;
封装的RoundedButton组件
import React, { Component } from 'react';
import PropTypes from 'prop-types';
import { Text, View, TouchableHighlight, StyleSheet} from 'react-native';
import colors from '../../styles/colors';
export default class RoundedButton extends Component {
render() {
const {
text,
textColor,
background,
handleOnPress,
icon
} = this.props;
const backgroundColor = background || 'transparent';
const color = textColor || colors.black;
return (
<TouchableHighlight
style={[{backgroundColor}, styles.wrapper]}
onPress={handleOnPress}
>
<View style={styles.buttonTextWrapper}>
{icon}
<Text style={[{color},styles.buttonText]}>{text}</Text>
</View>
</TouchableHighlight>
)
}
}
RoundedButton.PropTypes = {
text: PropTypes.string.isRequired,
textColor: PropTypes.string,
background: PropTypes.string,
icon: PropTypes.object,
handleOnPress: PropTypes.func.isRequired,
}
const styles = StyleSheet.create({
wrapper: {
display: 'flex',
padding: 15,
borderRadius: 40,
borderWidth: 1,
borderColor: colors.white,
height: 50,
marginBottom: 15,
alignItems: 'center',
},
buttonText: {
fontSize: 16,
width: '100%',
textAlign: 'center'
},
buttonTextWrapper: {
flexDirection: 'row',
justifyContent: 'flex-end',
}
});
//LoggedOut
import React, {Component} from 'react';
import { Image, StyleSheet, Text, View, TouchableHighlight } from 'react-native';
import RoundedButton from '../components/buttons/RoundedButton';
import colors from '../styles/colors';
import Icon from 'react-native-vector-icons/FontAwesome';
const airbnbLogo = require('../images/airbnb-logo.png')
class LoggedOut extends Component {
onFacebookPress(){
alert('Facebook press')
}
onCreateAccountPress(){
alert('Create Account')
}
onMoreOptionsPress(){
alert('More Options')
}
render() {
return (
<View style={styles.wrapper}>
<View style={styles.welcomeWrapper}>
<Image
source={airbnbLogo}
style={styles.logo}
/>
<Text style={styles.welcomeText}>
Welcome to Airbnb
</Text>
<RoundedButton
text="Continue with Facebook"
textColor={colors.green01}
background={colors.white}
icon={<Icon name="facebook" size={20} style={styles.facebookButtonIcon} />}
handleOnPress={this.onFacebookPress}
/>
<RoundedButton
text="Create Account"
textColor={colors.white}
background={colors.green01}
handleOnPress={this.onCreateAccountPress}
/>
<TouchableHighlight
style={styles.moreOptionsButton}
onPress={this.onMoreOptionsPress}
>
<Text style={styles.moreOptionsButtonText}>More Options</Text>
</TouchableHighlight>
<View style={styles.termsAndConditions}>
<Text style={styles.termsText}>
By Tapping Continue. Create An Account or More
</Text>
<Text style={styles.termsText}>options, </Text>
<Text style={styles.termsText}>I agree to Airbnb's</Text>
<TouchableHighlight style={styles.linkButton}>
<Text style={styles.termsText}>Terms of Service</Text>
</TouchableHighlight>
<Text style={styles.termsText}> ,</Text>
<TouchableHighlight style={styles.linkButton}>
<Text style={styles.termsText}>Payments, Terms of Service</Text>
</TouchableHighlight>
<Text style={styles.termsText}> ,and</Text>
<TouchableHighlight style={styles.linkButton}>
<Text style={styles.termsText}>Privacy Policy</Text>
</TouchableHighlight>
<Text style={styles.termsText}> ,</Text>
<TouchableHighlight style={styles.linkButton}>
<Text style={styles.termsText}>Nondiscrimination Policy.</Text>
</TouchableHighlight>
</View>
</View>
</View>
)
}
}
export default LoggedOut;
const styles = StyleSheet.create({
wrapper: {
flex: 1,
display: 'flex',
backgroundColor: colors.green01,
},
welcomeWrapper: {
flex: 1,
display: 'flex',
marginTop: 30,
padding: 20
},
logo: {
width: 50,
height: 50,
marginTop: 50,
marginBottom: 40,
},
welcomeText: {
fontSize: 30,
height: 60,
color: colors.white,
fontWeight: '300',
},
facebookButtonIcon: {
color: colors.green01,
position: 'relative',
left: 30,
zIndex: 8,
width: 20,
},
moreOptionsButton: {
marginTop: 15,
width: 50,
},
moreOptionsButtonText: {
color: colors.white,
width: 200,
fontSize: 20,
height: 30,
},
termsAndConditions: {
flexWrap: 'wrap',
alignItems: 'flex-start',
flexDirection: 'row',
marginTop: 40
},
termsText: {
color: colors.white,
fontSize: 12,
fontWeight: '600',
height: 20
},
linkButton: {
borderBottomWidth: 0.5,
display: 'flex',
borderBottomColor: colors.white,
}
})
第一个完毕~
【水滴石穿】AB-B-Clone的更多相关文章
- 基于 HTML5 WebGL 的挖掘机 3D 可视化应用
前言 在工业互联网以及物联网的影响下,人们对于机械的管理,机械的可视化,机械的操作可视化提出了更高的要求.如何在一个系统中完整的显示机械的运行情况,机械的运行轨迹,或者机械的机械动作显得尤为的重要,因 ...
- 基于 HTML5 + WebGL 的 3D 可视化挖掘机
前言 在工业互联网以及物联网的影响下,人们对于机械的管理,机械的可视化,机械的操作可视化提出了更高的要求.如何在一个系统中完整的显示机械的运行情况,机械的运行轨迹,或者机械的机械动作显得尤为的重要,因 ...
- 基于 HTML5 + WebGL 实现 3D 挖掘机系统
前言 在工业互联网以及物联网的影响下,人们对于机械的管理,机械的可视化,机械的操作可视化提出了更高的要求.如何在一个系统中完整的显示机械的运行情况,机械的运行轨迹,或者机械的机械动作显得尤为的重要,因 ...
- LeetCode: Clone Graph 解题报告
Clone GraphClone an undirected graph. Each node in the graph contains a label and a list of its neig ...
- wrk,ab,locust,Jmeter 压测结果比较
背景: 项目需要对一批接口进行压测,要求是接口的QPS(Quest Per Second每秒请求数)达到6万以上由于楼主一直使用的压力测试工具是jmeter,但是jmeter单台电脑无法达到6万的QP ...
- Git从码云Clone代码到本地
Git从码云或者Github 克隆代码到本地 1.下载安装Git,傻瓜式下一步下一步即可... 2.配置Git: 2.1.选择你要clone到本地的路径:右键--->$ Git Bash Her ...
- ab
ab is a tool for benchmarking your Apache Hypertext Transfer Protocol (HTTP) server. It is designed ...
- SCVMM中Clone虚拟机失败显示Unsupported Cluster Configuration状态
在SCVMM进行虚拟机的Clone,虽然失败了,但是Clone出虚拟机却显示在SCVMM控制台的虚拟机的列表中,并且状态是Unsupported Cluster Configuration.无法修复, ...
- [LeetCode] Clone Graph 无向图的复制
Clone an undirected graph. Each node in the graph contains a label and a list of its neighbors. OJ's ...
- 使用ab对nginx进行压力测试
nginx以高并发,省内存著称. 相信大多数安装nginx的同学都想知道自己的nginx性能如何. 我想跟大家分享下我使用ab工具的压力测试方法和结果, ab是针对apache的性能测试工具,可以只安 ...
随机推荐
- Java SE、Java EE、Java ME三者的区别
1. Java SE(Java Platform,Standard Edition).Java SE 以前称为 J2SE.它允许开发和部署在桌面.服务器.嵌入式环境和实时环境中使用的 Java 应用程 ...
- xml文件节点读取时,selectNodes总是在根节点下查找的问题
参考:https://yq.aliyun.com/articles/39543 SAXReader reader = new SAXReader();Document document = reade ...
- python初学小记
使用PyCharm向世界打招呼! print (“Hello world!”) 介绍自己的基本信息的方法 name = input("name:")age = int(input( ...
- Django--Cookie和Session组件
什么是Cookie: cookie的工作原理是:由服务端产生内容,浏览器收到请求之后保存在本地:当浏览器再次访问的时候,浏览器会自动带上这个cookie,这样服务端就能去通过这个cookie来判断你是 ...
- 在PyCharm中导入Numpy和Pygame模块 (win8.1)
我用的是anaconda安装python3.6 已经在终端 pip install numpy 但是在pycharm运行程序出现错误:ImportError: No module named nump ...
- (codeforces 853A)Planning 贪心
Helen works in Metropolis airport. She is responsible for creating a departure schedule. There are n ...
- Spring配置xml自动提示——转载https://blog.csdn.net/sinat_18474835/article/details/79370629
以Spring2.0为例: 下载地址: Csdn: http://download.csdn.net/download/hh775313602/9812757 没积分的可以去百度网盘下载,我已共享: ...
- geoserver与OpenLayers配置
geoserver与OpenLayers配置 目录 1 准备工作.... 4 1.1 需要用到的程序和资料... 4 2 地图格式转换方式(一 ...
- python 产生二项分布图练习
- 【Codeforces Round #430 (Div. 2) B】Gleb And Pizza
[链接]点击打开链接 [题意] 在这里写题意 [题解] 根据圆心到原点的距离这个东西判断一下圆在不在那个环里面就好 [错的次数] 0 [反思] 在这了写反思 [代码] #include <cst ...