I have been following exactly this article here to animate a header resizing on the scroll of a flatList (list of comments, on Scroll Y, reduce header). It works very well (sometimes a little slow but it's ok).
Now I would like to change layout disposition on resizing: passing from one to two columns when the header becomes smaller. But it seems to me very hard for a performant result.
I thought about two ways to do this:
Use onLayout on the header, to listen to the resizing height, at the middle of the height interpolation, change styles class. This method is costly on performance because it fired onLayout listener every frame, so my app is very buggy.
listen to ScrollY, at the middle of scrollY, change class. The same problem as previously said, each frame check scroll Y make my scroll perform very slowly.
Does anyone as a better idea to change a view layout on resizing?
Thank you
edit: here an exemple of the onlayout event, called a lot of time, causing shuttering