diff --git a/.vscode/settings.json b/.vscode/settings.json index d99304c..d0e96bc 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,5 +1,5 @@ { - "editor.formatOnSave": false, + "editor.formatOnSave": true, "editor.codeActionsOnSave": { "source.organizeImports": "explicit" }, diff --git a/src/screens/CreateGroupScreen.tsx b/src/screens/CreateGroupScreen.tsx index 1393910..ff7998f 100644 --- a/src/screens/CreateGroupScreen.tsx +++ b/src/screens/CreateGroupScreen.tsx @@ -82,31 +82,45 @@ const useData = () => { }; }; -const VerticalListItem: FC<{item: Contact; index: number; section: any;}> = ({ +const VerticalListItem: FC<{item: Contact; index: number; section: any}> = ({ item, index, - section + section, }) => { const {avatarUrl, displayName} = useContactInfo(item.address); const handlePress = () => section.onPress(item); return ( - + - + - + {displayName ?? formatAddress(item.address)} - + {formatAddress(item.address)} @@ -116,24 +130,32 @@ const VerticalListItem: FC<{item: Contact; index: number; section: any;}> = ({ ); }; -const HorizontalListItem: FC<{item: Contact; index: number; section: any;}> = ({ +const HorizontalListItem: FC<{item: Contact; index: number; section: any}> = ({ item, index, - section + section, }) => { const {avatarUrl, displayName} = useContactInfo(item.address); const handlePress = () => section.onPress(item); return ( - + - + {displayName ?? formatAddress(item.address)} @@ -153,13 +175,12 @@ const ListItem: FC<{ index: number; horizontal?: boolean; }> = ({item, index, section, horizontal}) => { - return horizontal ? ( - - ) : ( - - ); - }; - + return horizontal ? ( + + ) : ( + + ); +}; export const CreateGroupScreen = () => { const {goBack, navigate} = useTypedNavigation(); @@ -179,7 +200,9 @@ export const CreateGroupScreen = () => { const onGroupStart = useCallback(async () => { setErrorString(null); - const participantAddresses = participants.map(participant => participant.address); + const participantAddresses = participants.map( + participant => participant.address, + ); const canMessage = await client?.canGroupMessage(participantAddresses); for (const address of participantAddresses) { if (!canMessage?.[address.toLowerCase()]) { @@ -250,34 +273,25 @@ export const CreateGroupScreen = () => { ]; }, [recents, contacts, isValidAddress, ensAddress, searchText]); -const renderItem = ({horizontal = false}: {horizontal?: boolean} = {}): - SectionListRenderItem => ({ - item, - section, - index, - ...rest - }) => { - return ( - - ); - }; - - const removeParticipant = useCallback( - (address: string) => { - setErrorString(null); - setParticipants(prev => prev.filter(it => it !== address)); - }, - [setParticipants], - ); + const renderItem = + ({horizontal = false}: {horizontal?: boolean} = {}): SectionListRenderItem< + Contact, + {title: string; data: Contact[]} + > => + ({item, section, index, ...rest}) => { + return ( + + ); + }; return ( 0)}> 0 ? "text-sm/semibold" : "text-sm/regular"} - textAlign={'right'} - > + typography={ + participants.length > 0 ? 'text-sm/semibold' : 'text-sm/regular' + } + textAlign={'right'}> {translate('create_group')} @@ -365,7 +380,7 @@ const renderItem = ({horizontal = false}: {horizontal?: boolean} = {}): horizontal={true} sections={[{title: '', data: participants}]} renderItem={renderItem({horizontal: true})} - /> + />