@@ -6,7 +6,7 @@ import { useSelector } from '@legendapp/state/react';
66import MaskedView from '@react-native-masked-view/masked-view' ;
77import { LinearGradient } from 'expo-linear-gradient' ;
88import { memo , useMemo } from 'react' ;
9- import { View } from 'react-native' ;
9+ import { type StyleProp , TextStyle , View } from 'react-native' ;
1010import Svg , {
1111 Defs ,
1212 RadialGradient as SvgRadialGradient ,
@@ -32,14 +32,22 @@ interface PaintedUsernameProps {
3232 */
3333 userId ?: string ;
3434 fallbackColor ?: string ;
35+ /**
36+ * When false, omits the trailing ":" (e.g. reply preview). Default true for chat lines.
37+ * */
38+ showColon ?: boolean ;
39+ usernameTextStyle ?: StyleProp < TextStyle > ;
3540}
3641
3742function PaintedUsernameComponent ( {
3843 username,
3944 paint : paintProp ,
4045 userId,
4146 fallbackColor = '#FFFFFF' ,
47+ showColon = true ,
48+ usernameTextStyle,
4249} : PaintedUsernameProps ) {
50+ const displayUsername = showColon ? `${ username } :` : username ;
4351 const paintId = useSelector ( ( ) =>
4452 userId ? chatStore$ . userPaintIds [ userId ] ?. get ( ) : null ,
4553 ) ;
@@ -125,7 +133,9 @@ function PaintedUsernameComponent({
125133 </ Svg >
126134 </ View >
127135 { /* Invisible text to size the gradient correctly */ }
128- < Text style = { [ styles . hiddenText , shadowStyle ] } > { username } :</ Text >
136+ < Text style = { [ styles . hiddenText , usernameTextStyle , shadowStyle ] } >
137+ { displayUsername }
138+ </ Text >
129139 </ View >
130140 ) ;
131141 }
@@ -138,8 +148,9 @@ function PaintedUsernameComponent({
138148 end = { gradientConfig . end }
139149 style = { styles . gradient }
140150 >
141- { /* Invisible text to size the gradient correctly */ }
142- < Text style = { [ styles . hiddenText , shadowStyle ] } > { username } :</ Text >
151+ < Text style = { [ styles . hiddenText , usernameTextStyle , shadowStyle ] } >
152+ { displayUsername }
153+ </ Text >
143154 </ LinearGradient >
144155 ) ;
145156 } ;
@@ -148,7 +159,9 @@ function PaintedUsernameComponent({
148159 < MaskedView
149160 maskElement = {
150161 < View style = { styles . maskContainer } >
151- < Text style = { [ styles . maskText , shadowStyle ] } > { username } :</ Text >
162+ < Text style = { [ styles . maskText , usernameTextStyle , shadowStyle ] } >
163+ { displayUsername }
164+ </ Text >
152165 </ View >
153166 }
154167 >
0 commit comments