mirror of
https://github.com/bulwarkmail/native.git
synced 2026-11-02 00:06:23 +00:00
fix: create new groups in the address book being viewed
This commit is contained in:
@@ -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),
|
||||
});
|
||||
}}
|
||||
/>
|
||||
)}
|
||||
|
||||
@@ -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' },
|
||||
]);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user