import Undefined when try import my own module created with nativeModule (IOS - RN)

282 Views Asked by At

i created react-native-library for wrap MixPanel SDK but not working in IOS, just work in Android. When try import in android nativemodules can recognize my module "RNMixPanel" but every time when try import from ios the value is undefined. (previusly i linked this module)

"react": "16.6.1", "react-native": "0.57.5",

Create method to export in IOS folder 


#import "RNMixPanel.h"
#import "Mixpanel/Mixpanel.h"

@implementation RNMixPanel

RCT_EXPORT_MODULE();

RCT_EXPORT_METHOD(createInstance){
     Mixpanel *mixpanel = [Mixpanel sharedInstance];
    [mixpanel sharedInstanceWithToken:@"3XXXXXXXXXXXXXXXX3"];
}
@end



Wrap NativeModule. Index library



import { NativeModules } from 'react-native';

const { RNMixPanel } = NativeModules;

export default {
    createInstance: function () {
        console.log(RNMixPanel)
    }
}
0

There are 0 best solutions below