@planningcenter/chat-react-native 3.23.0 → 3.24.0-rc.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/components/display/toggle_button.d.ts +11 -4
- package/build/components/display/toggle_button.d.ts.map +1 -1
- package/build/components/display/toggle_button.js +6 -5
- package/build/components/display/toggle_button.js.map +1 -1
- package/build/screens/conversations/components/list_header_component.d.ts.map +1 -1
- package/build/screens/conversations/components/list_header_component.js +36 -18
- package/build/screens/conversations/components/list_header_component.js.map +1 -1
- package/package.json +2 -2
- package/src/components/display/toggle_button.tsx +27 -15
- package/src/screens/conversations/components/list_header_component.tsx +83 -60
|
@@ -4,9 +4,15 @@ import { IconString } from './icon';
|
|
|
4
4
|
type RestrictedPressableProps = Omit<PressableProps, 'onLongPress'>;
|
|
5
5
|
export interface ToggleButtonProps extends RestrictedPressableProps {
|
|
6
6
|
/**
|
|
7
|
-
*
|
|
7
|
+
* Whether the toggle button is active/checked
|
|
8
8
|
*/
|
|
9
9
|
active: boolean;
|
|
10
|
+
/**
|
|
11
|
+
* Required accessibility label for screen readers.
|
|
12
|
+
* When title is provided, this provides additional context.
|
|
13
|
+
* When title is omitted (icon-only mode), this is the primary label.
|
|
14
|
+
*/
|
|
15
|
+
accessibilityLabel: string;
|
|
10
16
|
/**
|
|
11
17
|
* Specifies whether fonts should be scaled down automatically to fit given style constraints.
|
|
12
18
|
*/
|
|
@@ -32,9 +38,10 @@ export interface ToggleButtonProps extends RestrictedPressableProps {
|
|
|
32
38
|
*/
|
|
33
39
|
minimumFontScale?: number;
|
|
34
40
|
/**
|
|
35
|
-
* Renders as text within the button
|
|
41
|
+
* Renders as text within the button.
|
|
42
|
+
* When omitted, button displays in icon-only mode.
|
|
36
43
|
*/
|
|
37
|
-
title
|
|
44
|
+
title?: string;
|
|
38
45
|
/**
|
|
39
46
|
* Pressable container styles
|
|
40
47
|
*/
|
|
@@ -44,6 +51,6 @@ export interface ToggleButtonProps extends RestrictedPressableProps {
|
|
|
44
51
|
*/
|
|
45
52
|
hapticFeedback?: boolean;
|
|
46
53
|
}
|
|
47
|
-
export declare function ToggleButton({ active, adjustsFontSizeToFit, allowFontScaling, iconNameLeft, iconNameRight, maxFontSizeMultiplier, minimumFontScale, title, style, hapticFeedback, onPress, ...props }: ToggleButtonProps): React.JSX.Element;
|
|
54
|
+
export declare function ToggleButton({ active, accessibilityLabel, adjustsFontSizeToFit, allowFontScaling, iconNameLeft, iconNameRight, maxFontSizeMultiplier, minimumFontScale, title, style, hapticFeedback, onPress, ...props }: ToggleButtonProps): React.JSX.Element;
|
|
48
55
|
export {};
|
|
49
56
|
//# sourceMappingURL=toggle_button.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"toggle_button.d.ts","sourceRoot":"","sources":["../../../src/components/display/toggle_button.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,OAAO,KAAK,EAAE,cAAc,EAAyB,MAAM,cAAc,CAAA;AAazE,OAAO,EAAQ,UAAU,EAAE,MAAM,QAAQ,CAAA;AAWzC,KAAK,wBAAwB,GAAG,IAAI,CAAC,cAAc,EAAE,aAAa,CAAC,CAAA;AAMnE,MAAM,WAAW,iBAAkB,SAAQ,wBAAwB;IACjE;;OAEG;IACH,MAAM,EAAE,OAAO,CAAA;IACf;;OAEG;IACH,oBAAoB,CAAC,EAAE,OAAO,CAAA;IAC9B;;OAEG;IACH,gBAAgB,CAAC,EAAE,OAAO,CAAA;IAC1B;;OAEG;IACH,YAAY,CAAC,EAAE,UAAU,CAAA;IACzB;;OAEG;IACH,aAAa,CAAC,EAAE,UAAU,CAAA;IAC1B;;OAEG;IACH,qBAAqB,CAAC,EAAE,MAAM,CAAA;IAC9B;;OAEG;IACH,gBAAgB,CAAC,EAAE,MAAM,CAAA;IACzB
|
|
1
|
+
{"version":3,"file":"toggle_button.d.ts","sourceRoot":"","sources":["../../../src/components/display/toggle_button.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,OAAO,KAAK,EAAE,cAAc,EAAyB,MAAM,cAAc,CAAA;AAazE,OAAO,EAAQ,UAAU,EAAE,MAAM,QAAQ,CAAA;AAWzC,KAAK,wBAAwB,GAAG,IAAI,CAAC,cAAc,EAAE,aAAa,CAAC,CAAA;AAMnE,MAAM,WAAW,iBAAkB,SAAQ,wBAAwB;IACjE;;OAEG;IACH,MAAM,EAAE,OAAO,CAAA;IACf;;;;OAIG;IACH,kBAAkB,EAAE,MAAM,CAAA;IAC1B;;OAEG;IACH,oBAAoB,CAAC,EAAE,OAAO,CAAA;IAC9B;;OAEG;IACH,gBAAgB,CAAC,EAAE,OAAO,CAAA;IAC1B;;OAEG;IACH,YAAY,CAAC,EAAE,UAAU,CAAA;IACzB;;OAEG;IACH,aAAa,CAAC,EAAE,UAAU,CAAA;IAC1B;;OAEG;IACH,qBAAqB,CAAC,EAAE,MAAM,CAAA;IAC9B;;OAEG;IACH,gBAAgB,CAAC,EAAE,MAAM,CAAA;IACzB;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,CAAA;IACd;;OAEG;IACH,KAAK,CAAC,EAAE,cAAc,CAAC,OAAO,CAAC,CAAA;IAC/B;;OAEG;IACH,cAAc,CAAC,EAAE,OAAO,CAAA;CACzB;AAED,wBAAgB,YAAY,CAAC,EAC3B,MAAM,EACN,kBAAkB,EAClB,oBAA4B,EAC5B,gBAAuB,EACvB,YAAY,EACZ,aAAa,EACb,qBAAyD,EACzD,gBAAgB,EAChB,KAAK,EACL,KAAK,EACL,cAAqB,EACrB,OAAO,EACP,GAAG,KAAK,EACT,EAAE,iBAAiB,qBA4DnB"}
|
|
@@ -6,7 +6,8 @@ import { MAX_FONT_SIZE_MULTIPLIER_LANDMARK, platformFontWeightBold, platformPres
|
|
|
6
6
|
import { Icon } from './icon';
|
|
7
7
|
import { tokens } from '../../vendor/tapestry/tokens';
|
|
8
8
|
import { Haptic } from '../../utils/native_adapters/configuration';
|
|
9
|
-
export function ToggleButton({ active, adjustsFontSizeToFit = false, allowFontScaling = true, iconNameLeft, iconNameRight, maxFontSizeMultiplier = MAX_FONT_SIZE_MULTIPLIER_LANDMARK, minimumFontScale, title, style, hapticFeedback = true, onPress, ...props }) {
|
|
9
|
+
export function ToggleButton({ active, accessibilityLabel, adjustsFontSizeToFit = false, allowFontScaling = true, iconNameLeft, iconNameRight, maxFontSizeMultiplier = MAX_FONT_SIZE_MULTIPLIER_LANDMARK, minimumFontScale, title, style, hapticFeedback = true, onPress, ...props }) {
|
|
10
|
+
const hasTitle = Boolean(title);
|
|
10
11
|
const styles = useStyles({ active, maxFontSizeMultiplier });
|
|
11
12
|
const { colors } = useTheme();
|
|
12
13
|
const overrideStyles = StyleSheet.flatten(style); // Ensures the pressed styles still get applied
|
|
@@ -21,11 +22,11 @@ export function ToggleButton({ active, adjustsFontSizeToFit = false, allowFontSc
|
|
|
21
22
|
...styles.pressable,
|
|
22
23
|
...(pressed ? platformPressedOpacityStyle : null),
|
|
23
24
|
...overrideStyles,
|
|
24
|
-
})} accessibilityRole="togglebutton" accessibilityState={{ checked: active }} android_ripple={{ color: androidRippleColor, borderless: false, foreground: true }} onPress={handlePress} accessibilityShowsLargeContentViewer accessibilityLargeContentTitle={
|
|
25
|
+
})} accessibilityRole="togglebutton" accessibilityLabel={accessibilityLabel} accessibilityState={{ checked: active }} android_ripple={{ color: androidRippleColor, borderless: false, foreground: true }} onPress={handlePress} accessibilityShowsLargeContentViewer accessibilityLargeContentTitle={accessibilityLabel} {...props}>
|
|
25
26
|
{iconNameLeft && (<Icon name={iconNameLeft} style={styles.icon} maxFontSizeMultiplier={maxFontSizeMultiplier}/>)}
|
|
26
|
-
<Text allowFontScaling={allowFontScaling} minimumFontScale={minimumFontScale} maxFontSizeMultiplier={maxFontSizeMultiplier} adjustsFontSizeToFit={adjustsFontSizeToFit} numberOfLines={1} style={styles.text} variant="tertiary">
|
|
27
|
-
|
|
28
|
-
|
|
27
|
+
{hasTitle && (<Text allowFontScaling={allowFontScaling} minimumFontScale={minimumFontScale} maxFontSizeMultiplier={maxFontSizeMultiplier} adjustsFontSizeToFit={adjustsFontSizeToFit} numberOfLines={1} style={styles.text} variant="tertiary">
|
|
28
|
+
{title}
|
|
29
|
+
</Text>)}
|
|
29
30
|
{iconNameRight && (<Icon name={iconNameRight} style={styles.icon} maxFontSizeMultiplier={maxFontSizeMultiplier}/>)}
|
|
30
31
|
</Pressable>);
|
|
31
32
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"toggle_button.js","sourceRoot":"","sources":["../../../src/components/display/toggle_button.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;AAEpD,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAA;AAC7B,OAAO,EACL,QAAQ,EACR,YAAY,EACZ,2BAA2B,EAC3B,kCAAkC,GACnC,MAAM,aAAa,CAAA;AACpB,OAAO,EACL,iCAAiC,EACjC,sBAAsB,EACtB,2BAA2B,GAC5B,MAAM,aAAa,CAAA;AACpB,OAAO,EAAE,IAAI,EAAc,MAAM,QAAQ,CAAA;AACzC,OAAO,EAAE,MAAM,EAAE,MAAM,8BAA8B,CAAA;AACrD,OAAO,EAAE,MAAM,EAAE,MAAM,2CAA2C,CAAA;
|
|
1
|
+
{"version":3,"file":"toggle_button.js","sourceRoot":"","sources":["../../../src/components/display/toggle_button.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;AAEpD,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAA;AAC7B,OAAO,EACL,QAAQ,EACR,YAAY,EACZ,2BAA2B,EAC3B,kCAAkC,GACnC,MAAM,aAAa,CAAA;AACpB,OAAO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sourcesContent":["import React from 'react'\nimport { Pressable, StyleSheet } from 'react-native'\nimport type { PressableProps, GestureResponderEvent } from 'react-native'\nimport { Text } from './text'\nimport {\n useTheme,\n useFontScale,\n useCreateAndroidRippleColor,\n useInteractionGhostBackgroundColor,\n} from '../../hooks'\nimport {\n MAX_FONT_SIZE_MULTIPLIER_LANDMARK,\n platformFontWeightBold,\n platformPressedOpacityStyle,\n} from '../../utils'\nimport { Icon, IconString } from './icon'\nimport { tokens } from '../../vendor/tapestry/tokens'\nimport { Haptic } from '../../utils/native_adapters/configuration'\n\n// =================================\n// ====== Constants ================\n// =================================\n\n// We are omitting `onLongPress` because we are instead supporting `accessibilityShowsLargeContentViewer`.\n// This is triggered by an `onLongPress` event when an iOS device is in Apple's accessible font scale range.\n// Triggering this prop will display an almost full screen iOS a11y button.\ntype RestrictedPressableProps = Omit<PressableProps, 'onLongPress'>\n\n// =================================\n// ====== Component ================\n// =================================\n\nexport interface ToggleButtonProps extends RestrictedPressableProps {\n /**\n * Whether the toggle button is active/checked\n */\n active: boolean\n /**\n * Required accessibility label for screen readers.\n * When title is provided, this provides additional context.\n * When title is omitted (icon-only mode), this is the primary label.\n */\n accessibilityLabel: string\n /**\n * Specifies whether fonts should be scaled down automatically to fit given style constraints.\n */\n adjustsFontSizeToFit?: boolean\n /**\n * Specifies whether fonts should scale to respect the device's text size accessibility settings. The default is true.\n */\n allowFontScaling?: boolean\n /**\n * Generates an icon to the left of the button text\n */\n iconNameLeft?: IconString\n /**\n * Generates an icon to the right of the button text\n */\n iconNameRight?: IconString\n /**\n * Specifies the maximum size a font can reach when allowFontScaling is enabled.\n */\n maxFontSizeMultiplier?: number\n /**\n * Specifies smallest possible scale a font can reach when adjustsFontSizeToFit is enabled. (values 0.01-1.0).\n */\n minimumFontScale?: number\n /**\n * Renders as text within the button.\n * When omitted, button displays in icon-only mode.\n */\n title?: string\n /**\n * Pressable container styles\n */\n style?: PressableProps['style']\n /**\n * Specifies whether haptic feedback should be enabled.\n */\n hapticFeedback?: boolean\n}\n\nexport function ToggleButton({\n active,\n accessibilityLabel,\n adjustsFontSizeToFit = false,\n allowFontScaling = true,\n iconNameLeft,\n iconNameRight,\n maxFontSizeMultiplier = MAX_FONT_SIZE_MULTIPLIER_LANDMARK,\n minimumFontScale,\n title,\n style,\n hapticFeedback = true,\n onPress,\n ...props\n}: ToggleButtonProps) {\n const hasTitle = Boolean(title)\n const styles = useStyles({ active, maxFontSizeMultiplier })\n const { colors } = useTheme()\n const overrideStyles = StyleSheet.flatten(style) // Ensures the pressed styles still get applied\n\n const baseRippleColor = active ? colors.interaction : colors.fillColorNeutral050Base\n const androidRippleColor = useCreateAndroidRippleColor({ color: baseRippleColor })\n\n const handlePress = (event: GestureResponderEvent) => {\n if (hapticFeedback) Haptic.impactLight()\n\n onPress?.(event)\n }\n\n return (\n <Pressable\n style={({ pressed }) => ({\n ...styles.pressable,\n ...(pressed ? platformPressedOpacityStyle : null),\n ...overrideStyles,\n })}\n accessibilityRole=\"togglebutton\"\n accessibilityLabel={accessibilityLabel}\n accessibilityState={{ checked: active }}\n android_ripple={{ color: androidRippleColor, borderless: false, foreground: true }}\n onPress={handlePress}\n accessibilityShowsLargeContentViewer\n accessibilityLargeContentTitle={accessibilityLabel}\n {...props}\n >\n {iconNameLeft && (\n <Icon\n name={iconNameLeft}\n style={styles.icon}\n maxFontSizeMultiplier={maxFontSizeMultiplier}\n />\n )}\n {hasTitle && (\n <Text\n allowFontScaling={allowFontScaling}\n minimumFontScale={minimumFontScale}\n maxFontSizeMultiplier={maxFontSizeMultiplier}\n adjustsFontSizeToFit={adjustsFontSizeToFit}\n numberOfLines={1}\n style={styles.text}\n variant=\"tertiary\"\n >\n {title}\n </Text>\n )}\n {iconNameRight && (\n <Icon\n name={iconNameRight}\n style={styles.icon}\n maxFontSizeMultiplier={maxFontSizeMultiplier}\n />\n )}\n </Pressable>\n )\n}\n\n// =================================\n// ====== Styles ===================\n// =================================\n\nconst useStyles = ({ active, maxFontSizeMultiplier }: Partial<ToggleButtonProps>) => {\n const { colors, button } = useTheme()\n const fontScale = useFontScale({ maxFontSizeMultiplier })\n\n const activeBackgroundColor = useInteractionGhostBackgroundColor()\n\n const color = active ? colors.interaction : colors.textColorDefaultSecondary\n\n return StyleSheet.create({\n pressable: {\n borderRadius: button.borderRadius * fontScale,\n borderWidth: 1,\n borderColor: active ? colors.interaction : colors.borderColorDefaultBase,\n backgroundColor: active ? activeBackgroundColor : 'transparent',\n paddingHorizontal: 16 * fontScale,\n flexDirection: 'row',\n alignItems: 'center',\n justifyContent: 'center',\n height: 32 * fontScale,\n gap: 6 * fontScale,\n overflow: 'hidden',\n },\n text: {\n textAlign: 'center',\n textAlignVertical: 'center',\n includeFontPadding: false,\n fontWeight: platformFontWeightBold,\n color,\n },\n icon: {\n fontSize: tokens.fontSizeSm * fontScale,\n color,\n },\n })\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"list_header_component.d.ts","sourceRoot":"","sources":["../../../../src/screens/conversations/components/list_header_component.tsx"],"names":[],"mappings":"AACA,OAAO,KAA+B,MAAM,OAAO,CAAA;AAuBnD,eAAO,MAAM,mBAAmB,
|
|
1
|
+
{"version":3,"file":"list_header_component.d.ts","sourceRoot":"","sources":["../../../../src/screens/conversations/components/list_header_component.tsx"],"names":[],"mappings":"AACA,OAAO,KAA+B,MAAM,OAAO,CAAA;AAuBnD,eAAO,MAAM,mBAAmB,yBAmK/B,CAAA"}
|
|
@@ -20,7 +20,6 @@ var FilterTypes;
|
|
|
20
20
|
FilterTypes["More"] = "More";
|
|
21
21
|
})(FilterTypes || (FilterTypes = {}));
|
|
22
22
|
export const ListHeaderComponent = () => {
|
|
23
|
-
const styles = useStyles();
|
|
24
23
|
const navigation = useNavigation();
|
|
25
24
|
const canFilterByTeams = useCanDisplayGroups({ source_app_name: 'Services', source_type: 'Team' });
|
|
26
25
|
const canFilterByGroups = useCanDisplayGroups({ source_app_name: 'Groups', source_type: 'Group' });
|
|
@@ -53,6 +52,12 @@ export const ListHeaderComponent = () => {
|
|
|
53
52
|
const handleGetHelp = useCallback(() => {
|
|
54
53
|
navigation.navigate('GetHelp', { type: 'chat' });
|
|
55
54
|
}, [navigation]);
|
|
55
|
+
const handleOpenConversationFilters = useCallback(() => {
|
|
56
|
+
navigation.navigate('ConversationFilters', {
|
|
57
|
+
chat_group_graph_id,
|
|
58
|
+
group_source_app_name,
|
|
59
|
+
});
|
|
60
|
+
}, [navigation, chat_group_graph_id, group_source_app_name]);
|
|
56
61
|
const handleMarkAllRead = useCallback(() => {
|
|
57
62
|
currentPersonCache.update({ unreadCount: 0 });
|
|
58
63
|
Haptic.notificationSuccess();
|
|
@@ -66,7 +71,19 @@ export const ListHeaderComponent = () => {
|
|
|
66
71
|
{ text: 'OK', onPress: () => handleMarkAllRead() },
|
|
67
72
|
]);
|
|
68
73
|
}, [active, handleMarkAllRead]);
|
|
69
|
-
const
|
|
74
|
+
const hasSomeSourceFilterCapability = canFilterByTeams || canFilterByGroups;
|
|
75
|
+
const hasMultiSourceFilterCapabilities = canFilterByTeams && canFilterByGroups;
|
|
76
|
+
const shouldShowHeaderFiltersButton = hasSomeSourceFilterCapability && !hasMultiSourceFilterCapabilities;
|
|
77
|
+
const moreFiltersButtonA11yLabel = shouldShowHeaderFiltersButton
|
|
78
|
+
? 'View filters'
|
|
79
|
+
: 'View more filters';
|
|
80
|
+
const moreFiltersButtonProps = {
|
|
81
|
+
onPress: handleOpenConversationFilters,
|
|
82
|
+
active: active === FilterTypes.More,
|
|
83
|
+
iconNameRight: 'general.threeReducingHorizontalBars',
|
|
84
|
+
accessibilityLabel: moreFiltersButtonA11yLabel,
|
|
85
|
+
};
|
|
86
|
+
const styles = useStyles({ shouldShowHeaderFiltersButton });
|
|
70
87
|
return (<View style={styles.listHeader}>
|
|
71
88
|
<View style={styles.headingRow}>
|
|
72
89
|
<View style={styles.titleContainer}>
|
|
@@ -80,35 +97,31 @@ export const ListHeaderComponent = () => {
|
|
|
80
97
|
<View style={styles.actionsContainer}>
|
|
81
98
|
{canCreateConversations && (<ListHeaderActionButton name="churchCenter.signups" onPress={handleNewConversationNavigation} accessibilityLabel="New conversation" testID="conversations-new-conversation-button" maxFontSizeMultiplier={MAX_FONT_SIZE_MULTIPLIER_LANDMARK}/>)}
|
|
82
99
|
{appName !== 'services' && (<ListHeaderActionButton name="general.outlinedInfoCircle" onPress={handleGetHelp} accessibilityLabel="Get help" maxFontSizeMultiplier={MAX_FONT_SIZE_MULTIPLIER_LANDMARK}/>)}
|
|
100
|
+
{shouldShowHeaderFiltersButton && <ToggleButton {...moreFiltersButtonProps}/>}
|
|
83
101
|
</View>
|
|
84
102
|
</View>
|
|
85
|
-
<ScrollView horizontal showsHorizontalScrollIndicator={false} contentContainerStyle={styles.filterRow} accessibilityRole="toolbar">
|
|
86
|
-
|
|
87
|
-
<ToggleButton title={FilterTypes.All} active={active === FilterTypes.All} onPress={() => navigation.setParams({
|
|
103
|
+
{hasMultiSourceFilterCapabilities && (<ScrollView horizontal showsHorizontalScrollIndicator={false} contentContainerStyle={styles.filterRow} accessibilityRole="toolbar">
|
|
104
|
+
<ToggleButton title={FilterTypes.All} active={active === FilterTypes.All} onPress={() => navigation.setParams({
|
|
88
105
|
chat_group_graph_id: undefined,
|
|
89
106
|
group_source_app_name: undefined,
|
|
90
|
-
})} accessibilityLabel="Show all conversations"/>
|
|
91
|
-
|
|
107
|
+
})} accessibilityLabel="Show all conversations" style={styles.filterButton}/>
|
|
108
|
+
<ToggleButton title={FilterTypes.Groups} active={active === FilterTypes.Groups} onPress={() => navigation.setParams({
|
|
92
109
|
chat_group_graph_id: undefined,
|
|
93
110
|
group_source_app_name: 'Groups',
|
|
94
|
-
})} accessibilityLabel="Filter to group conversations"/>
|
|
111
|
+
})} accessibilityLabel="Filter to group conversations" style={styles.filterButton}/>
|
|
95
112
|
|
|
96
|
-
|
|
113
|
+
<ToggleButton title={FilterTypes.Teams} active={active === FilterTypes.Teams} onPress={() => navigation.setParams({
|
|
97
114
|
chat_group_graph_id: undefined,
|
|
98
115
|
group_source_app_name: 'Services',
|
|
99
|
-
})} accessibilityLabel="Filter to team conversations"/>
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
chat_group_graph_id,
|
|
103
|
-
group_source_app_name,
|
|
104
|
-
})} active={active === FilterTypes.More} iconNameRight="general.threeReducingHorizontalBars" accessibilityLabel={showAppFilters ? 'View all filters' : 'View more filters'}/>
|
|
105
|
-
</ScrollView>
|
|
116
|
+
})} accessibilityLabel="Filter to team conversations" style={styles.filterButton}/>
|
|
117
|
+
<ToggleButton {...moreFiltersButtonProps}/>
|
|
118
|
+
</ScrollView>)}
|
|
106
119
|
<ChatGroupBadge rowPaddingHorizontal={ROW_PADDING_HORIZONTAL}/>
|
|
107
120
|
</View>);
|
|
108
121
|
};
|
|
109
|
-
const useStyles = () => {
|
|
122
|
+
const useStyles = ({ shouldShowHeaderFiltersButton, }) => {
|
|
110
123
|
const theme = useTheme();
|
|
111
|
-
const atFontScaleBreakpoint = useAtFontScaleBreakpoint();
|
|
124
|
+
const atFontScaleBreakpoint = useAtFontScaleBreakpoint(shouldShowHeaderFiltersButton ? 1.2 : undefined);
|
|
112
125
|
return StyleSheet.create({
|
|
113
126
|
listHeader: {
|
|
114
127
|
borderBottomWidth: 1,
|
|
@@ -140,6 +153,11 @@ const useStyles = () => {
|
|
|
140
153
|
justifyContent: 'flex-start',
|
|
141
154
|
gap: 8,
|
|
142
155
|
paddingHorizontal: ROW_PADDING_HORIZONTAL,
|
|
156
|
+
flexGrow: 1,
|
|
157
|
+
},
|
|
158
|
+
filterButton: {
|
|
159
|
+
flex: 1,
|
|
160
|
+
minWidth: 65,
|
|
143
161
|
},
|
|
144
162
|
});
|
|
145
163
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"list_header_component.js","sourceRoot":"","sources":["../../../../src/screens/conversations/components/list_header_component.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAa,aAAa,EAAE,Q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wB,EAAE,CAAA;IAExD,OAAO,UAAU,CAAC,MAAM,CAAC;QACvB,UAAU,EAAE;YACV,iBAAiB,EAAE,CAAC;YACpB,iBAAiB,EAAE,KAAK,CAAC,MAAM,CAAC,uBAAuB;YACvD,aAAa,EAAE,EAAE;YACjB,GAAG,EAAE,EAAE;SACR;QACD,UAAU,EAAE;YACV,GAAG,EAAE,EAAE;YACP,aAAa,EAAE,qBAAqB,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,KAAK;YACvD,UAAU,EAAE,qBAAqB,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,QAAQ;YAC3D,cAAc,EAAE,eAAe;YAC/B,aAAa,EAAE,qBAAqB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;YAC5C,iBAAiB,EAAE,sBAAsB;SAC1C;QACD,cAAc,EAAE;YACd,GAAG,EAAE,CAAC;SACP;QACD,gBAAgB,EAAE;YAChB,aAAa,EAAE,KAAK;YACpB,GAAG,EAAE,CAAC;YACN,UAAU,EAAE,QAAQ;SACrB;QACD,cAAc,EAAE;YACd,aAAa,EAAE,CAAC;SACjB;QACD,SAAS,EAAE;YACT,aAAa,EAAE,KAAK;YACpB,cAAc,EAAE,YAAY;YAC5B,GAAG,EAAE,CAAC;YACN,iBAAiB,EAAE,sBAAsB;SAC1C;KACF,CAAC,CAAA;AACJ,CAAC,CAAA","sourcesContent":["import { RouteProp, useNavigation, useRoute } from '@react-navigation/native'\nimport React, { useCallback, useMemo } from 'react'\nimport { Alert, ScrollView, StyleSheet, View } from 'react-native'\nimport { Heading, TextButton, ToggleButton } from '../../../components'\nimport { useAtFontScaleBreakpoint, useCurrentPersonCache, useTheme } from '../../../hooks'\nimport { useMarkAllRead } from '../../../hooks/use_conversations_actions'\nimport { useCanDisplayGroups } from '../../../hooks/use_groups'\nimport { useCanCreateConversations } from '../../../hooks'\nimport { useAppName } from '../../../hooks/use_app_name'\nimport { ConversationsScreenProps } from '../conversations_screen'\nimport { ChatGroupBadge } from './chat_group_badge'\nimport { Haptic } from '../../../utils/native_adapters'\nimport { MAX_FONT_SIZE_MULTIPLIER_LANDMARK } from '../../../utils'\nimport { ListHeaderActionButton } from './list_header_action_button'\n\nconst ROW_PADDING_HORIZONTAL = 16\n\nenum FilterTypes {\n All = 'All',\n Groups = 'Groups',\n Teams = 'Teams',\n More = 'More',\n}\n\nexport const ListHeaderComponent = () => {\n const styles = useStyles()\n const navigation = useNavigation()\n const canFilterByTeams = useCanDisplayGroups({ source_app_name: 'Services', source_type: 'Team' })\n const canFilterByGroups = useCanDisplayGroups({ source_app_name: 'Groups', source_type: 'Group' })\n const route = useRoute<RouteProp<ConversationsScreenProps['route']>>()\n const { chat_group_graph_id, group_source_app_name = '' } = route.params || {}\n const currentPersonCache = useCurrentPersonCache()\n const { markAllRead, isPending } = useMarkAllRead()\n const canCreateConversations = useCanCreateConversations()\n const appName = useAppName()\n\n const active: FilterTypes = useMemo(() => {\n if (chat_group_graph_id) {\n return FilterTypes.More\n } else if (/groups/i.test(group_source_app_name)) {\n return FilterTypes.Groups\n } else if (/services/i.test(group_source_app_name)) {\n return FilterTypes.Teams\n }\n\n return FilterTypes.All\n }, [chat_group_graph_id, group_source_app_name])\n\n const handleNewConversationNavigation = useCallback(() => {\n return navigation.navigate('New', {\n screen: 'ConversationSelectRecipients',\n params: {\n ...route.params,\n },\n })\n }, [navigation, route.params])\n\n const handleGetHelp = useCallback(() => {\n navigation.navigate('GetHelp', { type: 'chat' })\n }, [navigation])\n\n const handleMarkAllRead = useCallback(() => {\n currentPersonCache.update({ unreadCount: 0 })\n Haptic.notificationSuccess()\n markAllRead()\n }, [currentPersonCache, markAllRead])\n\n const alertMarkAllRead = useCallback(() => {\n if (active === FilterTypes.All) return handleMarkAllRead()\n\n Alert.alert('Mark all read', 'This includes conversations not shown by the current filter.', [\n { text: 'Cancel' },\n { text: 'OK', onPress: () => handleMarkAllRead() },\n ])\n }, [active, handleMarkAllRead])\n\n const showAppFilters = canFilterByGroups && canFilterByTeams\n\n return (\n <View style={styles.listHeader}>\n <View style={styles.headingRow}>\n <View style={styles.titleContainer}>\n <Heading numberOfLines={1} variant=\"h2\">\n Conversations\n </Heading>\n <TextButton\n onPress={alertMarkAllRead}\n disabled={isPending}\n maxFontSizeMultiplier={MAX_FONT_SIZE_MULTIPLIER_LANDMARK}\n accessibilityShowsLargeContentViewer\n accessibilityLargeContentTitle=\"Mark all read\"\n >\n Mark all read\n </TextButton>\n </View>\n <View style={styles.actionsContainer}>\n {canCreateConversations && (\n <ListHeaderActionButton\n name=\"churchCenter.signups\"\n onPress={handleNewConversationNavigation}\n accessibilityLabel=\"New conversation\"\n testID=\"conversations-new-conversation-button\"\n maxFontSizeMultiplier={MAX_FONT_SIZE_MULTIPLIER_LANDMARK}\n />\n )}\n {appName !== 'services' && (\n <ListHeaderActionButton\n name=\"general.outlinedInfoCircle\"\n onPress={handleGetHelp}\n accessibilityLabel=\"Get help\"\n maxFontSizeMultiplier={MAX_FONT_SIZE_MULTIPLIER_LANDMARK}\n />\n )}\n </View>\n </View>\n <ScrollView\n horizontal\n showsHorizontalScrollIndicator={false}\n contentContainerStyle={styles.filterRow}\n accessibilityRole=\"toolbar\"\n >\n {showAppFilters && (\n <>\n <ToggleButton\n title={FilterTypes.All}\n active={active === FilterTypes.All}\n onPress={() =>\n navigation.setParams({\n chat_group_graph_id: undefined,\n group_source_app_name: undefined,\n })\n }\n accessibilityLabel=\"Show all conversations\"\n />\n <ToggleButton\n title={FilterTypes.Groups}\n active={active === FilterTypes.Groups}\n onPress={() =>\n navigation.setParams({\n chat_group_graph_id: undefined,\n group_source_app_name: 'Groups',\n })\n }\n accessibilityLabel=\"Filter to group conversations\"\n />\n\n <ToggleButton\n title={FilterTypes.Teams}\n active={active === FilterTypes.Teams}\n onPress={() =>\n navigation.setParams({\n chat_group_graph_id: undefined,\n group_source_app_name: 'Services',\n })\n }\n accessibilityLabel=\"Filter to team conversations\"\n />\n </>\n )}\n <ToggleButton\n title={showAppFilters ? FilterTypes.More : 'Filter'}\n onPress={() =>\n navigation.navigate('ConversationFilters', {\n chat_group_graph_id,\n group_source_app_name,\n })\n }\n active={active === FilterTypes.More}\n iconNameRight=\"general.threeReducingHorizontalBars\"\n accessibilityLabel={showAppFilters ? 'View all filters' : 'View more filters'}\n />\n </ScrollView>\n <ChatGroupBadge rowPaddingHorizontal={ROW_PADDING_HORIZONTAL} />\n </View>\n )\n}\n\nconst useStyles = () => {\n const theme = useTheme()\n const atFontScaleBreakpoint = useAtFontScaleBreakpoint()\n\n return StyleSheet.create({\n listHeader: {\n borderBottomWidth: 1,\n borderBottomColor: theme.colors.fillColorNeutral050Base,\n paddingBottom: 16,\n gap: 16,\n },\n headingRow: {\n gap: 12,\n flexDirection: atFontScaleBreakpoint ? 'column' : 'row',\n alignItems: atFontScaleBreakpoint ? 'flex-start' : 'center',\n justifyContent: 'space-between',\n paddingBottom: atFontScaleBreakpoint ? 4 : 0,\n paddingHorizontal: ROW_PADDING_HORIZONTAL,\n },\n titleContainer: {\n gap: 8,\n },\n actionsContainer: {\n flexDirection: 'row',\n gap: 8,\n alignItems: 'center',\n },\n markAllReadRow: {\n paddingBottom: 4,\n },\n filterRow: {\n flexDirection: 'row',\n justifyContent: 'flex-start',\n gap: 8,\n paddingHorizontal: ROW_PADDING_HORIZONTAL,\n },\n })\n}\n"]}
|
|
1
|
+
{"version":3,"file":"list_header_component.js","sourceRoot":"","sources":["../../../../src/screens/conversations/components/list_header_component.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAa,aAAa,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAA;AAC7E,OAAO,KAAK,EAAE,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,OAAO,CAAA;AACnD,OAAO,EAAE,KAAK,EAAE,UAAU,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,cAAc,CAAA;AAClE,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,q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;KACF,CAAC,CAAA;AACJ,CAAC,CAAA","sourcesContent":["import { RouteProp, useNavigation, useRoute } from '@react-navigation/native'\nimport React, { useCallback, useMemo } from 'react'\nimport { Alert, ScrollView, StyleSheet, View } from 'react-native'\nimport { Heading, TextButton, ToggleButton } from '../../../components'\nimport { useAtFontScaleBreakpoint, useCurrentPersonCache, useTheme } from '../../../hooks'\nimport { useMarkAllRead } from '../../../hooks/use_conversations_actions'\nimport { useCanDisplayGroups } from '../../../hooks/use_groups'\nimport { useCanCreateConversations } from '../../../hooks'\nimport { useAppName } from '../../../hooks/use_app_name'\nimport { ConversationsScreenProps } from '../conversations_screen'\nimport { ChatGroupBadge } from './chat_group_badge'\nimport { Haptic } from '../../../utils/native_adapters'\nimport { MAX_FONT_SIZE_MULTIPLIER_LANDMARK } from '../../../utils'\nimport { ListHeaderActionButton } from './list_header_action_button'\n\nconst ROW_PADDING_HORIZONTAL = 16\n\nenum FilterTypes {\n All = 'All',\n Groups = 'Groups',\n Teams = 'Teams',\n More = 'More',\n}\n\nexport const ListHeaderComponent = () => {\n const navigation = useNavigation()\n const canFilterByTeams = useCanDisplayGroups({ source_app_name: 'Services', source_type: 'Team' })\n const canFilterByGroups = useCanDisplayGroups({ source_app_name: 'Groups', source_type: 'Group' })\n const route = useRoute<RouteProp<ConversationsScreenProps['route']>>()\n const { chat_group_graph_id, group_source_app_name = '' } = route.params || {}\n const currentPersonCache = useCurrentPersonCache()\n const { markAllRead, isPending } = useMarkAllRead()\n const canCreateConversations = useCanCreateConversations()\n const appName = useAppName()\n\n const active: FilterTypes = useMemo(() => {\n if (chat_group_graph_id) {\n return FilterTypes.More\n } else if (/groups/i.test(group_source_app_name)) {\n return FilterTypes.Groups\n } else if (/services/i.test(group_source_app_name)) {\n return FilterTypes.Teams\n }\n\n return FilterTypes.All\n }, [chat_group_graph_id, group_source_app_name])\n\n const handleNewConversationNavigation = useCallback(() => {\n return navigation.navigate('New', {\n screen: 'ConversationSelectRecipients',\n params: {\n ...route.params,\n },\n })\n }, [navigation, route.params])\n\n const handleGetHelp = useCallback(() => {\n navigation.navigate('GetHelp', { type: 'chat' })\n }, [navigation])\n\n const handleOpenConversationFilters = useCallback(() => {\n navigation.navigate('ConversationFilters', {\n chat_group_graph_id,\n group_source_app_name,\n })\n }, [navigation, chat_group_graph_id, group_source_app_name])\n\n const handleMarkAllRead = useCallback(() => {\n currentPersonCache.update({ unreadCount: 0 })\n Haptic.notificationSuccess()\n markAllRead()\n }, [currentPersonCache, markAllRead])\n\n const alertMarkAllRead = useCallback(() => {\n if (active === FilterTypes.All) return handleMarkAllRead()\n\n Alert.alert('Mark all read', 'This includes conversations not shown by the current filter.', [\n { text: 'Cancel' },\n { text: 'OK', onPress: () => handleMarkAllRead() },\n ])\n }, [active, handleMarkAllRead])\n\n const hasSomeSourceFilterCapability = canFilterByTeams || canFilterByGroups\n const hasMultiSourceFilterCapabilities = canFilterByTeams && canFilterByGroups\n const shouldShowHeaderFiltersButton =\n hasSomeSourceFilterCapability && !hasMultiSourceFilterCapabilities\n const moreFiltersButtonA11yLabel = shouldShowHeaderFiltersButton\n ? 'View filters'\n : 'View more filters'\n\n const moreFiltersButtonProps = {\n onPress: handleOpenConversationFilters,\n active: active === FilterTypes.More,\n iconNameRight: 'general.threeReducingHorizontalBars' as const,\n accessibilityLabel: moreFiltersButtonA11yLabel,\n }\n\n const styles = useStyles({ shouldShowHeaderFiltersButton })\n\n return (\n <View style={styles.listHeader}>\n <View style={styles.headingRow}>\n <View style={styles.titleContainer}>\n <Heading numberOfLines={1} variant=\"h2\">\n Conversations\n </Heading>\n <TextButton\n onPress={alertMarkAllRead}\n disabled={isPending}\n maxFontSizeMultiplier={MAX_FONT_SIZE_MULTIPLIER_LANDMARK}\n accessibilityShowsLargeContentViewer\n accessibilityLargeContentTitle=\"Mark all read\"\n >\n Mark all read\n </TextButton>\n </View>\n <View style={styles.actionsContainer}>\n {canCreateConversations && (\n <ListHeaderActionButton\n name=\"churchCenter.signups\"\n onPress={handleNewConversationNavigation}\n accessibilityLabel=\"New conversation\"\n testID=\"conversations-new-conversation-button\"\n maxFontSizeMultiplier={MAX_FONT_SIZE_MULTIPLIER_LANDMARK}\n />\n )}\n {appName !== 'services' && (\n <ListHeaderActionButton\n name=\"general.outlinedInfoCircle\"\n onPress={handleGetHelp}\n accessibilityLabel=\"Get help\"\n maxFontSizeMultiplier={MAX_FONT_SIZE_MULTIPLIER_LANDMARK}\n />\n )}\n {shouldShowHeaderFiltersButton && <ToggleButton {...moreFiltersButtonProps} />}\n </View>\n </View>\n {hasMultiSourceFilterCapabilities && (\n <ScrollView\n horizontal\n showsHorizontalScrollIndicator={false}\n contentContainerStyle={styles.filterRow}\n accessibilityRole=\"toolbar\"\n >\n <ToggleButton\n title={FilterTypes.All}\n active={active === FilterTypes.All}\n onPress={() =>\n navigation.setParams({\n chat_group_graph_id: undefined,\n group_source_app_name: undefined,\n })\n }\n accessibilityLabel=\"Show all conversations\"\n style={styles.filterButton}\n />\n <ToggleButton\n title={FilterTypes.Groups}\n active={active === FilterTypes.Groups}\n onPress={() =>\n navigation.setParams({\n chat_group_graph_id: undefined,\n group_source_app_name: 'Groups',\n })\n }\n accessibilityLabel=\"Filter to group conversations\"\n style={styles.filterButton}\n />\n\n <ToggleButton\n title={FilterTypes.Teams}\n active={active === FilterTypes.Teams}\n onPress={() =>\n navigation.setParams({\n chat_group_graph_id: undefined,\n group_source_app_name: 'Services',\n })\n }\n accessibilityLabel=\"Filter to team conversations\"\n style={styles.filterButton}\n />\n <ToggleButton {...moreFiltersButtonProps} />\n </ScrollView>\n )}\n <ChatGroupBadge rowPaddingHorizontal={ROW_PADDING_HORIZONTAL} />\n </View>\n )\n}\n\nconst useStyles = ({\n shouldShowHeaderFiltersButton,\n}: {\n shouldShowHeaderFiltersButton: boolean\n}) => {\n const theme = useTheme()\n const atFontScaleBreakpoint = useAtFontScaleBreakpoint(\n shouldShowHeaderFiltersButton ? 1.2 : undefined\n )\n\n return StyleSheet.create({\n listHeader: {\n borderBottomWidth: 1,\n borderBottomColor: theme.colors.fillColorNeutral050Base,\n paddingBottom: 16,\n gap: 16,\n },\n headingRow: {\n gap: 12,\n flexDirection: atFontScaleBreakpoint ? 'column' : 'row',\n alignItems: atFontScaleBreakpoint ? 'flex-start' : 'center',\n justifyContent: 'space-between',\n paddingBottom: atFontScaleBreakpoint ? 4 : 0,\n paddingHorizontal: ROW_PADDING_HORIZONTAL,\n },\n titleContainer: {\n gap: 8,\n },\n actionsContainer: {\n flexDirection: 'row',\n gap: 8,\n alignItems: 'center',\n },\n markAllReadRow: {\n paddingBottom: 4,\n },\n filterRow: {\n flexDirection: 'row',\n justifyContent: 'flex-start',\n gap: 8,\n paddingHorizontal: ROW_PADDING_HORIZONTAL,\n flexGrow: 1,\n },\n filterButton: {\n flex: 1,\n minWidth: 65,\n },\n })\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@planningcenter/chat-react-native",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.24.0-rc.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "build/index.js",
|
|
6
6
|
"types": "build/index.d.ts",
|
|
@@ -58,5 +58,5 @@
|
|
|
58
58
|
"react-native-url-polyfill": "^2.0.0",
|
|
59
59
|
"typescript": "<5.6.0"
|
|
60
60
|
},
|
|
61
|
-
"gitHead": "
|
|
61
|
+
"gitHead": "150efb30b4b95bfb81fb54dfc9896ae83b9c7b91"
|
|
62
62
|
}
|
|
@@ -32,9 +32,15 @@ type RestrictedPressableProps = Omit<PressableProps, 'onLongPress'>
|
|
|
32
32
|
|
|
33
33
|
export interface ToggleButtonProps extends RestrictedPressableProps {
|
|
34
34
|
/**
|
|
35
|
-
*
|
|
35
|
+
* Whether the toggle button is active/checked
|
|
36
36
|
*/
|
|
37
37
|
active: boolean
|
|
38
|
+
/**
|
|
39
|
+
* Required accessibility label for screen readers.
|
|
40
|
+
* When title is provided, this provides additional context.
|
|
41
|
+
* When title is omitted (icon-only mode), this is the primary label.
|
|
42
|
+
*/
|
|
43
|
+
accessibilityLabel: string
|
|
38
44
|
/**
|
|
39
45
|
* Specifies whether fonts should be scaled down automatically to fit given style constraints.
|
|
40
46
|
*/
|
|
@@ -60,9 +66,10 @@ export interface ToggleButtonProps extends RestrictedPressableProps {
|
|
|
60
66
|
*/
|
|
61
67
|
minimumFontScale?: number
|
|
62
68
|
/**
|
|
63
|
-
* Renders as text within the button
|
|
69
|
+
* Renders as text within the button.
|
|
70
|
+
* When omitted, button displays in icon-only mode.
|
|
64
71
|
*/
|
|
65
|
-
title
|
|
72
|
+
title?: string
|
|
66
73
|
/**
|
|
67
74
|
* Pressable container styles
|
|
68
75
|
*/
|
|
@@ -75,6 +82,7 @@ export interface ToggleButtonProps extends RestrictedPressableProps {
|
|
|
75
82
|
|
|
76
83
|
export function ToggleButton({
|
|
77
84
|
active,
|
|
85
|
+
accessibilityLabel,
|
|
78
86
|
adjustsFontSizeToFit = false,
|
|
79
87
|
allowFontScaling = true,
|
|
80
88
|
iconNameLeft,
|
|
@@ -87,6 +95,7 @@ export function ToggleButton({
|
|
|
87
95
|
onPress,
|
|
88
96
|
...props
|
|
89
97
|
}: ToggleButtonProps) {
|
|
98
|
+
const hasTitle = Boolean(title)
|
|
90
99
|
const styles = useStyles({ active, maxFontSizeMultiplier })
|
|
91
100
|
const { colors } = useTheme()
|
|
92
101
|
const overrideStyles = StyleSheet.flatten(style) // Ensures the pressed styles still get applied
|
|
@@ -108,11 +117,12 @@ export function ToggleButton({
|
|
|
108
117
|
...overrideStyles,
|
|
109
118
|
})}
|
|
110
119
|
accessibilityRole="togglebutton"
|
|
120
|
+
accessibilityLabel={accessibilityLabel}
|
|
111
121
|
accessibilityState={{ checked: active }}
|
|
112
122
|
android_ripple={{ color: androidRippleColor, borderless: false, foreground: true }}
|
|
113
123
|
onPress={handlePress}
|
|
114
124
|
accessibilityShowsLargeContentViewer
|
|
115
|
-
accessibilityLargeContentTitle={
|
|
125
|
+
accessibilityLargeContentTitle={accessibilityLabel}
|
|
116
126
|
{...props}
|
|
117
127
|
>
|
|
118
128
|
{iconNameLeft && (
|
|
@@ -122,17 +132,19 @@ export function ToggleButton({
|
|
|
122
132
|
maxFontSizeMultiplier={maxFontSizeMultiplier}
|
|
123
133
|
/>
|
|
124
134
|
)}
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
135
|
+
{hasTitle && (
|
|
136
|
+
<Text
|
|
137
|
+
allowFontScaling={allowFontScaling}
|
|
138
|
+
minimumFontScale={minimumFontScale}
|
|
139
|
+
maxFontSizeMultiplier={maxFontSizeMultiplier}
|
|
140
|
+
adjustsFontSizeToFit={adjustsFontSizeToFit}
|
|
141
|
+
numberOfLines={1}
|
|
142
|
+
style={styles.text}
|
|
143
|
+
variant="tertiary"
|
|
144
|
+
>
|
|
145
|
+
{title}
|
|
146
|
+
</Text>
|
|
147
|
+
)}
|
|
136
148
|
{iconNameRight && (
|
|
137
149
|
<Icon
|
|
138
150
|
name={iconNameRight}
|
|
@@ -23,7 +23,6 @@ enum FilterTypes {
|
|
|
23
23
|
}
|
|
24
24
|
|
|
25
25
|
export const ListHeaderComponent = () => {
|
|
26
|
-
const styles = useStyles()
|
|
27
26
|
const navigation = useNavigation()
|
|
28
27
|
const canFilterByTeams = useCanDisplayGroups({ source_app_name: 'Services', source_type: 'Team' })
|
|
29
28
|
const canFilterByGroups = useCanDisplayGroups({ source_app_name: 'Groups', source_type: 'Group' })
|
|
@@ -59,6 +58,13 @@ export const ListHeaderComponent = () => {
|
|
|
59
58
|
navigation.navigate('GetHelp', { type: 'chat' })
|
|
60
59
|
}, [navigation])
|
|
61
60
|
|
|
61
|
+
const handleOpenConversationFilters = useCallback(() => {
|
|
62
|
+
navigation.navigate('ConversationFilters', {
|
|
63
|
+
chat_group_graph_id,
|
|
64
|
+
group_source_app_name,
|
|
65
|
+
})
|
|
66
|
+
}, [navigation, chat_group_graph_id, group_source_app_name])
|
|
67
|
+
|
|
62
68
|
const handleMarkAllRead = useCallback(() => {
|
|
63
69
|
currentPersonCache.update({ unreadCount: 0 })
|
|
64
70
|
Haptic.notificationSuccess()
|
|
@@ -74,7 +80,22 @@ export const ListHeaderComponent = () => {
|
|
|
74
80
|
])
|
|
75
81
|
}, [active, handleMarkAllRead])
|
|
76
82
|
|
|
77
|
-
const
|
|
83
|
+
const hasSomeSourceFilterCapability = canFilterByTeams || canFilterByGroups
|
|
84
|
+
const hasMultiSourceFilterCapabilities = canFilterByTeams && canFilterByGroups
|
|
85
|
+
const shouldShowHeaderFiltersButton =
|
|
86
|
+
hasSomeSourceFilterCapability && !hasMultiSourceFilterCapabilities
|
|
87
|
+
const moreFiltersButtonA11yLabel = shouldShowHeaderFiltersButton
|
|
88
|
+
? 'View filters'
|
|
89
|
+
: 'View more filters'
|
|
90
|
+
|
|
91
|
+
const moreFiltersButtonProps = {
|
|
92
|
+
onPress: handleOpenConversationFilters,
|
|
93
|
+
active: active === FilterTypes.More,
|
|
94
|
+
iconNameRight: 'general.threeReducingHorizontalBars' as const,
|
|
95
|
+
accessibilityLabel: moreFiltersButtonA11yLabel,
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
const styles = useStyles({ shouldShowHeaderFiltersButton })
|
|
78
99
|
|
|
79
100
|
return (
|
|
80
101
|
<View style={styles.listHeader}>
|
|
@@ -111,73 +132,70 @@ export const ListHeaderComponent = () => {
|
|
|
111
132
|
maxFontSizeMultiplier={MAX_FONT_SIZE_MULTIPLIER_LANDMARK}
|
|
112
133
|
/>
|
|
113
134
|
)}
|
|
135
|
+
{shouldShowHeaderFiltersButton && <ToggleButton {...moreFiltersButtonProps} />}
|
|
114
136
|
</View>
|
|
115
137
|
</View>
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
138
|
+
{hasMultiSourceFilterCapabilities && (
|
|
139
|
+
<ScrollView
|
|
140
|
+
horizontal
|
|
141
|
+
showsHorizontalScrollIndicator={false}
|
|
142
|
+
contentContainerStyle={styles.filterRow}
|
|
143
|
+
accessibilityRole="toolbar"
|
|
144
|
+
>
|
|
145
|
+
<ToggleButton
|
|
146
|
+
title={FilterTypes.All}
|
|
147
|
+
active={active === FilterTypes.All}
|
|
148
|
+
onPress={() =>
|
|
149
|
+
navigation.setParams({
|
|
150
|
+
chat_group_graph_id: undefined,
|
|
151
|
+
group_source_app_name: undefined,
|
|
152
|
+
})
|
|
153
|
+
}
|
|
154
|
+
accessibilityLabel="Show all conversations"
|
|
155
|
+
style={styles.filterButton}
|
|
156
|
+
/>
|
|
157
|
+
<ToggleButton
|
|
158
|
+
title={FilterTypes.Groups}
|
|
159
|
+
active={active === FilterTypes.Groups}
|
|
160
|
+
onPress={() =>
|
|
161
|
+
navigation.setParams({
|
|
162
|
+
chat_group_graph_id: undefined,
|
|
163
|
+
group_source_app_name: 'Groups',
|
|
164
|
+
})
|
|
165
|
+
}
|
|
166
|
+
accessibilityLabel="Filter to group conversations"
|
|
167
|
+
style={styles.filterButton}
|
|
168
|
+
/>
|
|
146
169
|
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
onPress={() =>
|
|
163
|
-
navigation.navigate('ConversationFilters', {
|
|
164
|
-
chat_group_graph_id,
|
|
165
|
-
group_source_app_name,
|
|
166
|
-
})
|
|
167
|
-
}
|
|
168
|
-
active={active === FilterTypes.More}
|
|
169
|
-
iconNameRight="general.threeReducingHorizontalBars"
|
|
170
|
-
accessibilityLabel={showAppFilters ? 'View all filters' : 'View more filters'}
|
|
171
|
-
/>
|
|
172
|
-
</ScrollView>
|
|
170
|
+
<ToggleButton
|
|
171
|
+
title={FilterTypes.Teams}
|
|
172
|
+
active={active === FilterTypes.Teams}
|
|
173
|
+
onPress={() =>
|
|
174
|
+
navigation.setParams({
|
|
175
|
+
chat_group_graph_id: undefined,
|
|
176
|
+
group_source_app_name: 'Services',
|
|
177
|
+
})
|
|
178
|
+
}
|
|
179
|
+
accessibilityLabel="Filter to team conversations"
|
|
180
|
+
style={styles.filterButton}
|
|
181
|
+
/>
|
|
182
|
+
<ToggleButton {...moreFiltersButtonProps} />
|
|
183
|
+
</ScrollView>
|
|
184
|
+
)}
|
|
173
185
|
<ChatGroupBadge rowPaddingHorizontal={ROW_PADDING_HORIZONTAL} />
|
|
174
186
|
</View>
|
|
175
187
|
)
|
|
176
188
|
}
|
|
177
189
|
|
|
178
|
-
const useStyles = (
|
|
190
|
+
const useStyles = ({
|
|
191
|
+
shouldShowHeaderFiltersButton,
|
|
192
|
+
}: {
|
|
193
|
+
shouldShowHeaderFiltersButton: boolean
|
|
194
|
+
}) => {
|
|
179
195
|
const theme = useTheme()
|
|
180
|
-
const atFontScaleBreakpoint = useAtFontScaleBreakpoint(
|
|
196
|
+
const atFontScaleBreakpoint = useAtFontScaleBreakpoint(
|
|
197
|
+
shouldShowHeaderFiltersButton ? 1.2 : undefined
|
|
198
|
+
)
|
|
181
199
|
|
|
182
200
|
return StyleSheet.create({
|
|
183
201
|
listHeader: {
|
|
@@ -210,6 +228,11 @@ const useStyles = () => {
|
|
|
210
228
|
justifyContent: 'flex-start',
|
|
211
229
|
gap: 8,
|
|
212
230
|
paddingHorizontal: ROW_PADDING_HORIZONTAL,
|
|
231
|
+
flexGrow: 1,
|
|
232
|
+
},
|
|
233
|
+
filterButton: {
|
|
234
|
+
flex: 1,
|
|
235
|
+
minWidth: 65,
|
|
213
236
|
},
|
|
214
237
|
})
|
|
215
238
|
}
|