Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
D

datetimepicker

> 前端框架
Open source

React Native date & time picker component for iOS, Android and Windows

2.9K stars0 likes3 views
WebsiteGitHub

About

React Native date & time picker component for iOS, Android and Windows

Looking for collaborators and financial backers

Please support maintenance of the module with a monthly donation or help us with issues and pull requests.

Become a backer on OpenCollective or sponsor us on GitHub Sponsors.

See this issue for context. Thank you!
















React Native DateTimePicker

This repository was moved out of the react native community GH organization, in accordance to this proposal. The module is still published on npm under the old namespace (as documented) but will be published under a new namespace at some point, with a major version bump.

[![npm downloads][npm-downloads-badge]][npm-downloads-link] ![Supports Android and iOS][support-badge] ![MIT License][license-badge]

React Native date & time picker component for iOS, Android and Windows (please note Windows is not actively maintained).

Screenshots

Expand for screenshots
iOS

Android

Windows

Table of contents

  • React Native DateTimePicker
    • Table of contents
    • Expo users notice
    • Getting started
    • Usage
    • Localization note
    • Android imperative API
    • Android styling
    • Props / params
      • mode (optional)
      • display (optional)
      • design (optional, Android only)
      • initialInputMode (optional, Android only)
      • title (optional, Android only)
      • fullscreen (optional, Android only)
      • startOnYearSelection (optional, Android only)
      • onValueChange (optional)
      • onDismiss (optional)
      • onNeutralButtonPress (optional, Android only)
      • onChange (optional, deprecated)
      • value (required)
      • maximumDate (optional)
      • minimumDate (optional)
      • timeZoneName (optional, iOS or Android only)
      • timeZoneOffsetInMinutes (optional, iOS or Android only)
      • timeZoneOffsetInSeconds (optional, Windows only)
      • dayOfWeekFormat (optional, Windows only)
      • dateFormat (optional, Windows only)
      • firstDayOfWeek (optional, Android and Windows only)
      • textColor (optional, iOS only)
      • accentColor (optional, iOS only)
      • themeVariant (optional, iOS only)
      • locale (optional, iOS only)
      • is24Hour (optional, Windows and Android only)
      • positiveButton (optional, Android only)
      • negativeButton (optional, Android only)
      • neutralButton (optional, Android only)
      • minuteInterval (optional)
      • style (optional, iOS only)
      • disabled (optional, iOS only)
      • view props (optional, iOS only)
      • onError (optional, Android only)
    • Testing with Jest
    • Migration from the older components
    • Contributing to the component
    • Manual installation
    • Running the example app

Requirements

The module supports the new React Native architecture (Fabric rendering of iOS components, and turbomodules on Android).

Expo users notice

This module is part of Expo Go - see docs. However, Expo Go may not contain the latest version of the module and therefore, the newest features and bugfixes may not be available. If you use Expo Go, use the command npx expo install @react-native-community/datetimepicker (not yarn or npm) to install this module - Expo will automatically install the latest version compatible with your Expo SDK (which may not be the latest version of the module available).

If you're using a Dev Client, rebuild the Dev Client after installing the dependencies.

If you're using the expo prebuild command and building your native app projects (e.g. with EAS Build or locally), you can use the latest version of the module.

Getting started

bash
npm install @react-native-community/datetimepicker --save

or

bash
yarn add @react-native-community/datetimepicker

Autolinking is not yet implemented on Windows, so manual installation is needed.

On iOS, run npx pod-install after installing. Then rebuild your project.

Usage

javascript
import DateTimePicker from '@react-native-community/datetimepicker';
Expand for examples

We give two equivalent examples on how to use the package on all supported platforms.

Recommended imperative api usage on Android

While the component-approach as given in the second paragraph works on Android, the recommended approach is to use the imperative api given in the first paragraph.

Read more about the motivation in Android imperative API.

…

Component usage on iOS / Android / Windows

…

Localization note

By localization, we refer to the language (names of months and days), as well as order in which date can be presented in a picker (month/day vs. day/month) and 12 / 24 hour-format.

On Android, the picker will be controlled by the system locale. If you wish to change it, see instructions here.

On iOS, use XCode, as documented here to inform the OS about the locales your application supports. iOS will automatically display the correctly localized DateTimePicker as long as the target language is contained in project.pbxproj.

If you use a library like i18next or react-localize-redux to manage your translations, it is sufficient to add your target languages as described in the Apple Documentation - but you are not required to add any localization keys (like, for example, the days of the week). iOS will automatically display the correct localized strings as long as the target language is contained in project.pbxproj.

For testing your localization setup, refer here.

There is also the iOS-only locale prop that can be used to force locale in some cases but its usage is discouraged due to not working robustly in all picker modes (note the mixed month and day names). To the best of our knowledge, it works reliably in the spinner mode.

For Expo, follow the localization docs.

Android imperative api

On Android, you have a choice between using the component API (regular React component) or an imperative api (think of something like ReactNative.alert()).

While the component API has the benefit of writing the same code on all platforms, for start we recommend using the imperative API on Android.

The params is an object with the same properties as the component props documented in the next paragraph. (This is also because the component api internally uses the imperative one.)

typescript
import { DateTimePickerAndroid } from '@react-native-community/datetimepicker';

DateTimePickerAndroid.open(params: AndroidNativeProps)
DateTimePickerAndroid.dismiss(mode: AndroidNativeProps['mode'], design?: AndroidNativeProps['design'])

The reason we recommend the imperative API is: on Android, the date/time picker opens in a dialog, similar to ReactNative.alert() from core react native. The imperative api models this behavior better than the declarative component api. While the component approach is perfectly functional, based on the issue tracker history, it appears to be more prone to introducing bugs.

Android styling

If you'd like to use the Material pickers, your app theme will need to inherit from Theme.Material3.DayNight.NoActionBar in styles.xml.

Styling of the dialogs on Android can be easily customized by using the provided config plugin, provided that you use a Expo development build. The plugin allows you to configure color properties that cannot be set at runtime and requires building a new app binary to take effect.

Refer to this documentation for more information: android-styling.md.

Component props / params of the Android imperative api

Please note that this library currently exposes functionality from UIDatePicker on iOS and DatePickerDialog + TimePickerDialog on Android, and CalendarDatePicker + TimePicker on Windows.

These native classes offer only limited configuration, while there are dozens of possible options you as a developer may need. It follows that if your requirement is not supported by the backing native views, this library will not be able to implement your requirement. When you open an issue with a feature request, please document if (or how) the feature can be implemented using the aforementioned native views. If the native views do

Issues· 0 open

View all issuesOpen on GitHub

No open issues yet, or sync has not completed.

> Tags

JavaScriptdatetimepickerhacktoberfestreact-native

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedSep 17, 2026
Category前端框架
PricingOpen source

> Related tools

R
React
用于构建用户界面的 JavaScript 库
V
Vue.js
渐进式 JavaScript 框架
N
Next.js
基于 React 的全栈 Web 框架