我已经安装了nativebase版本2.15.2。我在 android 中遇到以下错误:
requireNativeComponent "RNCAndroidDropdownPicker" was not found in the UIManager
我在全新安装节点模块后开始遇到此问题。经过一番研究,我通过安装软件包解决了这个问题。
如果您使用
yarn
进行软件包安装
yarn add @react-native-community/picker
如果你使用npm
npm install @react-native-community/picker
如果您正在使用expo
expo install @react-native-community/picker
它对我有用:
npm install @react-native-picker/picker --save
链接:
iOS:
cd ios && pod install
安卓:
Clear and gradle run
问题出在原生基础版本 2.x 上 替换这个:
import { Picker, Button, Container, Form, Item, Card, Text, Icon, Label } from 'native-base';
为此:
import { Picker } from '@react-native-picker/picker';
import { Button, Container, Form, Item, Card, Text, Icon, Label } from 'native-base';
当然需要安装:
@react-native-picker/选择器
yarn add @react-native-picker/picker
在react-native >= 0.68.x 中测试
刚刚在全新安装时遇到了同样的问题(没有博览会),对我来说简单的修复是通常的嫌疑。
重置服务器和缓存
npx react-native start --reset-cache
删除节点模块,清理并构建。重新安装并再次运行。
rm -rf node_modules
npm i
cd android/
./gradlew clean
cd ../
npx react-native run-android
我在使用 AWS amplify 时遇到了同样的问题。我只需安装选择器包就可以解决这个问题。
npm install @react-native-community/picker