Skip to main content

The best React Native datepicker libraries in 2024

Datepickers are one of the most common, non-trivial UI components. They are particularly important for apps that involve any type of booking, like hotels, reservations, and flights, or any product that requires a date input, such as date-of-birth. Datepickers show the user they’ve chosen the right date while avoiding any confusion across global date format differences.

While React web applications have always relied on third-party date picker libraries, React Native apps used to have a native date-picker API for Android and iOS (named DatePickerAndroid (opens in a new tab) and DatePickerIOS (opens in a new tab) respectively). However, both were deprecated, with the framework instructing developers to use community packages instead.

With that in mind, we reviewed the most popular community React Native datepicker libraries. We’ll discuss the pros and cons of each library, share each one's popularity stats, and outline what projects each library is best suited for. As a forewarning, the names of these libraries are very similar. They also share very little variance compared to our React map library breakdown. But by the end of this post, you’ll be able to identify which datepicker library you should use for your project.

This article was originally published in Sept. 2021. It's been updated for 2024.

React Native DateTimePicker

GitHub Stars: 2.3K

NPM weekly downloads: 407.1K

Compatible with Expo? Yes

License: MIT

Overall, React native DateTimePicker (opens in a new tab) is the most successful library in the space. It has the most NPM downloads and the second most Github stars (and is the main dependency of this metric’s leader). The library is part of the react-native-community Github group, a popular, well-trusted organization that vets and publishes React Native libraries. While the group is actively looking for collaborators and financial backers (opens in a new tab), there is very active development (opens in a new tab) on the library.

React Native DateTimePicker uses the native system components under its hood. For most, these should be very familiar aesthetically:

Image courtesy of LogRocket

React Native DateTimePicker is notably compatible with Expo (opens in a new tab)—a popular React Native build environment—and is part of the Expo Managed Workflow (opens in a new tab).

React Native DateTimePicker is an extremely feature-packed library, with support for custom calendars, theme variants, locales, date maxes and mins, and custom minute intervals.

How do I use React Native DateTimePicker?

To install React Native DateTimePicker, first install the package and the relevant cocoa pods for iOS (unless using Expo):

JavaScript

yarn add @react-native-community/datetimepicker cd ios && pod install

If you are using Expo, instead do:

JavaScript

npx expo install @react-native-community/datetimepicker

Then, simply import the package and implement in JSX:

JSX

import React, { useState } from 'react'
import DatePicker from 'react-native-date-picker'

export default () => {
  const [myDate, setMyDate] = useState(new Date())
  return <DatePicker date={myDate} onDateChange={setMyDate} />
}

react-native-modal-datetime-picker

GitHub Stars: 2.9K

NPM weekly downloads: 283.6K

Compatible with Expo? Yes

License: MIT

react-native-modal-datetime-picker (opens in a new tab) (whew, what a mouthful, perhaps RNMDP for short) is a library that makes it easy to display a date-picker inside a modal, darkening the rest of the page.

Notably, RNMDP leverages React-Native DateTimePicker under the hood—and every RNMDP NPM weekly download also contributes to React-Native DateTimePicker’s numbers.

RNMDP simply makes it easy to put the date-picker in a modal. For some, this is particularly useful (evidenced by its slightly higher Github stars). For others, an already implemented modal library may be a better option.

RNMDP is also compatible with Expo. Given the dependency, it also is using the native iOS and Android date-time UI under the hood.

*ignoring React as a dependency.

How do I use react-native-modal-datetime-picker?

For non-Expo projects, install the package and the react-native-modal-datetime-picker dependency:

JavaScript

yarn add react-native-modal-datetime-picker 

For Expo projects, instead install it via Expo’s CLI:

JavaScript

npx expo install react-native-modal-datetime-picker

Then, to use the package:

JSX

import React, { useState } from "react";
import { Button, View } from "react-native";
import DateTimePickerModal from "react-native-modal-datetime-picker";

export default () => {
  const [myDate, setMyDate] = useState(new Date())
  return <DateTimePickerModal
			  date={myDate}
			  onConfirm={setMyDate}
				mode="date"
      />
}

export default Example;

React Native Date Picker

GitHub Stars: 2.1K

NPM weekly downloads: 162.6K

Compatible with Expo? No

License: MIT

React Native Date Picker is another option outside of the react-native-community ecosystem. It has scored a commendable 2.1K GitHub stars, has over a hundred thousand NPM weekly downloads, and operates under an MIT license. And, contrary to some outdated guides, it's compatible with Expo via Developmental Builds (opens in a new tab) without the need for a config plugin (opens in a new tab).

React Native Date Picker works differently from previous options—it uses the iOS native date-picker but emulates a similar interface for Android. This is ideal for developers that want a more unified experience across both operating systems.

How do I use React Native Date Picker?

To install React Native Date Picker, start by installing the package:

JavaScript

yarn add react-native-date-picker

Next, install the iOS cocoa pods (unless using Expo):

JavaScript

cd ios && pod install

Then, you can implement react-native-date-picker in a similar fashion to DateTimePicker:

JSX

import React, { useState } from 'react'
import DatePicker from 'react-native-date-picker'

export default () => {
  const [date, setDate] = useState(new Date())
  return <DatePicker date={date} onDateChange={setDate} />
}

Choosing the right React Native datepicker

There are three excellent options for using datepickers in React Native. It comes down to two questions:

  1. Do you want an unified look and feel across iOS and Android? If so, you should use React-Native-Date-Picker (opens in a new tab).
  2. Are you looking for something that uses native components? Then you should use React-Native DateTimePicker (opens in a new tab) for inline components or React-Native-Model-Datetime-Picker (opens in a new tab) for built-in modal support.

Now that you've chosen a datepicker, it's time to add it to an app. Sign up for a free Retool account and start building today.

Published

Category

Stories