Autolinking in React Native 0.60
Hey Guys, as you know React Native 0.60 is announced and there are lots of updates that you can see in the new version of React Native but here I want to highlight the Autolinking in this post which will change the process to linking a library.
Here are the main things that React Native has been updated and then we will talk about the auto-linking:
- So the first thing which is updated in the React Native 0.60 is the default screen of the app. Now you will see the new Start Screen
- Support of AndroidX for Android
- Cocoa Pods by default for iOS
- Under Lean Core project a new home for react-native-webview, @react-native-community/netinfo, and @react-native-community/geolocation
- Autolinking (Which we are going to discuss)
So these were the highlights of new features that are introduced by the new update of React Native. If you want to read all the updates about the new version then you can go through the official announcements – Announcing React Native 0.60.
In this post, we will talk about the auto-linking as all the other updates are related to the backend and will not directly affect you as they will be well managed by the React Native but in case of auto-linking, it will affect your library linking process. So let’s get started.
According to the official announcement “The team working on the React Native CLI has introduced major improvements to native module linking called auto-linking! Most scenarios will not require the use of a react-native link anymore.”
So to conclude there is no linking anymore but there are some additional changes also let’s see the example.
Before the update of React Native 0.60
1. Install a Library
npm install --save <LibraryName>
2. Linking of library
react native link <LibraryName>
3. Run the application
react-native run-android/run-ios
After the update of React Native 0.60
1. Install a Library
npm install --save <LibraryName>
2. Install CocoaPods on iOS
cd ios && pod install && cd ..
3. Run the application
react-native run-android/run-ios
So here we can see we don’t need to link the library now but have to install pod after the installation of the library.
This is what React Native Autolinking after React Native 0.60. If you have any type of additional information to share then you can comment below so that others can also take the help from that.
Hope you liked it. 🙂
it’s Good Documetion very helpful to everyone.