WeeklyCalendar.js 1.8 KB
Newer Older
1
2
import React, {  useState, useEffect } from 'react';
import { View,  StyleSheet } from 'react-native';
Soo Hyun Kim's avatar
Soo Hyun Kim committed
3
4
import CalendarStrip from 'react-native-calendar-strip';

Soo Hyun Kim's avatar
Soo Hyun Kim committed
5
6
7
8
9
const WeeklyCalendar = ({
    selectedDate,
    startingDate,
    onWeekChanged,
    onDateSelected,
Soo Hyun Kim's avatar
Soo Hyun Kim committed
10
    markedDates,
Soo Hyun Kim's avatar
Soo Hyun Kim committed
11
12
    customDatesStyles
}) => {
Soo Hyun Kim's avatar
Soo Hyun Kim committed
13
14
15
    return (
        <View>
            <CalendarStrip
Soo Hyun Kim's avatar
Soo Hyun Kim committed
16
                calendarAnimation={{ type: 'parallel', duration: 30 }}
Soo Hyun Kim's avatar
Soo Hyun Kim committed
17
                daySelectionAnimation={{ type: 'background', duration: 300, highlightColor: '#9265DC' }}
Soo Hyun Kim's avatar
Soo Hyun Kim committed
18
                style={{ height: 130, paddingTop: 20, paddingBottom: 10 }}
Soo Hyun Kim's avatar
Soo Hyun Kim committed
19
                calendarHeaderStyle={{ color: 'white' }}
Soo Hyun Kim's avatar
Soo Hyun Kim committed
20
                calendarColor={'#adbfdb'}
Soo Hyun Kim's avatar
Soo Hyun Kim committed
21
22
23
                dateNumberStyle={{ color: 'white' }}
                dateNameStyle={{ color: 'white' }}
                iconContainer={{ flex: 0.1 }}
Soo Hyun Kim's avatar
Soo Hyun Kim committed
24
                customDatesStyles={customDatesStyles}
Soo Hyun Kim's avatar
Soo Hyun Kim committed
25
                updateWeek = {false}
Soo Hyun Kim's avatar
Soo Hyun Kim committed
26
                highlightDateNameStyle={{ color: 'white' }}
Soo Hyun Kim's avatar
Soo Hyun Kim committed
27
                highlightDateNumberStyle={{ color: 'white' }}
Soo Hyun Kim's avatar
Soo Hyun Kim committed
28
29
30
                highlightDateContainerStyle={{ backgroundColor: '#6b768a' }}
                markedDates={markedDates||[]}
                startingDate={startingDate}
Soo Hyun Kim's avatar
Soo Hyun Kim committed
31
32
33
                selectedDate={selectedDate}
                onWeekChanged={onWeekChanged}
                onDateSelected={onDateSelected}
Soo Hyun Kim's avatar
Soo Hyun Kim committed
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
                useIsoWeekday={false}
            />
        </View>
    );
};

const style = StyleSheet.create({
    container: {
        height: 54,
        flexDirection: 'row',
        alignItems: "center",
        marginHorizontal: 10,
        marginVertical: 3,
        borderWidth: 1.5,
        borderStyle: "solid",
        borderColor: "#1467ff",
        borderRadius: 5,
        backgroundColor: "#f5f5f5",
    },
})

export default WeeklyCalendar