React Native开发中遇到的IOS问题

1.  rn版本升级后,找不到文件或者文件重复

重新引入rn的依赖
对某些依赖,需要设置headr-search-path

2.  Unable to resolve module `react/lib/ReactComponentWithPureRenderMixin`

解决:删除yourproject\node_modules\react-navigation\src\views\Header.js
里的第12行的import ReactComponentWithPureRenderMixin部分,
已经被react淘汰了,
以及其它相关ReactComponentWithPureRenderMixin的位置

3. Redefinition of ‘RCTMethodInfo’

"react": "^16.3.0-alpha.1",
 "react-native": "0.54.4",
 "react-native-file-opener": "^0.2.0",
 "react-native-fs": "^2.9.11"

在使用 react-native-file-opener 和 react-native-fs 的过程中,遇到 build failed 报错

Redefinition of ‘RCTMethodInfo’

解决:

#import "RCTBridgeModule.h"  #import "RCTBridge.h" 修改成 #import <React/RCTBridgeModule.h> #import <React/RCTBridge.h>

4. RCTBridge required dispatch_sync to load RCTDevLoadingView. This may lead to deadlocks

修改AppDelegate.m

#if RCT_DEV
#import <React/RCTDevLoadingView.h>
#endif
...
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
 ...
 RCTBridge *bridge = [[RCTBridge alloc] initWithBundleURL:jsCodeLocation
 moduleProvider:nil
 launchOptions:launchOptions];
#if RCT_DEV
 [bridge moduleForClass:[RCTDevLoadingView class]];
#endif
 RCTRootView *rootView = [[RCTRootView alloc] initWithBridge:bridge
 moduleName:@"Test"
 initialProperties:nil];
 ...
}

https://github.com/facebook/react-native/issues/16376

 

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注