运行

npm install --save react-navigation

后,运行

react-native run-android

解决方法:

1、react-native init NavTest (The cli is locally installed with this command)
2、deleted package-lock.json
3、npm install --save react-navigation
4、deleted the generated package-lock.json
5、npm install
6、react-native run android A little ugly, I don't know entirely what happened, but this worked. https://reactnavigation.org/ for sample code to run.

Or Copy this to index.android.js

import React, { Component } from 'react';
import {
AppRegistry,
Button,
} from 'react-native';
import {
StackNavigator,
} from 'react-navigation'; class HomeScreen extends Component {
static navigationOptions = {
title: 'Welcome',
};
render() {
const { navigate } = this.props.navigation;
return (
<Button
title="Go to Jane's profile"
onPress={() =>
navigate('Profile', { name: 'Jane' })
}
/>
);
}
} class ProfileScreen extends Component{
static navigationOptions = {
title: 'Jane',
};
render() {
return (null);
}
} const NavTest= StackNavigator({
Home: { screen: HomeScreen },
Profile: { screen: ProfileScreen },
}); AppRegistry.registerComponent('NavTest', () => NavTest);

最新文章

  1. EasyUi 方法传递多个参数值得方法
  2. jquery实现nav的下拉
  3. 分析器错误 MvcApplication 找不到
  4. iis错误记录
  5. 浏览器兼容性小整理和一些js小问题(后面会继续更新)
  6. iOS - (几个 button 按钮之间的单选与多选)
  7. linux C socket
  8. solr 竞价排行
  9. php数组遍历 使用foreach
  10. GitHub的css/js文件给墙了的解决方法
  11. Android运用自己的标题栏
  12. BP神经网络的基本原理
  13. redis - 主从复制与主从切换
  14. [原]左右的移动&amp;lt;&amp;lt;&amp;gt;&amp;gt;&amp;lt;&amp;gt;jQuery的实现
  15. Quartz 代码调用Demo
  16. 图片懒加载、selenium和PhantomJS
  17. TI 开发板安装USB转串口驱动
  18. CSS实现响应式全屏背景图
  19. es6函数的扩展
  20. IBM MQ相关 ---- 系列文章

热门文章

  1. 连接字符串配置在App.config中
  2. Leetcode - 309. Best Time to Buy and Sell Stock with Cooldown
  3. inception v1-v3 &amp; Xception
  4. Linux电源管理(7)_Wakeup events framework【转】
  5. Windows PowerShell 入門(9)-エラー編
  6. linux系统网络相关问题
  7. 《转》return *this和 return this有什么区别?
  8. 缓存系列之五:通过codis3.2实现redis3.2.8集群的管理
  9. MSSQL—行转列
  10. atoi 和 itoa的实现