1.2.0 • Published 4 years ago

react-native-inline-timepicker v1.2.0

Weekly downloads
7
License
ISC
Repository
github
Last release
4 years ago

react-native-inline-timepicker

npm version npm downloads

This is a react-native timepicker for android apps which will be rendered inline with other components. It may be used along with this inline datepicker.

Getting Started

Installation

$ npm install react-native-inline-timepicker --save

Usage

Import

import InlineTimePicker from 'react-native-inline-timepicker';

Example

import InlineTimePicker from 'react-native-inline-timepicker';
import React, { Component } from 'react';
import { View, Text } from 'react-native';

export default class TimePickerDemo extends Component {
  state = {
    hours: 12,
    minutes: 0,
    seconds: 0,
    meridian: "AM"
  };
  setTime = (h, m, s, mn) => {
    this.setState({hours: h, minutes: m, seconds: s, meridian: mn});
  }
  render() {
    return (
            <View>
              <InlineTimePicker onChangeTime = {this.setTime}/>
              <Text>The selected time is:</Text>
              <Text>
                {this.state.hours}:{this.state.minutes}:{this.state.seconds}{" "}{this.state.meridian}
              </Text>    
            </View>
    );
  }
}

Props

PropDefaultTypeDescription
onChangeTimenullfuncCallback function taking four arguments (hours, minutes, seconds, meridian) to take the user selected hours, minutes, seconds and meridian (AM or PM) respectively.
startTimenullArrayAn array containing three numbers and a string to set the current time of the timepicker. The first element is the hours, the second element is the minutes, the third is seconds and the string represents the meridian.
mode24hrsundefinedbooleanIf true, it changes the time mode from meridian based to 24hrs based.
skinColornullenum("red", "green", "blue")Predefined skin colors for the time picker which provides style alternatives without defining the color properties described below. See below for effects.
fontSize35numberThe font size of all the texts in the timepicker except the meridian.
textColor#cccstringText color.
textBorderColor#555stringBorder color of the background color of the texts.
borderRadius4numberThe border radius of the background of the texts.
textBackgroundColor"#555"stringThe background color of the texts.
iconSize40numberThe size of the increment icons (+ and -).
activeTextBackgroundColor#000stringBackground color active texts.
containerBackgroundColor#222stringBackground color the main container.

skinColor prop

The optional skinColor property can have values of "red", "green" or "blue" with the following effects.

Default

Screenshot

skinColor = 'red'

Screenshot

skinColor = 'green'

Screenshot

skinColor = 'blue'

Screenshot

Issues or suggestions?

If you have any issues or want to suggest something , your can write it here.