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

Prevent to hide datepicker when clicking anywhere, but close it when clicking close button #154

Open
DanielBSeeTrue opened this issue Feb 8, 2024 · 0 comments

Comments

@DanielBSeeTrue
Copy link

DanielBSeeTrue commented Feb 8, 2024

I want to be able to close when clicking the X close button
but not to close when clicking anywhere
I tried implementing that if onFocusChange , focusinput is null, I will keep it open by focusing on start date
but the button close also produced null

my code:

<DateRangeInput
        onDatesChange={(data) => {
          setState(data);
        }}
        onFocusChange={(focusedInput) => {
          console.log(focusedInput); 
          if (focusedInput === null) {
            setState((prev) => ({ ...prev, focusedInput: START_DATE }));
          } else {
            setState((prev) => ({ ...prev, focusedInput }))
          }
        }
        }
        startDate={props.startDate}
        endDate={props.endDate}
        focusedInput={state.focusedInput}
        displayFormat="dd/MM/yyyy"
      />
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

No branches or pull requests

1 participant