NativeBase
NativeBase copied to clipboard
Cannot install into existing React Native 0.69.x + React v18 project start from React Native seed
Description
I try to install into existing RN project start from React Native seed
CodeSandbox/Snack link
N/A
Steps to reproduce
Hi, I try to install into existing RN project start from React Native seed.
"react": "18.0.0",
"react-native": "0.69.4",
I've this compatibility error:
NativeBase Version
3.4.13
Platform
- [X] Android
- [ ] CRA
- [ ] Expo
- [X] iOS
- [ ] Next
Other Platform
No response
Additional Information
No response
I am also getting this exact same issue. The same steps to recreate it as well.
I am also getting this exact same issue. The same steps to recreate it as well.
Have you any news?
I am also getting this exact same issue. The same steps to recreate it as well.
Have you any news?
No news, also figured out that if you npm -i --force it will break everything.
I am also getting this exact same issue. The same steps to recreate it as well.
Have you any news?
No news, also figured out that if you
npm -i --forceit will break everything.
No. Don't use the force option.
Hey, Thanks for reporting the issue. We'll look into it.
I reported this 18 days ago, and has since been unresolved https://github.com/GeekyAnts/NativeBase/issues/5259#issuecomment-1214278468
Hey @biapar, any updates? or any workaround for this issue
Hi all, use --legacy-peer-deps
Hi all, use
--legacy-peer-deps
Is't a workaround or a fix?
I wouldn't close this issue, using that command does not solve the problem!
Hi @ankit-tailor ,
Do you have any news for us about this issue?
I don't think that using the --legacy-peer-deps should be the solution for this as it also makes a bunch of warnings emerge in the console when doing a simple npm i!
https://nativebase.io/roadmap

Looks like the latest expo SDK are not officially support yet.
Also the last RN version.
Might help someone but I just installed react-dom to the expected version prior to install to avoid it trying to install 18.2.0
npm i [email protected] --save --save-exact
Edited to save exact version
@evulse That allowed you to run npm i native-base without getting errors?
I still get the same error which seems normal as it's trying to install the highest version of react dom due to the ^
npm ERR! Could not resolve dependency: npm ERR! peer react@"^18.2.0" from [email protected] npm ERR! node_modules/react-dom npm ERR! react-dom@"^18.0.0" from the root project npm ERR! peer react-dom@"" from [email protected] npm ERR! node_modules/native-base npm ERR! native-base@"" from the root project
Am I missing something here?
@MrVico It looks like it's still trying to install 18.2.0 maybe because it's already installed or maybe because it's just because your package file has ^18.0.0
Just go in to your package.json and change it from ^18.0.0 to 18.0.0 to force the version
I also modified the npm command which should handle this better, you can just run the one above to also fix this
@evulse You are right, don't know what I did but after using your command I could run npm i native-base without errors (although a lot of warnings now surface when running npm i but at least I can use native base now, thanks!)
getting same error when i do npm i native-base on new react native 0.70 but i can install with flag --legacy-peer-deps but I wonder if native base is fully compatible with react 18 and react native 0.70 and I don't get any issues in future so I dont have to revert back to older version of react native and react
So, It's ok for RN0.70+ / React 18+?
Can confirm that I ran into this problem and @evulse's suggestion got things running for me too. Appreciate the tip! As mentioned before I received numerous warnings regarding peer dependencies, but it allowed me to run it via npm without erroring out and I've verified that I'm seeing components working.
@biapar @leighton-tidwell
- Add overrides react v18.
"overrides": {
"react": "18.0.0"
},
- Then run
npm i native-base
Works for me. PS: When i use --force flag to install native-base the emulator crashes after app refresh many times without edit the code.

@biapar @leighton-tidwell
- Add overrides react v18.
"overrides": { "react": "18.0.0" },
- Then run
npm i native-base
Works for me. PS: When i use --force flag to install native-base the emulator crashes after app refresh many times without edit the code.
I added --legacy-peer-deps flag too and it works fine. I'm using node v16.13.0 as someone suggests above
When will NativeBase be available to use with React-Native 0.70? Do you plan to support RN 0.70 any time soon?
If you get this error during the Expo's EAS build, you can solve the problem with adding EAS hooks in your package.json file.
Add his line in the Scripts tag "eas-build-pre-install": "npm config set legacy-peer-deps true"