1.遇见红屏显示Canni’t find variable:AppRegistry
解决方法:重新在在AS中的Terminal输入react-native bundle --platform android --entry-file index.js --bundle-output app/src/main/assets/index.android.bundle --dev false
2.重新编写界面之后,运行的还是之前的界面,修改的方法竟然也要加上上面这一步。。。。。。
解决方法:重新在在AS中的Terminal输入react-native bundle --platform android --entry-file index.js --bundle-output app/src/main/assets/index.android.bundle --dev false
3.报这个错误 ERROR EPERM: operation not permitted, lstat…
解决方法:直接clean
以下注意点:
AppRegistry.registerComponent('HelloWorld05', () => HelloWorld);
HelloWorld05是项目名称,一定要注意!!!
()=>HelloWorld 采用HelloWorld之后前面的代码
class HelloWorld extends Component {
class后面一定要是HelloWorld!
call_button(){
NativeModules.ToastExample.show('调用原生方法的Demo');
}
这段代码一定要注意ToasExample是ToastModule的getName方法返回的值!
show是ToastModule中的代码!