Giter Club home page Giter Club logo

ethiopian-calendar's Introduction

React Native Ethiopian Calendar

A react native calendar component which is mainly intended for applications which require Ethiopian calendar.

Features

  • Ethiopian/Gregorian mode toggle
  • Supports multiple local languages
  • Easy to customize
  • Zero dependency
  • Fully typed with typescript

Demo

Installation

with yarn

yarn add react-native-ethiopian-calendar

Install with npm

npm i react-native-ethiopian-calendar

Usage/Examples

Typescript Example

import {
  Calendar,
  LanguageCode,
  Mode,
  SelectedDate,
} from 'react-native-ethiopian-calendar';

function App() {
  const [mode, setMode] = React.useState<Mode>('EC');
  const [locale, setLocale] = React.useState<LanguageCode>('AMH');
  const [selectedDate, setSelectedDate] = React.useState<SelectedDate>();

  return (
      <Calendar
        mode={mode}
        onDatePress={(date) => setSelectedDate(date)}
        onModeChange={(selectedMode) => setMode(selectedMode)}
        onLanguageChange={(lang) => setLocale(lang)}
        locale={locale}
      />
  )
}

Javascript Example

import { Calendar } from 'react-native-ethiopian-calendar';

function App() {
  const [mode, setMode] = React.useState('EC');
  const [locale, setLocale] = React.useState('AMH');
  const [selectedDate, setSelectedDate] = React.useState();

  return (
    <Calendar
      mode={mode}
      onDatePress={(date) => setSelectedDate(date)}
      onModeChange={(selectedMode) => setMode(selectedMode)}
      onLanguageChange={(lang) => setLocale(lang)}
      locale={locale}
    />
  );
}

API Reference

Prop Type Required Description Default
mode Mode false a prop to switch b/n Ethiopian calendar and Gregorian calendar EC
locale LanguageCode false to change the language of days names and months names. AMH for EC and ENG for GC
theme Theme false to override default style {}
hideHeaderButtons boolean false to hide switch mode & change language dropdowns. false
onDatePress function void true an event handler gets executed when date press event is fired.
onModeChange function void false an event handler gets invoked on mode change.
onLanguageChange function void false an event handler gets invoked on language change.
initialDate Date false if this prop is not set, the calendar will start from current month. today

License

MIT

Made with create-react-native-library

ethiopian-calendar's People

Contributors

a-m-h-e-r-e avatar leulseged3 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.