diff options
author | Shravya Ramesh <shravs1208@gmail.com> | 2021-06-21 13:51:42 -0700 |
---|---|---|
committer | Shravya Ramesh <shravs1208@gmail.com> | 2021-06-21 13:51:42 -0700 |
commit | 17af6485eb251c979430a7953acac34316f03cb4 (patch) | |
tree | e9dd8d310ee0f29036a925db621093cc7681a439 | |
parent | 753ccae8ac402d0956ea855a5fbcbd60b90280f1 (diff) |
Fix double click crash bug
-rw-r--r-- | src/screens/profile/IndividualMoment.tsx | 21 |
1 files changed, 8 insertions, 13 deletions
diff --git a/src/screens/profile/IndividualMoment.tsx b/src/screens/profile/IndividualMoment.tsx index 4088895a..2ad22db4 100644 --- a/src/screens/profile/IndividualMoment.tsx +++ b/src/screens/profile/IndividualMoment.tsx @@ -88,32 +88,27 @@ const IndividualMoment: React.FC<IndividualMomentProps> = ({ data={momentData} renderItem={({item, index}) => ( <MomentPost + key={item.moment_id} moment={item} userXId={userXId} screenType={screenType} - index={index} /> )} keyExtractor={(item, _) => item.moment_id} showsVerticalScrollIndicator={false} initialScrollIndex={initialIndex} + onScrollToIndexFailed={(info) => { + setTimeout(() => { + scrollRef.current?.scrollToIndex({ + index: info.index, + }); + }, 500); + }} pagingEnabled /> <TabsGradient /> </MomentContext.Provider> ); }; -const styles = StyleSheet.create({ - contentContainer: { - paddingTop: StatusBarHeight, - flex: 1, - }, - header: { - height: normalize(70), - }, - listContentContainer: { - paddingBottom: SCREEN_HEIGHT * 0.2, - }, -}); export default IndividualMoment; |