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

react-native-modal-datetime-picker-nevo

v4.11.0

Published

A react-native datetime-picker for Android and iOS

Downloads

8

Readme

react-native-modal-datetime-picker

npm version styled with prettier

A declarative cross-platform react-native datetime-picker.

Description

This library exposes a cross-platform interface for showing the native date and time pickers inside a modal.
You will have an unified user experience, you won't have to worry anymore about testing the device platform and you won't have to programmatically call the Android TimePicker/DatePicker APIs.

Demo

Setup

This library is available on npm, install it with npm install --save react-native-modal-datetime-picker or yarn add react-native-modal-datetime-picker.

Usage

import React, { Component } from 'react';
import { Text, TouchableOpacity, View } from 'react-native';
import DateTimePicker from 'react-native-modal-datetime-picker';

export default class DateTimePickerTester extends Component {
  state = {
    isDateTimePickerVisible: false,
  };

  _showDateTimePicker = () => this.setState({ isDateTimePickerVisible: true });

  _hideDateTimePicker = () => this.setState({ isDateTimePickerVisible: false });

  _handleDatePicked = (date) => {
    console.log('A date has been picked: ', date);
    this._hideDateTimePicker();
  };

  render () {
    return (
      <View style={{ flex: 1 }}>
        <TouchableOpacity onPress={this._showDateTimePicker}>
          <Text>Show TimePicker</Text>
        </TouchableOpacity>
        <DateTimePicker
          isVisible={this.state.isDateTimePickerVisible}
          onConfirm={this._handleDatePicked}
          onCancel={this._hideDateTimePicker}
        />
      </View>
    );
  }

}

Available props

| Name | Type| Default | Description | | --- | --- | --- | --- | | cancelTextIOS | string | 'Cancel' | The text on the cancel button on iOS |
| confirmTextIOS | string | 'Confirm' | The text on the confirm button on iOS | | customCancelButtonIOS | node | | A custom component for the cancel button on iOS | | customConfirmButtonIOS | node | | A custom component for the confirm button on iOS | | customTitleContainerIOS | node | | A custom component for the title container on iOS | | datePickerContainerStyleIOS | style | | The style of the container on iOS | | reactNativeModalPropsIOS | object | | Additional props for react-native-modal on iOS | | date | obj | new Date() | Initial selected date/time | | isVisible | bool | false | Show the datetime picker? | | mode | string | 'date' | Datepicker? 'date' Timepicker? 'time' Both? 'datetime' | | datePickerModeAndroid | string | 'calendar' | Display as 'spinner' or 'calendar'| | onConfirm | func | REQUIRED | Function called on date picked | | onHideAfterConfirm | func | () => {} | Called after the hiding animation if a date was picked | | onCancel | func | REQUIRED | Function called on dismiss | | titleIOS | string | 'Pick a date' | The title text on iOS | | minimumDate | Date | undefined | Min Date. Does not work with 'time' picker on Android. | | maximumDate | Date | undefined | Max Date. Does not work with 'time' picker on Android. | | is24Hour | bool | true | If false, the picker shows an AM/PM chooser on Android |

All the DatePickerIOS props are also supported!

Notes

Just remember to always set the isVisible prop to false in both onConfirm and onCancel (like in the example above).

Under the hood this library is using react-native-modal for the iOS modal implementation.

Pull requests and suggestions are welcome!