“反应”:“ 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)
}
}