Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Do we need to run `pod install` with React Native 0.60?

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+?

like image 670
gkeenley Avatar asked Sep 13 '19 20:09

gkeenley


People also ask

Will install React Native 0.60 6 which is a breaking change?

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.

Do you need CocoaPods for React Native?

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.

What pod install does?

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.


1 Answers

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

like image 74
Mehran Khan Avatar answered Oct 08 '22 00:10

Mehran Khan