From 24f79b9cb3456b3901155ed2e4c8fc66710b97b2 Mon Sep 17 00:00:00 2001 From: Ivan Chen Date: Fri, 11 Jun 2021 18:09:57 -0400 Subject: Fix keyboard avoiding for last item, Add comment for scroll to index fail --- src/screens/profile/IndividualMoment.tsx | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/screens/profile/IndividualMoment.tsx b/src/screens/profile/IndividualMoment.tsx index 80438bcd..f8113aba 100644 --- a/src/screens/profile/IndividualMoment.tsx +++ b/src/screens/profile/IndividualMoment.tsx @@ -9,7 +9,12 @@ import {AVATAR_DIM} from '../../constants'; import {MainStackParams} from '../../routes'; import {RootState} from '../../store/rootreducer'; import {MomentPostType} from '../../types'; -import {isIPhoneX, normalize, StatusBarHeight} from '../../utils'; +import { + isIPhoneX, + normalize, + SCREEN_HEIGHT, + StatusBarHeight, +} from '../../utils'; /** * Individual moment view opened when user clicks on a moment tile @@ -92,6 +97,7 @@ const IndividualMoment: React.FC = ({ ( = ({ keyExtractor={(item, _) => item.moment_id} showsVerticalScrollIndicator={false} initialScrollIndex={initialIndex} + onScrollToIndexFailed={() => { + // TODO: code below does not work, index resets to 0 + // const wait = new Promise((resolve) => setTimeout(resolve, 500)); + // wait.then(() => { + // console.log('scrolling to ', initialIndex); + // scrollRef.current?.scrollToIndex({index: initialIndex}); + // }); + }} /> @@ -116,6 +130,9 @@ const styles = StyleSheet.create({ header: { height: normalize(70), }, + listContentContainer: { + paddingBottom: SCREEN_HEIGHT * 0.2, + }, }); export default IndividualMoment; -- cgit v1.2.3-70-g09d2