1.0.1 • Published 6 years ago

react-native-slot-creator v1.0.1

Weekly downloads
13
License
-
Repository
github
Last release
6 years ago

react-native-slot-creator

Creates time slots for iOS and Android React-Native apps , this package is in heavy development phase.

PLANNED FEATURES

  • Get time slots between given start time and end time
  • Get slots in required format (12hrs and 24hrs both)
  • Remove the inbetween breaktime slots if required.
  • DateObject manupulation
  • Dynamic UI for slots

Installation

  1. npm install react-native-slot-creator --save

Example

import React from 'react';
import { View, Image } from 'react-native';
import { slotCreator } from "react-native-slot-creator";


export default class App extends Component {
  componentWillMount(){
    // Default format
    slotCreator.createSlot(startTime, endTime, slotDuration, breakStartTime, breakEndTime, is12HoursFormat)

    // To get the Array of slots between given time interval with breakTime and 12 Hrs format
    let requiredArray = slotCreator.createSlot("08:00","10:00","20","09:00","09:30",true)
    console.warn("requiredArray",requiredArray)


    // To get the Array of slots between given time interval without breakTime 
    let requiredArray = slotCreator.createSlot("08:00","10:00","20")
    console.warn("requiredArray",requiredArray)
    
  }
  render() {
    return (
      <View style={styles.container}>
        <Text style={styles.welcome}>Welcome to React Native!</Text>
        <Text style={styles.instructions}>To get started, edit App.js</Text>
      </View>
    );
  }
}

Parameters

ParameterDefaultTypeDescription
startTimenull24 HrsStart time of your time intervalYes
endTimenull24 HrsEnd time of your time intervalYes
slotDurationnullMinsDuration of slot you requireYes
breakStartTimenull24 HrsBreak start timeoptional
breakEndTimenull24 HrsBreak start timeoptional
is12HoursFormatfalseboolIf you require the result in 12 Hrs format set this as trueoptional