2

I am fairly new to React Native but am helping manage a React Native plugin and would like some guidance for upgrading it so that it is compatible with auto linking and React Native versions 0.60 and up in iOS.

Our plugin currently only works with React Native up to and including 0.59.x through the react-native link command and sometimes involves manually dragging our xcodeproj and .a binary inside Xcode.

When trying to instrument our plugin with a blank hello world React Native app of version 0.60.5, after react-native link and dragging in Xcode, we get an error saying rctbridgemodule.h not found and have to add React.xcodeproj too. This however doesn’t work on some apps we’ve tried. Furthermore the issue is in newer versions of React eg 0.61.4, the React.xcodeproj file is no longer in the React folder in node_modules. 

I’ve had a look at the What do I need to have in my package to make it work? Section in this link: https://github.com/react-native-community/cli/blob/master/docs/autolinking.md

But to me its not very clear how we should be configuring a pod spec in the root of our repo. Our package is scoped also. I’m assuming that there shouldn’t need to be any changes to the actual code of our plugin but rather just some modifications to our pod spec and package configuration. Any guidance in how this works and how to upgrade our plugin to support versions 0.6 and above would be greatly appreciated. Thanks!

  • Once you upgrade to 0.60 version. Did you installed pod in iOS? That is what will do linking automatically and then clean build your project. That's it – RB RB Jun 08 '20 at 04:01
  • @RBRB Perhaps I have misunderstood how React Native plugins work. So you're saying, I should follow instructions of upgrading a React Native app from .5x to >.6 for my plugin? Is there a fundamental difference between a React Native app and plugin? I was under the impression that plugins operated differently. My plugin is 0.57.7, is upgrading to any post 0.6 version the same process? Thanks! – user13663202 Jun 08 '20 at 07:23
  • You need to specify path of your plugin in pod file when react-native version is above 0.59 where it is managed by pods. I also faced same issue while integrating custom plugin. It worked well in 0.57 but created issue in linking with 0.60 or greater. Just give path in pod file and this should work – RB RB Jun 08 '20 at 07:32
  • @RBRB Thank you for the info! I will upgrade the plugin from 0.57.7 to 0.62.2 and then provide the pod file path. Would you say its best to upgrade straight from 0.57.7 to the latest version or is there a different version that would make for a more seamless upgrade? https://react-native-community.github.io/upgrade-helper/?from=0.57.7&to=0.62.2 Should following these changes be sufficient? Thanks! – user13663202 Jun 08 '20 at 19:53
  • No you do not need to upgrade plugin dear. It's react-native version that you are going update right? From 0.57 to 0.62.2. – RB RB Jun 09 '20 at 01:06
  • Right, I am working on the plugin and trying to make it compatible with React Native apps with version newer than 0.6. This plugin currently gives 0.57.7 when I run react-native --version in the project directory. So I'm supposed to update this version to the latest 0.62.2 version, and then install pod and specify the path in the podfile right? – user13663202 Jun 09 '20 at 06:15
  • Yes specify the path and then install pod it will work – RB RB Jun 09 '20 at 06:36
  • @RBRB but the plugin wont work with >0.6 React Native apps if plugin version is 0.57.7 right? Or is that fine as long as the path is specified and the pod is installed? – user13663202 Jun 09 '20 at 06:48
  • According to my knowledge it should word by mentioning path in pod for instance pod 'RNPermission', :path => '.. /node_modules/react-native-permissions' – RB RB Jun 09 '20 at 06:51
  • @RBRB that was all super helpful, thank you very much!!! – user13663202 Jun 09 '20 at 06:59
  • Did the above idea worked? – RB RB Jun 09 '20 at 07:07

0 Answers0