[Bug]: Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[RNDatePicker setDatePickerMode:]: unrecognized selector sent to instance 0x120e5bc00'
Describe the bug
The app crashes on ios when I attempt to render a DatePicker. It was working fine for older versions of react native, but when I upgraded (0.74.2 to 0.78.0) to the newer version, it is crashing the app.
Expected behavior
It should render properly on all platforms.
To Reproduce
import React, { useState } from 'react'
import DatePicker from 'react-native-date-picker'
export default () => {
const [date, setDate] = useState(new Date())
return <DatePicker date={date} onDateChange={setDate} />
}
Operating System
- [ ] Android
- [x] iOS
React Native Version
0.78.0
Expo Version (if applicable)
No response
react-native-date-picker version
5.0.12
React Native Architecture
- [ ] Old Architecture (Paper)
- [x] New Architecture (Fabric)
Relevant log output
Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[RNDatePicker setDatePickerMode:]: unrecognized selector sent to instance 0x120e5bc00'
Have you rebuilt?
I have rebuilt it again and also cleared all the caches as well. I have integrated native app with react native app, It was crashing for this one. But when I tried to run this in standalone react native app, it is working fine
Please check the attached screenshot of the issue
I believe I've got the same issue. After updating to Expo 53 (RN 0.79.2), the app crashes when the date picker is being rendered. It works fine on Android, only crashes on iOS.
I'm getting this error during compilation after upgrade to Expo 52 (RN 0.79.2). Maybe it'll be useful for you.
› Compiling react-native-date-picker Pods/react-native-date-picker » RNDatePickerManager.mm
❌ (node_modules/react-native-date-picker/ios/RNDatePickerManager.mm:54:31)
52 | NSDate *date = [self convertToNSDate:json];
53 | if (date) {
> 54 | [(RNDatePicker *)view setDate:date];
| ^ no visible @interface for 'RNDatePicker' declares the selector 'setDate:'
55 | }
56 | }
57 |
❌ (node_modules/react-native-date-picker/ios/RNDatePickerManager.mm:64:31)
62 | NSDate *date = [self convertToNSDate:json];
63 | if (date) {
> 64 | [(RNDatePicker *)view setMinimumDate:date];
| ^ no visible @interface for 'RNDatePicker' declares the selector 'setMinimumDate:'
65 | }
66 | }
67 |
❌ (node_modules/react-native-date-picker/ios/RNDatePickerManager.mm:72:31)
70 | NSDate *date = [self convertToNSDate:json];
71 | if (date) {
> 72 | [(RNDatePicker *)view setMaximumDate:date];
| ^ no visible @interface for 'RNDatePicker' declares the selector 'setMaximumDate:'
73 | }
74 | }
75 |
@henninghall, Interestingly I just found out that the issue only occurs on debug mode, not with a release build.
I cleared my node modules, native folders and expo bundler cache, but none helped getting the time picker (in my case) to work again in debug mode (running Expo 53 on new arch, latest version of datepicker lib). It is broken on both my iOS simulator and physical iPhone.
When I made an EAS TestFlight build while in this state where the time picker crashes in debug mode, the TestFlight (release) build showed a fully working time picker.
I hope this information is helpful in tracking down the cause of the issue. If I can be of further help, please let me know.
I'm encountering the same issue on iOS after upgrading to React Native 0.80.0 and using react-native-date-picker version 5.0.12 (v5.0.13 gives me issue).
Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[RNDatePicker setDatePickerMode:]: unrecognized selector sent to instance ...'
Are there any known workarounds or updates on this?
I upgraded to version 5.0.13 and can confirm that the original issue no longer occurs on React Native 0.80.0.
However, I did run into issue #924 after the upgrade. I resolved it by following the suggestion from @makivlach
Hope this helps anyone facing the same issue!
Hi guys! I still have this/similar issue although I am on 5.0.13.
Here the error log:
Exception thrown while executing UI block: -[RNDatePicker setMinuteInterval:]: unrecognized selector sent to instance
__44-[RCTUIManager flushUIBlocksWithCompletion:]_block_invoke RCTUIManager.mm:1169 __44-[RCTUIManager flushUIBlocksWithCompletion:]_block_invoke.195 __RCTExecuteOnMainQueue_block_invoke _dispatch_call_block_and_release _dispatch_client_callout _dispatch_main_queue_drain.cold.7 _dispatch_main_queue_drain _dispatch_main_queue_callback_4CF CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE __CFRunLoopRun CFRunLoopRunSpecific GSEventRunModal -[UIApplication _run] UIApplicationMain __debug_main_executable_dylib_entry_point start_sim 0x0
react-native: installed: 0.79.3 iOS: hermesEnabled: true newArchEnabled: true "@react-native-community/cli": installed: 18.0.0 react: installed: 19.0.0
Basic implementation:
<DatePicker date={new Date()} mode="datetime" />
What further information should i provide?
Hi @hoerlanton , We are getting same error when using inline datepicker however working fine when using modal and open as true in iOS.