th3rdwave / react-native-safe-area-context

A flexible way to handle safe area insets in JS. Also works on Android and Web!
MIT License
2.13k stars 197 forks source link

Invariant Violation: Tried to register two views with the same name RNCSafeAreaProvider #250

Closed tradebulls closed 2 years ago

tradebulls commented 2 years ago

Hi,

I have been tracking similar issues regarding duplicate RNCSafeAreaProvider and hasn't found any conclusive solution for the same.

Libraries Used are: "react-native-elements": "3.4.2", "react-native-safe-area-context": "4.1.2", "rn-wave-bottom-bar": "2.1.1" "react-native": "0.67.3" "@react-navigation/stack": "6.1.1"

I are not using expo. The error comes in Run Time for IOS and Android both. I have tried to follow few suggested answers in other threads which works for others but not for me:

  1. npm dedupe
  2. Remove react-native-safe-area-context from package.json for react-native-elements( For me , its not present in dependency object)
  3. Reinstalling react-native-safe-area-context or reinstalling react-native-elements
  4. Have tried npm list react-native-safe-area-context, the output is as below: Screenshot 2022-03-10 at 1 52 01 PM

Error facing currently i

Screenshot 2022-03-10 at 1 53 33 PM

s

So after trying the above solutions, I am still facing the issue, Any one can please help? @th3rdwave

jacobp100 commented 2 years ago

You have two or more copies of this package in different places in your node_modules. It's likely due to something depending on v3, and something else depending on v4. I don't know how you fix this with npm, but yarn users will want to try yarn why react-native-safe-area-context.

tradebulls commented 2 years ago

The issue was with rn-wave-bottom-bar which was using v3 of Safe Area Context. The issue is solved now. Thanks

AbdulRehman960 commented 2 years ago

step 1: delete your node modules Step 2: install node modules using yarn instead of npm install

Now,your issue Fixed

aquib20034 commented 1 year ago

@AbdulRehman960 Thanks. Your solution worked for me also.

shanihusnain commented 1 month ago

i am still facing the issue while updating the expo sdk from 47 to 51.

package.json file is { "name": "avocado-mobile", "version": "1.0.0", "main": "node_modules/expo/AppEntry.js", "scripts": { "start": "expo start", "android": "expo start --android", "ios": "expo start --ios", "web": "expo start --web", "test": "jest --watchAll", "postinstall": "patch-package", "build:staging": "ENV=staging eas build --profile staging --platform all", "build:staging:ios": "ENV=staging eas build --profile staging --platform ios --auto-submit", "build:staging:android": "ENV=staging eas build --profile staging --platform android", "build:prod": "ENV=production eas build --profile production --platform all", "build:prod:ios": "ENV=production eas build --profile production --platform ios", "build:prod:android": "ENV=production eas build --profile production --platform android", "submit:staging": "ENV=staging eas submit --platform ios --profile staging" }, "jest": { "preset": "jest-expo" }, "dependencies": { "@expo/ngrok": "^4.1.1", "@expo/vector-icons": "^13.0.0", "@flyerhq/react-native-link-preview": "^1.6.0", "@front-finance/api": "^1.0.8", "@front-finance/link": "^1.0.8", "@gorhom/bottom-sheet": "^4", "@hookform/resolvers": "^2.9.10", "@react-native-async-storage/async-storage": "~1.17.3", "@react-native-community/datetimepicker": "6.5.2", "@react-native-community/hooks": "^2.8.1", "@react-native-community/netinfo": "9.3.5", "@react-native-community/slider": "4.2.4", "@react-navigation/bottom-tabs": "^6.0.5", "@react-navigation/drawer": "^6.5.0", "@react-navigation/native": "^6.0.2", "@react-navigation/native-stack": "^6.1.0", "@reduxjs/toolkit": "^1.9.0", "@rneui/base": "^0.0.0-edge.2", "@rneui/themed": "^0.0.0-edge.2", "@shopify/flash-list": "1.3.1", "axios": "^1.1.3", "deprecated-react-native-prop-types": "^4.1.0", "expo": "^47.0.0", "expo-apple-authentication": "~5.0.1", "expo-asset": "~8.7.0", "expo-auth-session": "~3.8.0", "expo-av": "~13.0.3", "expo-constants": "~14.0.2", "expo-crypto": "~12.0.0", "expo-dev-client": "~2.0.1", "expo-device": "~5.0.0", "expo-font": "~11.0.1", "expo-image-picker": "~14.0.2", "expo-linear-gradient": "~12.0.1", "expo-linking": "~3.3.1", "expo-notifications": "~0.17.0", "expo-random": "~13.0.0", "expo-sharing": "~11.0.1", "expo-splash-screen": "~0.17.5", "expo-status-bar": "~1.4.2", "expo-system-ui": "~2.0.1", "expo-updates": "~0.15.6", "expo-web-browser": "~12.0.0", "i18next": "^22.4.6", "intl": "^1.2.5", "jwt-decode": "^3.1.2", "lodash": "^4.17.21", "lottie-react-native": "5.1.4", "moment": "^2.29.4", "patch-package": "^7.0.0", "prop-types": "^15.8.1", "react": "18.1.0", "react-dom": "18.1.0", "react-hook-form": "^7.36.1", "react-i18next": "^12.1.1", "react-native": "0.70.8", "react-native-animated-splash-screen": "^2.0.5", "react-native-chart-kit": "^6.12.0", "react-native-confirmation-code-field": "^7.3.1", "react-native-controlled-mentions": "^2.2.5", "react-native-dotenv": "^3.4.8", "react-native-fbsdk-next": "^12.1.0", "react-native-flash-message": "^0.4.2", "react-native-gesture-handler": "~2.8.0", "react-native-gifted-charts": "^1.2.42", "react-native-gifted-chat": "^1.0.4", "react-native-google-places-autocomplete": "^2.5.1", "react-native-hyperlink": "^0.0.22", "react-native-keyboard-aware-scroll-view": "^0.9.5", "react-native-lottie-splash-screen": "^1.1.1", "react-native-modal": "^13.0.1", "react-native-modal-dropdown": "^1.0.2", "react-native-paper": "^4.12.4", "react-native-reanimated": "~2.12.0", "react-native-responsive-screen": "^1.4.2", "react-native-restart": "^0.0.27", "react-native-root-toast": "^3.3.1", "react-native-safe-area-context": "4.10.5", "react-native-screens": "~3.18.0", "react-native-snap-carousel": "^3.9.1", "react-native-svg": "13.4.0", "react-native-swiper": "https://github.com/leecade/react-native-swiper#5827a80002738abd1c0dc08428303c79bbc840c0", "react-native-toast-message": "^2.1.5", "react-native-ui-lib": "^6.22.1", "react-native-view-shot": "3.4.0", "react-native-web": "~0.18.7", "react-native-webview": "11.23.1", "react-native-youtube-iframe": "^2.2.2", "react-redux": "^8.0.5", "redux-persist": "^5.6.12", "socket.io-client": "^4.6.1", "toggle-switch-react-native": "^3.3.0", "victory-native": "^36.6.8", "yup": "^0.32.11" }, "devDependencies": { "@babel/core": "^7.19.3", "@types/expo": "^33.0.1", "@types/react": "~18.0.24", "@types/react-native": "~0.70.6", "jest": "^26.6.3", "jest-expo": "^47.0.0", "react-native-svg-transformer": "^1.0.0", "react-test-renderer": "18.0.0", "ts-node": "^10.9.1", "tsconfig-paths": "^4.1.0", "tslint": "^5.20.1", "tslint-config-airbnb": "^5.11.2", "typescript": "^4.6.3" }, "private": true } any one has solved please help me out