React-native开发系列(一)---NavigatorIOS应用
来源:互联网 发布:ubuntu opencv 编辑:程序博客网 时间:2024/05/18 02:54
看了好多教程,真的头大呀!不是写的很繁琐就是直接照搬Facebook的代码,看着真够头大的,还是直接上代码吧!
你的第一个文件,引入NavigatorIOS(相当于navigationController)
import React, { Component } from 'react';var SearchScreen = require ('./SearchScreen');//导入你写的rootviewcontroller。import { AppRegistry, StyleSheet, Text, View, NavigatorIOS,} from 'react-native';class NavigatorDemo extends Component { render() { return ( <NavigatorIOS style={styles.container} initialRoute={{ title:'movies',//这是navigationController的title。 component:SearchScreen,//注释:这里是要写的是相当于iOS开发里navigationController的rootViewController页面。 }} /> ); }}const styles = StyleSheet.create({ container: { flex: 1, backgroundColor: 'white', },});AppRegistry.registerComponent('NavigatorDemo', () => NavigatorDemo);
这里是你的rootviewcontroller。
import React, { Component } from 'react';import { AppRegistry, StyleSheet, Text, View} from 'react-native';class SearchScreen extends Component{ render() { return ( <View style={styles.container}> <Text style={styles.welcome}>131231232 </Text> </View> ); }}const styles = StyleSheet.create({ container: { flex: 1, backgroundColor: 'white', top:64, }, welcome: { fontSize: 20, textAlign: 'center', margin: 10, },});module.exports = SearchScreen;
最后奉献截图:
0 0
- React-native开发系列(一)---NavigatorIOS应用
- (六)React Native---NavigatorIOS 组件
- 【React-native系列开发笔记一】
- React-Native组件之 Navigator和NavigatorIOS
- React Native学习笔记(3)--NavigatorIOS组件
- React Native-7.React Native NavigatorIOS组件详解
- React Native开发(一)
- React Native开发(一)
- React Native 实战系列一
- Android React-Native系列之<一>零基础搭建React-Native开发环境
- React Native开发指南(一)
- react native 开发笔记(一)
- React Native开发android应用
- React Native系列(一)React Native 环境搭建
- React-Native 学习系列课程笔记(React-Native开发环境搭建)
- React-Native 学习系列课程笔记(React-Native 开发从零开始)
- React Native开发一 webstorm搭建React Native开发环境
- [React Native混合开发]React Native for iOS之应用
- mongodb权限设置之添加管理员、普通用户的方法
- 一念永恒 > 第九十二章 公孙婉儿的绝望
- android 使用TextView/EditText应该注意的地方
- SICP 习题2.17 last-pair 找出表的最后一个值
- apache与tomcat负载集群的方法与集群的文件同步问题和图片上传显示问题解决
- React-native开发系列(一)---NavigatorIOS应用
- 作为开发者不可不知的Native App,Web App,Hybrid App等技术的对比
- Can't resolve reference to bean 'dataSource' in parent factory: no parent factory available
- 多线程 2(线程安全与共享资源)
- struts action接收参数的三种方法
- 一念永恒 > 第九十一章 疯狂的北岸
- 一念永恒 > 第九十章 北岸公敌
- Java调用本地接口:java.lang.UnsatisfiedLinkError
- CMake Error: Could not find CMAKE_ROOT !!! CMake has most likely not been installed correctly. Modul