NativeBase icon indicating copy to clipboard operation
NativeBase copied to clipboard

Cannot install into existing React Native 0.69.x + React v18 project start from React Native seed

Open biapar opened this issue 1 year ago • 18 comments

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:

image

NativeBase Version

3.4.13

Platform

  • [X] Android
  • [ ] CRA
  • [ ] Expo
  • [X] iOS
  • [ ] Next

Other Platform

No response

Additional Information

No response

biapar avatar Aug 29 '22 07:08 biapar

I am also getting this exact same issue. The same steps to recreate it as well.

leighton-tidwell avatar Aug 29 '22 22:08 leighton-tidwell

I am also getting this exact same issue. The same steps to recreate it as well.

Have you any news?

biapar avatar Aug 30 '22 19:08 biapar

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.

leighton-tidwell avatar Aug 30 '22 19:08 leighton-tidwell

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.

No. Don't use the force option.

biapar avatar Aug 31 '22 07:08 biapar

Hey, Thanks for reporting the issue. We'll look into it.

ankit-tailor avatar Sep 01 '22 11:09 ankit-tailor

I reported this 18 days ago, and has since been unresolved https://github.com/GeekyAnts/NativeBase/issues/5259#issuecomment-1214278468

rohankleem avatar Sep 01 '22 11:09 rohankleem

Hey @biapar, any updates? or any workaround for this issue

Shahzad6077 avatar Sep 05 '22 22:09 Shahzad6077

Hi all, use --legacy-peer-deps

Viraj-10 avatar Sep 06 '22 11:09 Viraj-10

Hi all, use --legacy-peer-deps

Is't a workaround or a fix?

biapar avatar Sep 06 '22 14:09 biapar

I wouldn't close this issue, using that command does not solve the problem!

MrVico avatar Sep 06 '22 15:09 MrVico

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!

MrVico avatar Sep 09 '22 06:09 MrVico

https://nativebase.io/roadmap image

Looks like the latest expo SDK are not officially support yet.

turnerguo avatar Sep 09 '22 06:09 turnerguo

Also the last RN version.

biapar avatar Sep 09 '22 08:09 biapar

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 avatar Sep 11 '22 03:09 evulse

@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 avatar Sep 11 '22 06:09 MrVico

@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 avatar Sep 11 '22 08:09 evulse

@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!)

MrVico avatar Sep 12 '22 09:09 MrVico

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

nabinem avatar Sep 18 '22 06:09 nabinem

So, It's ok for RN0.70+ / React 18+?

biapar avatar Sep 28 '22 13:09 biapar

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.

JBertling avatar Sep 28 '22 22:09 JBertling

Stackoverflow

@biapar @leighton-tidwell

  1. Add overrides react v18.
  "overrides": {
    "react": "18.0.0"
  },
  1. 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.

image

itzmatheus avatar Nov 02 '22 20:11 itzmatheus