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
下一篇: MySQL数据库备份与恢复