datetimepicker: Invariant Violation: Tried to register two views with the same name RNDateTimePicker
Bug report
Summary
Unable to start the app in ios after update the datetimepicker to ver. @react-native-community/datetimepicker@3.4.0.
[Thu Mar 18 2021 21:33:42.444] ERROR Invariant Violation: Tried to register two views with the same name RNDateTimePicker
[Thu Mar 18 2021 21:33:42.444] ERROR Invariant Violation: Module AppRegistry is not a registered callable module (calling runApplication)
Reproducible sample code
Steps to reproduce
- Update the lib to @react-native-community/datetimepicker@3.4.0
- run: yarn ios
Environment info
npx react-native info
output:
System:
OS: macOS 11.2.3
CPU: (4) x64 Intel(R) Core(TM) i5-6360U CPU @ 2.00GHz
Memory: 281.48 MB / 16.00 GB
Shell: 5.8 - /bin/zsh
Binaries:
Node: 15.2.1 - /usr/local/bin/node
Yarn: 1.22.10 - /usr/local/bin/yarn
npm: 7.5.4 - /usr/local/bin/npm
Watchman: Not Found
Managers:
CocoaPods: 1.10.0 - /usr/local/bin/pod
SDKs:
iOS SDK:
Platforms: iOS 14.4, DriverKit 20.2, macOS 11.1, tvOS 14.3, watchOS 7.2
Android SDK: Not Found
IDEs:
Android Studio: 4.1 AI-201.8743.12.41.6953283
Xcode: 12.4/12D4e - /usr/bin/xcodebuild
Languages:
Java: 14.0.2 - /usr/bin/javac
Python: 2.7.16 - /usr/bin/python
npmPackages:
@react-native-community/cli: Not Found
react: 16.14.0 => 16.14.0
react-native: ^0.63.4 => 0.63.4
react-native-macos: Not Found
npmGlobalPackages:
*react-native*: Not Found
"dependencies": {
"@babel/core": "^7.12.10",
"@fortawesome/fontawesome-svg-core": "^1.2.34",
"@fortawesome/free-brands-svg-icons": "^5.15.2",
"@fortawesome/pro-light-svg-icons": "^5.15.2",
"@fortawesome/pro-regular-svg-icons": "^5.15.2",
"@fortawesome/pro-solid-svg-icons": "^5.15.2",
"@fortawesome/react-native-fontawesome": "^0.2.6",
"@invertase/react-native-apple-authentication": "^2.1.1",
"@react-native-clipboard/clipboard": "^1.6.0",
"@react-native-community/art": "^1.2.0",
"@react-native-community/async-storage": "^1.12.1",
"@react-native-community/audio-toolkit": "^2.0.3",
"@react-native-community/datetimepicker": "^3.4.0",
"@react-native-community/google-signin": "^5.0.0",
"@react-native-community/masked-view": "^0.1.10",
"@react-native-community/slider": "^3.0.3",
"@react-native-firebase/analytics": "7.3.1",
"@react-native-firebase/app": "8.2.0",
"@react-native-picker/picker": "^1.9.10",
"@types/uuid": "7.0.4",
"axios": "^0.21.1",
"color": "^3.1.3",
"formik": "^2.2.6",
"fsevents": "2.2.1",
"hermes-engine": "0.5.2-rc1",
"immutability-helper": "^3.1.1",
"link-preview-js": "^2.1.3",
"lodash": "^4.17.20",
"native-base": "^2.15.2",
"pretty-bytes": "^5.5.0",
"randomcolor": "^0.6.2",
"react": "16.14.0",
"react-native": "^0.63.4",
"react-native-add-calendar-event": "^4.0.0",
"react-native-base64": "^0.2.1",
"react-native-calendars": "^1.1129.0",
"react-native-config": "^1.4.1",
"react-native-device-info": "^8.0.0",
"react-native-document-picker": "^5.0.0",
"react-native-fast-image": "^8.3.4",
"react-native-fbsdk": "1.1.2",
"react-native-ffmpeg": "^0.5.1",
"react-native-file-viewer": "^2.1.4",
"react-native-gesture-handler": "^1.9.0",
"react-native-gifted-chat": "^0.16.3",
"react-native-heic-converter": "^1.3.0",
"react-native-hide-with-keyboard": "^1.2.1",
"react-native-image-crop-picker": "^0.36.0",
"react-native-image-zoom-viewer": "^3.0.1",
"react-native-inappbrowser-reborn": "^3.5.1",
"react-native-iphone-x-helper": "^1.3.1",
"react-native-linear-gradient": "^2.5.6",
"react-native-loading-spinner-overlay": "^2.0.0",
"react-native-masked-text": "^1.13.0",
"react-native-mime-types": "^2.3.0",
"react-native-modal": "^11.6.1",
"react-native-modal-datetime-picker": "^9.1.0",
"react-native-notifications": "^3.4.2",
"react-native-orientation-locker": "^1.2.0",
"react-native-permissions": "^3.0.1",
"react-native-progress": "^4.1.2",
"react-native-push-notification-popup": "^1.6.0",
"react-native-rate": "^1.2.4",
"react-native-reanimated": "^1.13.2",
"react-native-render-html": "^4.2.5",
"react-native-safe-area-context": "^3.1.9",
"react-native-screens": "^2.16.1",
"react-native-share": "^5.1.0",
"react-native-simple-dialogs": "^1.4.0",
"react-native-simple-toast": "^1.1.3",
"react-native-snap-carousel": "^3.9.1",
"react-native-spinkit": "^1.5.1",
"react-native-splash-screen": "^3.2.0",
"react-native-svg": "^12.1.0",
"react-native-swipe-gestures": "^1.0.5",
"react-native-vector-icons": "^7.1.0",
"react-native-version": "^4.0.0",
"react-native-video": "^5.1.1",
"react-native-webview": "^11.0.3",
"react-navigation": "^4.4.3",
"react-navigation-drawer": "^2.6.0",
"react-navigation-stack": "^2.10.2",
"react-redux": "7.2.2",
"read-package-json": "^3.0.0",
"redux": "^4.0.5",
"redux-persist": "^6.0.0",
"redux-thunk": "^2.3.0",
"rn-fetch-blob": "^0.12.0",
"rn-placeholder": "^3.0.3",
"rollbar-react-native": "^0.9.1",
"sanitize-filename": "^1.6.3",
"striptags": "^3.1.1",
"url": "^0.11.0",
"yup": "^0.32.8"
},
"devDependencies": {
"@babel/runtime": "7.12.5",
"@react-native-community/eslint-config": "^1.1.0",
"babel-jest": "25.5.1",
"detox": "17.14.3",
"eslint": "^6.8.0",
"jest": "25.5.4",
"metro-react-native-babel-preset": "^0.59.0",
"properties-reader": "^1.0.0",
"react-test-renderer": "16.14.0",
"redux-devtools": "3.7.0"
},
"jest": {
"preset": "react-native"
}
datetimepicker version: 3.4.0
iOS 14.4
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Reactions: 2
- Comments: 18 (1 by maintainers)
@manojkumar402 try to add this to your package.json
“resolutions”: { “@react-native-community/datetimepicker”: “3.5.0” }
my error - Requiring module “node_modules/react-native-weekly-calendar/node_modules/@react-native-community/datetimepicker/src/picker.ios.js”, which threw an exception: Invariant Violation: Tried to register two views with the same name RNDateTimePicker
SOLVED just delete folder (second version) = node_modules/react-native-weekly-calendar/node_modules/@react-native-community/datetimepicker cause we have already one global
hello and thanks for reporting, given there is no runnable repro I cannot test this myself but I tend to believe that the culprit is in the fact that you’re depending on both “@react-native-community/datetimepicker” and “react-native-modal-datetime-picker” which uses “@react-native-community/datetimepicker”. Maybe having two different versions that you depend on causes the issue.
Hope this helps.
Hi @ankit-navyug. This is the problem -> “native-base”: “^2.13.15”.
Try to use resolutions. For example:
“resolutions”: { “@react-native-community/datetimepicker”: “3.5.2” }
May the force be with you…
@claudiozam The above versions did not work on my m1 machine
datetimepicker: 3.5.0 react-native-modal-datetime-picker: ^10.0.0