web-ridge / react-native-paper-dates

Smooth and fast cross platform Material Design date and time picker for React Native Paper
https://www.reactnativepaperdates.com
MIT License
637 stars 161 forks source link

DatePickerInput crashed with initial value #390

Closed AlejandroRM-DEV closed 1 month ago

AlejandroRM-DEV commented 1 month ago

Current behaviour

When you tap the icon to open the modal, the application crashes.

Expected behaviour

Open the modal to select the date.

How to reproduce?

export function DatePicker({ control, name, rules, style, ...rest }) {
  return (
    <Controller
      control={control}
      name={name}
      rules={rules}
      render={({ field: { onChange, value } }) => (
        <DatePickerInput
          locale={i18n.locale}
          label=""
          iconSize={16}
          inputMode="start"
          style={[styles.datePicker, style]}
          mode="outlined"
          dense
          withDateFormatInLabel={false}
          onChange={(d) => onChange(d)}
          value={value}
          {...rest}
        />
      )}
    />
  );
}

Preview

Simulator Screenshot - iPhone 15 Pro Max - 2024-05-21 at 23 52 17

What have you tried so far?

If I do not pass the value property, the modal is displayed.

Your Environment

software version
ios 17.2
react-native 0.74.1
react-native-paper ^5.12.3
expo sdk ^51.0.8
github-actions[bot] commented 1 month ago

Hey! Thanks for opening the issue. Can you provide more information about the issue? Please fill the issue template when opening the issue without deleting any section. We need all the information we can, to be able to help. Make sure to at least provide - Current behaviour, Expected behaviour, A way to reproduce the issue with minimal code (link to snack.expo.dev) or a repo on GitHub, and the information about your environment (such as the platform of the device, versions of all the packages etc.).

github-actions[bot] commented 1 month ago

Hey! Thanks for opening the issue. Can you provide a minimal repro which demonstrates the issue? Posting a snippet of your code in the issue is useful, but it's not usually straightforward to run. A repro will help us debug the issue faster. Please try to keep the repro as small as possible. The easiest way to provide a repro is on snack.expo.dev. If it's not possible to repro it on snack.expo.dev, then you can also provide the repro in a GitHub repository.

iM-GeeKy commented 1 month ago

Working examples can be found in the docs. If you suspect this is still a bug feel free to open a PR!

AlejandroRM-DEV commented 1 month ago

Thanks for the reply, I finally realized that I was passing a dayjs object instead of Date as a value