Custom written iOS native module not exported

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP


Custom written iOS native module not exported



As my title says, I created a bare bones iOS native module in react native and it is not appearing in the final NativeModules javascript object. Here's exactly what I'm doing. I'm pretty stumped by this.


NativeModules


react-native init testproj


testproj


Cocoa Touch Class


MyModule



In MyModule.h I have the following:


MyModule.h


#import <React/RCTBridgeModule.h

@Interface MyModule : NSObject <RCTBridgeModule>
@end



In MyModule.m I have the following:


MyModule.m


#import "MyModule.h"

@implementation MyModule
RCT_EXPORT_MODULE()
@end



I run react-native run-ios and the app builds successfully. When printing out the NativeModules like so:


react-native run-ios


NativeModules


import React, {Component} from 'react';
import {NativeModules} from 'react-native'

export default class App extends Component {

componentWillMount() {
console.log('my modules! ', NativeModules)
}

render() {
...
}
}



I don't see MyModule in the console logs but I see all of the base react native modules.


MyModule



Does anyone have any ideas as to why this would happen? Is there something I'm missing in the xcode build phase? For more context, these are the relevant versions:


xcode


9.4.1


react


16.4.0


react-native


0.55.4


iPhone 6 - 11.4









By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Popular posts from this blog

Makefile test if variable is not empty

Will Oldham

Visual Studio Code: How to configure includePath for better IntelliSense results