You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Expo 50.0.14中RNDatePicker未找到问题及解决尝试

Expo 50.0.14 安卓真机部署崩溃:RNDatePicker 模块找不到错误(未直接使用RNDatePicker)

问题描述

使用 Expo 50.0.14 版本,通过 EAS 构建 APK 安装到安卓设备后应用直接崩溃,抛出 RNDatePicker 相关错误,但项目中并未直接使用 RNDatePicker,仅引入了 @react-native-picker/picker 和 react-native-modal-datetime-picker。该问题在 Expo 49.0.21 版本中未出现。

错误日志

ERROR  Invariant Violation: TurboModuleRegistry.getEnforcing(...): 'RNDatePicker' could not be found. Verify that a module by this name is registered in the native binary., js engine: hermes
 ERROR  Invariant Violation: "main" has not been registered. This can happen if:
* Metro (the local dev server) is run from the wrong folder. Check if Metro is running, stop it and restart it in the current project.
* A module failed to load due to an error and `AppRegistry.registerComponent` wasn't called., js engine: hermes

原项目 package.json 依赖

{
  "name": "rsrv",
  "version": "1.0.0",
  "main": "node_modules/expo/AppEntry.js",
  "scripts": {
    "start": "expo start --port 19000",
    "android": "expo start --android",
    "ios": "expo start --ios",
    "web": "expo start --web"
  },
  "dependencies": {
    "@expo/vector-icons": "^13.0.0",
    "@react-native-async-storage/async-storage": "^1.23.1",
    "@react-native-community/eslint-config": "^3.2.0",
    "@react-native-picker/picker": "^2.6.1",
    "@react-navigation/native": "^6.1.17",
    "@react-navigation/native-stack": "^6.9.26",
    "eslint-plugin-prettier": "^5.1.3",
    "expo": "^50.0.14",
    "expo-barcode-scanner": "^12.9.3",
    "expo-checkbox": "^2.7.0",
    "expo-constants": "^15.4.5",
    "expo-device": "^5.9.3",
    "expo-linear-gradient": "^12.7.2",
    "expo-notifications": "~0.20.1",
    "react": "18.2.0",
    "react-native": "0.72.10",
    "react-native-credit-card-input": "^0.4.1",
    "react-native-modal": "^13.0.1",
    "react-native-modal-datetime-picker": "^17.1.0",
    "react-native-safe-area-context": "^4.9.0",
    "react-native-screens": "^3.30.1",
    "react-native-vector-icons": "^10.0.0"
  },
  "private": true
}

解决方案

将 react-native-modal-datetime-picker@17.1.0 替换为 @react-native-community/datetimepicker@7.6.1,同时同步更新其他相关依赖版本,调整后的依赖配置如下:

"dependencies": {
    "@expo/vector-icons": "^14.0.0",
    "@react-native-async-storage/async-storage": "^1.21.0",
    "@react-native-community/datetimepicker": "^7.6.1",
    "@react-native-community/eslint-config": "^3.2.0",
    "@react-native-picker/picker": "^2.6.1",
    "@react-navigation/native": "^6.1.6",
    "@react-navigation/native-stack": "^6.9.12",
    "eslint-plugin-prettier": "^5.1.3",
    "expo": "~50.0.14",
    "expo-barcode-scanner": "~12.9.3",
    "expo-checkbox": "~2.7.0",
    "expo-constants": "~15.4.5",
    "expo-device": "~5.9.3",
    "expo-linear-gradient": "~12.7.2",
    "expo-notifications": "^0.27.6",
    "react": "18.2.0",
    "react-native": "^0.73.6",
    "react-native-credit-card-input": "^0.4.1",
    "react-native-modal": "^13.0.1",
    "react-native-safe-area-context": "^4.8.2",
    "react-native-screens": "~3.29.0",
    "react-native-vector-icons": "^10.0.0"
  },

目前已准备重新构建 Expo APK 并安装到真机验证方案有效性。

内容的提问来源于stack exchange,提问作者Урош Милошевић

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.26 10:42:08