效果图如下所示: 展示列表页面,点击跳转至详情页面:

   

/**
* Sample React Native App
* https://github.com/facebook/react-native
* @flow
*/ import React, { Component } from 'react';
import {
AppRegistry,
StyleSheet,
Text,
View,
Image,
TextInput,
Animated,
NavigatorIOS,
TouchableHighlight,
ScrollView
} from 'react-native'; var HelloReactNavtive = React.createClass({
render() {
return (
<NavigatorIOS
style = {styles.container}
initialRoute = {{
title: '主页',
component: List,
}}
/>
);
}
}); var List = React.createClass({ render: function () {
return (
<ScrollView style = {styles.flex}>
<Text style = {styles.list_item} onPress = {this.gotoDetail}>豪华游艇三日游</Text>
<Text style = {styles.list_item} onPress = {this.gotoDetail}>豪华游艇五日游</Text>
<Text style = {styles.list_item} onPress = {this.gotoDetail}>豪华游艇八日游</Text>
</ScrollView>
);
}, gotoDetail() {
// alert('111');
this.props.navigator.push({
component: detailPage,
title: '详情页面',
rightButtonTitle: '购物车', // 右侧item
onRightButtonPress:function() { // 右侧item的点击方法
alert('进入我的购物车...');
},
});
},
}); // 详情页面
var detailPage = React.createClass({ render: function() {
return (
<ScrollView style = {styles.list}>
<Text>
详情页面
</Text>
<Text>
啥都没有,这就是详情页面了...
</Text>
</ScrollView>
);
},
}); // styles
const styles = StyleSheet.create({ container: {
flex: ,
backgroundColor: 'white',
justifyContent: 'center',
}, list: { marginLeft: ,
marginTop: ,
}, blackText: {
fontSize:,
color:'rgb(0,0,0)',
backgroundColor:'rgba(255,255,25,0)',
textAlign:'center',
marginLeft:,
}, whiteText:{
fontSize:,
color:'rgb(255,255,255)',
backgroundColor:'rgba(255,255,255,0)',
textAlign:'left',
marginLeft:,
}, list_item: {
flex: ,
textAlign: 'left',
marginLeft: ,
marginTop: ,
color:'rgb(0,0,0)',
height: ,
}, flex: {
flex: ,
}
}); AppRegistry.registerComponent('HelloReactNavtive', () => HelloReactNavtive);

最新文章

  1. PHP无限极分类
  2. MongoDB(NoSQL) 入门
  3. linux使用技巧
  4. iOS - Swift Subscript 下标脚本
  5. cocos2dx libcurl
  6. Codeforces Beta Round #7 C. Line (扩展欧几里德)
  7. ffmpeg编译 --enable :没有命令
  8. 初识Google code jam平台
  9. Qt出现堆溢出(Error Code -1073741823)
  10. 一步操作关闭iOS状态栏(电池栏)
  11. 网站发布出现“未能找到路径“path\bin\roslyn\csc.exe”....“和拒绝访问的解决办法
  12. vs2017 在win10下安装后开始运行asp.net core 项目时出错
  13. 移植 iperf 网络性能测试工具到 Android-P
  14. mybatis3 date 的处理
  15. jstl的forEach详解(转)
  16. AbelSu教你搭建go语言开发环境
  17. iOS 10 之 网络权限带来的坑
  18. 20172308 实验一《Java开发环境的熟悉》实验报告
  19. C# 实现自动化打开和关闭可执行文件(或 关闭停止与系统交互的可执行文件)
  20. Java泛型的逆变

热门文章

  1. 使用Tarjan进行缩点无向图
  2. Linux的基础使用命令
  3. HDU 2897 bash 博弈变形
  4. body element height id small, but the backgroud color is full screen
  5. ELK架构图示例
  6. debug:The key &quot;&quot; is not recognized and ignored.
  7. C# 通过Process.Start() 打开程序 置顶方法
  8. $ python manage.py makemigrations You are trying to add a non-nullable field &#39;name&#39; to course without a default; we can&#39;t do that (the database needs something to populate existing rows). Please selec
  9. For 循环的嵌套与九九乘法表
  10. Unknown property &#39;mybatis-plus&#39; yml文件报错