[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,你可以先看 ...
随机推荐
- OCR识别流程
1.图像输入.预处理:图像输入:对于不同的图像格式,有着不同的存储格式,不同的压缩方式.预处理:主要包括二值化,噪声去除,倾斜较正等2.二值化:对摄像头拍摄的图片,大多数是彩色图像,彩色图像所含信息量 ...
- 5. Unity脚本的执行顺序
Unity是不支持多线程的,也就是说我们必须要在主线程中操作它,可是Unity可以同时创建很多脚本,并且可以分别绑定在不同的游戏对象身上,他们各自都在执行自己的生命周期感觉像是多线程,并行执行脚本的, ...
- ANDROID_MARS学习笔记_S02_005_AppWidget1
一.AppWidget介绍 1.要在手机生成AppWidget需的东西 (1)AppWidgetProviderInfo a).res\xml\example_appwidget_info.xml b ...
- INF文件
百度百科:http://baike.baidu.com/view/637107.htm?fr=ala0_1_1 INF简介 INF是Device INFormation File的英文缩写,是Micr ...
- leetcode面试准备:Kth Largest Element in an Array
leetcode面试准备:Kth Largest Element in an Array 1 题目 Find the kth largest element in an unsorted array. ...
- comparison of floating point numbers with equality operator. possible loss of precision while rounding values
double值由外部传入 private void Compare(double value) { string text; ) //小数位后保留2位 { //小数点后保留2位小数 text = st ...
- wcf iis host 打开exe失败 不能显示界面
最近谷歌没法用了,我的freegate经常性的崩溃 无奈之下,用了必应,貌似也不错 http://stackoverflow.com/questions/8414514/iis7-does-not-s ...
- HTML页面的导出,包括Excel和Word导出
//导出到Excel --- 全部导出,可以设置一些隐藏进行导出 protected void btnExport_Click(object sender, EventArgs e) { ...
- Journal.Today 1.0.0
我喜欢把一天的日记都放在一个文件中,而不是每次都新建一个文件. 写了一个脚本,检测当天是否已经新建日记,已经新建则打开,未新建则新建并打开. 其中我不太喜欢Wiz日记本来的标题命名方式,所以都 ...
- Senparc.Weixin.MP SDK 微信公众平台开发教程(一):微信公众平台注册
微信公众平台(下面简称“公众平台”)注册步骤和导航还是比较流畅的,因此这个教程对于上网经验丰富的朋友来说,有点多余.不过为了保持教程系列的完整性,这里还是认认真真把流程梳理一遍. 第一步:进入公众平台 ...