'Horizontal flatlist item not adapting to device orientation changes
So i'm making an email client. On the message view screen there is a header (from, to, subject) and a WebView for content. Each message is a child in a horizontal Flatlist with paging in order to swipe through each message, just like Gmail for example.
The problem is, when I rotate the device, it never adjusts right. It takes really long time to fire the event that the width has changed, and when it eventually does it goes offset like in between 2 messages but not exactly in the middle.
I used every hook and listener possible (Dimensions, useDeviceOrientation, onLayout etc) I've search everywhere but no one seems to have had this issue before. So in my last hope, do you know anything that can help me with that ?
I have narrowed down the root cause to be (probably) at getItemLayout which needs to be set in order to use flatlist.scrollTo() method. Somehow I've managed to get a proper end result with a combination of all of the above but there is still a big delay and clumsiness so I believe there has to be something that I'm missing
Here you can see exactly what I'm talking about example video
Not posting code because it doesn't really matter. U can just write in expo a plain horizontal flatlist with paging and rotate the device that's literally it
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
