react-native-paper-dates icon indicating copy to clipboard operation
react-native-paper-dates copied to clipboard

fix(calendar): Detect orientation and change scrollMode

Open SoyDiego opened this issue 2 years ago • 8 comments

Fix #355.

Read below ⚠️

POSSIBLE SOLUTION AT THE MOMENT

landscape mode

Is not 100% ok, we should improve it. I was able to made scrollable the calendar and works perfectly If you are in mode portrait all time or if you are in mode landscape all time. But if you open the modal in portrait and you rotate to landscape the scroll will works, but the layout will breaks. @RichardLindhout I hope can help us to solve this problem.

Layout when you change from portrait to landscape.

image

Layout when you change from landscape to portrait.

image

SoyDiego avatar Nov 21 '23 15:11 SoyDiego

Could you give me a hand / ideas / opinions @RichardLindhout?.

Thanks

SoyDiego avatar Nov 23 '23 09:11 SoyDiego

I think we could reduce states by useWindowDimensions hook and not use state's at all. I'm not sure why the layout won't change do we have hardcoded width somewhere maybe?

RichardLindhout avatar Nov 23 '23 12:11 RichardLindhout


const dimensions = useWindowDimensions()
const isLandscape = dimensions.width > dimensions.height

RichardLindhout avatar Nov 23 '23 12:11 RichardLindhout

https://github.com/web-ridge/react-native-paper-dates/blob/60e1ea0562ffc4c354ab36d3345a1d2a20adbf05/src/Date/DatePickerModal.tsx#L106

RichardLindhout avatar Nov 23 '23 12:11 RichardLindhout

What about tablets we only need to change scrollMode if height is not enough right?

RichardLindhout avatar Nov 23 '23 12:11 RichardLindhout

I think te problem is here: https://github.com/web-ridge/react-native-paper-dates/blob/master/src/Date/AutoSizer.tsx#L27

Does the onLayout get called is device is rotated?

RichardLindhout avatar Nov 23 '23 12:11 RichardLindhout

I think the swiper.native.ts + Autosizer have some problems maybe on rotate?

RichardLindhout avatar Nov 23 '23 12:11 RichardLindhout

What about tablets we only need to change scrollMode if height is not enough right?

Thanks for your reply. I didn't check in tablets because I don't have iOS, for that I would like your help to manage this problem. I can try some things that you told me above, but my level in react-native is not in your level hahaha. I hope we can improve it because is very important this things for accessibility.

Thanks again

SoyDiego avatar Nov 23 '23 12:11 SoyDiego