2

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.