react-native-picker-select icon indicating copy to clipboard operation
react-native-picker-select copied to clipboard

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

Open bittu1028 opened this issue 3 years ago • 6 comments

bittu1028 avatar Sep 15 '21 08:09 bittu1028

Same issue

ramisalem avatar Sep 28 '21 10:09 ramisalem

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

superguineapig avatar Oct 04 '21 22:10 superguineapig

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",

teckbeng-payboy avatar Oct 06 '21 07:10 teckbeng-payboy

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.

superguineapig avatar Oct 06 '21 18:10 superguineapig

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.

Rehubbard avatar Oct 25 '21 22:10 Rehubbard

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"
  },

ebaynaud avatar Oct 27 '21 09:10 ebaynaud

newest version uses 2.4

lfkwtz avatar Nov 27 '23 15:11 lfkwtz