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

/**
* 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);
React Native实战一的更多相关文章
- 【腾讯Bugly干货分享】React Native项目实战总结
本文来自于腾讯bugly开发者社区,非经作者同意,请勿转载,原文地址:http://dev.qq.com/topic/577e16a7640ad7b4682c64a7 “8小时内拼工作,8小时外拼成长 ...
- 利用react native创建一个天气APP
我们将构建一个实列程序:天气App,(你可以在react native 中创建一个天气应用项目),我们将学习使用并结合可定义模板(stylesheets).盒式布局(flexbox).网络通信.用户输 ...
- 慢牛系列四:好玩的React Native
在上次随笔(系列三)中,我试着用RN实现了一个Demo,感觉很不错,当时遇到的问题这篇文章里基本都解决了,比如导航动画问题,这篇文章里主要介绍RN的动画,学会动画以后,各种小创意都可以实现了^^ 下面 ...
- React Native通信机制详解
React Native是facebook刚开源的框架,可以用javascript直接开发原生APP,先不说这个框架后续是否能得到大众认可,单从源码来说,这个框架源码里有非常多的设计思想和实现方式值得 ...
- 基于React Native的58 APP开发实践
React Native在iOS界早就炒的火热了,随着2015年底Android端推出后,一套代码能运行于双平台上,真正拥有了Hybrid框架的所有优势.再加上Native的优秀性能,让越来越多的公司 ...
- React Native 网络层分析
文:志俊(沪江Web前端) 本文原创,转载请注明作者及出处 在使用React Native开发中,我们熟练的采用JavaScript的方式发送请求的方式发送一个请求到服务端,但是处理这个请求的过程其实 ...
- 《React Native 精解与实战》书籍连载「React Native 源码学习方法及其他资源」
此系列文章将整合我的 React 视频教程与 React Native 书籍中的精华部分,给大家介绍 React Native 源码学习方法及其他资源. 最后的章节给大家介绍 React Native ...
- 《React Native 精解与实战》书籍连载「iOS 平台与 React Native 混合开发」
此文是我的出版书籍<React Native 精解与实战>连载分享,此书由机械工业出版社出版,书中详解了 React Native 框架底层原理.React Native 组件布局.组件与 ...
- React Native入门指南
转载自:http://www.jianshu.com/p/b88944250b25 前言 React Native 诞生于 2015 年,名副其实的富二代,主要使命是为父出征,与 Apple 和 Go ...
随机推荐
- 寻找一组数中最大的K个数
对于"从一组数中挑出最大的K个数"这个在面试中经常会遇到,所以这次好好的去解析它,而当拿到这个问题时第一时间能想到解法就是:先对数据进行排序,然后再取最大的K个元素,当然这思路没毛 ...
- KeyboardEvent keyCode Property
Definition and Usage The keyCode property returns the Unicode character code of the key that trigger ...
- JavaScript实现数据的双向绑定
接触到Angulr.js和Vue.js后,提到最多的就是双向绑定 下面将用JavaScript实现数据的双向绑定 <!DOCTYPE html> <html> <head ...
- React 入门与实战-课时7 虚拟DOM的本质和目的
DOM树的概念: 一个网页呈现的过程: 1.浏览器请求服务器获取页面HTML代码 2.浏览器先在内存中,解析DOM结构,并在浏览器内存中,渲染出一颗DOM树: 3.浏览器把DOM树,呈现到页面上: R ...
- Python 字典 (4) 持续更新
字典一种用名字来引用值的数据结构,这种数据结构称为 映射(mapping) .字典中的键可以是数字.字符串和元组. 字典 创建和使用 创建 phonebook = {'Aaron':133000000 ...
- Codeforces Round #590 (Div. 3) B2. Social Network (hard version)
链接: https://codeforces.com/contest/1234/problem/B2 题意: The only difference between easy and hard ver ...
- HDU 6073 - Matching In Multiplication | 2017 Multi-University Training Contest 4
/* HDU 6073 - Matching In Multiplication [ 图论 ] | 2017 Multi-University Training Contest 4 题意: 定义一张二 ...
- 关于单片机特殊功能寄存器(SFR)和内存(RAM)公用地址:80-FF 如何区分
RAM 的 80-FF 需要间接寻址进行访问 如: MOV R0,#80H; MOV A,@R0 ; (内存 80H地址内的数据放到A中) SFR的80-FF需要直接寻址进行访问如: MOV ...
- nginx配置项
try_files location / { try_files $uri $uri/ /index.php?$query_string; } 当用户请求 http://host/instance时, ...
- pat 甲级 1034 ( Head of a Gang )
1034 Head of a Gang (30 分) One way that the police finds the head of a gang is to check people's pho ...