From d34dc2a9d662acc90c0758aaa857ad301d147b78 Mon Sep 17 00:00:00 2001 From: liaoliao666 <1076988944@qq.com> Date: Fri, 23 Dec 2022 08:52:55 +0800 Subject: [PATCH] fix: app will crash when click notify --- screens/TopicDetailScreen_old.tsx | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/screens/TopicDetailScreen_old.tsx b/screens/TopicDetailScreen_old.tsx index 763799d..47c66af 100644 --- a/screens/TopicDetailScreen_old.tsx +++ b/screens/TopicDetailScreen_old.tsx @@ -106,7 +106,12 @@ function TopicDetailScreen() { key={colorScheme} ref={flatList} data={flatedData} - initialScrollIndex={params.initialScrollIndex} + initialScrollIndex={ + params.initialScrollIndex != null && + params.initialScrollIndex < flatedData.length + ? params.initialScrollIndex + : undefined + } onScrollToIndexFailed={info => { sleep(500).then(() => { flatList.current?.scrollToIndex({