diff options
author | George Rusu <george@tagg.id> | 2021-07-01 11:54:30 -0700 |
---|---|---|
committer | George Rusu <george@tagg.id> | 2021-07-01 11:54:30 -0700 |
commit | 97a3f554746b3b73eb57b21e2d8b8d8b5a1a049c (patch) | |
tree | 920e42e995fda5b76347e066bc99706ed666fec6 | |
parent | 34414dcf71e0c764e7c6102ef3711135e0d88a4c (diff) |
Remove viewabilityConfigCallback
-rw-r--r-- | src/screens/profile/IndividualMoment.tsx | 18 |
1 files changed, 17 insertions, 1 deletions
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<IndividualMomentProps> = ({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 ( <MomentContext.Provider value={{ @@ -86,9 +91,20 @@ const IndividualMoment: React.FC<IndividualMomentProps> = ({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, }); |