1- import React , { useContext , useState } from 'react'
2- import type { ReactNode } from 'react'
3- import { View , Text , TouchableOpacity , Image } from 'react-native'
4- import Clipboard from '@react-native-clipboard/clipboard'
5- import { ThemeContext , UserContext } from '@flyerhq/react-native-chat-ui'
6- import type { MessageType } from '@flyerhq/react-native-chat-ui'
7- import { useTheme } from '../contexts/ThemeContext'
1+ import React , { useContext , useState } from 'react' ;
2+ import type { ReactNode } from 'react' ;
3+ import { View , Text , TouchableOpacity , Image } from 'react-native' ;
4+ import Clipboard from '@react-native-clipboard/clipboard' ;
5+ import { ThemeContext , UserContext } from '@flyerhq/react-native-chat-ui' ;
6+ import type { MessageType } from '@flyerhq/react-native-chat-ui' ;
7+ import { useTheme } from '../contexts/ThemeContext' ;
88
99export const Bubble = ( {
1010 child,
@@ -13,51 +13,51 @@ export const Bubble = ({
1313 child : ReactNode
1414 message : MessageType . Any
1515} ) => {
16- const { isDark } = useTheme ( )
17- const theme = useContext ( ThemeContext )
18- const user = useContext ( UserContext )
19- const currentUserIsAuthor = user ?. id === message . author . id
16+ const { isDark } = useTheme ( ) ;
17+ const theme = useContext ( ThemeContext ) ;
18+ const user = useContext ( UserContext ) ;
19+ const currentUserIsAuthor = user ?. id === message . author . id ;
2020 const { copyable, timings, completionResult, partialCompletionResult } =
21- message . metadata || { }
21+ message . metadata || { } ;
2222
23- const [ showReasoning , setShowReasoning ] = useState ( false )
24- const [ showToolCalls , setShowToolCalls ] = useState ( false )
23+ const [ showReasoning , setShowReasoning ] = useState ( false ) ;
24+ const [ showToolCalls , setShowToolCalls ] = useState ( false ) ;
2525
26- const Container = copyable ? TouchableOpacity : View
26+ const Container = copyable ? TouchableOpacity : View ;
2727
2828 // Theme-aware colors
29- const overlayBackground = isDark ? 'rgba(255,255,255,0.1)' : 'rgba(0,0,0,0.1)'
29+ const overlayBackground = isDark ? 'rgba(255,255,255,0.1)' : 'rgba(0,0,0,0.1)' ;
3030 const sectionBackground = isDark
3131 ? 'rgba(255,255,255,0.05)'
32- : 'rgba(0,0,0,0.05)'
33- const borderColor = isDark ? 'rgba(255,255,255,0.1)' : 'rgba(0,0,0,0.1)'
32+ : 'rgba(0,0,0,0.05)' ;
33+ const borderColor = isDark ? 'rgba(255,255,255,0.1)' : 'rgba(0,0,0,0.1)' ;
3434 const textColor = ( ( ) => {
3535 if ( currentUserIsAuthor ) {
36- return 'rgba(255,255,255,0.8)'
36+ return 'rgba(255,255,255,0.8)' ;
3737 }
38- return isDark ? 'rgba(255,255,255,0.8)' : 'rgba(0,0,0,0.6)'
39- } ) ( )
38+ return isDark ? 'rgba(255,255,255,0.8)' : 'rgba(0,0,0,0.6)' ;
39+ } ) ( ) ;
4040 const contentTextColor = ( ( ) => {
4141 if ( currentUserIsAuthor ) {
42- return 'rgba(255,255,255,0.9)'
42+ return 'rgba(255,255,255,0.9)' ;
4343 }
44- return isDark ? 'rgba(255,255,255,0.9)' : 'rgba(0,0,0,0.8)'
45- } ) ( )
44+ return isDark ? 'rgba(255,255,255,0.9)' : 'rgba(0,0,0,0.8)' ;
45+ } ) ( ) ;
4646 const toolCallBackground = isDark
4747 ? 'rgba(255,255,255,0.1)'
48- : 'rgba(0,0,0,0.1)'
49- const timingTextColor = isDark ? '#999' : '#ccc'
48+ : 'rgba(0,0,0,0.1)' ;
49+ const timingTextColor = isDark ? '#999' : '#ccc' ;
5050
5151 // Use partial data during streaming, fall back to final result
52- const currentResult = partialCompletionResult || completionResult
53- const hasReasoningContent = currentResult ?. reasoning_content
52+ const currentResult = partialCompletionResult || completionResult ;
53+ const hasReasoningContent = currentResult ?. reasoning_content ;
5454 const hasToolCalls =
55- currentResult ?. tool_calls && currentResult . tool_calls . length > 0
55+ currentResult ?. tool_calls && currentResult . tool_calls . length > 0 ;
5656 // Check if we're in a streaming state (partial data available but no final content yet)
5757 const isStreamingReasoning =
58- partialCompletionResult && partialCompletionResult ?. reasoning_content
58+ partialCompletionResult && partialCompletionResult ?. reasoning_content ;
5959 const isStreamingToolCalls =
60- partialCompletionResult && partialCompletionResult ?. tool_calls
60+ partialCompletionResult && partialCompletionResult ?. tool_calls ;
6161
6262 return (
6363 < Container
@@ -77,8 +77,8 @@ export const Bubble = ({
7777 overflow : 'hidden' ,
7878 } }
7979 onPress = { ( ) => {
80- if ( message . type !== 'text' ) return
81- Clipboard . setString ( message . text )
80+ if ( message . type !== 'text' ) { return ; }
81+ Clipboard . setString ( message . text ) ;
8282 } }
8383 >
8484 { /* Show toggle button for reasoning if available */ }
@@ -229,5 +229,5 @@ export const Bubble = ({
229229 </ Text >
230230 ) }
231231 </ Container >
232- )
233- }
232+ ) ;
233+ } ;
0 commit comments