Custom day view have margins around.
See original GitHub issueI’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:
- Created 5 years ago
- Reactions:1
- Comments:8 (2 by maintainers)
Top 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 >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@7laria After some inspection, the code below worked for me. Thank you for the hint 👍
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>