Invariant Violation: Picker has been removed from React Native

2.6k Views Asked by At

enter image description here

ERROR 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
ERROR Invariant Violation: Module AppRegistry is not a registered callable module (calling runApplication). A frequent cause of the error is that the application entry file path is incorrect. This can also happen when the JS bundle is corrupt or there is an early initialization error when loading React Native.

I'm trying to configure an existing react-native project, but I'm facing the above issue with it.

I do not have picker in the project while it is showing following error. Added @react-native-picker/picker as well.

3

There are 3 best solutions below

0
On

In My case I removed @davidgovea/react-native-wheel-datepicker this package which uses old dependencies which caused the issue.

0
On
1
On

1.Install patch-package into your project,

Install @react-native-picker/picker into your project,

go to node_modules\react-native\index.js

replace all

invariant(
      false,
     'DatePickerAndroid has been removed from React Native. ' +
       "It can now be installed and imported from '@react-native- 
     community/datetimepicker' instead of 'react-native'. " +
       'See https://github.com/react-native- 
   datetimepicker/datetimepicker',
      );

or

invariant(
             false,
          ........ DatePicker ..........
             );

to

return require('@react-native-picker/picker') 

run

npx patch-package react-native

rebuild your app and it will be work