diff options
author | Ivan Chen <ivan@tagg.id> | 2021-06-11 16:35:31 -0400 |
---|---|---|
committer | Ivan Chen <ivan@tagg.id> | 2021-06-11 16:35:31 -0400 |
commit | 47b087816844473be858adf766b2f538ecf6d0aa (patch) | |
tree | 931df7ac8406bd16e79f32598f6b9fd5d47437c5 | |
parent | 23c1a0861a6370241fcb73652af99272baff10ae (diff) |
Fix viewoffset
-rw-r--r-- | src/screens/profile/IndividualMoment.tsx | 6 |
1 files changed, 4 insertions, 2 deletions
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<IndividualMomentProps> = ({ }, []); 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, }); }; |