From 47b087816844473be858adf766b2f538ecf6d0aa Mon Sep 17 00:00:00 2001 From: Ivan Chen Date: Fri, 11 Jun 2021 16:35:31 -0400 Subject: Fix viewoffset --- src/screens/profile/IndividualMoment.tsx | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/screens/profile/IndividualMoment.tsx b/src/screens/profile/IndividualMoment.tsx index b14b31fa..80438bcd 100644 --- a/src/screens/profile/IndividualMoment.tsx +++ b/src/screens/profile/IndividualMoment.tsx @@ -9,7 +9,7 @@ import {AVATAR_DIM} from '../../constants'; import {MainStackParams} from '../../routes'; import {RootState} from '../../store/rootreducer'; import {MomentPostType} from '../../types'; -import {normalize, StatusBarHeight} from '../../utils'; +import {isIPhoneX, normalize, StatusBarHeight} from '../../utils'; /** * Individual moment view opened when user clicks on a moment tile @@ -65,9 +65,11 @@ const IndividualMoment: React.FC = ({ }, []); const scrollTo = (index: number) => { + // TODO: make this dynamic + const offset = isIPhoneX() ? -(AVATAR_DIM + 100) : -(AVATAR_DIM + 160); scrollRef.current?.scrollToIndex({ index: index, - viewOffset: -(AVATAR_DIM + normalize(90)), + viewOffset: offset, }); }; -- cgit v1.2.3-70-g09d2