ReactNative - unable to call function from native module
<p>I have existing ReactNative project. </p>

<p>Now I'm trying to connect to some native libraries. I've been going through official <a href="https://facebook.github.io/react-native/docs/native-modules-ios.html#content" rel="nofollow">Native modules guide</a>. </p>

<p>In my code I've added CalendarManager.h file which contains this code:</p>

<pre><code>#import &lt;Foundation/Foundation.h&gt;
#import "RCTBridgeModule.h"

@interface CalendarManager : NSObject &lt;RCTBridgeModule&gt;

@end
</code></pre>

<p>I also have CalendarManager.m file:</p>

<pre><code>#import "CalendarManager.h"

@implementation CalendarManager

RCT_EXPORT_MODULE();

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

@end
</code></pre>

<p>This files are added at same level as AppDelegate.m file via XCode. </p>

<p>In my javascript code i do this:</p>

<pre><code>import React from 'react-native';
</code></pre>

<p>And then i call that function like this:</p>

<pre><code>var cmanager = React.CalendarManager;
cmanager.addEvent('Birthday Party', '4 Privet Drive, Surrey');
</code></pre>

<p>I'm able to build the project, but when I run it in Simulator (after package manager starts) I get nasty red error:</p>

<pre><code>Cannot read property 'addEvent' of undefined. 
</code></pre>

<p>It looks to me that I'm missing something, but I'm not sure what? </p>