Skip to content

Commit 90913b5

Browse files
author
Jiri Kolarik
authored
Merge pull request #17 from werein/custom-styles
Add possibility to add custom styles
2 parents d730ff9 + 3042773 commit 90913b5

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

src/index.js

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ type WeekType = {
4747
onDisableClicked: (date: moment) => void
4848
}
4949

50-
const styles = StyleSheet.create({
50+
const defaultStyles = StyleSheet.create({
5151
calendar: {
5252
backgroundColor: 'rgb(255, 255, 255)'
5353
},
@@ -120,7 +120,8 @@ export const Week = (props: WeekType) => {
120120
startOfWeek,
121121
onDatesChange,
122122
isDateBlocked,
123-
onDisableClicked
123+
onDisableClicked,
124+
styles
124125
} = props;
125126

126127
const days = [];
@@ -202,7 +203,8 @@ export const Month = (props: MonthType) => {
202203
focusedMonth,
203204
onDatesChange,
204205
isDateBlocked,
205-
onDisableClicked
206+
onDisableClicked,
207+
styles
206208
} = props;
207209

208210
const dayNames = [];
@@ -236,6 +238,7 @@ export const Month = (props: MonthType) => {
236238
onDatesChange={onDatesChange}
237239
isDateBlocked={isDateBlocked}
238240
onDisableClicked={onDisableClicked}
241+
styles={styles}
239242
/>
240243
);
241244
return null;
@@ -279,6 +282,8 @@ export default class Dates extends Component {
279282
const nextMonth = () => {
280283
this.setState({ focusedMonth: this.state.focusedMonth.add(1, 'M') });
281284
};
285+
286+
const styles = {...defaultStyles, ...(this.props.styles || {})};
282287

283288
return (
284289
<View style={styles.calendar}>
@@ -302,6 +307,7 @@ export default class Dates extends Component {
302307
onDatesChange={this.props.onDatesChange}
303308
isDateBlocked={this.props.isDateBlocked}
304309
onDisableClicked={this.props.onDisableClicked}
310+
styles={styles}
305311
/>
306312
</View>
307313
);

0 commit comments

Comments
 (0)