当前位置: 移动技术网 > 移动技术>移动开发>Android > 2020-08-11

2020-08-11

2020年08月14日  | 移动技术网移动技术  | 我要评论
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

如您对本文有疑问或者有任何想说的,请点击进行留言回复,万千网友为您解惑!

相关文章:

验证码:
移动技术网