Skip to content

Commit 02298b5

Browse files
committed
Merge pull request #493 from tjwudi/patch-1
Add import RCTBridge.h for event sending example
2 parents 86a1e70 + 4f49271 commit 02298b5

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

docs/NativeModulesIOS.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,12 +177,21 @@ Note that the constants are exported only at initialization time, so if you chan
177177
The native module can signal events to JavaScript without being invoked directly. The easiest way to do this is to use `eventDispatcher`:
178178

179179
```objective-c
180+
#import "RCTBridge.h"
181+
#import "RCTEventDispatcher.h"
182+
183+
@implementation CalendarManager
184+
185+
@synthesize bridge = _bridge;
186+
180187
- (void)calendarEventReminderReceived:(NSNotification *)notification
181188
{
182189
NSString *eventName = notification.userInfo[@"name"];
183190
[self.bridge.eventDispatcher sendAppEventWithName:@"EventReminder"
184191
body:@{@"name": eventName}];
185192
}
193+
194+
@end
186195
```
187196
188197
JavaScript code can subscribe to these events:

0 commit comments

Comments
 (0)