react-native-full-calendars
Version:
React Native Full Calendar (RNFC) is an intuitive and powerful calendar component library designed for React Native.
52 lines (51 loc) • 1.21 kB
JavaScript
;
import { format } from 'date-fns';
import React, { useContext } from 'react';
import { StyleSheet, Text, View } from 'react-native';
import { CalendarContext } from '../../store';
import { jsx as _jsx } from "react/jsx-runtime";
export function DayLabels({
datesOfWeek
}) {
return /*#__PURE__*/_jsx(View, {
style: styleSheet.row,
children: /*#__PURE__*/_jsx(View, {
style: styleSheet.dayLabelRow,
children: datesOfWeek.map(date => /*#__PURE__*/_jsx(DayLabel, {
date: date
}, date.toISOString()))
})
});
}
export function DayLabel({
date
}) {
const {
renderDayLabel,
theme
} = useContext(CalendarContext);
return renderDayLabel ? renderDayLabel({
date
}) : /*#__PURE__*/_jsx(View, {
style: styleSheet.dayLabelContainer,
children: /*#__PURE__*/_jsx(Text, {
children: format(date, theme.dayLabelDateFormat)
})
});
}
const styleSheet = StyleSheet.create({
row: {
flexDirection: 'row'
},
dayLabelContainer: {
flex: 1,
justifyContent: 'center',
alignItems: 'center'
},
dayLabelRow: {
flex: 1,
flexDirection: 'row',
paddingVertical: 10
}
});
//# sourceMappingURL=DayLabel.js.map