Hi Guys, In this article we are going to solve common issue facing while install react-navigation dependency. CocoaPods could not find compatible versions for pod “react-native-safe-area-context”. When working on a React Native project with CocoaPods, you may encounter compatibility issues with the “react-native-safe-area-context” library. The error message typically indicates that there is a mismatch between the library’s version and the required minimum deployment target in your project. In this article, we will walk you through the steps to resolve this error and ensure smooth integration of “react-native-safe-area-context” into your project.
1. Update “react-native-safe-area-context” Version
The first step to resolving this error is to use compatible version of “react-native-safe-area-context” in your project. To do this, open your project’s package.json file and find the dependency entry for “react-native-safe-area-context.” Update it to the latest version, or a version that is known to be compatible with your React Native version.
"dependencies": { "react-native-safe-area-context": "^4.3.4", // Other dependencies... }
2. Update Minimum Deployment Target in Podfile
After updating the library version, you need to adjust the minimum deployment target in your iOS project. This target specifies the minimum iOS version your app supports. Open your project’s Podfile
platform :ios, '11.0'
Update the iOS version to a higher value that is compatible with the new version of “react-native-safe-area-context.” For example, you can set it to ‘13.0’.
platform :ios, '13.0'
3. Run Pod install
After making these changes, save the Podfile and return to your project’s root directory inside ios folder in the terminal. Run the following command to update your CocoaPods dependencies
pod install
4. Output
You will able to install pod successfully with following message. this is how we can solve CocoaPods could not find compatible versions for pod “react-native-safe-area-context”
Thank you 🙂