All Projects → tiaanduplessis → react-native-datepicker-modal

tiaanduplessis / react-native-datepicker-modal

Licence: MIT license
React Native DatePicker Modal Component for iOS/Android

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to react-native-datepicker-modal

datepicker
A simple datepicker with Chakra-UI and date-fns
Stars: ✭ 140 (+191.67%)
Mutual labels:  datepicker
TypePicker
A date picker use in web and react-native
Stars: ✭ 14 (-70.83%)
Mutual labels:  datepicker
svelty-picker
Simple date & time picker in svelte
Stars: ✭ 38 (-20.83%)
Mutual labels:  datepicker
rn-date-range
date picker component for react native
Stars: ✭ 16 (-66.67%)
Mutual labels:  datepicker
vue-date-range-picker
A vue component using Bootstrap 4 styles for date range selection
Stars: ✭ 30 (-37.5%)
Mutual labels:  datepicker
flutter date picker
A Cupertino style date picker for Android and IOS
Stars: ✭ 78 (+62.5%)
Mutual labels:  datepicker
vue3-date-time-picker
Datepicker component for Vue 3
Stars: ✭ 157 (+227.08%)
Mutual labels:  datepicker
PersianDateRangePicker
Select range of date and time in the Persian
Stars: ✭ 41 (-14.58%)
Mutual labels:  datepicker
s-date-range-picker
📅 A date range picker built with Svelte
Stars: ✭ 13 (-72.92%)
Mutual labels:  datepicker
qing
🍧一个UI组件库。包括 { 日期选择器组件 } { 时间选择器组件 } { 分页组件 } { 树组件 } { 级联选择器组件 } { 表单组件 } 等,ES6语法编写,原生模块化
Stars: ✭ 71 (+47.92%)
Mutual labels:  datepicker
flatpickr-rails
This gem packages flatpickr's assets for drop-in use in Rails applications.
Stars: ✭ 29 (-39.58%)
Mutual labels:  datepicker
datePicker
时间选择器,包含年月、年月日、年月日时分秒、
Stars: ✭ 14 (-70.83%)
Mutual labels:  datepicker
mithril-datepicker
Pick a date! But only if you're using Mithril. (component for Mithril.js ^v1.0)
Stars: ✭ 23 (-52.08%)
Mutual labels:  datepicker
yii2-datetime-widgets
Datetime widgets for Yii2
Stars: ✭ 22 (-54.17%)
Mutual labels:  datepicker
imrc-datetime-picker
(Improved) React component datetime picker by momentjs 📆
Stars: ✭ 21 (-56.25%)
Mutual labels:  datepicker
jquery-datepicker
A full-featured datepicker jquery plugin
Stars: ✭ 35 (-27.08%)
Mutual labels:  datepicker
jquery-date-dropdowns
A simple, customisable jQuery datepicker plugin to dynamically generate separate "day", "month" and "year" dropdowns, and provide a formatted date string for form submission
Stars: ✭ 42 (-12.5%)
Mutual labels:  datepicker
react-native-daterange-picker
A React Native component for picking date ranges or single dates.
Stars: ✭ 86 (+79.17%)
Mutual labels:  datepicker
MCDatepicker
A vanilla JavaScript Datepicker
Stars: ✭ 69 (+43.75%)
Mutual labels:  datepicker
popoPicker
popoPicker是一个移动端3D滚轮日期时间和单项的选择器,支持无限循环滚动,不依赖第三方库
Stars: ✭ 26 (-45.83%)
Mutual labels:  datepicker
ios android

react-native-datepicker-modal

package version package downloads standard-readme compliant package license make a pull request

React Native DatePicker Modal Component for iOS/Android

Table of Contents

Install

This project uses node and npm.

$ npm install react-native-datepicker-modal
$ # OR
$ yarn add react-native-datepicker-modal

Usage

import React from 'react'
import { StyleSheet, Text } from 'react-native'

import ModalDatePicker from 'react-native-datepicker-modal'

import colors from './config/colors'
import spacing from './config/spacing'
import fontSize from './config/fontSize'

const DatePicker = ({ style, ...props }) => (
  <ModalDatePicker
    style={[styles.container, style]}
    renderDate={({ year, month, day, date }) => {
      if (!date) {
        return <Text style={[styles.text, styles.placeholderText]}>Date of birth</Text>
      }

      const dateStr = `${day}-${month}-${year}`
      return <Text style={styles.text}>{dateStr}</Text>
    }}
    {...props}
  />
)

const styles = StyleSheet.create({
  container: {
    backgroundColor: colors.white,
    borderBottomColor: colors.gray.veryLight,
    borderBottomWidth: 1,
    marginVertical: spacing[1],
    marginHorizontal: spacing[0],
    justifyContent: 'center',
    borderRadius: 2,
    height: 50
  },
  placeholderText: {
    color: colors.gray.light
  },
  text: {
    width: '100%',
    paddingHorizontal: spacing[1],
    paddingVertical: spacing[0],
    fontFamily: 'Montserrat',
    fontSize: fontSize.medium,
    color: colors.gray.dark
  }
})

export default DatePicker

Properties

Component accepts the following propeties. Please see propTypes for more detail.

renderDate

Function to render Component for date. Receives object with selected date, year, day and month.

startDate

Start date for DatePicker (Default: Current Date new Date()).

onError

Function called with error argument if there is error setting date.

onDateChanged

Function called when new date has been selected. Receives object with selected date, year, day and month.

minDate

Minimum date that can be selected.

maxDate

Maximum date that can be selected.

modalButtonText

Text string for the iOS modal button (default: "Done")

Styling

Styling for different sub-components can also be configured:

Name Description
style Styles for the container of renderDate
modalButtonStyle Styles for the modal button on iOS
modalBtnContainerStyle Styles for the modal button container on iOS
modalStyle Styles for the modal on iOS
modalOverlayStyle Styles for the modal overlay on iOS

Styling on Android:

We use DatePickerAndroid is and API for the native DatePicker Android module and this cannot be directly styled through JS props like real React Native components.

However, you can style the native android modules by changing the styles.xml in your android folder. It is located at android/app/src/main/res/values/styles.xml relative to your react-native project.

Example:

<resources xmlns:tools="http://schemas.android.com/tools">

    <!-- Base application theme. -->
    <style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
        <!-- Customize your theme here. -->
        <item name="android:datePickerDialogTheme">@style/Picker.Theme</item>
    </style>

    <style name="Picker.Theme" parent="Theme.AppCompat.Light.Dialog">
        <item name="colorPrimary">#3F51B5</item>
        <item name="colorPrimaryDark">#303F9F</item>
        <item name="colorAccent">#448AFF</item>
        <item name="android:textColorPrimary">#212121</item>
    </style>

</resources>

Contribute

  1. Fork it and create your feature branch: git checkout -b my-new-feature
  2. Commit your changes: git commit -am 'Add some feature' 3.Push to the branch: git push origin my-new-feature
  3. Submit a pull request

License

MIT

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].