title: How To Use RCT_EXPORT_MODULE React Native
body: <p>Can anyone explain how to use the macro <code>RCT_EXPORT_MODULE</code> from React Native to create custom react modules with a specific name that's not the class name?</p>
  
  <p>The <a href="https://facebook.github.io/react-native/docs/native-modules-ios.html" rel="noreferrer">documentation</a> says, </p>
  
  <blockquote>
    <p>This takes an optional argument that specifies the name that the module will be accessible as in your JavaScript code</p>
  </blockquote>
  
  <p>My class name is:</p>
  
  <pre><code>@implementation ReactCustomService
  </code></pre>
  
  <p>But I want to rename it to:</p>
  
  <pre><code>RCT_EXPORT_MODULE(@"CustomService")
  </code></pre>
  
  <p>But this doesn't work. When I do:</p>
  
  <pre><code>var service = NativeModules.CustomService;
  </code></pre>
  
  <p>nothing is returned. But if I did <code>RCT_EXPORT_MODULE()</code>, then <code>NativeModules.ReactCustomService</code> it works fine.</p>
  
  <p>Any thoughts? I also tried <code>RCT_EXPORT_MODULE("CustomService")</code>, but that doesn't work either.</p>
  
  <p>I'm on react-native: 0.40.0</p>