I'm using React Native 0.60.5 and am linking this module. It says that for React Native 0.60+, "CLI autolink feature links the module while building the app", so all we need to run is yarn add @react-native-community/async-storage
.
However, on the main page describing autolinking it says that we need to run:
yarn add @react-native-community/async-storage
cd ios && pod install && cd ..
What I Want To Know:
Do we have to run pod install
for all native modules with React Native 0.60+?
For 0.60, React Native has been migrated over to AndroidX. This is a breaking change, and your native code and dependencies will need to be migrated as well. With this change, React Native apps will need to begin using AndroidX themselves.
Cocoapods is the only way to add React Native and its' native modules to iOS projects. Cocoapods uses a configuration file called a Podfile to instruct the Cocoapods dependency manager which modules to add to your Xcode project.
This is to be used the first time you want to retrieve the pods for the project, but also every time you edit your Podfile to add, update or remove a pod. Every time the pod install command is run — and downloads and install new pods — it writes the version it has installed, for each pods, in the Podfile.
There are 2 types of linking in react-native
1 ) Manual linking
2 ) Pod linking
As described in official site
"If your iOS project is using CocoaPods (contains Podfile) and linked library has "podspec file", then react-native link will link library using Podfile."
Now when you
react-native link
If you project has CocoaPods (contains Podfile) and linked library has podspec file then it will add pod path of linked library in podfile like this
pod 'RNImageCropPicker', :path => '../node_modules/@react-native-community/async-storage'
But you still have to run pod install command
If project does not have pod file or linked library does not have podspec file then you have to do manual linking as described in site
Now coming to question from react-native 0.60 this process is now automatic. You do not have to run "react-native link " . It will automatically do pod work for you when you install library using npm/yarn but still you have to run "pod install" command
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With