Reputation: 3553
I'm new to react-native, since I'm using Expo and I had to install react-native community picker, I used the following command to install:
npm install @react-native-community/picker --save
After that I import it like this:
import {Picker} from '@react-native-community/picker';
But I get the following error:
While trying to resolve module `@react-native-community/picker` from file `C:\xampp\htdocs\secondtry\screens\HomeScreen3.js`, the package `C:\xampp\htdocs\secondtry\node_modules\@react-native-community\picker\package.json` was successfully found. However, this package itself specifies a `main` module field that could not be resolved (`C:\xampp\htdocs\secondtry\node_modules\@react-native-community\picker\js\index.js`. Indeed, none of these files exist:
Upvotes: 0
Views: 8376
Reputation: 41
it was actually the opposite for me, using standard npm (over npx expo) to install worked.
Upvotes: 0
Reputation: 41
The Author renamed the library to @react-native-picker/picker
. Please try to use it.
For details see this link.
Upvotes: 4
Reputation: 349
You need to use expo command for installing:
expo install @react-native-community/picker
Upvotes: 3