[英]Error when importing react-native community picker
我是 react-native 的新手,因為我使用的是 Expo 並且我必須安裝 react-native 社區選擇器,我使用以下命令進行安裝:
npm install @react-native-community/picker --save
之后我像這樣導入它:
import {Picker} from '@react-native-community/picker';
但我收到以下錯誤:
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:
作者將庫重命名為@react-native-picker/picker
。 請嘗試使用它。
有關詳細信息,請參閱此鏈接。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.