[React Native] Basic iOS Routing -- NavigatorIOS
Inside the app component, we use NavigatiorIOS to render the compoent:
class githubnotetaker extends Component {
render() {
return (
<NavigatorIOS
style={styles.container}
initialRoute={{
title: 'Github note taker',
component: Main
}}
/>
);
}
}
This is like rouer. 'initialRoute': for the initial loading, it will loads 'Main' component by default.
Whole code for index.ios.js:
/**
* Sample React Native App
* https://github.com/facebook/react-native
* @flow
*/ import React, { Component } from 'react';
import {
AppRegistry,
StyleSheet,
Text,
NavigatorIOS
} from 'react-native';
import Main from './App/components/main'; const styles = StyleSheet.create({
container:{
flex: 1,
backgroundColor: '#111111'
},
}); class githubnotetaker extends Component {
render() {
return (
<NavigatorIOS
style={styles.container}
initialRoute={{
title: 'Github note taker',
component: Main
}}
/>
);
}
} AppRegistry.registerComponent('githubnotetaker', () => githubnotetaker);
Main component:
import React, { Component, PropTypes } from 'react';
import { View, Text, StyleSheet } from 'react-native'; var style = StyleSheet.create({
mainContainer: {
flex: 1,
padding: 30,
marginTop: 65,
flexDirection: 'column',
justifyContent: 'center',
backgroundColor: '#48BBEC'
},
title: {
marginBottom: 20,
fontSize: 25,
textAlign: 'center',
color: '#fff'
},
searchInput: {
height: 50,
padding: 4,
marginRight: 5,
fontSize: 23,
borderWidth: 1,
borderColor: 'white',
borderRadius: 8,
color: 'white'
},
buttonText: {
fontSize: 18,
color: '#111',
alignSelf: 'center'
},
button: {
height: 45,
flexDirection: 'row',
backgroundColor:'white',
borderColor:'white',
borderWidth:1,
borderRadius:8,
marginBottom:10,
alignSelf:'stretch',
justifyContent:'center'
}
}); export default class Main extends Component{
render(){
return (
<View style={style.mainContainer}>
<Text>Testing the Router</Text>
</View>
)
}
}
We sue 'View', 'Text', 'StyleSheet' from react-native for rendering the content. And apply the styles.
[React Native] Basic iOS Routing -- NavigatorIOS的更多相关文章
- React Native & Android & iOS & APK
React Native & Android & iOS & APK https://play.google.com/apps/publish/signup/ $ 25 bui ...
- React Native & Android & iOS
React Native & Android & iOS React Native & Android & iOS https://facebook.github.io ...
- React Native之 Navigator与NavigatorIOS使用
前言 学习本系列内容需要具备一定 HTML 开发基础,没有基础的朋友可以先转至 HTML快速入门(一) 学习 本人接触 React Native 时间并不是特别长,所以对其中的内容和性质了解可能会有所 ...
- React Native视频播放(iOS)
网站链接:http://www.ncloud.hk/%E6%8A%80%E6%9C%AF%E5%88%86%E4%BA%AB/learn-react-native-video/ React Nativ ...
- React Native (二) ios打包到真机
每当在模拟器上完成了开发,都想到真机上试试,正好前段时候淘了一个imac. 这里就以打包rndemo到iphone为例,讲一下react ntive ios打包到真机的流程. 一.前置 1.有个iph ...
- React Native(十三)——ios键盘挡住textInput
渐入佳境 用React Native重构的项目也快接近尾声,剩下的就是适配ios的功能了.慢慢地也从中琢磨出了一点门道,于是就遇见了键盘遮挡textInput问题斑斑: 正常页面: android点击 ...
- react native进一步学习(NavigatorIOS 学习)
特别申明:本人代码不作为任何商业的用途,只是个人学习的一些心得,为了使得后来的更多的程序员少走一些弯路.*(如若侵犯你的版权还望见谅)*. 开发工具:WebStorm,xcode 1. rn的创建的时 ...
- React Native之iOS App打包
iOS打包步骤(一.二.三可不按照顺序) 步骤一: 选择iOS Device(以下两者选其中一个即可) 选择 Generic iOS Device (个人建议使用这个) 选择Generic iOS D ...
- React Native ios开发第一课
前言 本篇文章的作用在于帮助你快速上手使用React Native编写iOS应用.如果你现在还不太了解React Native是什么以及Facebook为什么要创建React Native,你可以先看 ...
随机推荐
- [状压dp]HDOJ4539 郑厂长系列故事——排兵布阵
中文题,题意不再赘述 对于“?”这一格,它所能攻击到的(曼哈顿距离为2的) 前方的 即“√”的四个位置 那么与此格有关的即它前方两行(即状压这两行) 首先预处理每行能满足的: i 和(i<< ...
- [状压dp]HDOJ3182 Hamburger Magi
题意 大致是: 有n个汉堡 m块钱 (n<=15) 然后分别给n个汉堡的能量 再分别给n个汉堡所需的花费 然后下面n行 第i行有x个汉堡要在i汉堡之前吃 然后给出这x个汉堡的编号 输出 能获得 ...
- Postman(API & HTTP请求调试插件)和Apizza fiddler
http://blog.csdn.net/u011012932/article/details/51456263#comments
- Django Aggregation聚合
在当今根据需求而不断调整而成的应用程序中,通常不仅需要能依常规的字段,如字母顺序或创建日期,来对项目进行排序,还需要按其他某种动态数据对项目进行排序.Djngo聚合就能满足这些要求. 以下面的Mode ...
- S3C2410 实验三——跑马灯实验
http://www.evernote.com/shard/s307/sh/f2a748e7-34c4-4ce6-acac-82a756cc9e82/ad5813188d655e504857970db ...
- Java-Swing嵌入浏览器(二)
这是qtjambi利用webview来做嵌入式浏览器,下面是我的工程目录. 运行效果如下图: 代码相关: package qtBowers; import com.trolltech.qt.core. ...
- 一个简单的有向图Java实现
最近看了点有向图的内容,参考开源项目做了一个简单版本,直接贴代码. /** * 有向图接口,定义需要实现的各个方法,可以选择使用邻接矩阵或者邻接链表来实现 * @param <V> V代表 ...
- poj2029Get Many Persimmon Trees(最大矩阵和)
链接 类似最大矩阵 sum存下 枚举最大就是 #include <iostream> #include<cstdio> #include<cstring> #inc ...
- 六月计划#2A(6.10-6.16)
17/35 STL BZOJ_1588_&_Codevs_1296_[HNOI2002]_营业额统计(平衡树/set)(set重做) BZOJ_1208_&_Codevs_1258_[ ...
- Android What is Application
本文转自:http://www.cnblogs.com/elleniou/archive/2012/05/16/2502661.html Application和Activity,Service一样是 ...