Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

React Native Redefinition of 'RCTMethodInfo' in RCTBridgeModule.h

React Native 0.49 in iOS I clone my project install npm and link from git and run but it has error in RCTBridgeModule.h in code

typedef struct RCTMethodInfo {
  const char *const jsName;
  const char *const objcName;
  const BOOL isSync;
} RCTMethodInfo;

it have 2 Error

Redefinition of 'RCTMethodInfo' and Typedef redefinition with different types ('struct (anonymous struct at ../../react-native/React/Base/RCTBridgeModule.h:57:16)' vs 'struct RCTMethodInfo')

I fine solution and included

 #if __has_include(<React/RCTBridgeModule.h>)
 #import <React/RCTBridgeModule.h>
 else
 #import "RCTBridgeModule.h"
 #endif

but it error same

like image 895
salution Avatar asked Jan 01 '26 08:01

salution


1 Answers

I happend to encountered this issue just now.It was caused by a third party penguin called "react-native-weibo".I just changed #import "RCTBridgeModule" to #import <React/RCTBridgeModule.h> inside RCTWeiboAPI ,then everything is ok now.

so if your issue is caused by third party penguin also,just try to change #import "xxxx.h" to #import <React/xxxx.h> inside third party API.

Hope it works.

like image 183
Gorgeous_Xie Avatar answered Jan 03 '26 03:01

Gorgeous_Xie



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!