Problem when changing orientation of FlashList - React-native/EXPO
I have encountered a problem with the FlashList component in my React Native/EXPO application. When the screen orientation changes to landscape, the list unexpectedly "jumps" out of the visible part of the screen.
I have 3 columns of photos - in both orientations. Each column takes up all the available space, so
- in portrait mode: more content with smaller item sizes,
- in landscape mode: less content, but larger item sizes. For example, I have images from 30 to 1, after switching to landscape mode I expect that at least one row from portrait orientation will be in landscape mode, but instead I have a row that was previously outside the visible area (it keeps the same positions between several rotations, but for landscape it is one position, for portrait orientation it is another position). - You can see this in the screenshots.
I understand that the problem is likely related to the resizing of renderItem (flex: 1) and possibly estimatedItemSize.
I tried to track the index of the first item in the row that crosses the middle of the screen (there are no issues with this part), and then use scrollToIndex after changing the orientation (this also works unexpectedly - scrolling to a "random" place).
I also tried to use ref instead of the index for the first item in the middle row and use scrollToItem - but this also did not work (scrolling to a "random" place).
If you have any ideas on how to solve this problem, I would appreciate it!
Applications 2
Current freelance projects in the category Gaming Apps
Game Developer
1200 USD
We are looking for an experienced game developer to refine an existing project on PixiJS. It is necessary to improve the game's mathematical system, redesign and balance the bonus rounds, as well as make changes to the current game logic. Experience in commercial game… Javascript and Typescript, Gaming Apps ∙ 6 hours 44 minutes back ∙ 13 proposals |
VFX Artist for creating explosion and smoke effectsNeed a VFX artist to create a series of explosion effects and smoke screens of various sizes for a VR simulator on Unity. Tasks include creating realistic explosions and smoke deployments using EmberGen, followed by preparing and integrating the effects into Unity. Experience… VR & AR Design, Gaming Apps ∙ 5 days 5 hours back ∙ 3 proposals |
SAMP Admin Tools for projectNeed Admin Tools for a Ukrainian samp project, to simplify commands and speed, there are many examples, individuality is not important, just need to adapt it for other commands and names. Gaming Apps ∙ 12 days 5 hours back ∙ 8 proposals |