UNPKG

react-native-full-calendars

Version:

React Native Full Calendar (RNFC) is an intuitive and powerful calendar component library designed for React Native.

37 lines (36 loc) 1.07 kB
"use strict"; import React from 'react'; import { isSameMonth } from 'date-fns'; import { StyleSheet, View } from 'react-native'; import { computedWeeksOfMonth } from '../../../../src/calendar/utils/computed-weeks'; import { DayWrapper } from '../day/DayWrapper'; import { jsx as _jsx } from "react/jsx-runtime"; function Week({ days, firstDayOfMonth }) { const sameMonth = isSameMonth(days[0], firstDayOfMonth); const weeks = computedWeeksOfMonth(days[0], sameMonth ? false : true); const weekStyle = [styles.weekContainer, { height: `${Math.floor(100 / weeks)}%` }]; return /*#__PURE__*/_jsx(View, { style: weekStyle, children: days.map(day => { const isDisabled = !isSameMonth(day, firstDayOfMonth); return /*#__PURE__*/_jsx(DayWrapper, { isDisabled: isDisabled, date: day }, day?.toISOString()); }) }); } export default Week; const styles = StyleSheet.create({ weekContainer: { flex: 1, flexDirection: 'row', justifyContent: 'space-between' } }); //# sourceMappingURL=Week.js.map