New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Native Modules (iOS) guide #176
Conversation
JavaScript code can subscribe to these events: | ||
|
||
```javascript | ||
var subscription = RCTDeviceEventEmitter.addListener( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(Do we want to kill the RCT prefix from this module?)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, we probably should.
-Spencer
On Mar 21, 2015, at 11:48 AM, Ben Alpert notifications@github.com wrote:
In docs/NativeModulesIOS.md:
+The native module can signal events to JavaScript without being invoked directly. The easiest way to do this is to use
eventDispatcher
:
+
+```objective-c
+- (void)calendarEventReminderReceived:(NSNotification *)notification
+{
- NSString *eventName = notification.userInfo[@"name"];
- [self.bridge.eventDispatcher sendAppEventWithName:@"EventReminder"
+}body:@{@"name": eventName}];
++ +JavaScript code can subscribe to these events: + +
javascript
+var subscription = RCTDeviceEventEmitter.addListener(
(Do we want to kill the RCT prefix from this module?)—
Reply to this email directly or view it on GitHub.
This is awesome - really thorough! |
// RCTCalendarManager.h | ||
#import "RCTBridgeModule.h" | ||
|
||
@interface RCTCalendarManager : NSObject <RCTBridgeModule> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
RCT prefix should only be used for first-party modules, we shouldn't encourage others to use it as it will create namespace conflicts.
* Adding metro-config dependency * Updating metro-config version
* [TVOS] Add new properties for tvParallaxProperties * [TVOS] Add properties for tvParallaxProperties
cc @vjeux @nicklockwood @a2