3

Recently I have upgraded to a version of React Native which is >=0.60. From the release notes I can now see Native modules are "autolinked". So there is no need to use react-native link every time I want to install a library which uses native modules.

However, even after updating to the latest version of react native and unlinking all my modules. React Native would not auto-link them.

For example, I have just downloaded React Native Slider and ran npm install @react-native-community/slider --save. After running pod install the required native module is never installed. Pod install does not install it in the terminal. And upon starting, my app would crash with the following error:

enter image description here

However, if I write react-native link @react-native-community/slider and then run pod install - I can see in the terminal that pod is installing the required native module of the library. The app would then start and will work properly.

Why does React Native not auto-link my modules so that pod can install them? My environment is the following:

react-native: 0.61.2
react-native-cli: 2.0.1
react: 16.10.2
Xcode version: 11.1
iOS simulator version: 13.1
Pod version: 1.7.5
EDJ
  • 843
  • 3
  • 17
  • 37
  • Just being curious: do you have `# Add new pods below this line` in _Podfile_? – Samuli Hakoniemi Oct 13 '19 at 18:40
  • @zvona No, I do not. Which ones should I have there by default? – EDJ Oct 13 '19 at 20:31
  • Same problem for me on Linux/Android – Simon Jan 27 '20 at 13:57
  • Were you able to find a solution to this ? I am facing the same problem. Every time I install a new library I have to run ```react-native link ``` even though the library installation instructions mention it should not be required for react native >= 0.60 – sushrut619 Feb 14 '20 at 18:57
  • 1
    @sushrut619 Unfortunately, I did not find a solution. I had to create a new React Native project and migrate my components to it. It was a long and exhausting process but it was worth it! – EDJ Feb 16 '20 at 22:57

0 Answers0