Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiple Selection #9

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
Open

Conversation

bearkillerPT
Copy link

@bearkillerPT bearkillerPT commented Dec 17, 2023

Hey there! Found this lib yesterday and it's just what I need! Here's what I did:

  • Added an attribute to enable multiple selection;
  • Added an attribute to control the strategy used between:
    • Non-consecutive: accepts any slot selection;
    • Consecutive: Only accepts consecutive slots and removal of the first and last slots as to keep the slots consecutive;
    • Same-day-consecutive: the same as the last but limits the slots to the ones happening on the same day;
    • Edited the Example to include multiple selection.

Don't ask me why but for the first 3 commit's the pre-commit hook didn't run and alert me about the conventions used.

I also have a function that I still have to perfect but I think it would be cool to add to the ultilities. It's a function that given a timeInterval and numberOfDays produces the array of available slots.

Thanks for creating the lib!

@bearkillerPT
Copy link
Author

bearkillerPT commented Dec 30, 2023

It seems there was a bug that allowed for the deletion of a time slot if it was in between different days. I started testing it now since I'm going to integrate it. For now I'll use patch-package.
Fixed it with the last 2 commits. Also introduced a utils file for the time slots generation I mentioned!

@dgreasi
Copy link
Owner

dgreasi commented Dec 31, 2023

@bearkillerPT Thanks for the contribution, let me check and I will let you know.

@dgreasi
Copy link
Owner

dgreasi commented Jan 10, 2024

@bearkillerPT can you create runnable example in expo like the one i have here expo

title = 'Select time',
backgroundColor = theme.colors.white,
}: Props) => {
const onPress = (value: string) => {
setSelectedTime(value);
if (!scheduledAppointments || scheduledAppointments.length === 0)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This needs to be refactored in a utility function is different file. The multiple if-else statements are not helping to understand the logic. Can you please add comments or refactor the code to be more development friendly?

Copy link
Author

@bearkillerPT bearkillerPT Feb 6, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This needs to be refactored in a utility function is different file. The multiple if-else statements are not helping to understand the logic. Can you please add comments or refactor the code to be more development friendly?

Added comments that I think explain well what's going on. I agree with the util functions file but didn't have the time to do it yet 😞

@bearkillerPT
Copy link
Author

@bearkillerPT can you create runnable example in expo like the one i have here expo

I've modified the example app inside it. I tested with that.
I'll try refactoring as soon as I can!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants