aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShravya Ramesh <shravs1208@gmail.com>2021-06-21 13:51:42 -0700
committerShravya Ramesh <shravs1208@gmail.com>2021-06-21 13:51:42 -0700
commit17af6485eb251c979430a7953acac34316f03cb4 (patch)
treee9dd8d310ee0f29036a925db621093cc7681a439
parent753ccae8ac402d0956ea855a5fbcbd60b90280f1 (diff)
Fix double click crash bug
-rw-r--r--src/screens/profile/IndividualMoment.tsx21
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;