[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,你可以先看 ...
随机推荐
- glibc, eglibc和 glib的区别
http://blog.csdn.net/wind19/article/details/6082874
- 如何将Springside4项目转成Eclipse项目
1)下载springside4 官网地址 http://www.springside.org.cn/download.html 2)运行CMD,进入 C:\Documents and Settings ...
- PICK定理模板
PICK定理: S=I+O/2-1 S为多边形面积,I多边形内部的格点,O是多边形边上的格点 其中边上格点求法: 假设两个点A(x1,y1),B(x2,y2) 线段AB间格点个数为gcd(abs(x1 ...
- Xcode7创建纯代码空白工程
0: Create a new project with 'single view controller' A: Xcode Settings 1: migrate launch image B: ...
- sdfsdf
http://www.cocoachina.com/bbs/read.php?tid-234704.html 选择工程->Build Settings -> Code Signing -& ...
- jQuery与XML
jQuery与XML 快而强的遍历系统,华丽丽的选择器语法,这或许是jQuery 那么流行的原因.当然它还有详尽的文档.它主要是用来处理HTML的,但在这里妳会看到如何应用到XML. 使用jQuery ...
- MongoDB 权限 验证
在MongoDB中,服务启动默认是没有权限验证的,就安全性方面来说,这肯定是不行的,所以需要加上权限验证. 既然是要进行权限验证,那肯定是得有用户的吧,所以权限验证的第一步就是给MongoDB库添加用 ...
- 热修复 RocooFix篇(一)
吐槽之前先放一张大帅图. (md 这张图貌似有点小 不纠结这个了==) 有时候项目刚刚上线或者迭代 测试或者在线上使用测出一个bug来 真让人蛋疼 不得不重新改bug测试 打包混淆上线感觉就向find ...
- lua与C/C++交互
Lua设计小巧很容易与C/C++进行交互,下面我们具体讲解C/C++中如何调用lua,而lua中又如何调用C代码. 首先lua和C交互的一个重要的数据结构lua_State,它是进行数据交换的堆栈,按 ...
- JZ2440开发笔记(7)——2440启动方式
JZ2440的启动方式有两种,一种是从NOR FLASH中启动,还有一种就是从NAND FLASH中启动. 如果从NOR FLASH启动,CPU会访问NOR FLASH的0地址,而0地址位于BANK0 ...