UNPKG

react-native-calendars-datepicker

Version:

Customizable date picker for React Native that supports Hijri calendar

43 lines 1.76 kB
import React, { memo } from 'react'; import { StyleSheet, View } from 'react-native'; import { useCalendarContext } from '../../calendar-context'; import MonthButton from './month-button'; import YearButton from './year-button'; import { TimeButton } from './time-button'; const Selectors = ({ position }) => { const { mode, calendarView, timePicker, timePickerOptions } = useCalendarContext(); const renderTimePicker = () => timePicker && mode === 'single' && calendarView !== 'year' ? /*#__PURE__*/React.createElement(TimeButton, null) : null; return /*#__PURE__*/React.createElement(View, { style: [defaultStyles.container, position === 'around' && defaultStyles.justifySpaceEvenly, position === 'left' && defaultStyles.rowReverse] }, /*#__PURE__*/React.createElement(View, { style: [defaultStyles.monthAndYear, position === 'left' && defaultStyles.rowReverse] }, calendarView !== 'year' ? /*#__PURE__*/React.createElement(MonthButton, null) : null, /*#__PURE__*/React.createElement(YearButton, null), (timePickerOptions === null || timePickerOptions === void 0 ? void 0 : timePickerOptions.renderBesideSelectors) && renderTimePicker()), !(timePickerOptions !== null && timePickerOptions !== void 0 && timePickerOptions.renderBesideSelectors) && renderTimePicker()); }; export default /*#__PURE__*/memo(Selectors); const defaultStyles = StyleSheet.create({ container: { flex: 1, flexDirection: 'row', alignItems: 'center', justifyContent: 'space-between' }, monthAndYear: { gap: 5, flexDirection: 'row', alignItems: 'center' }, rowReverse: { flexDirection: 'row-reverse' }, justifySpaceEvenly: { justifyContent: 'space-evenly' } }); //# sourceMappingURL=selectors.js.map