react-native-calendars icon indicating copy to clipboard operation
react-native-calendars copied to clipboard

fix: correctly type style override props

Open AmauryLiet opened this issue 6 months ago • 2 comments

Current typing incorrectly enforces passing styling props as:

<Calendar
    theme={{
      stylesheet: {
        calendar: {
          header: {
            dayTextAtIndex0: { color: 'fuchsia', fontSize: 42 },
          }
        }
      }
    }}
/>

although this leads to ignored styling. Correct usage is:

<Calendar
    theme={{
      'stylesheet.calendar.header': {
        dayTextAtIndex0: { color: 'fuchsia', fontSize: 42 },
      }
    }}
/>

AmauryLiet avatar Jul 16 '25 15:07 AmauryLiet

@AmauryLiet

Thank you so much for uploading this PR!

I'd like to share a suggestion regarding styling consistency that I've noticed while working with the library. Currently, there are two different approaches for styling calendar components in the original source code:

  1. Other Custom style properties: Can be modified using stylesheet.~... approach
export default function getStyle(theme: Theme = {}) {
    ...other things...,
    ...(theme['stylesheet.calendar.main'] || {})
  });
}
  1. ExpandableCalendar properties: Must use the currently defined types for styling to be applied
export default function styleConstructor(theme: Theme = {}) {
  const appStyle = {...defaultStyle, ...theme};

  return StyleSheet.create({
    ...other things...,
    ...(theme?.stylesheet?.expandable?.main || {})
  });
}

As a developer using this library, I've found this inconsistency to be a bit confusing when trying to understand which styling approach to use. It would be really helpful if we could have a more consistent styling pattern across all calendar components.

Suggestion: Would it be possible to consider standardizing the styling approach (either all stylesheet.~... or all current types) and applying it uniformly? This would make the library much easier to use and maintain for the community.

SWARVY avatar Aug 25 '25 02:08 SWARVY

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Dec 11 '25 19:12 stale[bot]