WeeklyCalendar.js 1.79 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
}) => {
Choi Ga Young's avatar
Choi Ga Young committed
13

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