Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

react-native-ui-datepicker

Package Overview
Dependencies
Maintainers
0
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-native-ui-datepicker

Customizable date picker for React Native

  • 2.0.4
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
0
Created
Source

react-native-ui-datepicker


react-native-ui-datepicker

styled with prettier license

DateTimePicker component for React Native that allows you to create a customizable date and time picker. The component uses Day.js library and it contains a set of style props that allows you to change every item of calendar based on your own UI design. Please visit demo.

Installation

npm install react-native-ui-datepicker

Or

yarn add react-native-ui-datepicker

Usage

import DateTimePicker from 'react-native-ui-datepicker';
import dayjs from 'dayjs';

export default function App() {
  const [date, setDate] = useState(dayjs());

  return (
    <View style={styles.container}>
      <DateTimePicker
        mode="single"
        date={date}
        onChange={(params) => setDate(params.date)}
      />
    </View>
  );
}

const styles = StyleSheet.create({
  container: {
    flex: 1,
    backgroundColor: '#F5FCFF',
  },
});

For more, take a look at the /example directory.

react-native-ui-datepicker-styles

Calendar props

NameTypeDefaultDescription
modestring'single'Defines the DatePicker mode ['single', 'range', 'multiple']
localestring'en'Defines the DatePicker locale
minDateDateTypenullDefines DatePicker minimum selectable date
maxDateDateTypenullDefines DatePicker maximum selectable date
disabledDatesDateType[] or Function[] or (date: DateType) => booleanDefines DatePicker array of disabled dates, or a function that returns true for a given date
firstDayOfWeeknumber0Defines the starting day of week, number 0-6, 0 - Sunday, 6 - Saturday
displayFullDaysbooleanfalseDefines show previous and next month's days in the current calendar view
initialViewstring'day'Defines the DatePicker initial view ['day', 'month', 'year', 'time']
heightnumber'undefined'Defines the Calendar view heights

Single Mode props

NameTypeDefaultDescription
dateDateTypeundefinedDate value to display selected date
onChangeFunction({date}) => {}Called when the new date selected from DatePicker
timePickerbooleanfalseDefines show or hide time picker

Range Mode props

NameTypeDefaultDescription
startDateDateTypeundefinedStart date value to display selected start date
endDateDateTypeundefinedEnd date value to display selected end date
onChangeFunction({startDate, endDate}) => {}Called when the new start or end date selected from DatePicker

Multiple Mode props

NameTypeDefaultDescription
datesDateType[][]Dates array to display selected dates
onChangeFunction({dates}) => {}Called when the new dates selected from DatePicker

Styling props

NameTypeDefaultDescription
calendarTextStyleTextStylenullDefines all text styles inside the calendar (Days, Months, Years, Hours, and Minutes)
selectedTextStyleTextStylenullDefines selected (Day, Month, Year) text styles
selectedItemColorstring'#0047FF'Defines selected (Day, Month, Year) background and border colors
headerContainerStyleViewStylenullDefines calendar header container style
headerTextContainerStyleViewStylenullDefines calendar header texts (Month, Year, Time) containers style
headerTextStyleTextStylenullDefines calendar header text styles (Month, Year, Time)
headerButtonStyleViewStylenullDefines calendar header "prev and next buttons" containers style
headerButtonColorstringnullDefines calendar header "prev and next buttons" icon color
headerButtonSizenumber18Defines calendar header "prev and next buttons" icon size
headerButtonsPositionstring'around'Defines calendar header "prev and next buttons" positions ['around', 'right', 'left']
buttonPrevIconReactNodeundefinedDefines calendar header "prev button" custom icon
buttonNextIconReactNodeundefinedDefines calendar header "next button" custom icon
dayContainerStyleViewStylenullDefines days containers style
todayContainerStyleViewStylenullDefines today container style
todayTextStyleTextStylenullDefines today text style
monthContainerStyleViewStylenullDefines months containers style
yearContainerStyleViewStylenullDefines years containers style
weekDaysContainerStyleViewStylenullDefines weekdays container style
weekDaysTextStyleTextStylenullDefines weekdays texts style
timePickerContainerStyleViewStylenullDefines time picker container style
timePickerTextStyleTextStylenullDefines time picker (Hours, Minutes) texts style
timePickerIndicatorStyleViewStylenullDefines selected time indicator style
timePickerDecelerationRate'normal', 'fast', number'fast'Defines how quickly the underlying scroll view decelerates after the user lifts their finger.
selectedRangeBackgroundColorstringundefinedDefines selected range background color.

Contributing

See the contributing guide to learn how to contribute to the repository and the development workflow.

Consider supporting with a ⭐️ Star on GitHub

If you are using the library in one of your projects, please consider supporting it with a star.

License

MIT

Keywords

FAQs

Package last updated on 15 Sep 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc