fix: open a list mail without mounting every pane before it #67

The tap fix makes a notification open a single page, so the viewer no
longer needs to render up to the opened index. That setting mounted
about N mail panes on every list open, on iOS too. Also drop the
onScrollToIndexFailed handler, which FlatList never calls when
getItemLayout is set.
This commit is contained in:
Linus Rath
2026-10-10 19:20:46 +02:00
parent ec137e931b
commit 96e1cc1c3f
+1 -6
View File
@@ -772,17 +772,12 @@ function EmailViewer({ route, navigation }: Props) {
initialScrollIndex={initialIndexRef.current}
getItemLayout={(_, index) => ({ length: windowWidth, offset: windowWidth * index, index })}
windowSize={3}
initialNumToRender={Math.max(initialIndexRef.current + 1, 1)}
initialNumToRender={1}
maxToRenderPerBatch={2}
removeClippedSubviews
scrollEnabled={!pagerLocked && kbObstruction === 0}
onScrollBeginDrag={releaseNeighbours}
onMomentumScrollEnd={onMomentumEnd}
onScrollToIndexFailed={(info) => {
setTimeout(() => {
listRef.current?.scrollToOffset({ offset: info.index * windowWidth, animated: false });
}, 50);
}}
renderItem={({ item, index }) => (
<View style={{ width: windowWidth }}>
<EmailPane