Skip to content

Commit

Permalink
Add example with inactive days
Browse files Browse the repository at this point in the history
  • Loading branch information
lidord-wix committed Aug 9, 2021
1 parent cb9db2c commit c22a08a
Showing 1 changed file with 23 additions and 12 deletions.
35 changes: 23 additions & 12 deletions example/src/screens/calendars.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import {StyleSheet, View, ScrollView, Text, TouchableOpacity, Switch} from 'reac
// @ts-expect-error
import {Calendar} from 'react-native-calendars';


const testIDs = require('../testIDs');
const INITIAL_DATE = '2020-02-02';

Expand All @@ -24,7 +23,6 @@ const CalendarsScreen = () => {
<Fragment>
<Text style={styles.text}>Calendar with selectable date</Text>
<Calendar
disableAllTouchEventsForInactiveDays
testID={testIDs.calendars.FIRST}
current={INITIAL_DATE}
style={styles.calendar}
Expand All @@ -35,12 +33,6 @@ const CalendarsScreen = () => {
disableTouchEvent: true,
selectedColor: 'orange',
selectedTextColor: 'red'
},
'2020-02-10': {
inactive: true
},
'2020-02-11': {
inactive: true
}
}}
/>
Expand Down Expand Up @@ -390,6 +382,27 @@ const CalendarsScreen = () => {
);
};

const renderCalendarWithInactiveDays = () => {
return (
<Fragment>
<Text style={styles.text}>Calendar with inactive days</Text>
<Calendar
style={styles.calendar}
disableAllTouchEventsForInactiveDays
current={INITIAL_DATE}
markedDates={{
'2020-02-10': {
inactive: true
},
'2020-02-11': {
inactive: true
}
}}
/>
</Fragment>
);
};

const renderMarkedDatesExamples = () => {
return (
<Fragment>
Expand All @@ -411,6 +424,7 @@ const CalendarsScreen = () => {
{renderCalendarWithMinAndMaxDates()}
{renderCalendarWithCustomDay()}
{renderCalendarWithCustomHeader()}
{renderCalendarWithInactiveDays()}
</Fragment>
);
};
Expand All @@ -430,10 +444,7 @@ const CalendarsScreen = () => {
};

return (
<ScrollView
showsVerticalScrollIndicator={false}
testID={testIDs.calendars.CONTAINER}
>
<ScrollView showsVerticalScrollIndicator={false} testID={testIDs.calendars.CONTAINER}>
{renderSwitch()}
{showMarkedDatesExamples && renderMarkedDatesExamples()}
{!showMarkedDatesExamples && renderExamples()}
Expand Down

0 comments on commit c22a08a

Please sign in to comment.