diff options
Diffstat (limited to 'src/components')
-rw-r--r-- | src/components/moments/MomentPostContent.tsx | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/components/moments/MomentPostContent.tsx b/src/components/moments/MomentPostContent.tsx index eb89fd03..da04211f 100644 --- a/src/components/moments/MomentPostContent.tsx +++ b/src/components/moments/MomentPostContent.tsx @@ -49,7 +49,8 @@ const MomentPostContent: React.FC<MomentPostContentProps> = ({ ); const [commentPreview, setCommentPreview] = useState<MomentCommentPreviewType | null>(moment.comment_preview); - const {keyboardVisible, setScrollToTargetIndex} = useContext(MomentContext); + const {keyboardVisible, currentScrollToIndex, scrollTo} = + useContext(MomentContext); useEffect(() => { setTags(momentTags); @@ -96,7 +97,7 @@ const MomentPostContent: React.FC<MomentPostContentProps> = ({ /> </Animated.View> )} - {!keyboardVisible && ( + {(!keyboardVisible || currentScrollToIndex !== index) && ( <> {moment.caption !== '' && renderTextWithMentions({ @@ -129,7 +130,7 @@ const MomentPostContent: React.FC<MomentPostContentProps> = ({ comment: message, }) } - onFocus={() => setScrollToTargetIndex(index)} + onFocus={() => scrollTo(index)} theme={'dark'} /> <Text style={styles.text}>{getTimePosted(moment.date_created)}</Text> |