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;

Logo

开源鸿蒙跨平台开发社区汇聚开发者与厂商,共建“一次开发,多端部署”的开源生态,致力于降低跨端开发门槛,推动万物智联创新。

更多推荐