From 707aba822e98957ff2e9777b01ac9a0a50fe1af7 Mon Sep 17 00:00:00 2001 From: Tim Creasy Date: Fri, 30 Sep 2016 12:51:25 -0700 Subject: [PATCH] Added RCTLog.h import for clarity Summary: Explicitly show import statements in example implementation file. Xcode build fails unless RCTLog is imported. Adding this clarifies this, as it is not stated anywhere else. Closes https://github.com/facebook/react-native/pull/10117 Differential Revision: D3952631 Pulled By: javache fbshipit-source-id: f268ff53ee2cf69aabd83c3305c5c25add338d83 --- docs/NativeModulesIOS.md | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/docs/NativeModulesIOS.md b/docs/NativeModulesIOS.md index ac76ab7b9..824ef74c1 100644 --- a/docs/NativeModulesIOS.md +++ b/docs/NativeModulesIOS.md @@ -42,6 +42,13 @@ RCT_EXPORT_MODULE(); React Native will not expose any methods of `CalendarManager` to JavaScript unless explicitly told to. This is done using the `RCT_EXPORT_METHOD()` macro: ```objective-c +#import "CalendarManager.h" +#import "RCTLog.h" + +@implementation CalendarManager + +RCT_EXPORT_MODULE(); + RCT_EXPORT_METHOD(addEvent:(NSString *)name location:(NSString *)location) { RCTLogInfo(@"Pretending to create an event %@ at %@", name, location); @@ -252,14 +259,14 @@ RCT_EXPORT_METHOD(doSomethingExpensive:(NSString *)param callback:(RCTResponseSe ## Depedency Injection The bridge initializes any registered RCTBridgeModules automatically, however you may wish to instantiate your own module instances (so you may inject dependencies, for example). - + You can do this by creating a class that implements the RTCBridgeDelegate Protocol, initializing an RTCBridge with the delegate as an argument and initialising a RTCRootView with the initialized bridge. - + ```objective-c id moduleInitialiser = [[classThatImplementsRTCBridgeDelegate alloc] init]; - + RCTBridge *bridge = [[RCTBridge alloc] initWithDelegate:moduleInitialiser launchOptions:nil]; - + RCTRootView *rootView = [[RCTRootView alloc] initWithBridge:bridge moduleName:kModuleName