Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@mohalla-tech/react-native-date-time-picker

Package Overview
Dependencies
Maintainers
14
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@mohalla-tech/react-native-date-time-picker

Date/Time picker component written entirely on React Native side

  • 2.0.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
105
decreased by-18.6%
Maintainers
14
Weekly downloads
 
Created
Source

React Native DateTimePicker

React Native date & time picker component for iOS, Android written without using any Native modules. It's highly customizable and can be easily modified.

:camera: Screenshots

iOS

Android

📲 Getting started

npm install @mohalla-tech/react-native-date-time-picker --save

or

yarn add @mohalla-tech/react-native-date-time-picker

No linking or pod install are required.

📝 General Usage

import React, { useState } from 'react';
import { View, Text } from 'react-native';
import DateTimePicker from 'react-native-date-time-picker';

const App = () => {
    const initialDate = new Date(1950, 6, 15, 7, 30);
    const [date, setDate] = useState(initialDate);
    const [time, setTime] = useState(initialDate);
    const [datetime, setDatetime] = useState();

    const onDateChange = (selectedDate: Date) => setDate(selectedDate);

    const onTimeChange = (selectedTime: Date) => setTime(selectedTime);

    const onDatetimeChange = (selectedDatetime: Date) => setDatetime(selectedDatetime);

    return (
        <View>
            <Text style={styles.text}>mode="date"</Text>
            <DateTimePicker mode="date" initialValue={initialDate} onChange={onDateChange} />

            <Text style={styles.text}>mode="time"</Text>
            <DateTimePicker
                mode="time"
                is24Hour={false}
                initialValue={initialDate}
                onChange={onTimeChange}
            />

            <Text style={styles.text}>mode="datetime"</Text>
            <View style={styles.card}>
                <DateTimePicker mode="datetime" onChange={onDatetimeChange} />
            </View>
        </View>
    );
};

export default App;

Note: mode change on the fly is not supported

⚙️ Props

ListItemStyleType = { color?: string; backgroundColor?: string } Mode = 'date' | 'time' | 'datetime'

PropTypeRequiredDefaultDescription
modeMode-'date'Defines the type of the picker.
initialValueDate-new Date()Initial Date to scroll to
minimumDateDate-undefinedMinimum Date available to select(only for "datetime" mode)
maximumDateDate-undefinedMaximum Date available to select(only for "datetime" mode)
is24Hourboolean-falseDisplay TimePicker in 24 hour.
minuteIntervalnumber-1Interval gap in minute list
onChangefunction-Callback to be called every time user change date.
itemHeightnumber-40Height of single item in list
containerStyleViewStyle-undefinedOutermost View style
listItemStyleListItemStyleType-undefinedStyle for individual list item text
separatorColorstring-undefinedColor for the separator between 2 item
flatListPropsFlatListProps-undefinedTo optimise FlatList add optimizations to this prop

📣 Acknowledgements

  • react-native-module-template

🛡 License

This project is licensed under the MIT License - see the LICENSE.md file for details.

Keywords

FAQs

Package last updated on 03 May 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc