I’ve been very quiet lately, this is because I was solving problems, of course ;).

All about native modules.

Again this is not allaboutmadonna.com :):)

My last project for one of my customer involves a lot a native modules for iOS and Android. I’m using:

    "appcenter": "1.12.2",
    "appcenter-analytics": "1.12.2",
    "appcenter-crashes": "1.12.2",
    "react-native-ble-plx": "^1.0.2",
    "react-native-charts-wrapper": "^0.5.0",
    "react-native-device-info": "^1.0.0",<span id="mce_SELREST_start" style="overflow:hidden;line-height:0;"></span>
    "react-native-side-menu": "^1.1.3",
    "react-native-splash-screen": "^3.2.0",
    "react-native-svg": "^9.2.4",
    "react-native-vector-icons": "^6.3.0",

I’ve been struggling with automatic integration methods:

And lastly:

  • manual integration

Specifically for the iOS project.

Honestly there is room for improvements in the automatic methods. They are not bullet proof and running them more than once may lead to side effects. I even ended up loosing track of knowing which module was integrated with which method, because the recommended automatic method will vary from one project to another.

I may have installed modules with both, while trying to solve below problems. This is the price to pay when dealing with numerous modules and not writing down what was done. My fault.

We’re not in the ‘its just works’ mode for now.

So all the problems depicted below were all solved all at once following each module instructions regarding manual integration.

I also had to deal with a new version of React Native that brings 64-bit support on Android and a new versions 10.2 of XCode (which brings Swift 5). That has not helped.

All right, so what troubled me so far?

No more react native debug menu

I’ve seen a ton a questions on Stack Overflow about this problem and none of the proposed solutions were working for me.

Crash in react native bridge for some native module

I’ve opened an issue on GitHub but it has been closed without an answer. I don’t care anymore.

RCT_EXTERN_MODULE Swift modules broken in Xcode 10.2

That React Native one had weird side effect on my project. Vanished completely with manual integration.

Crash in release mode for react-native-side-menu

Again, I’ve opened an issue about that problem. Solved. Closed.

Class is implemented in both ‘…’ and ‘…’. One of the two will be used. Which one is undefined

I do not know how I ended up here, but I was having React Native classes implemented twice in my project. Gone.

My takeaways: I’m not going back to either automatic integration method.

Ever.

On the dark side, this has been hard for me because all these malfunctions triggered distress that I was not able to share with someone else because I’m working remotely as a freelance. In those moments this is my body that processes my emotions and honestly I don’t like that at all.

But, on the bright side, this has had the benefit to make me better understand how integration works with Both Android Studio and XCode. Of course this is tedious and error prone, but even if I’m looking for ways to create value rapidly by not reinventing the wheel, I could spend some time learning new thinks.

Open Source Software is great actually when done correctly in your context.

By the way : I will soon integrate C++ code with react-native-djinni. So excited.

5 thoughts on “A tale about React Native (XP) iOS native modules

  1. Hi! I’am new to Xcode and iam struggling with the Binary link and cocoa pods, I have the same problems that you had, except for the one related to react-native-side-menu, but I don’t know how to do the manual integration of the native modules. Could you provide a short explanation of how to do so?
    Thanks in advance.

    Like

      1. the module is RCTNativeModule and RCTBridge I think.

        here is the piece of code in RCTNativeModule.mm where the app crashes on release

        if (m_bridge.valid) {
        dispatch_queue_t queue = m_moduleData.methodQueue;
        if (queue == RCTJSThread) {
        block();
        } else if (queue) {
        dispatch_async(queue, block); –> in this line it tries to access a invalid memory address giving a EXC_BAD_ACCESS error
        }

        do you have any idea of what else could it be?
        Sorry for the delay to respond, I was expecting a notification on my e-mail but there was nothing.
        Thank you.

        Like

Leave a Reply to matthewlr Cancel reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.