I followed this tutorial to create my react native library with Native Module. I need to use a mobile SDK developed from BROTHER to use their printers in one of my REACT-NATIVE app.

The library that I wrote works great, and I'm able also to test in the example app that the automatic tool creates.

Now I want to use this library in my REACT-NATIVE app, and I followed these steps:

  1. in the path of my react native app i wrote npm install ;
  2. in my app I call my library with import MyLibrary from '...name of my library...' without using it inside my component, just import only to try if there is some error;

The result is that my app start and is blocked with white screen and in the log of XCode I receive the following errors that are in loop: enter image description here

and

enter image description here

I tried to delete metro cache, remove node_modules, reinstall pods...nothing helped me. If I remove the line import MyLibrary from '...name of my library...' my app works. There is some problem in the way I have to link my local library to my react-native app.

I started my react-native app with EXPO and after I ejected it.

react: 16.13.1 react-native: 0.63.4 npm: 7.9.0

1

There are 1 answers

0
Christian Cascone On BEST ANSWER

To solve this I should only create a Swift file and a Bridge header file in the React app where I want to add my Native Module. This is because I developed the Native Module with Swift.