0.0.4 • Published 7 months ago

calendar-date-picker-react-native v0.0.4

Weekly downloads
-
License
MIT
Repository
github
Last release
7 months ago

calendar-date-picker-react-native

PRs Welcome

Note: Make sure you have install react-native-calendars, moment instructions till step, before proceeding.

Installation

using yarn:

yarn add calendar-date-picker-react-native

using npm:

npm install calendar-date-picker-react-native

Usage

Without Modal

import DatePicker from 'calendar-date-picker-react-native';

function App() {
  return <DatePicker type={'view'} onChnage={e => console.log(e)} />;
}

With Modal

import {DatePicker} from 'calendar-date-picker-react-native';

function App() {
  const [picker, setPicker] = useState(false);

  const [date, setdate] = useState('');
  const [dates, setdates] = useState([]);

  const showPicker = () => {
    setPicker(true);
  };
  const hidePicker = () => {
    setPicker(false);
  };

  return (
    <View>
      <Text>{date}</Text>
      <DatePicker
        mode="single"
        visible={picker}
        onConfirm={showPicker}
        onCancel={hidePicker}
        type="modal"
        onChnage={e => setdates(e)}
        current={'2023-03-01'}
        minDate={'2022-03-01'}
        maxDate={'2025-03-01'}
        showSixWeeks={true}
        showLeftArrow={false}
        showRightArrow={false}
        style={{
          leftArrow: {tintColor: 'black'},
          title: {backgroundColor: 'red'},
        }}
        hideArrows={false}
        showTitle={true}
      />
      {dates.map((item, index) => {
        return <Text key={index}>{item}</Text>;
      })}
      <DatePicker mode="rangePicker" type="view" onChnage={e => setdate(e)} />
    </View>
  );
}

Props

Basic

PropTypeDescriptionDefault
visiblebooleanShow / Hide date picker typetrue
modestringshow in modal or in viewmodal
showFooterbooleanshow footer componentfalse
confirmButtonTextstringchange confirm button textOk
cancelButtonTextstringchange cancel button textCancel
confirmButtonReactNodecustom confirm button-
cancelButtonReactNodecustom cancel button-
currentDatestringinitial date for calendarCurrent date
onCancelfunfunction trigger when user press cancel()=>
onChnagefunevent when user click on any date(e)=>string / string[]
footerReactNodecustom footer compoennt-
minDatestringmin calendar dateundefined
maxDatestringmax calendar dateundefined
showSixWeeksboolshow six week on calnedarfalse
showLeftArrowboolshow left arrow on calendartrue
showRightArrowboolshow right arrow on calendarttrue
hideArrowsboolhide both arrow from calendarfalse
showWeekDaysboolshow week days nametrue
showTitleboolshow title on calendartrue
headerfuncustom header compoent(e:headerEvent)=> <></>
titleReactNodecustom title compoent-

Styling

PropTypeDescriptionDefault
calenderobjectcalendar parent container style-
footerContainerobjectfooter container style-
footerButtonobjectfooter button style-
footerButtonTextobjectfooter buttons text style-
footerCancelButtonobjectfooter cancel button style-
footerConfirmButtonobjectfooter coonfirm button style-
calendarWrapperobjectcalendar wrapper container style-
modalOverlayobjectmodal over container style-
headerobjectheader style-
headerButtonobjectheader arrow button style-
Titleobjectheader text style-
headerButtonsContainerobjectheader buttons container-
daysContainerobjectname week days container style-
dayNameobjectcalendar date style-
leftArrowButtonobjectheader left arrow button style-
arrowobjectheader arrow style-
leftArrowobjectheader left arrow style-
rightArrowobjectheader right arrow style-

theme

PropTypeDescriptionDefault
selectedDateColorstringselected date text color#fff
selectedDateBackgroundstringselected date background#0000FF
footerButtonTextColorstringfooter button text colors#0000FF
modalOverlayColorstringmodal overlay colorrgba(0,0,0,0.5)
titleColorstringheader title color#000
dayNameColorstringcolor of the date on calendar#fFF
iconColorstringcalendar arrow icon Color#0000FF

Authors

See also the list of contributors who participated in this project.

Contributing

We welcome contributions to calendar-date-picker-react-native.

If you have an idea for a new feature or have discovered a bug, please open an issue.

Don't forget to add a title and a description explaining the issue you're trying to solve and your proposed solution.

Screenshots and Gifs are VERY helpful to add to the PR for reviews.

Please DO NOT format the files - we're trying to keep a unified syntax and keep the reviewing process fast and simple.

Questions

Feel free to Contact me or Create an issue