您好,欢迎来到二三四教育网。
搜索
您的当前位置:首页React Native 遇到的坑(持续更新)

React Native 遇到的坑(持续更新)

来源:二三四教育网
  1. Module @babel/runtime/helpers/interopRequireDefault does not exist in the Haste module map
loading error

解决方案:

npm install --save-dev @babel/core
npm install --save-dev @babel/runtime
or with yarn:
yarn add --dev @babel/core
yarn add --dev @babel/runtime
//若还是失败
npm run start --reset-cache
or
react-native start --reset-cache
  1. The module ./../react-transform-hmr/lib/index.js could not be found from /Users/xxx/Documents/TestProject/RNApplication/App.js
    解决方案:
#react-native start --reset-cache
#react-native start 
//重新打开一个终端窗口
#react-native run-android`
# or
# react-native run-ios
  1. Application iOSRN- has not been registered.
NSURL * jsCodeLocation;

    NSString * strUrl = @"http://localhost:8081/index.bundle?platform=ios&dev=true";
    jsCodeLocation = [NSURL URLWithString:strUrl];

    
    NSDictionary *params = @{@"componentName":@"MeApp1", @"args":@{@"params":@"这是原生传递的参数"}};
    
    RCTRootView * rootView = [[RCTRootView alloc] initWithBundleURL:jsCodeLocation
                                                         moduleName:@"iOSRN-"
                                                  initialProperties:params
                                                      launchOptions:nil];

解决方案:查看App.js中是否注册正确

AppRegistry.registerComponent('iOSRN', () => App)

Copyright © 2019- how234.cn 版权所有 赣ICP备2023008801号-2

违法及侵权请联系:TEL:199 1889 7713 E-MAIL:2724546146@qq.com

本站由北京市万商天勤律师事务所王兴未律师提供法律服务