固定违规:选取器已从React Native中删除,现在可以从“@react-native-picker”中安装和导入它

balp4ylt  于 2022-11-25  发布在  React
关注(0)|答案(2)|浏览(259)

如何在react原生版本0.68.2中修复此问题

Invariant Violation: Picker has been removed from React Native. It can now be installed and imported from '@react-native-picker/picker' instead of 'react-native'. See https://github.com/react-native-picker/picker
ht4b089n

ht4b089n1#

您应该使用此包,因为选择器已从react native中删除:
https://github.com/react-native-picker/picker
安装时使用

npm install @react-native-picker/picker --save

yarn add @react-native-picker/picker

然后,您可以按如下方式导入选取器元素:

import {Picker} from '@react-native-picker/picker';
4xrmg8kj

4xrmg8kj2#

只需尝试安装@react-native-picker/picker,而不仅仅是“Picker”
请尝试以下命令:npm安装@React-本机-选取器/选取器--保存
您可以在此处阅读更多信息-https://github.com/react-native-picker/picker

相关问题