0.0.1 • Published 6 years ago

react-native-notag-datepicker v0.0.1

Weekly downloads
5
License
-
Repository
-
Last release
6 years ago

React Native DatePicker

A React Native DatePicker without Tag

based on: Cordova DatePicker Plugin

origin ios https://github.com/sectore/phonegap3-ios-datepicker-plugin

example code

import {
  NativeEventEmitter,
  NativeModules
} from 'react-native';

const DatePickerHandler = {};
const RNNoTagDatepicker = NativeModules.RNNoTagDatepicker;

const DatePickerEvent = new NativeEventEmitter(NativeModules.RNNoTagDatepicker);

DatePickerEvent.addListener('DATEPICKER_NATIVE_INVOKE', (evt: Event) => {
if(evt.status === 'success') {
  const toMSUnit = parseFloat(evt.value) * 1000;
  const date =  new Date(toMSUnit);
  webView.postMessage(JSON.stringify({
    type: 'DATE_PICKER',
    success: true,
    date
  }));
}
});

const showPicker = async (options) => {
  RNNoTagDatepicker.show(options);
};

showPicker({
  date: payload.date,
  maxDate: payload.maxDate,
});

LICENSE

MIT