Skip to content

Commit 3042773

Browse files
author
Jiri Kolarik
authored
Add possibility to add custom styles
1 parent 323dc3d commit 3042773

1 file changed

Lines changed: 9 additions & 3 deletions

File tree

src/index.js

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ type WeekType = {
4444
onDisableClicked: (date: moment) => void
4545
}
4646

47-
const styles = StyleSheet.create({
47+
const defaultStyles = StyleSheet.create({
4848
calendar: {
4949
backgroundColor: 'rgb(255, 255, 255)'
5050
},
@@ -117,7 +117,8 @@ export const Week = (props: WeekType) => {
117117
startOfWeek,
118118
onDatesChange,
119119
isDateBlocked,
120-
onDisableClicked
120+
onDisableClicked,
121+
styles
121122
} = props;
122123

123124
const days = [];
@@ -197,7 +198,8 @@ export const Month = (props: MonthType) => {
197198
focusedMonth,
198199
onDatesChange,
199200
isDateBlocked,
200-
onDisableClicked
201+
onDisableClicked,
202+
styles
201203
} = props;
202204

203205
const dayNames = [];
@@ -229,6 +231,7 @@ export const Month = (props: MonthType) => {
229231
onDatesChange={onDatesChange}
230232
isDateBlocked={isDateBlocked}
231233
onDisableClicked={onDisableClicked}
234+
styles={styles}
232235
/>
233236
);
234237
});
@@ -258,6 +261,8 @@ export default class Dates extends Component {
258261
const nextMonth = () => {
259262
this.setState({ focusedMonth: this.state.focusedMonth.add(1, 'M') });
260263
};
264+
265+
const styles = {...defaultStyles, ...(this.props.styles || {})};
261266

262267
return (
263268
<View style={styles.calendar}>
@@ -281,6 +286,7 @@ export default class Dates extends Component {
281286
onDatesChange={this.props.onDatesChange}
282287
isDateBlocked={this.props.isDateBlocked}
283288
onDisableClicked={this.props.onDisableClicked}
289+
styles={styles}
284290
/>
285291
</View>
286292
);

0 commit comments

Comments
 (0)