From 9e476cb0590b7e2f43d153f3b5ca8a412e0612e8 Mon Sep 17 00:00:00 2001 From: Travis CI Date: Thu, 2 Apr 2015 00:22:48 +0000 Subject: [PATCH] update website --- docs/nativemodulesios.html | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/nativemodulesios.html b/docs/nativemodulesios.html index 2c12890b48c..ef073bb1715 100644 --- a/docs/nativemodulesios.html +++ b/docs/nativemodulesios.html @@ -1,5 +1,6 @@ React Native | A framework for building native apps using React

Native Modules (iOS)

Sometimes an app needs access to platform API, and React Native doesn't have a corresponding wrapper yet. Maybe you want to reuse some existing Objective-C or C++ code without having to reimplement it in JavaScript. Or write some high performance, multi-threaded code such as image processing, network stack, database or rendering.

We designed React Native such that it is possible for you to write real native code and have access to the full power of the platform. This is a more advanced feature and we don't expect it to be part of the usual development process, however it is essential that it exists. If React Native doesn't support a native feature that you need, you should be able to build it yourself.

This is a more advanced guide that shows how to build a native module. It assumes the reader knows Objective-C (Swift is not supported yet) and core libraries (Foundation, UIKit).

iOS Calendar module example #

This guide will use iOS Calendar API example. Let's say we would like to be able to access iOS calendar from JavaScript.

Native module is just an Objectve-C class that implements RCTBridgeModule protocol. If you are wondering, RCT is a shorthand for ReaCT.

// CalendarManager.h #import "RCTBridgeModule.h" +#import "RCTLog.h" @interface CalendarManager : NSObject <RCTBridgeModule> @end

React Native will not expose any methods of CalendarManager to JavaScript unless explicitly asked. Fortunately this is pretty easy with RCT_EXPORT:

// CalendarManager.m