diff --git a/app/(tabs)/chat.tsx b/app/(tabs)/chat.tsx index cca8acb..cc3edc5 100644 --- a/app/(tabs)/chat.tsx +++ b/app/(tabs)/chat.tsx @@ -408,6 +408,7 @@ export default function ChatScreen() { timestamp: new Date(), }, ]); + const [sortNewestFirst, setSortNewestFirst] = useState(false); // Voice call state (local connecting state only) const [isConnectingVoice, setIsConnectingVoice] = useState(false); @@ -765,7 +766,17 @@ export default function ChatScreen() { setSortNewestFirst(prev => !prev)} + > + + + { Alert.alert( 'Clear Chat', @@ -857,12 +868,16 @@ export default function ChatScreen() { > item.id} renderItem={renderMessage} contentContainerStyle={styles.messagesList} showsVerticalScrollIndicator={false} - onContentSizeChange={() => flatListRef.current?.scrollToEnd({ animated: true })} + onContentSizeChange={() => { + if (!sortNewestFirst) { + flatListRef.current?.scrollToEnd({ animated: true }); + } + }} /> {/* Input */} @@ -999,8 +1014,9 @@ const styles = StyleSheet.create({ fontSize: FontSizes.sm, color: AppColors.success, }, - eraseButton: { + headerButton: { padding: Spacing.xs, + marginLeft: Spacing.sm, }, chatContainer: { flex: 1,