@@ -84,10 +84,22 @@ const GroupSettingsScreen = ({ route, navigation }) => {
8484 if ( ! isAdmin ) return ;
8585 const updates = { } ;
8686 if ( name && name !== group ?. name ) updates . name = name ;
87- // Prefer picked image (base64 -> data URL). If none, ignore unless we had previous URL change via choices.
87+
88+ // Handle different icon types
8889 if ( pickedImage ?. base64 ) {
90+ // If user picked an image, use it as imageUrl
8991 updates . imageUrl = `data:image/jpeg;base64,${ pickedImage . base64 } ` ;
92+ } else if ( icon && icon !== ( group ?. imageUrl || group ?. icon || "" ) ) {
93+ // If user selected an emoji and it's different from current
94+ // Check if it's an emoji (not a URL)
95+ const isEmoji = ICON_CHOICES . includes ( icon ) ;
96+ if ( isEmoji ) {
97+ updates . imageUrl = icon ; // Store emoji as imageUrl for now
98+ } else {
99+ updates . imageUrl = icon ; // Store other text/URL as imageUrl
100+ }
90101 }
102+
91103 if ( Object . keys ( updates ) . length === 0 )
92104 return Alert . alert ( "Nothing to update" ) ;
93105 try {
@@ -320,12 +332,20 @@ const GroupSettingsScreen = ({ route, navigation }) => {
320332 >
321333 { pickedImage ? "Change Image" : "Upload Image" }
322334 </ Button >
323- { ( pickedImage ?. uri || group ?. imageUrl ) && (
335+ { pickedImage ?. uri ? (
324336 < Image
325- source = { { uri : pickedImage ? .uri || group ?. imageUrl } }
337+ source = { { uri : pickedImage . uri } }
326338 style = { { width : 48 , height : 48 , borderRadius : 24 } }
327339 />
328- ) }
340+ ) : group ?. imageUrl &&
341+ / ^ ( h t t p s ? : | d a t a : i m a g e ) / . test ( group . imageUrl ) ? (
342+ < Image
343+ source = { { uri : group . imageUrl } }
344+ style = { { width : 48 , height : 48 , borderRadius : 24 } }
345+ />
346+ ) : group ?. imageUrl ? (
347+ < Text style = { { fontSize : 32 } } > { group . imageUrl } </ Text >
348+ ) : null }
329349 </ View >
330350 { isAdmin && (
331351 < Button
0 commit comments