Default Image

Datepicker

To select or input a date.

Installation (Not necessary on iOS)

expo install @react-native-community/datetimepicker

NOTE:

if not is Expo project, please complete the installation here

When To Use

By clicking the input box, you can select a date from a popup calendar.

import { DatePicker } from '@redshank/native';

Examples

Default

Default datepicker element.

Picker modes

Picker default modes element.

Calendar (iOS only)

Calendar mode only iOS in Android default.

Format

Custom format date.

Locales

Change locale api.

APIs

DatePicker Props

Api props extends from react-native-modal-datetime-picker

AttributeTypeAccepted valuesDescriptionDefault
backgroundThemeColorThemeColorBackground color of the elementinputColor
borderInputColorThemeColorThemeColorSelect border colorborder
colorThemeColorThemeColorText coloraccents2
defaultValueDate stringDate TextDefault date in date instance or string with some format that format prop-
displayEnumspinner default inlineHow the modal is displayedspinner
errorbooleantrue falseShow error variant-
formatstringTextDate format for show in input and format default and value prop when is string-
onChangefunction(date: Date, dateText: string) => voidOn change function, pass to Date object and date text format-
placeholderstringTextPlaceholder prop-
prefixReactNodeIconProp for render element to start-
sizeSizeTypesmall middle largeSize elementmiddle
suffixReactNodeIconProp for render element to end-
textErrorstringTextMessage of the error, set with error prop in true-
valuestring DateText DateValue prop for controlled element, if the value is string apply format prop-
styleobjectStyleProp<ViewStyle>Style for the wrapper element-

Community:

We're excited to see the community adopt @redshank/native, raise issues, and provide feedback. Whether it's a feature request, bug report, or a project to showcase, please get involved!

DiscordGithub

Contributing:

PR's on @redshank/native are always welcome, please see our contribution guidelines to learn how you can contribute to this project.

Copyright © 2023 @redshank.