地址:

源码

运行效果



无别的效果,代码如下

//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,
}
})

第一个完毕~

最新文章

  1. Win+Ctrl键设置
  2. 【Android】apk文件反编译
  3. NOIP2010乌龟棋[DP 多维状态]
  4. 你真的懂了R中的stem函数是如何绘制茎叶图的么?
  5. Mina 资料
  6. (转)关于java和web项目中的相对路径问题
  7. Asp.net开启分布式事务管理
  8. Java 执行 SQL 脚本文件
  9. ZeroMQ(JAVA)中的数据流,SessionBase与SocketBase
  10. CH BR8(小学生放假了-clock()/CLOCKS_PER_SEC-斜率优化常错集锦)
  11. Android Studio ADB响应失败解决方法(2CTo.com)
  12. OA系统在实际应用中可发挥出的协同应用价值
  13. 关于pip安装时提示&quot;pkg_resources.DistributionNotFound&quot;错误
  14. Vue基于vue-quill-editor富文本编辑器使用心得
  15. Linux上svn搭建
  16. Docker Doc之一:小白入门
  17. 自学Linux Shell9.4-基于Red Hat系统工具包存在两种方式之二:源码包
  18. prometheus 通过企业微信接收告警
  19. easyui tree 搜索
  20. Maven的安装学习笔记

热门文章

  1. Spring注解驱动开发(五)-----扩展原理
  2. python函数当容器
  3. C#——找出实现某个接口的所有类 - Hello World - CSDN博客
  4. python时间处理,datetime中的strftime/strptime
  5. 操作系统实验 windows编程多线程 生产者消费者问题 画圆画方(内置bug版)
  6. UVA11613 Acme Corproation
  7. Ubuntu 链接ln的使用:创建和删除符号链接
  8. 【python之路36】进程、线程、协程相关
  9. bzoj 1029 [JSOI2007]建筑抢修——贪心(伪dp)
  10. laravel-admin 报错 Disk [admin] not configured, please add a disk config in `config/filesystems.php`.