1.首先AppRegistry是用来表示RN的入口;
2.入口文件是index.js
3.更改入口js,只需要更改AppRegistry的注册组件.
*这里有坑,很容易出现错误.
Uncaught Error: Invariant Violation: Element type is invalid: expected a string
首先,检查入口的控件类名有没问题(把入口从./App改为./index.ios),有没有export出来.然后
import {MyNavigatior} from './index.ios'; AppRegistry.registerComponent('your project name', () => MyNavigatior);
还有,没有用到的控件不要注册,要不也会报错
一个js文件可以有多个class,但是只能有一个export出来,注册组件就是注册export出来的那个class
还有一种写法:
require('./appPage/HomePageTabbarHidden')
这样会自动注入路径的js控件的export class.效果和上述一样(组件内不要忘记注册).
参考:https://stackoverflow.com/questions/36501856/uncaught-error-invariant-violation-element-type-is-invalid-expected-a-string
相关推荐
React Native By Example by Richard Kho English | 24 Apr. 2017 | ASIN: B01M31KB4Q | 414 Pages | AZW3 | 4.46 MB Key Features Work on native APIs and UI Elements using React Native Get the best of both...
第2课2、手把手教React Native实战之从React到RN 第3课3、手把手教React Native实战之flexbox布局(RN基础) 第4讲4、手把手教React Native实战之flexbox布局(伸缩属性) 第5讲5、手把手教React Native实战之盒子模型...
mac端可视化调试react或者reactnative工具,可以调试redux应用状态
为 React Native 带来 NFC 功能。灵感来自phonegap-nfc和react-native-ble-manager 该库最简单(也是最常见)的用例是读取NFC包含 的标签NDEF,可以通过以下代码实现: import React from 'react'; import {View, ...
本书通过丰富的示例和详细的讲解, 介绍了 React Native 这款 JavaScript 框架。...除了框架本身的概念讲解之外,本书还讨论了如何使用第三 方库,以及如何编写自己的 Java 或 Objective-C 的 React Native 扩展。
React Native版本的ViewPager控件,自动播放,无限循环。项目地址:https://github.com/race604/react-native-viewpager 效果图:使用说明: 运行 npm 安装 react-native-viewpager --save代码如下:var ViewPager...
react native 显示本地图片
react native 实现水波纹效果,效果非常棒哦
React Native Cookbook English | 5 Jan. 2017 | ISBN: 1786462559 | 437 Pages | AZW3/MOBI/EPUB/PDF (conv) | 54.26 MB Key Features Build rich and engaging user experiences in React Native while ...
React and React Native by Adam Boduch English | 8 Mar. 2017 | ASIN: B01MQ1GHCS | 604 Pages | AZW3 | 7.22 MB Key Features Build React and React Native applications using familiar component concepts ...
react-native bundle --entry-file index.js //entry-file,ios或者android入口的js名称,比如index.js --platform ios //platform ,平台名称(ios或者android) --dev false //设置为false时会对JavaScript代码进行...
30天学习React Native教程
PART 1 Getting started with React Native Chapter 1. Getting Started With React Native Chapter 2. Understanding React Chapter 3. Building Your First React Native App PART 2 Developing applications in ...
React Native 瀑布流列表,用于展示瀑布流形式的内容,定制简单。
Use React and React Native to build applications for desktop browsers, mobile browsers, and even as native mobile apps Build React and React Native applications using familiar component concepts Dive ...
React Native地图。
云生活超市——React Native项目,React Native电商app,(项目配套:1、后台管理系统(React ant-design) 2、服务器端代码(SpringBoot)。技术栈: react native redux react-navigation native-base
react-native-page一个简单的react-native分页组件
As the title suggests, this is an introduction to React Native. React has become a leading technology for building fast, responsive native iOS apps. You will begin by understanding the path breaking ...