web-ridge / react-native-paper-dates

Smooth and fast cross platform Material Design date and time picker for React Native Paper
https://www.reactnativepaperdates.com
MIT License
637 stars 161 forks source link

fix landscape flickering bug #368

Open ibrahimtuna opened 5 months ago

ibrahimtuna commented 5 months ago

At landscape screens, date component was flickering due to infinite loop into useCallback hook. Here you may find an example: https://github.com/web-ridge/react-native-paper-dates/assets/52549674/c6db7e31-dda5-4128-bdc4-ae8ba897a36b

Due to React-Native issues onLayout triggers more than once when landscape mode, and its creates infinite loop. I added more checks than before to fix it. I am not familiar the entire library, might be better approach please carefully review it.

Thanks