0.5.0 • Published 3 years ago

rn-schedule-availability v0.5.0

Weekly downloads
1
License
MIT
Repository
github
Last release
3 years ago

RnScheduleAvailability

Component used to schedule times of week

Installation

npm install rn-schedule-availability

Usage

import * as React from 'react';
import { Button, StyleSheet, View } from 'react-native';
import RnScheduleAvailability from 'rn-schedule-availability';

const daysOfWeek = [
  'Segunda-feira',
  'Terça-feira',
  'Quarta-feira',
  'Quinta-feira',
  'Sexta-feira',
  'Sábado',
  'Domingo',
];

export default function App() {
  const scheduleRef = React.createRef<any>();

  const handleSubmit = React.useCallback(() => {
    if (scheduleRef.current) {
      const schedules = scheduleRef.current.submit();
      console.log(schedules);
    }
  }, [scheduleRef]);

  return (
    <View style={styles.container}>
      <RnScheduleAvailability
        disabled={false}
        daysOfWeek={daysOfWeek}
        ref={scheduleRef}
      />
      <Button onPress={handleSubmit} title="Submit" />
    </View>
  );
}

const styles = StyleSheet.create({
  container: {
    flex: 1,
    alignItems: 'center',
    justifyContent: 'center',
  },
});

Contributing

See the contributing guide to learn how to contribute to the repository and the development workflow.

License

MIT