davidtran / react-google-flight-datepicker

React date picker inspired by Google Flight
MIT License
385 stars 47 forks source link

Setting Start Date and End Date with onChange lead to infinit reRender #9

Closed kouloughli-hemza closed 4 years ago

kouloughli-hemza commented 4 years ago

Hello , First Thank you so much for the great Job , i tried to use the DateRangePicker and set startDate and EndDate from my redux, or even new Date() just for test , but it always fires the onChange on component mounting which lead to infinit reRender and Crash of the app, here what i did :

                <RangeDatePicker
                    startDate={new Date()}
                    endDate={null}
                    onChange={(startDate, endDate) => props.handleDatesChange(startDate, endDate)}
                    minDate={new Date()}
                    maxDate={new Date(2022, 0, 1)}
                    dateFormat="dddd D MMM"
                    monthFormat="MMM YYYY"
                    startDatePlaceholder={<Translate tKey="start_date" />}
                    endDatePlaceholder={<Translate tKey="end_date" />}
                    disabled={false}
                    className="my-own-class-name"
                    startWeekDay="monday"
                />

To reproduce the issue use startDate and endDate from redux store and the onChange dispatch an action

davidtran commented 4 years ago

Thanks for letting me know, I will check this issue.

kouloughli-hemza commented 4 years ago

Thanks for letting me know, I will check this issue. Thank you for the reply, I will be waiting for a fix , at the time i will try to help find any bug thank you

kouloughli-hemza commented 4 years ago

is there any update on the issue yet ? i can't find what causing the issue yet

kouloughli-hemza commented 4 years ago

To reproduce the issue use startDate and endDate from redux store and the onChange dispatch an action

davidtran commented 4 years ago

@kouloughli-hemza Hi, I have fixed this issue, please check.

kouloughli-hemza commented 4 years ago

@kouloughli-hemza Hi, I have fixed this issue, please check.

it works great now , thank you lot