fix: eliminate random list-mode row spacing on first render#140
Conversation
…random spacing Agent-Logs-Url: https://github.com/Kallb123/SimpleMediaBrowser/sessions/b35a7100-8b81-45f0-8ebe-5564b7b2ebb3 Co-authored-by: Kallb123 <1054734+Kallb123@users.noreply.github.com>
|
@copilot checks are failing |
…ng issue Agent-Logs-Url: https://github.com/Kallb123/SimpleMediaBrowser/sessions/a6a3a153-4043-4a4d-a2a5-61548732111e Co-authored-by: Kallb123 <1054734+Kallb123@users.noreply.github.com>
…duplication Agent-Logs-Url: https://github.com/Kallb123/SimpleMediaBrowser/sessions/a6a3a153-4043-4a4d-a2a5-61548732111e Co-authored-by: Kallb123 <1054734+Kallb123@users.noreply.github.com>
Fixed in commit 9b702a7. The TypeScript error was caused by using The root cause of the spacing bug is that FlashList 2.0 hardcodes a 200 px default height estimate for all unmeasured items — list mode rows are only 40–80 px, so the initial render shows every row 200 px apart. After measurement the gaps normalise, which is why navigating in and out of folders fixes it. The fix replaces FlashList with React Native's |
FlashList 2.0 hardcodes a 200 px default height estimate for unmeasured items. In list mode, rows are only 40–80 px tall, so the initial render positions every row 200 px apart — producing random-looking gaps that only normalise after items are measured through subsequent navigation.
Changes
MediaBrowserScreen.tsx— switches list mode fromFlashListto React Native'sFlatListwithgetItemLayout, which supplies the exactlistRowHeightfor every item index at construction time. This eliminates the height-estimation phase entirely, giving a correct layout from the very first render. Grid/poster mode continues to useFlashListunchanged.MediaBrowserScreen.tsx— extracts a sharedgetItemHandlersuseCallbackcontaining the commonisEditable/isShowAtRoot/isSelected/handlePress/onEditPresslogic, removing duplication between the list-mode and grid-moderenderItemcallbacks.