diff --git a/src/components/bottomsheets/CommentsBottomSheet.js b/src/components/bottomsheets/CommentsBottomSheet.js index c496692..88fbf87 100644 --- a/src/components/bottomsheets/CommentsBottomSheet.js +++ b/src/components/bottomsheets/CommentsBottomSheet.js @@ -3,6 +3,7 @@ import { BottomSheetBackdrop, BottomSheetModal, BottomSheetScrollView, + BottomSheetTextInput, } from '@gorhom/bottom-sheet'; import { BlurView } from 'expo-blur'; import { Image as ExpoImage } from 'expo-image'; @@ -18,7 +19,6 @@ import { Platform, Pressable, Text, - TextInput, View, KeyboardAvoidingView, } from 'react-native'; @@ -86,6 +86,13 @@ const CommentsBottomSheet = () => { const snapPoints = useMemo(() => ['90%'], []); + const INPUT_HEIGHT = 54; + const INPUT_MARGIN_VERTICAL = 12; + const bottomPadding = useMemo( + () => INPUT_HEIGHT + INPUT_MARGIN_VERTICAL + (insets?.bottom || 0) + 12, + [insets?.bottom] + ); + const commentsRef = useMemo(() => { try { return projectId @@ -237,148 +244,152 @@ const CommentsBottomSheet = () => { Commentaires - - { - if (typing) { - try { - scrollRef.current?.scrollToEnd?.({ animated: true }); - } catch {} - } - }} - onScroll={handleScroll} - scrollEventThrottle={100} - contentContainerStyle={{ - paddingHorizontal: 14, - paddingBottom: (insets?.bottom || 0) + 40, - }} - showsVerticalScrollIndicator> - {Array.isArray(comments) && comments.length > 0 ? ( - comments.map((c) => ( - - {c?.profilePicture ? ( - - ) : ( - - )} - - - + { + if (typing) { + try { + scrollRef.current?.scrollToEnd?.({ animated: true }); + } catch {} + } + }} + onScroll={handleScroll} + scrollEventThrottle={100} + contentContainerStyle={{ + paddingHorizontal: 14, + paddingBottom: bottomPadding, + }} + showsVerticalScrollIndicator> + {Array.isArray(comments) && comments.length > 0 ? ( + comments.map((c) => ( + + {c?.profilePicture ? ( + + ) : ( + + )} + + - {c?.userId === currentUID ? 'vous' : c?.userName || ''} - + + {c?.userId === currentUID + ? 'vous' + : c?.userName || ''} + + + • {formatRelativeTime(c?.createdAt)} + + - • {formatRelativeTime(c?.createdAt)} + {c?.text} - - {c?.text} - - - )) - ) : ( - - Aucun commentaire pour le moment - - )} + )) + ) : ( + + Aucun commentaire pour le moment + + )} + - {/* INPUT en bas du contenu */} - - - { - setText(t); - }} - onFocus={() => { - setTyping(true); - setTimeout(() => { - try { - scrollRef.current?.scrollToEnd?.({ animated: true }); - } catch {} - }, 50); - }} - onBlur={() => setTyping(false)} + position: 'absolute', + left: 14, + right: 14, + bottom: (insets?.bottom || 0) + INPUT_MARGIN_VERTICAL, + }}> + - - + { + setText(t); + }} + onFocus={() => { + setTyping(true); + }} + onBlur={() => setTyping(false)} + style={{ + flex: 1, + color: Palette.white, + fontSize: 14, + fontFamily: FONT_FAMILY.InterRegular, + }} /> - - - - + + + + + +