npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

datetimepicker-react-native

v1.0.0

Published

React Native DatePicker component for both Android and iOS, useing DatePickerAndroid, TimePickerAndroid and RNDateTimePicker

Downloads

5

Readme

rndatepicker

React Native DatePicker component for both Android and iOS, using DatePickerAndroid, TimePickerAndroid and RNDateTimePicker

Install

npm install react-native-datepicker --save
npm install react-native-ui-xg --save

Example

Check index.android.js in the Example.

android ios

Usage


import React, { Component } from 'react'
import DatePicker from 'react-native-datepicker'

export default class MyDatePicker extends Component {
  constructor(props){
    super(props)
    this.state = {date:"2016-05-15"}
  }

  render(){
    return (
      <DatePicker
        style={{width: 200}}
        date={this.state.date}
        mode="date"
        placeholder="select date"
        format="YYYY-MM-DD"
        minDate="2016-05-01"
        maxDate="2016-06-01"
        confirmBtnText="Confirm"
        cancelBtnText="Cancel"
        customStyles={{
          dateIcon: {
            position: 'absolute',
            left: 0,
            top: 4,
            marginLeft: 0
          },
          dateInput: {
            marginLeft: 36
          }
          // ... You can check the source to find the other keys.
        }}
        onDateChange={(date) => {this.setState({date: date})}}
      />
    )
  }
}

You can check index.js in the Example for detail.

Properties

| Prop | Default | Type | Description | | :------------ |:---------------:| :---------------:| :-----| | style | - | object | Specify the style of the DatePicker, eg. width, height... | | date | - | string | date | Moment instance | Specify the display date of DatePicker. string type value must match the specified format | | mode | 'date' | enum | The enum of date, datetime and time | | androidMode | 'default' | enum | The enum of default, calendar and spinner (only Android) | | format | 'YYYY-MM-DD' | string | Specify the display format of the date, which using moment.js. The default value change according to the mode. | | confirmBtnText | '确定' | string | Specify the text of confirm btn in ios. | | cancelBtnText | '取消' | string | Specify the text of cancel btn in ios. | | iconSource | - | {uri: string} | number | Specify the icon. Same as the source of Image, always using require() | | minDate | - | string | date | Restricts the range of possible date values. | | maxDate | - | string | date | Restricts the range of possible date values. | | duration | 300 | number | Specify the animation duration of datepicker.| | customStyles | - | object | The hook of customize datepicker style, same as the native style. dateTouchBody, dateInput...| | showIcon | true | boolean | Controller whether or not show the icon | | hideText | false | boolean | Controller whether or not show the dateText | | iconComponent | - | element | Set the custom icon | | disabled | false | boolean | Controller whether or not disable the picker | | is24Hour | - | boolean | Set the TimePicker is24Hour flag. The default value depend on format. Only work in Android | | allowFontScaling | true | boolean | Set to false to disable font scaling for every text component | | placeholder | '' | string | The placeholder show when this.props.date is falsy | | onDateChange | - | function | This is called when the user confirm the picked date or time in the UI. The first and only argument is a date or time string representing the new date and time formatted by moment.js with the given format property. | | onOpenModal | - | function | This is called when the DatePicker Modal open. | | onCloseModal | - | function | This is called when the DatePicker Modal close | | onPressMask | - | function | This is called when clicking the ios modal mask | | modalOnResponderTerminationRequest | - | function | Set the callback for React Native's Gesture Responder System's call to onResponderTerminationRequest. By default this will reject a termination request, but can be overidden in case the View under the Modal is implementing custom gesture responders, and you wish for those to be overidden in certain cases. | | TouchableComponent | TouchableHighlight | Component | Replace the TouchableHighlight with a custom Component. For example : TouchableOpacity | | getDateStr | - | Function | A function to override how to format the date into a String for display, receives a Date instance

Property customStyles available keys

  • appearance: dateInput, disabled, dateTouchBody, dateIcon, placeholderText, dateText
  • ios select panel: datePickerCon, datePicker, btnConfirm, btnTextConfirm, btnCancel, btnTextCancel

Instance Methods

| Method | Params | Description | | :------------ |:---------------:| :---------------:| | onPressDate | - | Manually open the date picker panel | | onPressCancel | - | Manually close the date picker panel like, similarly pressing cancel btn |