Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Calendar 'modal' as overlapping components (when yearsDiff >= 100y.) #415

Open
Izocel opened this issue Aug 8, 2024 · 4 comments
Open
Labels
bug Something isn't working needs more info Needs more information

Comments

@Izocel
Copy link

Izocel commented Aug 8, 2024

Current behavior

ANDROID && IOS
Using Single-Date mode in the calendar, if the picker date is 100 year under 'current-year' we get weird components overlapping.

Expected behavior

All dates should works properly.

How to reproduce?

// Top component return
    return <DatePickerInput
      mode="flat"
      label={label}
      inputMode="start"
      locale={pickerLocale}
      ref={datePickerInputRef}

      value={outputDate}
      {...validationProps}

      disabled={disabled}
      editable={!disabled && editable}
      withModal={!disabled && editable}
      saveLabelDisabled={disabled || !editable}
      inputEnabled={!disabled && editable && inputEnabled}
      withDateFormatInLabel={withDateFormatInLabel ?? false}
      placeholder={placeholder ?? translate("baseDisplayFields.date")}

      cursorColor={null}
      selectionColor={null}
      textColor={colors.black}
      outlineColor="transparent"
      underlineColor="transparent"
      activeOutlineColor="transparent"
      activeUnderlineColor="transparent"
      placeholderTextColor={colors.dimmed}

      iconStyle={styleIcon}
      iconSize={styleIcon.iconSize}
      iconColor={styleIcon.iconColor}
      style={[DatePickerStyles.defaultInput, style]}
      underlineStyle={[DatePickerStyles.defaultInputFlat, flatStyle]}
      contentStyle={[DatePickerStyles.defaultInputContent, contentStyle]}
      outlineStyle={[DatePickerStyles.defaultInputOutlined, outLineStyle]}

      onChange={onInputChange}
      onChangeText={onChangeText}
      onValidationError={onInvalidDate}
    />

//Wrapped component:
export function DatePickerForInlineInput(value, styles, onChange) {
  value = value ? tryParseDateValue(moment(value).toDate()) : null;
  styles = {
    style: [DatePickerStyles.defaultInlineInputStyle, styles.style],
    inputContainerStyle: [DatePickerStyles.defaultInlineInputContainerStyle, styles.inputContainerStyle]
  }

  return <DatePicker
    placeholder={""}
    dateValue={value}
    style={styles.style}
    inputContainerStyle={styles.inputContainerStyle}
    onChange={(date) => {
      const textDate = date ? moment(date).format("YYYY-MM-DD") : "";
      onChange(textDate);
    }}
  />;
}

//Call to wrapped component:
return DatePickerForInlineInput(value, pickerStyle, (newValue) => {
  this.setColumnValue(index, key, newValue);
});

Preview

1901-01-01 <> 1923-01-01 (1925-01-01 is OK)

image

What have you tried so far?

  • Evaluate if it was related to the device OS. (no)
  • Evaluate if this was only in dev/prod build (affects both)

Your Environment

software version
IOS 17.x
android 14.x
react-native 0.73.x
react-native-paper latest
@Izocel Izocel added the bug Something isn't working label Aug 8, 2024
@iM-GeeKy
Copy link
Collaborator

iM-GeeKy commented Aug 8, 2024

PRs are welcome!

@Izocel
Copy link
Author

Izocel commented Aug 8, 2024

Do you have a clue about what's going on here ?

@iM-GeeKy iM-GeeKy added the needs more info Needs more information label Aug 20, 2024
Copy link
Contributor

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.).

@yoshitaka-sato
Copy link

yoshitaka-sato commented Aug 25, 2024

I have the same issue.

I think the following is the cause, but I don't know how to fix it.

https://github.com/web-ridge/react-native-paper-dates/blob/master/src/Date/Month.tsx#L461
https://github.com/web-ridge/react-native-paper-dates/blob/master/src/Date/dateUtils.tsx#L173

Modifying the startAtIndex to 2688 ((2024 - 1800) * 12) seems to be fine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working needs more info Needs more information
Projects
None yet
Development

No branches or pull requests

3 participants