首页 > 解决方案 > react-native-picker 不适用于 react-native 版本 0.63.2

问题描述

我将 react-native 版本升级到0.63.2. 然后我在Android应用程序上遇到问题。

Android 应用显示空白屏幕。

错误如下:

Warning: Picker has been extracted from react-native core and will be removed in a future release. 
It can now be installed and imported from '@react-native-community/picker' instead of 'react-native'. 
See https://github.com/react-native-community/react-native-picker
ERROR    TypeError: Super expression must either be null or a function
ERROR    Invariant Violation: Module AppRegistry is not a registered callable module (calling runApplication)
ERROR    Invariant Violation: Module AppRegistry is not a registered callable module (calling runApplication)

我怎么解决这个问题?

标签: androidreact-native

解决方案


选择器已从“react-native”安装库@react-native-picker/picker中删除

代替

import {Picker} from 'react-native';

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

推荐阅读