Skip to content

Conversation

@TVGSOFT
Copy link
Contributor

@TVGSOFT TVGSOFT commented Sep 13, 2022

Enhance some features:

  1. Allow rendering custom scroll component in YearPicker that prevent DatePickerModal inside FlatList.
  2. Custom "allowEditing" props to enable or disable the "Edit" button via DateInput.

Fixed bug from #201

@RichardLindhout
Copy link
Member

@TVGSOFT looks good but we let it slip, could you fix the merge conflict on this so we could merge?

@TVGSOFT
Copy link
Contributor Author

TVGSOFT commented Mar 3, 2023

Hi @RichardLindhout

I have resolved the conflict, please help to review and merge this PR.

Thank a lot!

merge resolve duplicated import
@RichardLindhout RichardLindhout merged commit 79d63e4 into web-ridge:master Mar 4, 2023
Copy link
Contributor

@jcloquell jcloquell left a comment

Choose a reason for hiding this comment

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

Hi there! I know this was already merged (and also released in the 0.14.0 version), but I found these issues that I wanted to share with you, in case you want to address them :)

locale={locale}
editIcon={props?.editIcon}
calendarIcon={props.calendarIcon}
allowEditing={props.allowEditing || true}
Copy link
Contributor

Choose a reason for hiding this comment

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

This is always true. Shouldn't it be {props.allowEditing ?? true} instead?

Copy link
Contributor Author

@TVGSOFT TVGSOFT Mar 8, 2023

Choose a reason for hiding this comment

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

Hi @jcloquell Yup I agree.
it should be allowEditing={props.allowEditing ?? true}

if (inputDate !== undefined) {
allowEditing = inputDate
}
const isAllowEditing = allowEditing && mode !== 'multiple' && inputDate !== undefined
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this change brought some undesired side effects, as

if (inputDate !== undefined) {
    allowEditing = inputDate
}

is not equivalent to making const isAllowEditing = ... && inputDate !== undefined.

The first is overriding the value of isAllowEditing with inputDate if this is defined.
The second is having an impact on the isAllowEditing value depending on inputDate being defined or not.

At the same time, the existing inputDate property is and was never set from anywhere outside where this component is used, so its value is always undefined.

All of this make the edit button to always be hidden regardless the value passed for the allowEditing prop.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Hi @jcloquell, thanks for catching this! Would you mind creating a quick PR to address this?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@jcloquell i think can change to this:
const isAllowEditing = allowEditing && mode !== 'multiple'

And remove this:
if (inputDate !== undefined) { allowEditing = inputDate }

What do you think?

Copy link
Contributor

Choose a reason for hiding this comment

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

Sure! Here is the PR - #264 :)

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.

5 participants