Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not compatible with @react-native-picker/picker v2.1.0 #458

Closed
bittu1028 opened this issue Sep 15, 2021 · 7 comments
Closed

Not compatible with @react-native-picker/picker v2.1.0 #458

bittu1028 opened this issue Sep 15, 2021 · 7 comments

Comments

@bittu1028
Copy link

No description provided.

@ramisalem
Copy link

Same issue

@superguineapig
Copy link

@bittu1028 @ramisalem - what are you experiencing exactly? which platform? which deps? etc...

@teckbeng-payboy
Copy link

Screenshot 2021-10-06 at 3 52 15 PM

Once update react-native-picker to v2.1.0, then it will show this error which probably cause by this package

Current env:
"@react-native-picker/picker": "^2.1.0",
"react-native-picker-select": "^8.0.4",

@superguineapig
Copy link

Try this as a quick troubleshooting checklist: (in order)

  1. close app in simulator if running
  2. simulator Device -> Erase all content and settings
  3. close any running instances of metro/bundler
  4. search your (*.js) codebase for old imports to @react-native-community/picker replace with @react-native-picker/picker
  5. npm uninstall @react-native-community/picker
  6. cd ios && pod install
  7. if using XCode, run aProduct -> Clean Build Folder
  8. Rebuild and run however you usually do (cli or XCode)

Double check that your package.json does not include any old/duplicate picker deps (dev too) at different versions.

You can also try to repeat the steps starting at 5, by completely removing your local node modules rm -rf node_modules then npm install and at 6 by removing your installed Pods cd ios && rm Podfile.lock && rm -rf Pods then pod install --repo-update to get fresh versions of all deps. This will take longer to do, but usually clears out any old stuff.

If you are still seeing the same error after all of this, it might be another dep in your package.json that is including the old community picker in its source.

@Rehubbard
Copy link

Rehubbard commented Oct 25, 2021

If you follow the current readme, this library will end up installing 2 versions of @react-native-picker/picker. That's what causes this issue.

I got it working by installing @react-native-picker/picker with ^1.8.3 in package.json. It has to match this library's dependency exactly or it will install duplicates and you'll get the Invariant Violation error.

I believe the dependency configuration around @react-native-picker/picker could be improved in this library.

I made a PR using @react-native-picker/picker as a peerDependency. You could also just upgrade the dependency to the latest in the current package.json (^2.1.0), but I think this is a good use of peerDependencies.

@ebaynaud
Copy link

If you are using Yarn, you can solve this temporarily by forcing react-native-picker-select to resolve to ^2.1.0 instead of ^1.8.3 using yarn resolutions.

In package.json, add:


  "resolutions": {
    "react-native-picker-select/@react-native-picker/picker": "^2.1.0"
  },

@lfkwtz
Copy link
Collaborator

lfkwtz commented Nov 27, 2023

newest version uses 2.4

@lfkwtz lfkwtz closed this as not planned Won't fix, can't repro, duplicate, stale Nov 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants