欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  移动技术

2020-08-11

程序员文章站 2022-07-06 13:39:26
AppRegistry.registerComponent(android开发) 入坑Error: Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: object. You likely forgot to export your component from the file it's defin...

AppRegistry.registerComponent(android开发) 入坑

Error: Element type is invalid: expected a string (for built-in components)
 or a class/function (for composite components) but got: object. 
 You likely forgot to export your 
 component from the file it's defined in, 
 or you might have mixed up default and named imports.

1.使用AppRegistry.registerComponent
import {AppRegistry} from ‘react-native’;
import App from ‘./App’;
AppRegistry.registerComponent(appName, () => App);
appName要与android/app/src/main/java/com/xxx/MainActivty中的
protected String getMainComponentName() {
return “xxx”;
}
appName要与xxx的名字一致,或者将xxx改为 appName;

本文地址:https://blog.csdn.net/yzcbk/article/details/107939929

相关标签: reactjs