[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,你可以先看 ...
随机推荐
- SPRING IN ACTION 第4版笔记-第四章ASPECT-ORIENTED SPRING-006-定义切面使用xml
一. you can also define pointcuts that can be used across multiple aspects by placing the <aop:poi ...
- Tomcat 系统架构与设计模式,第 1 部分: 工作原理
简介: 这个分为两个部分的系列文章将研究 Apache Tomcat 的系统架构以及其运用的很多经典设计模式.本文是第 1 部分,将主要从 Tomcat 如何分发请求.如何处理多用户同时请求,还有它的 ...
- 使用Oracle的存储过程批量插入数据
原文地址:http://www.cnblogs.com/liaoyu/p/oracle-procedure-batch-insert.html 作者:L君还在说之乎者也 最近在工作中,需要使用生成一些 ...
- Android开发:Translucent System Bar 的最佳实践
Translucent System Bar 的最佳实践 近几天准备抽空总结Android一些系统UI的实践使用,于是开始动手建了一个库AndroidSystemUiTraining ,边撸代码边写总 ...
- java1.8的几大新特性(一)
一.接口的默认方法与静态方法,也就是接口中可以有实现方法 public class Test { public static void main(String[] args) { Formula a= ...
- poj1724ROADS(BFS)
链接 本来想写spfa 加点什么限制什么的可能就过了 写着写着就成裸BFS了 也没优化就水过了 #include <iostream> #include<cstdio> #in ...
- Struts 2.3.1.1 命令执行漏洞
漏洞版本: Struts 2.3.1.1 漏洞描述: CVE ID:CVE-2011-3923 Struts2的核心使用的是WebWork框架,而WebWork通过XWork来处理用户的请求参数.Xw ...
- arch Linux not found device 错误解决
使用Archlinux LiveCD mount /dev.sda1 /mnt (有boot分区的挂boot) Running mkinitcpio -p linux Running grub-mkc ...
- MFC VS2005 添加Override 和 Message
VS2005 1.Overrides OnInitDialog() 在Class View选中 这个类,然后properties中点Message 旁边的Overrides, 添加OnInitDial ...
- STL find() ,还是挺重要的
template<class InputIterator, class T> InputIterator find (InputIterator first, InputIterator ...