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.

Custom day view have margins around.

See original GitHub issue

I’m trying to make calendar custom day view in my app. I want to day views take all available horizontal width and height evenly.

I tried to use flex: 1 on container, but calendar is always putting some spacing between elements.

This is my JSX for day view:

<View style={Styles.container}>
    <Text style={Styles.dayText}>1</Text>
    <View style={Styles.reportedHoursBox}>
        <Text style={Styles.hoursText}>8h</Text>
    </View>
</View>

I have tried to change calendar theme by changing some day view properties by changing stylesheet.day.single, there is a width and height in base, It didn’t work.

I’m aiming for grid view with day view borders, like excel sheet. Someone can tell me what props and styles I have to change to make layout without margins? Container view have border line around, and this is how I know it has spacing between day views.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:1
  • Comments:8 (2 by maintainers)

github_iconTop GitHub Comments

10reactions
darron1217commented, Dec 3, 2020

@7laria After some inspection, the code below worked for me. Thank you for the hint 👍

theme={{
  'stylesheet.calendar.main': {
    week: {
      marginTop: 3,
      marginBottom: 3,
      flexDirection: 'row',
      justifyContent: 'space-around',
    },
  },
}}
1reaction
7lariacommented, Oct 17, 2018

solved: react-native-calendars/src/calendar/style.js week: { // marginTop: 7, // marginBottom: 7, flexDirection: 'row', justifyContent: 'space-around' },

my component is: <TouchableOpacity onPress={() => { this.selectDate(date) }} disabled={!Object.keys(this.state.markedDays).includes(date.dateString)} style={{ width: 50, height: 50, borderColor: 'grey', borderWidth: 1, margin: 0, backgroundColor: (Object.keys(this.state.markedDays).includes(date.dateString)) ? backgroundColor : '#E0E0E0', alignItems: 'center', justifyContent: 'center' }}> <Text style={{ color: labelColor }}>{date.day + ''}</Text> </TouchableOpacity>

Read more comments on GitHub >

github_iconTop Results From Across the Web

Custom View not giving margin - android - Stack Overflow
You are setting margins in Pixels. Try converting them into dp, so that the margins value becomes independent of display density.
Read more >
ClickFunnels: How to Adjust Margins On Elements ... - YouTube
ClickFunnels Tutorial: Everything You Need to Know! ClickFunnels: How to Adjust Margins On Elements (Using Custom CSS). 7.5K views 5 years ...
Read more >
CSS Customization - Docs - FullCalendar
This article describes the various techniques for customizing the CSS of your calendar.
Read more >
How to control spacing around individual views using padding
SwiftUI lets us set individual padding around views using the padding() modifier, causing views to be placed further away from their neighbors.
Read more >
Introduction of presets across padding, margin and block gap
The block editor design tools allowed users only to add custom values for the spacing around block content, eg. padding, margin, or gap....
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