React Native Propel Kit

React Native Propel Kit

  • Quick Start
  • Components
  • Github
  • v0.8.6

›Components

Introduction

  • Quick Start

Components

  • ActionSheetProvider
  • BackdropProvider
  • ModalDialog
  • Select
  • DatePicker
  • TimePicker
  • DateTimePicker
  • MonthPicker
  • YearPicker
  • Picker

Recipes

  • Customizing styles

DateTimePicker

The <DateTimePicker /> component gives you an easy-to-use cross platform datetime picker leveraging DatePickerAndroid on Android and DatePickerIOS on iOS using an unified API.

  • Integrates well in forms as a themable TextInput-like button
  • Properly unified API and casted results (aligned on iOS).
  • Supports an UTC-mode for tz-proofing the data.

This component is an alias to <DatePicker mode="datetime" />

Preview

iOSAndroid

Usage

Setup dependencies

Since this components uses a backdrop, you need to wrap your application with a <BackdropProvider /> component. You usually want to wrap it as high as possible in your tree so that the backdrop properly covers the whole screen.

// App.jsx

import React from 'react';
import BackdropProvider from '@mgcrea/react-native-backdrop-provider';

const App: FunctionComponent = () => {
  return (
    <BackdropProvider>
      <RootNavigator />
    </BackdropProvider>
  );
};

export default App;

Basic

The basic API is relatively close to a regular TextInput

// MyComponent.jsx

import React from 'react';
import {Button} from 'react-native';
import {BackdropContext} from '@mgcrea/react-native-backdrop-provider';

const MyComponent = () => {
  const [date, setDate] = useState(new Date());
  return (
    <View>
      <Text style={{color: 'white', marginBottom: 12}}>Value: {time.toISOString()}</Text>
      <DateTimePicker title="Pick a date" value={date} onChange={setDate} />
    </View>
  );
};

export default MyComponent;

Props

Refer to the DatePicker props

Last updated on 9/24/2019
← TimePickerMonthPicker →
  • Preview
  • Usage
    • Setup dependencies
    • Basic
  • Props
React Native Propel Kit
Docs
Getting Started (or other categories)Guides (or other categories)API Reference (or other categories)
Community
User ShowcaseStack OverflowProject ChatTwitter
More
BlogGitHubStar
Facebook Open Source
Copyright © 2019 Olivier Louvignes