1.0.15 • Published 1 year ago

react-native-12hours-timepicker v1.0.15

Weekly downloads
-
License
ISC
Repository
github
Last release
1 year ago

react-native-12hours-timepicker

Time picker for US time standart

Installation

Using NPM:

$ npm i react-native-12hours-timepicker

Using Yarn:

$ yarn add react-native-12hours-timepicker

Usage

import { TimePicker, AnalogClock12 } from 'react-native-12hours-timepicker'
<TimePicker
  topPadding={0}
  dayPeriods={{'11:00 – 14:00': 'red'}} // max hour 24:00
  value={'13:00'} // 24 hours format
  onChange={(v) => onTimeChange(v)}
  clockWidth={272}
  periodSeparator="–"
  title="Select time"
  clockNumberShift={50}
/>
<AnalogClock12
  topPadding={0}
  // onHourSelect run when Gesture.Pan.**onBegin**() and Gesture.Pan.**onUpdate**()
  // hour in range from 0 to 11
  onHourSelect={(hour: number, minutes: number) => onTimeChanged(hour, minutes)}
  value={'13:00'} // 24 hours format
  periods={{'07:00 – 09:00': 'red'}} // max hour 12:00
  // onTimeSelectEnd run when Gesture.Pan.**onFinalize**()
  // hour in range from 0 to 11
  onTimeSelectEnd={(hour: number, minutes: number) => onTimeSelectEnd(hour, minutes)}
  width={272}
  periodSeparator="–"
  clockNumberShift={50}
/>

Options

TimePicker

PropsTypeDataDefault
titleStringTime picker title'Select time'
topPaddingNumberStatus bar height for pan responder if work custom safe-area-view, such as react-native-safe-area-context0
clockWidthNumberDefault width for analog clock272
valueStringValue in 24 hours format'00:00'
dayPeriods{ period: color }Period in 24 hours format and color for this period, { '11:00 – 14:00': '#FFA98D' }{}
onChange(string): voidReturn value in 24 hours format, '14:00'-
periodSeparatorStringPeriods keys separator'–'
clockNumberShiftNumberOffset of the number of hours from the outer point50
clockBorderColorStringClock border color'#F7F7F7'
hourDotFillColorStringClock hour dot fill color'#EBEBEB'
hourDotBorderColorStringClock hour dot border color'#F7F7F7'
styleStylePropStyles for main container-
timeContainerStyleStylePropStyles for numeric timer container-
titleStyleStylePropStyles for title-
timeStyleStylePropStyles for numeric timer text-
switcherStyleStylePropStyles for meridiem switcher container-
clockFaceNumberStyleStylePropStyles for number literal on clock face-
switcherTextStyleStylePropStyles for meridiem switcher text-

AnalogClock12

PropsTypeDataDefault
styleStylePropStyles for clock container-
clockFaceNumberStyleStylePropStyles for number literal on clock face-
widthNumberClock width272
topPaddingNumberStatus bar height for pan responder if work custom safe-area-view, such as react-native-safe-area-context0
valueStringValue in 24 hours format'00:00'
periodSeparatorStringPeriods keys separator'–'
clockBorderColorStringClock border color'#F7F7F7'
hourDotFillColorStringClock hour dot fill color'#EBEBEB'
hourDotBorderColorStringClock hour dot border color'#F7F7F7'
clockNumberShiftNumberOffset of the number of hours from the outer point50
periodsPeriod in 24 hours format and color for this period, but max time 12:00, { '09:00 – 12:00': '#FFA98D' }{}
onHourSelect(hour: number, minutes: number) => voidRun when Gesture.Pan handled onBegin and onUpdate. Hour in range from 0 to 11-
onTimeSelectEnd(hour: number, minutes: number) => voidrun when Gesture.Pan handled onFinalize. Hour in range from 0 to 11-

Authors