说个题外话,早上打开电脑的时候,电脑变成彩色的了,锅是我曾经安装的一个chrome扩展,没有经过我的同意开启了

(也许是昨天迷迷糊糊开启了)

上午运行项目都不成功,还以为被黑客攻击了~~~然后下午就排除问题啊,不能一直彩色界面啊~~~

就一个一个禁掉chrome插件

言归正传,时间如流水,快快珍惜。

接下来这个demo也是很基础的,重点是看看数据处理还有有没有下拉加载更多,页面返回是有点问题的

上开源的程序员的源码:https://github.com/githubze/react-native-aze

页面效果如下







还是不够有些基础啊,分析代码

//taskapp1/index.js
//引用入口是在app.js
/**
* @format
*/ import {AppRegistry} from 'react-native';
import App from './App';
import {name as appName} from './app.json'; AppRegistry.registerComponent(appName, () => App);
//定义可切换下部,和引用组件
/**
* Sample React Native App
* https://github.com/facebook/react-native
*
* @format
* @flow
*/ import React, {Component} from 'react';
import {Platform, StyleSheet, Text, View,Image} from 'react-native';
import {DrawerNavigator,TabNavigator,StackNavigator} from 'react-navigation';
import {
createDrawerNavigator,
createStackNavigator,
createBottomTabNavigator,
createAppContainer,
} from 'react-navigation';
import HomeScreen from './Component/HomePage/Home';
import DetailScreen from './Component/HomePage/DetailScreen';
import Mine from './Component/MinePage/Mine'; export const Stack = createStackNavigator(
{
Home: { screen: HomeScreen },
Details: { screen: DetailScreen },
},
{
headerMode:'screen',
navigationOptions: ({
navigation
}) => ({
tabBarVisible: navigation.state.index > 0 ? false : true,
}),
headerBackTitleVisible:false,
//headerBackImage:<Image source={require('./Component/HomePage/back.png')}/>,
},
); export const Stack1 = createStackNavigator(
{
Home: { screen: Mine },
},
{
headerMode:'screen',
navigationOptions: ({
navigation
}) => ({
tabBarVisible: navigation.state.index > 0 ? false : true, }),
headerBackTitleVisible:false,
},
); export const Tabs = createBottomTabNavigator(
{
TabA: {
screen: Stack,
navigationOptions: {
tabBarLabel: '任务',
tabBarIcon: ({tintColor, focused}) => {
if(focused){
return <Image source={require('./Images/HomeImage1.png')} style={styles.imageStyle} />;
} else {
return <Image source={ require('./Images/HomeImage0.png')} style={styles.imageStyle}/>;
}
},
},
},
TabB: {
screen: Stack1,
navigationOptions: {
tabBarLabel: '我的',
tabBarIcon: ({tintColor, focused}) => {
if(focused){
return <Image source={require('./Images/MineImage1.png')} style={styles.imageStyle} />;
} else {
return <Image source={ require('./Images/MineImage0.png')} style={styles.imageStyle}/>;
}
}, //headerBackImage:navigation.state.index > 0? <Image source={require('./Images/back.png')} style={styles.imageStyle} />:null,
},
}
},
{
order: ['TabA', 'TabB'],
tabBarOptions:{
labelStyle: {
fontSize: 11,
bottom:4
},
style: {
backgroundColor: 'white',
},
activeTintColor:'#EA7B00',
inactiveTintColor:'#D1D1D1',
showIcon:true, }, }, ) export const RootStack = createAppContainer(
createDrawerNavigator({
// Stack: { screen: Stack },
Tabs: { screen: Tabs },
})
); type Props = {};
export default class App extends Component<Props> {
render() {
return <RootStack />;
}
} const styles = StyleSheet.create({
container: {
flex: 1,
justifyContent: 'center',
alignItems: 'center',
backgroundColor: '#F5F5F5',
},
imageStyle:{
width:20,
height:20,
}, });

关于首页是写死的数据没有与后端交互

//home
//taskapp1/Component/HomePage/Home.js
import React, {Component} from 'react';
import {Platform, StyleSheet, Text, View,Button,ListView,FlatList,Image,TouchableOpacity} from 'react-native'; class HomeScreen extends React.Component {
static navigationOptions = {
title: '任务',
}; state = {selected: (new Map(): Map<string, boolean>)};
_keyExtractor = (item, index) => index; refreshing(){
let timer = setTimeout(()=>{
clearTimeout(timer)
// alert('刷新成功') },15000)
} itemClick(item, index) {
//alert('点击了第' + index + '项,name为:' + item.title); this.props.navigation.navigate('Details',{
userName:'Tory',
userInfo:'Hello'
})
} render() {
let movies = [
{title: '微信分享 帮忙助力领跑汽车优惠 第一行',ProgressText:'33%',DetailText:'4.4',ImageName:'https://gsnapshot.alicdn.com/imgextra/i3/575127927/TB2n8OJIk9WBuNjSspeXXaz5VXa_!!575127927.jpg_430x430.jpg?time=1539689523000'},
{title: '微信分享 帮忙助力领跑汽车优惠 第二行',ProgressText:'33%',DetailText:'4.4',ImageName:'https://gsnapshot.alicdn.com/imgextra/i3/575127927/TB2n8OJIk9WBuNjSspeXXaz5VXa_!!575127927.jpg_430x430.jpg?time=1539689523000'},
{title: '微信分享 帮忙助力领跑汽车优惠 第三行',ProgressText:'33%',DetailText:'4.4',ImageName:'https://gsnapshot.alicdn.com/imgextra/i3/575127927/TB2n8OJIk9WBuNjSspeXXaz5VXa_!!575127927.jpg_430x430.jpg?time=1539689523000'},
{title: '微信分享 帮忙助力领跑汽车优惠 第四行',ProgressText:'33%',DetailText:'4.4',ImageName:'https://gsnapshot.alicdn.com/imgextra/i3/575127927/TB2n8OJIk9WBuNjSspeXXaz5VXa_!!575127927.jpg_430x430.jpg?time=1539689523000'},
{title: '微信分享 帮忙助力领跑汽车优惠 第五行',ProgressText:'33%',DetailText:'4.4',ImageName:'https://gsnapshot.alicdn.com/imgextra/i3/575127927/TB2n8OJIk9WBuNjSspeXXaz5VXa_!!575127927.jpg_430x430.jpg?time=1539689523000'},
{title: '微信分享 帮忙助力领跑汽车优惠 第六行',ProgressText:'33%',DetailText:'4.4',ImageName:'https://gsnapshot.alicdn.com/imgextra/i3/575127927/TB2n8OJIk9WBuNjSspeXXaz5VXa_!!575127927.jpg_430x430.jpg?time=1539689523000'},
{title: '微信分享 帮忙助力领跑汽车优惠 第七行',ProgressText:'33%',DetailText:'4.4',ImageName:'https://gsnapshot.alicdn.com/imgextra/i3/575127927/TB2n8OJIk9WBuNjSspeXXaz5VXa_!!575127927.jpg_430x430.jpg?time=1539689523000'},
];
return (
<View style={styles.container}>
<FlatList
data = {movies}
showsVerticalScrollIndicator = {false}
keyExtractor={this._keyExtractor}
onRefresh={this.refreshing}
refreshing={false}
renderItem={ ({item}) =>
<TouchableOpacity onPress={this.itemClick.bind(this, item, item.index)}>
<View style={styles.cellView} > <View style={styles.contentStyle}>
<Text style={styles.titleStyle}>{item.title}</Text>
<Text style={styles.progressStyle}>{'完成率:'+item.ProgressText}</Text>
<Text style={styles.detailStyle}>{'好评值:'+item.DetailText}</Text>
</View>
<View style={styles.imageContentStyle}>
<Image
source={{uri: 'https://gsnapshot.alicdn.com/imgextra/i3/575127927/TB2n8OJIk9WBuNjSspeXXaz5VXa_!!575127927.jpg_430x430.jpg?time=1539689523000'}}
style={styles.showImageStyle}
/>
</View> </View>
</TouchableOpacity> }
/> </View>
);
}
} const styles = StyleSheet.create({
container: {
flex: 1,
justifyContent: 'center',
alignItems: 'center',
backgroundColor: '#F4F4F4',
},
welcome: {
fontSize: 20,
textAlign: 'center',
margin: 10,
},
instructions: {
textAlign: 'center',
color: '#333333',
marginBottom: 5,
},
showImageStyle: {
width:70,
height:70,
},
cellView: {
flexDirection:'row',
backgroundColor: '#ffffff',
marginBottom: 1,
flex: 1,
},
contentStyle:{
marginTop:16,
marginLeft:20,
width: 230,
},
imageContentStyle:{
marginTop:19,
marginRight:20,
marginBottom:15,
marginLeft: 35,
},
titleStyle: {
color: '#333333',
fontSize: 16,
fontWeight: 'bold',
},
progressStyle: {
color: '#A1A1A1',
height:12,
marginTop: 5,
fontSize: 12,
},
detailStyle: {
color: '#A1A1A1',
height:12,
marginTop: 3,
fontSize: 12,
},
}); export {HomeScreen as default};
//taskapp1/Component/HomePage/DetailScreen.js
//点击进入详情页,注意data在homepage页面用到
import React, {Component} from 'react';
import {Image, Platform, StyleSheet, Text, View} from 'react-native'; class DetailScreen extends Component {
static navigationOptions = {
title: '任务详情',
headerBackImage:<Image source={require('../HomePage/back.png')}/>,
}; render() {
const data=this.props.navigation.state.params;
return (
<View style={styles.container}>
<Text>你好!</Text>
</View>
);
}
}
const styles = StyleSheet.create({
container: {
flex: 1,
justifyContent: 'center',
alignItems: 'center',
backgroundColor: '#F5F5F5',
},
welcome: {
fontSize: 20,
textAlign: 'center',
margin: 10,
},
instructions: {
textAlign: 'center',
color: '#333333',
marginBottom: 5,
},
});
export {DetailScreen as default};
//detail页面模仿的homepage页面写法,作者有很强的模仿发散能力啊
import React, {Component} from 'react';
import {Platform, StyleSheet, Text, View,Button,ListView,FlatList,Image,TouchableOpacity,Dimensions,StatusBar} from 'react-native'; var {height,width} = Dimensions.get('window');
class Mine extends React.Component {
static navigationOptions = {
title: '我的',
header:null,
}; state = {selected: (new Map(): Map<string, boolean>)};
_keyExtractor = (item, index) => index; itemClick(item, index) {
//alert('点击了第' + index + '项,name为:' + item.title); this.props.navigation.navigate('Details',{
userName:'Tory',
userInfo:'Hello'
}) } header = () => {
return ( <View style={styles.headViewStyle}>
<View style={styles.userViewStyle}>
<Image
source={{uri: 'http://img01.myyzz.com/upload/images/20190429/userlogo/20190429wxxwjv24rgl1.png'}}
style={styles.iconImageStyle}
/>
<Text style={styles.nameStyle}>Geniusn</Text>
</View> </View>
)
}; render() {
let movies = [
{title: '我的互助'},
{title: '分享给好友'},
{title: '版本更新'},
{title: '设置'},
{title: '退出登录'},
];
return (
<View style={styles.container}>
<FlatList
data = {movies}
showsVerticalScrollIndicator = {false}
keyExtractor={this._keyExtractor}
ListHeaderComponent={this.header}
renderItem={ ({item}) =>
<TouchableOpacity onPress={this.itemClick.bind(this, item, item.index)}>
<View style={styles.cellView} >
<Text style={[styles.titleStyle,styles.contentStyle]}>{item.title}</Text>
<Image
source={require('../MinePage/ordershow.png')}
style={styles.showImageStyle}
/> </View>
</TouchableOpacity> }
/> </View>
);
}
} const styles = StyleSheet.create({
container: {
flex: 1,
justifyContent: 'center',
alignItems: 'center',
backgroundColor: '#F4F4F4',
},
cellView: {
flexDirection:'row',
backgroundColor: '#ffffff',
marginBottom: 1,
flex: 1,
height:50,
width:width,
},
contentStyle:{
marginLeft:20,
marginTop:17,
width: 230,
},
titleStyle: {
color: '#333333',
fontSize: 16,
textAlign:'left',
},
showImageStyle: {
width:15,
height:20,
marginTop:15,
marginLeft: 98,
},
headViewStyle:{
flexDirection:'row',
backgroundColor: '#EA7B00',
height:220,
justifyContent:'center',
},
userViewStyle:{
width:70,
height:100,
marginTop:60,
},
iconImageStyle:{
width:70,
height:70,
borderRadius:35,
resizeMode:'cover',
},
nameStyle:{
color: '#ffffff',
fontSize: 18,
marginTop:10,
},
}); export {Mine as default};

【水滴石穿】react-native-aze的更多相关文章

  1. 基于React Native的58 APP开发实践

    React Native在iOS界早就炒的火热了,随着2015年底Android端推出后,一套代码能运行于双平台上,真正拥有了Hybrid框架的所有优势.再加上Native的优秀性能,让越来越多的公司 ...

  2. React Native 之 Text的使用

    前言 学习本系列内容需要具备一定 HTML 开发基础,没有基础的朋友可以先转至 HTML快速入门(一) 学习 本人接触 React Native 时间并不是特别长,所以对其中的内容和性质了解可能会有所 ...

  3. React Native环境配置之Windows版本搭建

    接近年底了,回想这一年都做了啥,学习了啥,然后突然发现,这一年买了不少书,看是看了,就没有完整看完的.悲催. 然后,最近项目也不是很紧了,所以抽空学习了H5.自学啃书还是很无趣的,虽然Head Fir ...

  4. 史上最全Windows版本搭建安装React Native环境配置

    史上最全Windows版本搭建安装React Native环境配置 配置过React Native 环境的都知道,在Windows React Native环境配置有很多坑要跳,为了帮助新手快速无误的 ...

  5. 【腾讯Bugly干货分享】React Native项目实战总结

    本文来自于腾讯bugly开发者社区,非经作者同意,请勿转载,原文地址:http://dev.qq.com/topic/577e16a7640ad7b4682c64a7 “8小时内拼工作,8小时外拼成长 ...

  6. React Native环境搭建以及几个基础控件的使用

    之前写了几篇博客,但是没有从最基础的开始写,现在想了想感觉不太合适,所以现在把基础的一些东西给补上,也算是我从零开始学习RN的经验吧! 一.环境搭建 首先声明一下,本人现在用的编辑器是SublimeT ...

  7. React Native组件介绍

    1.React Native目前已有的组件 ActivityIndicatorIOS:标准的旋转进度轮; DatePickerIOS:日期选择器: Image:图片控件: ListView:列表控件: ...

  8. React Native图片控件的使用

    首先定义组件 import { AppRegistry, StyleSheet, Text, View, Image,} from 'react-native'; 然后将render返回中的模版增加I ...

  9. react-native学习笔记--史上最详细Windows版本搭建安装React Native环境配置

    参考:http://www.lcode.org/react-native/ React native中文网:http://reactnative.cn/docs/0.23/android-setup. ...

  10. windows 7下React Native环境配置

    React Native 是 Facebook 推出的一个用 Java 语言就能同时编写 ios,android,以及后台的一项技术,它可以做到实时热更新 .FaceBook 也号称这们技术是 “Le ...

随机推荐

  1. springboot新增jsp的支持

    一.添加依赖 <!-- 添加对jsp的支持 --> <!-- web 依赖 --> <dependency> <groupId>org.springfr ...

  2. property中ref、value、name的区别

    转载: 版权声明:本文为CSDN博主「qq_36098284」的原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接及本声明.原文链接:https://blog.csdn.net ...

  3. Redis多API开发

    目录 Redis API支持 redis-py安装方式 Python 连接redis 直接连接 使用连接池连接 Windows 连接redis数据库 一.下载Redis Desktop Manager ...

  4. JS钩子的机制与实现

    [什么是钩子] 接触过WordPress的朋友都知道,WP的程序中可以执行类似钩子的函数,当然是这PHP实现的钩子.在JavaScript中一样可以实现类似的功能. 用一句话来形容一下:钩子是将需要执 ...

  5. CentOS7.4 安装JDK 步骤

    1.先在官网下载jdk1.8的压缩文件 2.用putty将压缩文件拷到home目录下 3.新建一个/home/jdk1.8目录 :  mkdir  /home/jdk1.8 4.将压缩文件解压到hom ...

  6. PAT甲级——A1024 Palindromic Number

    A number that will be the same when it is written forwards or backwards is known as a Palindromic Nu ...

  7. 一键清理系统垃圾文件bat

    历史比较久远了,可做一定参考. @echo off echo 正在清理系统垃圾文件,请稍等...... del /f /s /q %systemdrive%*.tmp del /f /s /q %sy ...

  8. TCP、UDP区别

    个人认为,用户层Socket的TCP和UDP编程,区别并不大.   最大的区别,或者说,唯一的区别,似乎就是TCP客户端中断连接之后,TCP会得到一个应答.   但是如果用UDP来实现TCP,似乎也不 ...

  9. 轻松搞定 JS 的this、call和apply

    年前最后一篇文章,提前祝大家春节快乐.对了,还有369就要2018年了,提前祝大家2018年春节快乐. .. .vr qBMBBBMBMY 8BBBBBOBMBMv iMBMM5vOY:BMBBv . ...

  10. Tensorflow通过CNN实现MINST数据分类

    import tensorflow as tf from tensorflow.examples.tutorials.mnist import input_data mnist = input_dat ...