From 97a3f554746b3b73eb57b21e2d8b8d8b5a1a049c Mon Sep 17 00:00:00 2001 From: George Rusu Date: Thu, 1 Jul 2021 11:54:30 -0700 Subject: Remove viewabilityConfigCallback --- src/screens/profile/IndividualMoment.tsx | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/screens/profile/IndividualMoment.tsx b/src/screens/profile/IndividualMoment.tsx index 0fd15b2c..bd87f4b0 100644 --- a/src/screens/profile/IndividualMoment.tsx +++ b/src/screens/profile/IndividualMoment.tsx @@ -7,6 +7,7 @@ import {MomentPost, TabsGradient} from '../../components'; import {MainStackParams} from '../../routes'; import {RootState} from '../../store/rootreducer'; import {MomentPostType} from '../../types'; +import {SCREEN_HEIGHT} from '../../utils'; type MomentContextType = { keyboardVisible: boolean; @@ -66,6 +67,10 @@ const IndividualMoment: React.FC = ({route}) => { }; }, []); + console.log('moment data length: \n ' + momentData.length); + console.log('Moment length: \n ' + moments.length); + console.log('initINDEX: \n' + initialIndex); + const ITEM_HEIGHT = SCREEN_HEIGHT; return ( = ({route}) => { keyExtractor={(item, _) => item.moment_id} showsVerticalScrollIndicator={false} initialScrollIndex={initialIndex} - onViewableItemsChanged={viewabilityConfigCallback.current} + // onViewableItemsChanged={viewabilityConfigCallback.current} + // getItemLayout={} + // snaptoIte + // snapToInterval={ITEM_HEIGHT} + getItemLayout={(data, index) => ({ + length: ITEM_HEIGHT, + offset: ITEM_HEIGHT * index, + index, + })} onScrollToIndexFailed={(info) => { + console.log('this is when it fails: '); setTimeout(() => { + console.log('trying to scroll to some index: ' + info.index); + console.log('ScrollRef: ' + scrollRef.current); scrollRef.current?.scrollToIndex({ index: info.index, }); -- cgit v1.2.3-70-g09d2