react-native-date-picker icon indicating copy to clipboard operation
react-native-date-picker copied to clipboard

[Bug]: Crash on iOS when rendering DatePicker inside a custom Modal

Open hirenitp opened this issue 3 months ago • 7 comments

Describe the bug

When using react-native-date-picker inside a Modal on iOS, the app crashes with the following error: libc++abi: terminating with uncaught exception of type NSException The crash occurs as soon as the DatePicker is rendered. This does not happen on Android — it works as expected there.

I confirmed that the date prop is being passed as a valid JavaScript Date object on render, yet the crash still occurs on iOS.

Device: iPhone 6s plus / Simulator

Expected behavior

Expected the DatePicker to render normally on iOS, like it does on Android, when shown inside a custom modal.

To Reproduce

<Modal
        animationType={'fade'}
        transparent={true}
        visible={showDateTimePicker}>
        <ModalMainView>
          <ModalMainCardView>
            <DatePicker
              date={new Date()}
              fadeToColor={'none'}
              mode={'datetime'}
              placeholder="Select Date and Time"
              format="MM/DD/YY  h:mm a"
              confirmBtnText="Confirm"
              cancelBtnText="Cancel"
              showIcon={true}
              textColor={theme.colors.black}
              onDateChange={date => setSelectedDateForEdit(date)}
            />
            {renderGotoTodayBtn()}
            <ModalButtonContainer>
              <ModalButtonView>
                <Button
                  label={'Discard'}
                  size={'medium'}
                  height={40}
                  fontSize={17}
                  variant={'grey'}
                  onPress={hideDatePicker}
                />
              </ModalButtonView>
              <ModalButtonView>
                <Button
                  label={'Ok'}
                  size={'medium'}
                  height={40}
                  fontSize={18}
                  variant={'primary'}
                  onPress={saveSelectedDate}
                />
              </ModalButtonView>
            </ModalButtonContainer>
          </ModalMainCardView>
        </ModalMainView>
      </Modal>

Operating System

  • [ ] Android
  • [x] iOS

React Native Version

0.80.2

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

Below is logs found in Xcode (16.2) 
[RNDatePicker setDatePickerMode:]: unrecognized selector sent to instance 0x1524a12f0*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[RNDatePicker setDatePickerMode:]: unrecognized selector sent to instance 0x1524a12f0'
libc++abi: terminating with uncaught exception of type NSException

hirenitp avatar Sep 05 '25 16:09 hirenitp

+1

AbdullahZareen avatar Oct 01 '25 07:10 AbdullahZareen

+1

pierreprezelin avatar Oct 07 '25 13:10 pierreprezelin

+1

Toan181402958 avatar Oct 09 '25 10:10 Toan181402958

+1

Paul12pp avatar Oct 10 '25 22:10 Paul12pp

+1

han-nwin avatar Oct 22 '25 20:10 han-nwin

+1

shibakar avatar Nov 10 '25 13:11 shibakar

TBH I would stay away from the Modal component from React Native. Lots of weird issues with it, it's really easy to implement your own variation of a Modal. Or use gorhom portal for example - 0 issues with it

iway1 avatar Nov 10 '25 19:11 iway1

+1

aqee1ahmed avatar Dec 18 '25 06:12 aqee1ahmed