diff --git a/src/components/contacts/ContactsSidebarDrawer.tsx b/src/components/contacts/ContactsSidebarDrawer.tsx index 91821da2..c6254ba1 100644 --- a/src/components/contacts/ContactsSidebarDrawer.tsx +++ b/src/components/contacts/ContactsSidebarDrawer.tsx @@ -11,7 +11,9 @@ import { import type { RootStackParamList } from '../../navigation/types'; import type { AddressBook } from '../../api/types'; import type { ContactCategory } from '../../stores/contacts-store'; -import { useContactsStore, selectGroupMembers, selectUncategorized } from '../../stores/contacts-store'; +import { + useContactsStore, selectCreateTargetBookId, selectGroupMembers, selectUncategorized, +} from '../../stores/contacts-store'; import { getContactDisplayName, getContactKeywords, isGroup } from '../../lib/contact-utils'; import { spacing, radius, typography, componentSizes, type ThemePalette } from '../../theme/tokens'; import { useColors } from '../../theme/colors'; @@ -223,7 +225,11 @@ export default function ContactsSidebarDrawer({ visible, onClose }: Props) { muted onPress={() => { onClose(); - navigation.navigate('ContactForm', { asGroup: true }); + // Into the address book being viewed, like a new contact. + navigation.navigate('ContactForm', { + asGroup: true, + addressBookId: selectCreateTargetBookId(selectedCategory, addressBooks), + }); }} /> )} diff --git a/src/screens/ContactsScreen.tsx b/src/screens/ContactsScreen.tsx index b98b5d52..a2983067 100644 --- a/src/screens/ContactsScreen.tsx +++ b/src/screens/ContactsScreen.tsx @@ -251,7 +251,8 @@ export default function ContactsScreen() { } }; - // A new contact lands in the address book being viewed, not the default one. + // A new contact or group lands in the address book being viewed, not the + // default one. const createBookId = React.useMemo( () => selectCreateTargetBookId(selectedCategory, addressBooks), [selectedCategory, addressBooks], @@ -260,7 +261,7 @@ export default function ContactsScreen() { const openNewMenu = () => { Alert.alert('Create', undefined, [ { text: 'New contact', onPress: () => navigation.navigate('ContactForm', { addressBookId: createBookId }) }, - { text: 'New group', onPress: () => navigation.navigate('ContactForm', { asGroup: true }) }, + { text: 'New group', onPress: () => navigation.navigate('ContactForm', { asGroup: true, addressBookId: createBookId }) }, { text: 'Cancel', style: 'cancel' }, ]); };