在尝试使用“@react-native-community/datetimepicker”中的“DateTimePicker”时,出现以下错误。
错误不变违规:TurboModuleRegistry.getEnforcing(...):找不到“RNCDatePicker”。验证此名称的模块是否已在本机二进制文件中注册。,js 引擎:hermes 错误不变违规:“main”尚未注册。如果出现以下情况,就会发生这种情况:
AppRegistry.registerComponent
。,js 引擎:hermes
您可以在这里找到该项目https://github.com/mendismenon/md_reactnative。
我按照下面的视频来实现此功能。 https://www.youtube.com/watch?v=UEfFjfW7Zes
感谢迄今为止已回答的评论 - 我也能够修复此错误。
当我开始这个项目时,我收到了这个警告:
...
Starting Metro Bundler
Some dependencies are incompatible with the installed expo version:
[email protected] - expected version: 13.9.0
@react-native-community/[email protected] - expected version: 7.2.0
@react-native-async-storage/[email protected] - expected version: 1.18.2
Your project may not work correctly until you install the correct versions of the packages.
Fix with: npx expo install --fix
按照人们的建议,我修改了我的 package.json,如下所示:
"dependencies": {
"expo": "~49.0.15",
....
"@react-native-community/datetimepicker": "7.2.0",
"@react-native-async-storage/async-storage": "1.18.2"
},
基本上我所做的就是降级 datetimepicker 和 async-storage 的版本以匹配警告消息中的版本。
然后我就跑了:
npx expo install --fix
npm install
这解决了我的问题。祝你好运!