Nicky Romeijn Nicky Romeijn - 3 months ago 6
Android Question

How to register React-native IOS module

Im running into an issue with a React-Native IOS module. I wrote a module in objective C and used

to export the module and expose it to react-native. However when i print out the contents of the react-native it does not contain the module.

import { NativeModules } from 'react-native';
console.log("Native modules:", NativeModules);

I also wrote a similar module in Java(Android) and this works just fine. However with android modules i know you have the register them in the MainActivity class. i'm thinking i have missed something similar with IOS but can't find it anywhere in the react-native documentation.

Would appreciate it if someone could help me out.


On iOS module are automatically registered. The bridge does this by querying all classes implementing the RCTBridgeModule protocol.

If you don't see your module, this means something is missing somewhere.

One possibility is that your ObjC class is not compiled as part of the application target. In that case open Xcode and check your {your_module}.m belongs to your app's target.

Example with the F8Scrolling module from the F8 sample app:

enter image description here