question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Propagate text and base styles from theme to day and calendar

See original GitHub issue

While theme can change some global properties of the calendar, it does not take into account the text and base styles. For example: theme={{ todayTextColor: 'red', base: { width: 20, height: 20, justifyContent: 'center' }, text: { marginTop: 0, fontSize: 13.5, } }} only update the todayTextColor. Also I noticed there’s a default 32 width for the day box in calendar which can also needs to take the value from the theme base style.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

6reactions
tautvilascommented, May 15, 2017

Hi, it is not feasible to make the callendar ux fully customizable. If there is a need for a very different design then it would be best to give you a way to provide a way to override renderDay method.

What is the problem that you are trying to solve with such customization?

5reactions
gabrielgilinicommented, Jul 13, 2017

I personally think the theme prop strategy is very limiting so I went ahead and introduced the styleSheet prop to Calendar, which I passed down the nodes and appended to each component’s style array. This allowed me to freely override defaults and customize the looks to my need. I don’t think it’s complete enough to create a PR, but I’ll just link to my commit in case anyone is going through a similar problem.

I.e.:

const calendarStyles = StyleSheet.create({
  header: {
    backgroundColor: colors.azure,
    paddingVertical: 10
  },
  week: {
    backgroundColor: colors.azure,
    marginTop: 0,
    paddingBottom: 10,
  },
  monthText:{
    fontSize: 24,
    lineHeight: 30,
    margin: 0,
    letterSpacing: 1.45,
    color: colors.paleGrey,
  },
  dayHeader: {
    fontSize: 18.2,
    color: colors.paleGrey,
  },
  day: {
    justifyContent: 'center'
  },
  dayText: {
    fontSize: 18.2,
    color: colors.warmGreyThree,
    marginTop: 0,
  },
  todayText: {
    fontSize: 18.2,
    color: colors.warmGreyThree,
    marginTop: 0,
  },
  disabledText: {
    opacity: 0.5,
    fontSize: 18.2,
    color: colors.warmGreyThree
  }
});
<Calendar
  style={styles.calendar}
  monthFormat='MMMM'
  markedDates={marked}
  renderArrow={(direction) => <Icon name={direction == 'left' ? 'navLeft' : 'navRight'} />}
  styleSheet={calendarStyles} />
Read more comments on GitHub >

github_iconTop Results From Across the Web

Elastic Calendar Styling with CSS
This post was co-authored by Chris Coyier and Tim Wright of CSSKarma. A traditional calendar is a grid of numbered boxes on a...
Read more >
CSS and HTML calendar examples to add to your site
This article created by the team behind Slider Revolution will recommend some of the best HTML calendar examples you can add to your...
Read more >
How to Create an Events Calendar in WordPress
The All-In-One Event Calendar plugin comes with a selection of calendar themes that you can customize. To access them, go to Events >...
Read more >
Reformatting a Document with Messed-Up Styles
Click the Options link at the bottom of the Styles pane. ... Word selects all the paragraphs or text that uses the style....
Read more >
17+ Beautiful CSS calendars [Examples] - Alvaro Trigo
This is a collection of HTML and CSS calendars with varying features and styles. Let's jump right in! List of Beautiful CSS Calendar...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found