0

I have troubles with the development of a React Native app.

I have developed a native module and a native ui component.

Finally, I would like to publish both as a NPM module.

However, when I tried to integrate the native module and the native ui as NPM package into a (new) React Native app (for example created with react-native init command), I first got the following error Invariant Violation requireNativeComponent ComponentName was not found in UIManager. According to some GitHub issues this might be a problem with missing linking.

So I decided to run react-native link. However, by doing this the situation got even worse, because from that point on I got the following error Workspace Integrity Error - Couldn't load project for all the RCT libraries.

Error messages

I already followed the instructions of other Stackoverflow posts regarding that topic, which describe how to investigate the .pbxproj file. Further, I tried to reinstall the pods of my npm package. Finally, I ensured that I use the .xcworkspace file and not the .xcodeproj file.

However, the errors still persist.

Michael Andorfer
  • 1,660
  • 5
  • 25
  • 45
  • 1
    `react-native link` and cocoapods don’t play nicely together. If you need to stick with cocoapods you ought to bring RN libraries as subspecs via your Podfile instead.. – Rob Hogan Aug 13 '18 at 21:27
  • @RobHogan I will try this, although I had had some troubles in the past with that approach too. – Michael Andorfer Aug 13 '18 at 21:28
  • If you want to try it that way and post your podfile we can see if we can spot any issues. You’ll need to revert the `link` though. – Rob Hogan Aug 13 '18 at 21:31
  • @RobHogan if I revert the linking I again get `Invariant Violation requireNativeComponent ComponentName was not found in UIManager`. Do you know anything to do about that? – Michael Andorfer Aug 13 '18 at 21:44
  • That's expected if nothing's linked. Instead of using `react-native link` though, setting up your `Podfile` as in http://facebook.github.io/react-native/docs/integration-with-existing-apps#configuring-cocoapods-dependencies – Rob Hogan Aug 14 '18 at 10:49

1 Answers1

0

Worked for me by

  • opening a new .xcworkspace file
  • clean project
  • Pressing on "Build and run the current scheme"
Programmer_Bee
  • 41
  • 1
  • 1
  • 7