f-react-native-schedule
Version:
Flexible scheduling library with more built-in features and enhanced customization options
44 lines (40 loc) • 1.11 kB
JavaScript
import React from 'react';
import dayjs from 'dayjs';
import { useContext } from 'react';
import { Text, View } from 'react-native';
import ScheduleContext from '../ScheduleContext';
import styles from './styles';
const Sidebar = () => {
const {
hours,
sidebarSettings,
cellDimensions
} = useContext(ScheduleContext);
const {
hourColor,
hourFormat,
cellRender
} = sidebarSettings;
const {
height
} = cellDimensions;
function renderHour(hour) {
return /*#__PURE__*/React.createElement(View, {
key: hour,
style: [styles.card, {
height
}]
}, cellRender && cellRender(hour), !cellRender && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Text, {
style: {
color: hourColor
}
}, dayjs().hour(hour).format(hourFormat))));
}
return /*#__PURE__*/React.createElement(View, {
style: [styles.container, {
marginTop: height
}]
}, hours === null || hours === void 0 ? void 0 : hours.map(renderHour));
};
export default Sidebar;
//# sourceMappingURL=index.js.map