react-native-ethiopian-calendar
Version:
A react native calendar component which is mainly intended for applications which require Ethiopian calendar.
45 lines • 1.39 kB
JavaScript
import React, { useState } from 'react';
import { EthiopianCalender } from './components/EthiopianCalendar';
import { GregorianCalendar } from './components/GregorianCalender';
export const Calendar = /*#__PURE__*/React.memo(props => {
const {
mode = 'EC',
locale = 'AMH',
onDatePress,
onModeChange,
onLanguageChange,
hideHeaderButtons,
theme,
initialDate
} = props;
const [selectedDate, setSelectedDate] = useState();
if (mode === 'EC') return /*#__PURE__*/React.createElement(EthiopianCalender, {
date: initialDate && {
year: initialDate.getFullYear(),
month: initialDate.getMonth() + 1,
day: initialDate.getDate()
},
locale: locale,
onDatePress: onDatePress,
theme: theme,
onModeChange: onModeChange,
onLanguageChange: onLanguageChange,
hideHeaderButtons: hideHeaderButtons,
selectedDate: selectedDate,
setSelectedDate: setSelectedDate
});
return /*#__PURE__*/React.createElement(GregorianCalendar, {
date: initialDate && {
year: initialDate.getFullYear(),
month: initialDate.getMonth() + 1,
day: initialDate.getDate()
},
onDatePress: onDatePress,
theme: theme,
onModeChange: onModeChange,
hideHeaderButtons: hideHeaderButtons,
selectedDate: selectedDate,
setSelectedDate: setSelectedDate
});
});
//# sourceMappingURL=index.js.map