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:
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