2

I'm following the example posted in the official doc for native module ios. I've set up everything, build it and run the application.

//  CAL.h    

#import <React/RCTBridgeModule.h>

@interface CAL : NSObject <RCTBridgeModule>

@end
// CAL.m

#import <React/RCTLog.h>
#import "CAL.h"

@implementation CAL

RCT_EXPORT_MODULE(CAL);

RCT_EXPORT_METHOD(createCalendarEvent:(NSString *)name location:(NSString *)location)
{
 RCTLogInfo(@"Pretending to create an event %@ at %@", name, location);
}
@end

But when I check NativeModules from react-native it shows an empty object - {}.

I'm not sure what I'm missing.

Zephyr
  • 1,612
  • 2
  • 13
  • 37

1 Answers1

0

Like @chengsam mentioned, when I access CAL directly in the following manner it works.

const { CAL } = NativeModules; or NativeModules.CAL

CAL still held the native module while NativeModules directly displayed {}

Zephyr
  • 1,612
  • 2
  • 13
  • 37