diff options
| author | Ivan Chen <ivan@tagg.id> | 2021-06-11 15:41:50 -0400 |
|---|---|---|
| committer | Ivan Chen <ivan@tagg.id> | 2021-06-11 15:41:50 -0400 |
| commit | e4dd6cf05a631197be4d192901d532e8625900bb (patch) | |
| tree | 83638a5a2803c9ca2a4a491dd37180871f3cbdde /src/screens | |
| parent | eb672872d85f203085c96005758314d5dba359f2 (diff) | |
Cleanup scrolling logic, Fix scrollTo logic
Diffstat (limited to 'src/screens')
| -rw-r--r-- | src/screens/profile/IndividualMoment.tsx | 17 |
1 files changed, 4 insertions, 13 deletions
diff --git a/src/screens/profile/IndividualMoment.tsx b/src/screens/profile/IndividualMoment.tsx index ddf4c478..b14b31fa 100644 --- a/src/screens/profile/IndividualMoment.tsx +++ b/src/screens/profile/IndividualMoment.tsx @@ -17,7 +17,6 @@ import {normalize, StatusBarHeight} from '../../utils'; type MomentContextType = { keyboardVisible: boolean; - currentScrollToIndex: number; scrollTo: (index: number) => void; }; @@ -52,8 +51,6 @@ const IndividualMoment: React.FC<IndividualMomentProps> = ({ (m) => m.moment_category === moment_category, ); const initialIndex = momentData.findIndex((m) => m.moment_id === moment_id); - const [currentScrollToIndex, setCurrentScrollToIndex] = - useState<number>(initialIndex); const [keyboardVisible, setKeyboardVisible] = useState(false); useEffect(() => { @@ -68,22 +65,16 @@ const IndividualMoment: React.FC<IndividualMomentProps> = ({ }, []); const scrollTo = (index: number) => { - setCurrentScrollToIndex(index); - setTimeout(() => { - console.log('scrolling to', index); - scrollRef.current?.scrollToIndex({ - index: index, - // viewOffset: -(AVATAR_DIM + normalize(120)), - viewOffset: -(AVATAR_DIM + normalize(90)), - }); - }, 100); + scrollRef.current?.scrollToIndex({ + index: index, + viewOffset: -(AVATAR_DIM + normalize(90)), + }); }; return ( <MomentContext.Provider value={{ keyboardVisible, - currentScrollToIndex, scrollTo, }}> <BlurView |
