@planningcenter/chat-react-native 3.15.0-rc.0 → 3.15.0-rc.2
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/conversations/conversation_preview.d.ts.map +1 -1
- package/build/components/conversations/conversation_preview.js +9 -5
- package/build/components/conversations/conversation_preview.js.map +1 -1
- package/build/components/conversations/mute_indicator.d.ts.map +1 -1
- package/build/components/conversations/mute_indicator.js +3 -1
- package/build/components/conversations/mute_indicator.js.map +1 -1
- package/build/components/conversations/swipeable_toggle_button.d.ts.map +1 -1
- package/build/components/conversations/swipeable_toggle_button.js +6 -3
- package/build/components/conversations/swipeable_toggle_button.js.map +1 -1
- package/build/components/conversations/unread_count_badge.js +9 -6
- package/build/components/conversations/unread_count_badge.js.map +1 -1
- package/build/components/display/action_button.d.ts.map +1 -1
- package/build/components/display/action_button.js +2 -4
- package/build/components/display/action_button.js.map +1 -1
- package/build/components/display/badge.d.ts +5 -1
- package/build/components/display/badge.d.ts.map +1 -1
- package/build/components/display/badge.js +2 -2
- package/build/components/display/badge.js.map +1 -1
- package/build/components/display/toggle_button.d.ts +3 -1
- package/build/components/display/toggle_button.d.ts.map +1 -1
- package/build/components/display/toggle_button.js +1 -1
- package/build/components/display/toggle_button.js.map +1 -1
- package/build/components/primitive/form_sheet.d.ts +3 -2
- package/build/components/primitive/form_sheet.d.ts.map +1 -1
- package/build/components/primitive/form_sheet.js +5 -3
- package/build/components/primitive/form_sheet.js.map +1 -1
- package/build/hooks/index.d.ts +1 -0
- package/build/hooks/index.d.ts.map +1 -1
- package/build/hooks/index.js +1 -0
- package/build/hooks/index.js.map +1 -1
- package/build/hooks/use_scalable_number_of_lines.d.ts +2 -0
- package/build/hooks/use_scalable_number_of_lines.d.ts.map +1 -0
- package/build/hooks/use_scalable_number_of_lines.js +9 -0
- package/build/hooks/use_scalable_number_of_lines.js.map +1 -0
- package/build/screens/conversations/components/list_header_component.d.ts.map +1 -1
- package/build/screens/conversations/components/list_header_component.js +2 -2
- package/build/screens/conversations/components/list_header_component.js.map +1 -1
- package/build/screens/conversations/conversations_screen.d.ts.map +1 -1
- package/build/screens/conversations/conversations_screen.js +1 -1
- package/build/screens/conversations/conversations_screen.js.map +1 -1
- package/build/utils/styles.d.ts +1 -1
- package/build/utils/styles.js +1 -1
- package/build/utils/styles.js.map +1 -1
- package/package.json +2 -2
- package/src/components/conversations/conversation_preview.tsx +15 -4
- package/src/components/conversations/mute_indicator.tsx +9 -1
- package/src/components/conversations/swipeable_toggle_button.tsx +18 -3
- package/src/components/conversations/unread_count_badge.tsx +9 -6
- package/src/components/display/action_button.tsx +3 -4
- package/src/components/display/badge.tsx +6 -1
- package/src/components/display/toggle_button.tsx +12 -1
- package/src/components/primitive/form_sheet.tsx +33 -5
- package/src/hooks/index.ts +1 -0
- package/src/hooks/use_scalable_number_of_lines.ts +10 -0
- package/src/screens/conversations/components/list_header_component.tsx +3 -1
- package/src/screens/conversations/conversations_screen.tsx +2 -0
- package/src/utils/styles.ts +1 -1
|
@@ -43,9 +43,10 @@ interface FormSheetHeaderTitleProps {
|
|
|
43
43
|
interface FormSheetHeaderActionsProps {
|
|
44
44
|
children: ReactNode;
|
|
45
45
|
}
|
|
46
|
-
interface FormSheetHeaderTextButtonProps extends Omit<TextButtonProps, 'maxFontSizeMultiplier'> {
|
|
46
|
+
interface FormSheetHeaderTextButtonProps extends Omit<TextButtonProps, 'maxFontSizeMultiplier' | 'onLongPress'> {
|
|
47
|
+
children: string;
|
|
47
48
|
}
|
|
48
|
-
interface FormSheetHeaderButtonProps extends Omit<ButtonProps, 'maxFontSizeMultiplier'> {
|
|
49
|
+
interface FormSheetHeaderButtonProps extends Omit<ButtonProps, 'maxFontSizeMultiplier' | 'onLongPress'> {
|
|
49
50
|
}
|
|
50
51
|
declare const FORM_SHEET_ACTION_APPEARANCES: {
|
|
51
52
|
readonly neutral: "neutral";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"form_sheet.d.ts","sourceRoot":"","sources":["../../../src/components/primitive/form_sheet.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,4BAA4B,EAAE,MAAM,gCAAgC,CAAA;AAC7E,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AACxC,OAAO,EAKL,KAAK,iBAAiB,EACtB,KAAK,SAAS,EACd,KAAK,SAAS,EACf,MAAM,cAAc,CAAA;AAGrB,OAAO,KAAK,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,YAAY,CAAA;AAC9D,OAAO,EAAyB,UAAU,EAAoB,MAAM,YAAY,CAAA;
|
|
1
|
+
{"version":3,"file":"form_sheet.d.ts","sourceRoot":"","sources":["../../../src/components/primitive/form_sheet.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,4BAA4B,EAAE,MAAM,gCAAgC,CAAA;AAC7E,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AACxC,OAAO,EAKL,KAAK,iBAAiB,EACtB,KAAK,SAAS,EACd,KAAK,SAAS,EACf,MAAM,cAAc,CAAA;AAGrB,OAAO,KAAK,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,YAAY,CAAA;AAC9D,OAAO,EAAyB,UAAU,EAAoB,MAAM,YAAY,CAAA;AAOhF;;;;;;GAMG;AACH,eAAO,MAAM,yBAAyB,mDAInC,4BAA4B,KAAQ,4BAQrC,CAAA;AAYF,KAAK,mBAAmB,GAAG;IACzB,IAAI,EAAE,KAAK,CAAC,EAAE,CAAC,kBAAkB,CAAC,CAAA;IAClC,MAAM,EAAE,KAAK,CAAC,EAAE,CAAC,oBAAoB,CAAC,CAAA;IACtC,MAAM,EAAE,KAAK,CAAC,EAAE,CAAC,oBAAoB,CAAC,CAAA;IACtC,WAAW,EAAE,KAAK,CAAC,EAAE,CAAC,yBAAyB,CAAC,CAAA;IAChD,aAAa,EAAE,KAAK,CAAC,EAAE,CAAC,2BAA2B,CAAC,CAAA;IACpD,g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AM,CAAA;IACb,QAAQ,EAAE,UAAU,CAAA;IACpB,OAAO,EAAE,MAAM,IAAI,CAAA;IACnB,kBAAkB,CAAC,EAAE,MAAM,CAAA;IAC3B,iBAAiB,CAAC,EAAE,MAAM,CAAA;IAC1B,iBAAiB,CAAC,EAAE,iBAAiB,CAAA;IACrC,UAAU,CAAC,EAAE,8BAA8B,CAAA;IAC3C,QAAQ,CAAC,EAAE,OAAO,CAAA;CACnB"}
|
|
@@ -4,6 +4,7 @@ import { Platform, StyleSheet, View, useWindowDimensions, } from 'react-native';
|
|
|
4
4
|
import { useSafeAreaInsets } from 'react-native-safe-area-context';
|
|
5
5
|
import { useTheme } from '../../hooks';
|
|
6
6
|
import { Button, Heading, Icon, Text, TextButton } from '../display';
|
|
7
|
+
import { MAX_FONT_SIZE_MULTIPLIER_LANDMARK } from '../../utils';
|
|
7
8
|
// =================================
|
|
8
9
|
// ====== Exports ==================
|
|
9
10
|
// =================================
|
|
@@ -60,7 +61,7 @@ function FormSheetHeader({ children, style }) {
|
|
|
60
61
|
FormSheetHeader.displayName = 'FormSheet.Header';
|
|
61
62
|
function FormSheetHeaderTitle({ children }) {
|
|
62
63
|
const styles = useStyles();
|
|
63
|
-
return (<Heading variant="h3" style={styles.headerTitle} maxFontSizeMultiplier={
|
|
64
|
+
return (<Heading variant="h3" style={styles.headerTitle} maxFontSizeMultiplier={MAX_FONT_SIZE_MULTIPLIER_LANDMARK}>
|
|
64
65
|
{children}
|
|
65
66
|
</Heading>);
|
|
66
67
|
}
|
|
@@ -71,11 +72,11 @@ function FormSheetHeaderActions({ children }) {
|
|
|
71
72
|
}
|
|
72
73
|
FormSheetHeaderActions.displayName = 'FormSheet.HeaderActions';
|
|
73
74
|
function FormSheetHeaderTextButton(props) {
|
|
74
|
-
return <TextButton {...props} maxFontSizeMultiplier={
|
|
75
|
+
return (<TextButton {...props} maxFontSizeMultiplier={MAX_FONT_SIZE_MULTIPLIER_LANDMARK} accessibilityShowsLargeContentViewer accessibilityLargeContentTitle={props.children}/>);
|
|
75
76
|
}
|
|
76
77
|
FormSheetHeaderTextButton.displayName = 'FormSheet.HeaderTextButton';
|
|
77
78
|
function FormSheetHeaderButton(props) {
|
|
78
|
-
return <Button {...props} maxFontSizeMultiplier={
|
|
79
|
+
return (<Button {...props} maxFontSizeMultiplier={MAX_FONT_SIZE_MULTIPLIER_LANDMARK} accessibilityShowsLargeContentViewer accessibilityLargeContentTitle={props.title}/>);
|
|
79
80
|
}
|
|
80
81
|
FormSheetHeaderButton.displayName = 'FormSheet.HeaderButton';
|
|
81
82
|
// ====================================
|
|
@@ -160,6 +161,7 @@ const useStyles = ({ appearance = 'neutral' } = {}) => {
|
|
|
160
161
|
},
|
|
161
162
|
headerTitle: {
|
|
162
163
|
textAlign: 'left',
|
|
164
|
+
flex: 1,
|
|
163
165
|
},
|
|
164
166
|
headerActions: {
|
|
165
167
|
flexDirection: 'row',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"form_sheet.js","sourceRoot":"","sources":["../../../src/components/primitive/form_sheet.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAA;AAE/E,OAAO,KAAoB,MAAM,OAAO,CAAA;AACxC,OAAO,EACL,QAAQ,EACR,UAAU,EACV,IAAI,EACJ,mBAAmB,GAIpB,MAAM,cAAc,CAAA;AACrB,OAAO,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAA;AAClE,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA;AAEtC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAc,IAAI,EAAE,UAAU,EAAE,MAAM,YAAY,CAAA;AAEhF,oCAAoC;AACpC,oCAAoC;AACpC,oCAAoC;AAEpC;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,yBAAyB,GAAG,CAAC,EACxC,WAAW,EACX,mBAAmB,GAAG,CAAC,IAAI,CAAC,EAC5B,GAAG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AE,MAAM,CAAC,mBAAmB;YAC3C,YAAY,EAAE,GAAG;YACjB,SAAS,EAAE,QAAQ;SACpB;QACD,OAAO,EAAE;YACP,GAAG,QAAQ,CAAC,MAAM,CAAC;gBACjB,OAAO,EAAE;oBACP,SAAS,EAAE,MAAM,EAAE,kGAAkG;iBACtH;aACF,CAAC;SACH;QACD,MAAM,EAAE;YACN,iBAAiB,EAAE,EAAE;YACrB,UAAU,EAAE,EAAE;YACd,aAAa,EAAE,EAAE;YACjB,eAAe,EAAE,MAAM,CAAC,2BAA2B;YACnD,GAAG,EAAE,EAAE;YACP,iBAAiB,EAAE,CAAC;YACpB,iBAAiB,EAAE,MAAM,CAAC,sBAAsB;SACjD;QACD,aAAa,EAAE;YACb,aAAa,EAAE,KAAK;YACpB,UAAU,EAAE,QAAQ;YACpB,cAAc,EAAE,eAAe;SAChC;QACD,WAAW,EAAE;YACX,SAAS,EAAE,MAAM;SAClB;QACD,aAAa,EAAE;YACb,aAAa,EAAE,KAAK;YACpB,UAAU,EAAE,QAAQ;YACpB,GAAG,EAAE,EAAE;SACR;QACD,eAAe,EAAE;YACf,aAAa,EAAE,KAAK;YACpB,UAAU,EAAE,QAAQ;YACpB,eAAe,EAAE,EAAE;YACnB,iBAAiB,EAAE,EAAE;YACrB,GAAG,EAAE,CAAC;SACP;QACD,UAAU,EAAE;YACV,KAAK,EAAE,mBAAmB,CAAC,UAAU,CAAC,CAAC,SAAS;SACjD;QACD,WAAW,EAAE;YACX,KAAK,EAAE,mBAAmB,CAAC,UAAU,CAAC,CAAC,SAAS;SACjD;KACF,CAAC,CAAA;AACJ,CAAC,CAAA","sourcesContent":["import { PlatformPressable, useHeaderHeight } from '@react-navigation/elements'\nimport { NativeStackNavigationOptions } from '@react-navigation/native-stack'\nimport React, { ReactNode } from 'react'\nimport {\n Platform,\n StyleSheet,\n View,\n useWindowDimensions,\n type AccessibilityRole,\n type StyleProp,\n type ViewStyle,\n} from 'react-native'\nimport { useSafeAreaInsets } from 'react-native-safe-area-context'\nimport { useTheme } from '../../hooks'\nimport type { ButtonProps, TextButtonProps } from '../display'\nimport { Button, Heading, Icon, IconString, Text, TextButton } from '../display'\n\n// =================================\n// ====== Exports ==================\n// =================================\n\n/**\n * Screen options for the formsheet's NativeStackNavigation route\n * @param {string} options.headerTitle - Doesn't show in UI but good to have for semantic reasons.\n * @param {number[]} [options.sheetAllowedDetents] - Controls the height increments the sheet grows to. To prevent bugs in Android, do not specify more then two values and use [0.94] instead of [1] to go full screen.\n * @param {NativeStackNavigationOptions} [options.rest] - Adds or overrides any valid NativeStackNavigationOptions\n * @returns {NativeStackNavigationOptions} Merged NativeStackNavigationOptions\n */\nexport const getFormSheetScreenOptions = ({\n headerTitle,\n sheetAllowedDetents = [0.25],\n ...rest\n}: NativeStackNavigationOptions = {}): NativeStackNavigationOptions => ({\n presentation: 'formSheet',\n headerShown: false,\n sheetAllowedDetents,\n sheetCornerRadius: 16,\n sheetGrabberVisible: true,\n headerTitle,\n ...rest,\n})\n\nconst FormSheet = {\n Root: FormSheetRoot,\n Action: FormSheetAction,\n Header: FormSheetHeader,\n HeaderTitle: FormSheetHeaderTitle,\n HeaderActions: FormSheetHeaderActions,\n HeaderTextButton: FormSheetHeaderTextButton,\n HeaderButton: FormSheetHeaderButton,\n} as const\n\ntype FormSheetComponents = {\n Root: React.FC<FormSheetRootProps>\n Action: React.FC<FormSheetActionProps>\n Header: React.FC<FormSheetHeaderProps>\n HeaderTitle: React.FC<FormSheetHeaderTitleProps>\n HeaderActions: React.FC<FormSheetHeaderActionsProps>\n HeaderTextButton: React.FC<FormSheetHeaderTextButtonProps>\n HeaderButton: React.FC<FormSheetHeaderButtonProps>\n}\n\nexport default FormSheet as FormSheetComponents\nexport type {\n FormSheetActionProps,\n FormSheetHeaderActionsProps,\n FormSheetHeaderButtonProps,\n FormSheetHeaderProps,\n FormSheetHeaderTextButtonProps,\n FormSheetHeaderTitleProps,\n FormSheetRootProps,\n}\n\n// ====================================\n// ====== ActionsFormSheetRoot ========\n// ====================================\n\ninterface FormSheetRootProps {\n children: ReactNode\n style?: StyleProp<ViewStyle>\n contentStyle?: StyleProp<ViewStyle>\n showAndroidSheetGrabber?: boolean\n}\n\nexport function FormSheetRoot({\n children,\n style,\n contentStyle,\n showAndroidSheetGrabber = true,\n}: FormSheetRootProps) {\n const styles = useStyles()\n\n return (\n <View style={[styles.container, style]} collapsable={false}>\n <View style={[styles.content, contentStyle]}>{children}</View>\n {showAndroidSheetGrabber && <AndroidSheetGrabber />}\n </View>\n )\n}\n\nFormSheetRoot.displayName = 'FormSheet.Root'\n\n// ====================================\n// ====== AndroidSheetGrabber =========\n// ====================================\n\nfunction AndroidSheetGrabber() {\n const styles = useStyles()\n\n return Platform.select({\n android: <View style={styles.androidSheetGrabber} />,\n ios: null,\n })\n}\n\n// ====================================\n// ====== FormSheetHeader =============\n// ====================================\n\ninterface FormSheetHeaderProps {\n children: ReactNode\n style?: StyleProp<ViewStyle>\n}\n\nfunction FormSheetHeader({ children, style }: FormSheetHeaderProps) {\n const styles = useStyles()\n\n return (\n <View style={[styles.header, style]}>\n <View style={styles.headerContent}>{children}</View>\n </View>\n )\n}\n\nFormSheetHeader.displayName = 'FormSheet.Header'\n\n// ====================================\n// ====== FormSheetHeaderTitle ========\n// ====================================\n\ninterface FormSheetHeaderTitleProps {\n children: ReactNode\n}\n\nfunction FormSheetHeaderTitle({ children }: FormSheetHeaderTitleProps) {\n const styles = useStyles()\n\n return (\n <Heading variant=\"h3\" style={styles.headerTitle} maxFontSizeMultiplier={1}>\n {children}\n </Heading>\n )\n}\n\nFormSheetHeaderTitle.displayName = 'FormSheet.HeaderTitle'\n\n// ====================================\n// ====== FormSheetHeaderActions ======\n// ====================================\n\ninterface FormSheetHeaderActionsProps {\n children: ReactNode\n}\n\nfunction FormSheetHeaderActions({ children }: FormSheetHeaderActionsProps) {\n const styles = useStyles()\n\n return <View style={styles.headerActions}>{children}</View>\n}\n\nFormSheetHeaderActions.displayName = 'FormSheet.HeaderActions'\n\n// ===========================================\n// ====== FormSheetHeaderTextButton ==========\n// ===========================================\n\ninterface FormSheetHeaderTextButtonProps extends Omit<TextButtonProps, 'maxFontSizeMultiplier'> {}\n\nfunction FormSheetHeaderTextButton(props: FormSheetHeaderTextButtonProps) {\n return <TextButton {...props} maxFontSizeMultiplier={1} />\n}\n\nFormSheetHeaderTextButton.displayName = 'FormSheet.HeaderTextButton'\n\n// =========================================\n// ====== FormSheetHeaderButton ============\n// =========================================\n\ninterface FormSheetHeaderButtonProps extends Omit<ButtonProps, 'maxFontSizeMultiplier'> {}\n\nfunction FormSheetHeaderButton(props: FormSheetHeaderButtonProps) {\n return <Button {...props} maxFontSizeMultiplier={1} />\n}\n\nFormSheetHeaderButton.displayName = 'FormSheet.HeaderButton'\n\n// ====================================\n// ====== ActionsFormSheetAction ======\n// ====================================\n\nconst FORM_SHEET_ACTION_APPEARANCES = {\n neutral: 'neutral',\n danger: 'danger',\n} as const\n\ntype FormSheetActionAppearanceUnion =\n (typeof FORM_SHEET_ACTION_APPEARANCES)[keyof typeof FORM_SHEET_ACTION_APPEARANCES]\n\ninterface FormSheetActionProps {\n title: string\n iconName: IconString\n onPress: () => void\n accessibilityLabel?: string\n accessibilityHint?: string\n accessibilityRole?: AccessibilityRole\n appearance?: FormSheetActionAppearanceUnion\n disabled?: boolean\n}\n\nfunction FormSheetAction({\n title,\n iconName,\n onPress,\n accessibilityLabel,\n accessibilityHint,\n accessibilityRole = 'button',\n appearance = 'neutral',\n disabled = false,\n}: FormSheetActionProps) {\n const styles = useStyles({ appearance })\n\n return (\n <PlatformPressable\n onPress={onPress}\n accessibilityLabel={accessibilityLabel}\n accessibilityHint={accessibilityHint}\n accessibilityRole={accessibilityRole}\n style={styles.actionPressable}\n disabled={disabled}\n >\n <Icon name={iconName} size={16} accessibilityElementsHidden style={styles.actionIcon} />\n <Text style={styles.actionTitle}>{title}</Text>\n </PlatformPressable>\n )\n}\n\nFormSheetAction.displayName = 'FormSheet.Action'\n\n// ==================================\n// ====== Styles ====================\n// ==================================\n\ninterface Styles {\n appearance?: FormSheetActionAppearanceUnion\n}\n\nconst useStyles = ({ appearance = 'neutral' }: Styles = {}) => {\n const { colors } = useTheme()\n const { height } = useWindowDimensions()\n const { bottom, top } = useSafeAreaInsets()\n const headerHeight = useHeaderHeight()\n\n const containerHeight = Platform.select({\n ios: height - top - headerHeight,\n default: null,\n })\n\n const appearanceColorsMap = {\n neutral: {\n iconColor: colors.iconColorDefaultPrimary,\n textColor: colors.textColorDefaultPrimary,\n },\n danger: {\n iconColor: colors.fillColorStatusErrorMedium,\n textColor: colors.fillColorStatusErrorMedium,\n },\n }\n\n return StyleSheet.create({\n container: {\n justifyContent: 'flex-start',\n paddingBottom: bottom,\n width: '100%',\n backgroundColor: colors.fillColorNeutral100Inverted,\n height: containerHeight,\n ...Platform.select({\n ios: {\n flexGrow: 1, // Ensures the FormSheet children respond to the formsheet height changing on iOS\n },\n android: {\n maxHeight: '100%', // Ensures lists to scroll on Android\n },\n }),\n },\n androidSheetGrabber: {\n position: 'absolute',\n top: 5,\n width: 34,\n height: 5,\n backgroundColor: colors.fillColorNeutral040,\n borderRadius: 100,\n alignSelf: 'center',\n },\n content: {\n ...Platform.select({\n android: {\n maxHeight: '100%', // Ensures content above a list (e.g. FormSheet.Header) don't subtract from the FormSheet's height\n },\n }),\n },\n header: {\n paddingHorizontal: 16,\n paddingTop: 20,\n paddingBottom: 16,\n backgroundColor: colors.fillColorNeutral100Inverted,\n gap: 16,\n borderBottomWidth: 1,\n borderBottomColor: colors.borderColorDefaultBase,\n },\n headerContent: {\n flexDirection: 'row',\n alignItems: 'center',\n justifyContent: 'space-between',\n },\n headerTitle: {\n textAlign: 'left',\n },\n headerActions: {\n flexDirection: 'row',\n alignItems: 'center',\n gap: 16,\n },\n actionPressable: {\n flexDirection: 'row',\n alignItems: 'center',\n paddingVertical: 12,\n paddingHorizontal: 16,\n gap: 8,\n },\n actionIcon: {\n color: appearanceColorsMap[appearance].iconColor,\n },\n actionTitle: {\n color: appearanceColorsMap[appearance].textColor,\n },\n })\n}\n"]}
|
|
1
|
+
{"version":3,"file":"form_sheet.js","sourceRoot":"","sources":["../../../src/components/primitive/form_sheet.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAA;AAE/E,OAAO,KAAoB,MAAM,OAAO,CAAA;AACxC,OAAO,EACL,QAAQ,EACR,UAAU,EACV,IAAI,EACJ,mBAAmB,GAIpB,MAAM,cAAc,CAAA;AACrB,OAAO,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAA;AAClE,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA;AAEtC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAc,IAAI,EAAE,UAAU,EAAE,MAAM,YAAY,CAAA;AAChF,OAAO,EAAE,iCAAiC,EAAE,MAAM,aAAa,CAAA;AAE/D,oCAAoC;AACpC,oCAAoC;AACpC,oCAAoC;AAEpC;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,yBAAyB,GAAG,CAAC,EACxC,WAAW,EACX,mBAAmB,GAAG,CAAC,IAAI,CAAC,EAC5B,GAAG,IAAI,KACyB,EAAE,EAAgC,EAAE,CAAC,CAAC;IACtE,YAAY,EAAE,WAAW;IACzB,WAAW,EAAE,KAAK;IAClB,mBAAmB;IACnB,iBAAiB,EAAE,EAAE;IACrB,mBAAmB,EAAE,IAAI;IACzB,WAAW;IACX,GAAG,IAAI;CACR,CAAC,CAAA;AAEF,MAAM,SAAS,GAAG;IAChB,IAAI,EAAE,aAAa;IACnB,MAAM,EAAE,eAAe;IACvB,MAAM,EAAE,eAAe;IACvB,WAAW,EAAE,oBAAoB;IACjC,aAAa,EAAE,sBAAsB;IACrC,gBAAgB,EAAE,yBAAyB;IAC3C,YAAY,EAAE,qBAAqB;CAC3B,CAAA;AAYV,eAAe,SAAgC,CAAA;AAsB/C,MAAM,UAAU,aAAa,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M,CAAC,2BAA2B;YACnD,GAAG,EAAE,EAAE;YACP,iBAAiB,EAAE,CAAC;YACpB,iBAAiB,EAAE,MAAM,CAAC,sBAAsB;SACjD;QACD,aAAa,EAAE;YACb,aAAa,EAAE,KAAK;YACpB,UAAU,EAAE,QAAQ;YACpB,cAAc,EAAE,eAAe;SAChC;QACD,WAAW,EAAE;YACX,SAAS,EAAE,MAAM;YACjB,IAAI,EAAE,CAAC;SACR;QACD,aAAa,EAAE;YACb,aAAa,EAAE,KAAK;YACpB,UAAU,EAAE,QAAQ;YACpB,GAAG,EAAE,EAAE;SACR;QACD,eAAe,EAAE;YACf,aAAa,EAAE,KAAK;YACpB,UAAU,EAAE,QAAQ;YACpB,eAAe,EAAE,EAAE;YACnB,iBAAiB,EAAE,EAAE;YACrB,GAAG,EAAE,CAAC;SACP;QACD,UAAU,EAAE;YACV,KAAK,EAAE,mBAAmB,CAAC,UAAU,CAAC,CAAC,SAAS;SACjD;QACD,WAAW,EAAE;YACX,KAAK,EAAE,mBAAmB,CAAC,UAAU,CAAC,CAAC,SAAS;SACjD;KACF,CAAC,CAAA;AACJ,CAAC,CAAA","sourcesContent":["import { PlatformPressable, useHeaderHeight } from '@react-navigation/elements'\nimport { NativeStackNavigationOptions } from '@react-navigation/native-stack'\nimport React, { ReactNode } from 'react'\nimport {\n Platform,\n StyleSheet,\n View,\n useWindowDimensions,\n type AccessibilityRole,\n type StyleProp,\n type ViewStyle,\n} from 'react-native'\nimport { useSafeAreaInsets } from 'react-native-safe-area-context'\nimport { useTheme } from '../../hooks'\nimport type { ButtonProps, TextButtonProps } from '../display'\nimport { Button, Heading, Icon, IconString, Text, TextButton } from '../display'\nimport { MAX_FONT_SIZE_MULTIPLIER_LANDMARK } from '../../utils'\n\n// =================================\n// ====== Exports ==================\n// =================================\n\n/**\n * Screen options for the formsheet's NativeStackNavigation route\n * @param {string} options.headerTitle - Doesn't show in UI but good to have for semantic reasons.\n * @param {number[]} [options.sheetAllowedDetents] - Controls the height increments the sheet grows to. To prevent bugs in Android, do not specify more then two values and use [0.94] instead of [1] to go full screen.\n * @param {NativeStackNavigationOptions} [options.rest] - Adds or overrides any valid NativeStackNavigationOptions\n * @returns {NativeStackNavigationOptions} Merged NativeStackNavigationOptions\n */\nexport const getFormSheetScreenOptions = ({\n headerTitle,\n sheetAllowedDetents = [0.25],\n ...rest\n}: NativeStackNavigationOptions = {}): NativeStackNavigationOptions => ({\n presentation: 'formSheet',\n headerShown: false,\n sheetAllowedDetents,\n sheetCornerRadius: 16,\n sheetGrabberVisible: true,\n headerTitle,\n ...rest,\n})\n\nconst FormSheet = {\n Root: FormSheetRoot,\n Action: FormSheetAction,\n Header: FormSheetHeader,\n HeaderTitle: FormSheetHeaderTitle,\n HeaderActions: FormSheetHeaderActions,\n HeaderTextButton: FormSheetHeaderTextButton,\n HeaderButton: FormSheetHeaderButton,\n} as const\n\ntype FormSheetComponents = {\n Root: React.FC<FormSheetRootProps>\n Action: React.FC<FormSheetActionProps>\n Header: React.FC<FormSheetHeaderProps>\n HeaderTitle: React.FC<FormSheetHeaderTitleProps>\n HeaderActions: React.FC<FormSheetHeaderActionsProps>\n HeaderTextButton: React.FC<FormSheetHeaderTextButtonProps>\n HeaderButton: React.FC<FormSheetHeaderButtonProps>\n}\n\nexport default FormSheet as FormSheetComponents\nexport type {\n FormSheetActionProps,\n FormSheetHeaderActionsProps,\n FormSheetHeaderButtonProps,\n FormSheetHeaderProps,\n FormSheetHeaderTextButtonProps,\n FormSheetHeaderTitleProps,\n FormSheetRootProps,\n}\n\n// ====================================\n// ====== ActionsFormSheetRoot ========\n// ====================================\n\ninterface FormSheetRootProps {\n children: ReactNode\n style?: StyleProp<ViewStyle>\n contentStyle?: StyleProp<ViewStyle>\n showAndroidSheetGrabber?: boolean\n}\n\nexport function FormSheetRoot({\n children,\n style,\n contentStyle,\n showAndroidSheetGrabber = true,\n}: FormSheetRootProps) {\n const styles = useStyles()\n\n return (\n <View style={[styles.container, style]} collapsable={false}>\n <View style={[styles.content, contentStyle]}>{children}</View>\n {showAndroidSheetGrabber && <AndroidSheetGrabber />}\n </View>\n )\n}\n\nFormSheetRoot.displayName = 'FormSheet.Root'\n\n// ====================================\n// ====== AndroidSheetGrabber =========\n// ====================================\n\nfunction AndroidSheetGrabber() {\n const styles = useStyles()\n\n return Platform.select({\n android: <View style={styles.androidSheetGrabber} />,\n ios: null,\n })\n}\n\n// ====================================\n// ====== FormSheetHeader =============\n// ====================================\n\ninterface FormSheetHeaderProps {\n children: ReactNode\n style?: StyleProp<ViewStyle>\n}\n\nfunction FormSheetHeader({ children, style }: FormSheetHeaderProps) {\n const styles = useStyles()\n\n return (\n <View style={[styles.header, style]}>\n <View style={styles.headerContent}>{children}</View>\n </View>\n )\n}\n\nFormSheetHeader.displayName = 'FormSheet.Header'\n\n// ====================================\n// ====== FormSheetHeaderTitle ========\n// ====================================\n\ninterface FormSheetHeaderTitleProps {\n children: ReactNode\n}\n\nfunction FormSheetHeaderTitle({ children }: FormSheetHeaderTitleProps) {\n const styles = useStyles()\n\n return (\n <Heading\n variant=\"h3\"\n style={styles.headerTitle}\n maxFontSizeMultiplier={MAX_FONT_SIZE_MULTIPLIER_LANDMARK}\n >\n {children}\n </Heading>\n )\n}\n\nFormSheetHeaderTitle.displayName = 'FormSheet.HeaderTitle'\n\n// ====================================\n// ====== FormSheetHeaderActions ======\n// ====================================\n\ninterface FormSheetHeaderActionsProps {\n children: ReactNode\n}\n\nfunction FormSheetHeaderActions({ children }: FormSheetHeaderActionsProps) {\n const styles = useStyles()\n\n return <View style={styles.headerActions}>{children}</View>\n}\n\nFormSheetHeaderActions.displayName = 'FormSheet.HeaderActions'\n\n// ===========================================\n// ====== FormSheetHeaderTextButton ==========\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.\ninterface FormSheetHeaderTextButtonProps\n extends Omit<TextButtonProps, 'maxFontSizeMultiplier' | 'onLongPress'> {\n children: string\n}\n\nfunction FormSheetHeaderTextButton(props: FormSheetHeaderTextButtonProps) {\n return (\n <TextButton\n {...props}\n maxFontSizeMultiplier={MAX_FONT_SIZE_MULTIPLIER_LANDMARK}\n accessibilityShowsLargeContentViewer\n accessibilityLargeContentTitle={props.children}\n />\n )\n}\n\nFormSheetHeaderTextButton.displayName = 'FormSheet.HeaderTextButton'\n\n// =========================================\n// ====== FormSheetHeaderButton ============\n// =========================================\n\n// Same `onLongPress`note as `FormSheetHeaderTextButtonProps`\ninterface FormSheetHeaderButtonProps\n extends Omit<ButtonProps, 'maxFontSizeMultiplier' | 'onLongPress'> {}\n\nfunction FormSheetHeaderButton(props: FormSheetHeaderButtonProps) {\n return (\n <Button\n {...props}\n maxFontSizeMultiplier={MAX_FONT_SIZE_MULTIPLIER_LANDMARK}\n accessibilityShowsLargeContentViewer\n accessibilityLargeContentTitle={props.title}\n />\n )\n}\n\nFormSheetHeaderButton.displayName = 'FormSheet.HeaderButton'\n\n// ====================================\n// ====== ActionsFormSheetAction ======\n// ====================================\n\nconst FORM_SHEET_ACTION_APPEARANCES = {\n neutral: 'neutral',\n danger: 'danger',\n} as const\n\ntype FormSheetActionAppearanceUnion =\n (typeof FORM_SHEET_ACTION_APPEARANCES)[keyof typeof FORM_SHEET_ACTION_APPEARANCES]\n\ninterface FormSheetActionProps {\n title: string\n iconName: IconString\n onPress: () => void\n accessibilityLabel?: string\n accessibilityHint?: string\n accessibilityRole?: AccessibilityRole\n appearance?: FormSheetActionAppearanceUnion\n disabled?: boolean\n}\n\nfunction FormSheetAction({\n title,\n iconName,\n onPress,\n accessibilityLabel,\n accessibilityHint,\n accessibilityRole = 'button',\n appearance = 'neutral',\n disabled = false,\n}: FormSheetActionProps) {\n const styles = useStyles({ appearance })\n\n return (\n <PlatformPressable\n onPress={onPress}\n accessibilityLabel={accessibilityLabel}\n accessibilityHint={accessibilityHint}\n accessibilityRole={accessibilityRole}\n style={styles.actionPressable}\n disabled={disabled}\n >\n <Icon name={iconName} size={16} accessibilityElementsHidden style={styles.actionIcon} />\n <Text style={styles.actionTitle}>{title}</Text>\n </PlatformPressable>\n )\n}\n\nFormSheetAction.displayName = 'FormSheet.Action'\n\n// ==================================\n// ====== Styles ====================\n// ==================================\n\ninterface Styles {\n appearance?: FormSheetActionAppearanceUnion\n}\n\nconst useStyles = ({ appearance = 'neutral' }: Styles = {}) => {\n const { colors } = useTheme()\n const { height } = useWindowDimensions()\n const { bottom, top } = useSafeAreaInsets()\n const headerHeight = useHeaderHeight()\n\n const containerHeight = Platform.select({\n ios: height - top - headerHeight,\n default: null,\n })\n\n const appearanceColorsMap = {\n neutral: {\n iconColor: colors.iconColorDefaultPrimary,\n textColor: colors.textColorDefaultPrimary,\n },\n danger: {\n iconColor: colors.fillColorStatusErrorMedium,\n textColor: colors.fillColorStatusErrorMedium,\n },\n }\n\n return StyleSheet.create({\n container: {\n justifyContent: 'flex-start',\n paddingBottom: bottom,\n width: '100%',\n backgroundColor: colors.fillColorNeutral100Inverted,\n height: containerHeight,\n ...Platform.select({\n ios: {\n flexGrow: 1, // Ensures the FormSheet children respond to the formsheet height changing on iOS\n },\n android: {\n maxHeight: '100%', // Ensures lists to scroll on Android\n },\n }),\n },\n androidSheetGrabber: {\n position: 'absolute',\n top: 5,\n width: 34,\n height: 5,\n backgroundColor: colors.fillColorNeutral040,\n borderRadius: 100,\n alignSelf: 'center',\n },\n content: {\n ...Platform.select({\n android: {\n maxHeight: '100%', // Ensures content above a list (e.g. FormSheet.Header) don't subtract from the FormSheet's height\n },\n }),\n },\n header: {\n paddingHorizontal: 16,\n paddingTop: 20,\n paddingBottom: 16,\n backgroundColor: colors.fillColorNeutral100Inverted,\n gap: 16,\n borderBottomWidth: 1,\n borderBottomColor: colors.borderColorDefaultBase,\n },\n headerContent: {\n flexDirection: 'row',\n alignItems: 'center',\n justifyContent: 'space-between',\n },\n headerTitle: {\n textAlign: 'left',\n flex: 1,\n },\n headerActions: {\n flexDirection: 'row',\n alignItems: 'center',\n gap: 16,\n },\n actionPressable: {\n flexDirection: 'row',\n alignItems: 'center',\n paddingVertical: 12,\n paddingHorizontal: 16,\n gap: 8,\n },\n actionIcon: {\n color: appearanceColorsMap[appearance].iconColor,\n },\n actionTitle: {\n color: appearanceColorsMap[appearance].textColor,\n },\n })\n}\n"]}
|
package/build/hooks/index.d.ts
CHANGED
|
@@ -13,4 +13,5 @@ export * from './use_api_client';
|
|
|
13
13
|
export * from './use_message_reaction_toggle';
|
|
14
14
|
export * from './use_interaction_ghost_color';
|
|
15
15
|
export * from './use_at_font_scale_breakpoint';
|
|
16
|
+
export * from './use_scalable_number_of_lines';
|
|
16
17
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/hooks/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAA;AACnC,cAAc,aAAa,CAAA;AAC3B,cAAc,oBAAoB,CAAA;AAClC,cAAc,sBAAsB,CAAA;AACpC,cAAc,kBAAkB,CAAA;AAChC,cAAc,mCAAmC,CAAA;AACjD,cAAc,wBAAwB,CAAA;AACtC,cAAc,kBAAkB,CAAA;AAChC,cAAc,qBAAqB,CAAA;AACnC,cAAc,cAAc,CAAA;AAC5B,cAAc,WAAW,CAAA;AACzB,cAAc,kBAAkB,CAAA;AAChC,cAAc,+BAA+B,CAAA;AAC7C,cAAc,+BAA+B,CAAA;AAC7C,cAAc,gCAAgC,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/hooks/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAA;AACnC,cAAc,aAAa,CAAA;AAC3B,cAAc,oBAAoB,CAAA;AAClC,cAAc,sBAAsB,CAAA;AACpC,cAAc,kBAAkB,CAAA;AAChC,cAAc,mCAAmC,CAAA;AACjD,cAAc,wBAAwB,CAAA;AACtC,cAAc,kBAAkB,CAAA;AAChC,cAAc,qBAAqB,CAAA;AACnC,cAAc,cAAc,CAAA;AAC5B,cAAc,WAAW,CAAA;AACzB,cAAc,kBAAkB,CAAA;AAChC,cAAc,+BAA+B,CAAA;AAC7C,cAAc,+BAA+B,CAAA;AAC7C,cAAc,gCAAgC,CAAA;AAC9C,cAAc,gCAAgC,CAAA"}
|
package/build/hooks/index.js
CHANGED
|
@@ -13,4 +13,5 @@ export * from './use_api_client';
|
|
|
13
13
|
export * from './use_message_reaction_toggle';
|
|
14
14
|
export * from './use_interaction_ghost_color';
|
|
15
15
|
export * from './use_at_font_scale_breakpoint';
|
|
16
|
+
export * from './use_scalable_number_of_lines';
|
|
16
17
|
//# sourceMappingURL=index.js.map
|
package/build/hooks/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/hooks/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAA;AACnC,cAAc,aAAa,CAAA;AAC3B,cAAc,oBAAoB,CAAA;AAClC,cAAc,sBAAsB,CAAA;AACpC,cAAc,kBAAkB,CAAA;AAChC,cAAc,mCAAmC,CAAA;AACjD,cAAc,wBAAwB,CAAA;AACtC,cAAc,kBAAkB,CAAA;AAChC,cAAc,qBAAqB,CAAA;AACnC,cAAc,cAAc,CAAA;AAC5B,cAAc,WAAW,CAAA;AACzB,cAAc,kBAAkB,CAAA;AAChC,cAAc,+BAA+B,CAAA;AAC7C,cAAc,+BAA+B,CAAA;AAC7C,cAAc,gCAAgC,CAAA","sourcesContent":["export * from './use_async_storage'\nexport * from './use_theme'\nexport * from './use_suspense_api'\nexport * from './use_current_person'\nexport * from './use_font_scale'\nexport * from './use_create_android_ripple_color'\nexport * from './use_chat_permissions'\nexport * from './use_api_client'\nexport * from './use_groups_groups'\nexport * from './use_groups'\nexport * from './use_api'\nexport * from './use_api_client'\nexport * from './use_message_reaction_toggle'\nexport * from './use_interaction_ghost_color'\nexport * from './use_at_font_scale_breakpoint'\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/hooks/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAA;AACnC,cAAc,aAAa,CAAA;AAC3B,cAAc,oBAAoB,CAAA;AAClC,cAAc,sBAAsB,CAAA;AACpC,cAAc,kBAAkB,CAAA;AAChC,cAAc,mCAAmC,CAAA;AACjD,cAAc,wBAAwB,CAAA;AACtC,cAAc,kBAAkB,CAAA;AAChC,cAAc,qBAAqB,CAAA;AACnC,cAAc,cAAc,CAAA;AAC5B,cAAc,WAAW,CAAA;AACzB,cAAc,kBAAkB,CAAA;AAChC,cAAc,+BAA+B,CAAA;AAC7C,cAAc,+BAA+B,CAAA;AAC7C,cAAc,gCAAgC,CAAA;AAC9C,cAAc,gCAAgC,CAAA","sourcesContent":["export * from './use_async_storage'\nexport * from './use_theme'\nexport * from './use_suspense_api'\nexport * from './use_current_person'\nexport * from './use_font_scale'\nexport * from './use_create_android_ripple_color'\nexport * from './use_chat_permissions'\nexport * from './use_api_client'\nexport * from './use_groups_groups'\nexport * from './use_groups'\nexport * from './use_api'\nexport * from './use_api_client'\nexport * from './use_message_reaction_toggle'\nexport * from './use_interaction_ghost_color'\nexport * from './use_at_font_scale_breakpoint'\nexport * from './use_scalable_number_of_lines'\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use_scalable_number_of_lines.d.ts","sourceRoot":"","sources":["../../src/hooks/use_scalable_number_of_lines.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,wBAAwB,mBAAoB,MAAM,KAAG,MAAM,GAAG,SAO1E,CAAA"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { useAtFontScaleBreakpoint } from './use_at_font_scale_breakpoint';
|
|
2
|
+
export const useScalableNumberOfLines = (numberOfLines) => {
|
|
3
|
+
const atFontScaleBreakpoint = useAtFontScaleBreakpoint();
|
|
4
|
+
if (!numberOfLines)
|
|
5
|
+
return undefined;
|
|
6
|
+
const numberOfLinesDoubled = numberOfLines + 1;
|
|
7
|
+
return atFontScaleBreakpoint ? numberOfLinesDoubled : numberOfLines;
|
|
8
|
+
};
|
|
9
|
+
//# sourceMappingURL=use_scalable_number_of_lines.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use_scalable_number_of_lines.js","sourceRoot":"","sources":["../../src/hooks/use_scalable_number_of_lines.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,MAAM,gCAAgC,CAAA;AAEzE,MAAM,CAAC,MAAM,wBAAwB,GAAG,CAAC,aAAsB,EAAsB,EAAE;IACrF,MAAM,qBAAqB,GAAG,wBAAwB,EAAE,CAAA;IAExD,IAAI,CAAC,aAAa;QAAE,OAAO,SAAS,CAAA;IAEpC,MAAM,oBAAoB,GAAG,aAAa,GAAG,CAAC,CAAA;IAC9C,OAAO,qBAAqB,CAAC,CAAC,CAAC,oBAAoB,CAAC,CAAC,CAAC,aAAa,CAAA;AACrE,CAAC,CAAA","sourcesContent":["import { useAtFontScaleBreakpoint } from './use_at_font_scale_breakpoint'\n\nexport const useScalableNumberOfLines = (numberOfLines?: number): number | undefined => {\n const atFontScaleBreakpoint = useAtFontScaleBreakpoint()\n\n if (!numberOfLines) return undefined\n\n const numberOfLinesDoubled = numberOfLines + 1\n return atFontScaleBreakpoint ? numberOfLinesDoubled : numberOfLines\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;AAoBnD,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;AAoBnD,eAAO,MAAM,mBAAmB,yBAmH/B,CAAA"}
|
|
@@ -56,7 +56,7 @@ export const ListHeaderComponent = () => {
|
|
|
56
56
|
<Heading numberOfLines={1} variant="h2">
|
|
57
57
|
Conversations
|
|
58
58
|
</Heading>
|
|
59
|
-
<TextButton onPress={alertMarkAllRead} disabled={isPending} maxFontSizeMultiplier={MAX_FONT_SIZE_MULTIPLIER_LANDMARK}>
|
|
59
|
+
<TextButton onPress={alertMarkAllRead} disabled={isPending} maxFontSizeMultiplier={MAX_FONT_SIZE_MULTIPLIER_LANDMARK} accessibilityShowsLargeContentViewer accessibilityLargeContentTitle="Mark all read">
|
|
60
60
|
Mark all read
|
|
61
61
|
</TextButton>
|
|
62
62
|
</View>
|
|
@@ -102,7 +102,7 @@ const useStyles = () => {
|
|
|
102
102
|
rowGap: 8,
|
|
103
103
|
columnGap: 16,
|
|
104
104
|
paddingTop: 8,
|
|
105
|
-
paddingBottom: atFontScaleBreakpoint ?
|
|
105
|
+
paddingBottom: atFontScaleBreakpoint ? 4 : 0,
|
|
106
106
|
paddingHorizontal: ROW_PADDING_HORIZONTAL,
|
|
107
107
|
},
|
|
108
108
|
filterRow: {
|
|
@@ -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,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,qBAAqB,CAAA;AACvE,OAAO,EAAE,wBAAwB,EAAE,qBAAqB,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAA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U,EAAE,CAAC;YACb,aAAa,EAAE,qBAAqB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;YAC5C,iBAAiB,EAAE,sBAAsB;SAC1C;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 { ConversationsScreenProps } from '../conversations_screen'\nimport { ChatGroupBadge } from './chat_group_badge'\nimport { Haptic } from '../../../utils/native_adapters'\nimport { MAX_FONT_SIZE_MULTIPLIER_LANDMARK } from '../../../utils'\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\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 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.titleRow}>\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 >\n Mark all read\n </TextButton>\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: 12,\n },\n titleRow: {\n flexDirection: atFontScaleBreakpoint ? 'column' : 'row',\n justifyContent: 'space-between',\n alignItems: atFontScaleBreakpoint ? 'flex-start' : 'center',\n flexWrap: 'wrap',\n rowGap: 8,\n columnGap: 16,\n paddingTop: 8,\n paddingBottom: atFontScaleBreakpoint ? 8 : 0,\n paddingHorizontal: ROW_PADDING_HORIZONTAL,\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,qBAAqB,CAAA;AACvE,OAAO,EAAE,wBAAwB,EAAE,qBAAqB,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAA;AAC1F,OAAO,EAAE,cAAc,EAAE,MAAM,0CAA0C,CAAA;AACzE,OAAO,EAAE,m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qBAAqB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;YAC5C,iBAAiB,EAAE,sBAAsB;SAC1C;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 { ConversationsScreenProps } from '../conversations_screen'\nimport { ChatGroupBadge } from './chat_group_badge'\nimport { Haptic } from '../../../utils/native_adapters'\nimport { MAX_FONT_SIZE_MULTIPLIER_LANDMARK } from '../../../utils'\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\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 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.titleRow}>\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 <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: 12,\n },\n titleRow: {\n flexDirection: atFontScaleBreakpoint ? 'column' : 'row',\n justifyContent: 'space-between',\n alignItems: atFontScaleBreakpoint ? 'flex-start' : 'center',\n flexWrap: 'wrap',\n rowGap: 8,\n columnGap: 16,\n paddingTop: 8,\n paddingBottom: atFontScaleBreakpoint ? 4 : 0,\n paddingHorizontal: ROW_PADDING_HORIZONTAL,\n },\n filterRow: {\n flexDirection: 'row',\n justifyContent: 'flex-start',\n gap: 8,\n paddingHorizontal: ROW_PADDING_HORIZONTAL,\n },\n })\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"conversations_screen.d.ts","sourceRoot":"","sources":["../../../src/screens/conversations/conversations_screen.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAiB,MAAM,0BAA0B,CAAA;AAC3E,OAAO,KAAK,MAAM,OAAO,CAAA;AAMzB,OAAO,EAAE,OAAO,EAAE,MAAM,sCAAsC,CAAA;AAG9D,OAAO,EAAE,OAAO,EAAE,MAAM,gCAAgC,CAAA;AAExD,MAAM,MAAM,wBAAwB,GAAG,iBAAiB,CAAC;IACvD,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,mBAAmB,CAAC,EAAE,OAAO,CAAA;IAC7B,qBAAqB,CAAC,EAAE,OAAO,CAAA;CAChC,CAAC,CAAA;AAEF,wBAAgB,mBAAmB,CAAC,EAAE,KAAK,EAAE,EAAE,wBAAwB,
|
|
1
|
+
{"version":3,"file":"conversations_screen.d.ts","sourceRoot":"","sources":["../../../src/screens/conversations/conversations_screen.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAiB,MAAM,0BAA0B,CAAA;AAC3E,OAAO,KAAK,MAAM,OAAO,CAAA;AAMzB,OAAO,EAAE,OAAO,EAAE,MAAM,sCAAsC,CAAA;AAG9D,OAAO,EAAE,OAAO,EAAE,MAAM,gCAAgC,CAAA;AAExD,MAAM,MAAM,wBAAwB,GAAG,iBAAiB,CAAC;IACvD,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,mBAAmB,CAAC,EAAE,OAAO,CAAA;IAC7B,qBAAqB,CAAC,EAAE,OAAO,CAAA;CAChC,CAAC,CAAA;AAEF,wBAAgB,mBAAmB,CAAC,EAAE,KAAK,EAAE,EAAE,wBAAwB,qBAkEtE"}
|
|
@@ -48,7 +48,7 @@ export function ConversationsScreen({ route }) {
|
|
|
48
48
|
<ConversationsContextProvider args={route.params}>
|
|
49
49
|
<Conversations ListHeaderComponent={ListHeaderComponent}/>
|
|
50
50
|
</ConversationsContextProvider>
|
|
51
|
-
<ActionButton visible={canCreateConversations} title="New conversation" onPress={handleNewConversationNavigation} buttonIconNameLeft="churchCenter.signups" secondaryButton={<TextButton variant="tertiary" onPress={reportABug} maxFontSizeMultiplier={MAX_FONT_SIZE_MULTIPLIER_LANDMARK}>
|
|
51
|
+
<ActionButton visible={canCreateConversations} title="New conversation" onPress={handleNewConversationNavigation} buttonIconNameLeft="churchCenter.signups" secondaryButton={<TextButton variant="tertiary" onPress={reportABug} maxFontSizeMultiplier={MAX_FONT_SIZE_MULTIPLIER_LANDMARK} accessibilityShowsLargeContentViewer accessibilityLargeContentTitle="Report a bug">
|
|
52
52
|
Report a bug
|
|
53
53
|
</TextButton>}/>
|
|
54
54
|
</View>);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"conversations_screen.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AC,CAAA;QACJ,CAAC;QACD,IAAI,aAAa,KAAK,QAAQ,EAAE,CAAC;YAC/B,OAAO,UAAU,CAAC,QAAQ,CAAC,KAAK,EAAE;gBAChC,MAAM,EAAE,iBAAiB;gBACzB,MAAM,EAAE;oBACN,QAAQ,EAAE,QAAQ;oBAClB,eAAe,EAAE,aAAa;oBAC9B,GAAG,KAAK,CAAC,MAAM;iBAChB;aACF,CAAC,CAAA;QACJ,CAAC;QAED,OAAO,UAAU,CAAC,QAAQ,CAAC,KAAK,EAAE;YAChC,MAAM,EAAE,8BAA8B;YACtC,MAAM,EAAE;gBACN,GAAG,KAAK,CAAC,MAAM;aAChB;SACF,CAAC,CAAA;IACJ,CAAC,CAAA;IAED,MAAM,UAAU,GAAG,GAAG,EAAE;QACtB,OAAO,UAAU,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAA;IACzC,CAAC,CAAA;IAED,OAAO,CACL,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,SAAS,CAAC,CAC5B;MAAA,CAAC,4BAA4B,CAAC,IAAI,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,CAC/C;QAAA,CAAC,aAAa,CAAC,mBAAmB,CAAC,CAAC,mBAAmB,CAAC,EAC1D;MAAA,EAAE,4BAA4B,CAC9B;MAAA,CAAC,YAAY,CACX,OAAO,CAAC,CAAC,sBAAsB,CAAC,CAChC,KAAK,CAAC,kBAAkB,CACxB,OAAO,CAAC,CAAC,+BAA+B,CAAC,CACzC,kBAAkB,CAAC,sBAAsB,CACzC,eAAe,CAAC,CACd,CAAC,UAAU,CACT,OAAO,CAAC,UAAU,CAClB,OAAO,CAAC,CAAC,UAAU,CAAC,CACpB,qBAAqB,CAAC,CAAC,iCAAiC,CAAC,
|
|
1
|
+
{"version":3,"file":"conversations_screen.js","sourceRoot":"","sources":["../../../src/screens/conversations/conversations_screen.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAqB,aAAa,EAAE,MAAM,0BAA0B,CA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,EAAE,QAAQ;SACzB;KACF,CAAC,CAAA;AACJ,CAAC,CAAA","sourcesContent":["import { StaticScreenProps, useNavigation } from '@react-navigation/native'\nimport React from 'react'\nimport { StyleSheet, View } from 'react-native'\nimport { Conversations, TextButton } from '../../components'\nimport { ActionButton } from '../../components/display/action_button'\nimport { ConversationsContextProvider } from '../../contexts/conversations_context'\nimport { useCanCreateConversations } from '../../hooks'\nimport { GraphId } from '../../types/resources/group_resource'\nimport { destructureChatGroupGraphId, MAX_FONT_SIZE_MULTIPLIER_LANDMARK } from '../../utils'\nimport { ListHeaderComponent } from './components/list_header_component'\nimport { AppName } from '../../types/resources/app_name'\n\nexport type ConversationsScreenProps = StaticScreenProps<{\n title?: string\n chat_group_graph_id?: GraphId\n group_source_app_name?: AppName\n}>\n\nexport function ConversationsScreen({ route }: ConversationsScreenProps) {\n const navigation = useNavigation()\n const canCreateConversations = useCanCreateConversations()\n const styles = useStyles()\n\n const { chat_group_graph_id } = route.params || {}\n const { sourceAppName, sourceId } = destructureChatGroupGraphId(chat_group_graph_id)\n\n const handleNewConversationNavigation = () => {\n if (sourceAppName === 'Services') {\n return navigation.navigate('New', {\n screen: 'ConversationNew',\n params: {\n team_ids: sourceId ? [sourceId] : [],\n source_app_name: sourceAppName,\n ...route.params,\n },\n })\n }\n if (sourceAppName === 'Groups') {\n return navigation.navigate('New', {\n screen: 'ConversationNew',\n params: {\n group_id: sourceId,\n source_app_name: sourceAppName,\n ...route.params,\n },\n })\n }\n\n return navigation.navigate('New', {\n screen: 'ConversationSelectRecipients',\n params: {\n ...route.params,\n },\n })\n }\n\n const reportABug = () => {\n return navigation.navigate('BugReport')\n }\n\n return (\n <View style={styles.container}>\n <ConversationsContextProvider args={route.params}>\n <Conversations ListHeaderComponent={ListHeaderComponent} />\n </ConversationsContextProvider>\n <ActionButton\n visible={canCreateConversations}\n title=\"New conversation\"\n onPress={handleNewConversationNavigation}\n buttonIconNameLeft=\"churchCenter.signups\"\n secondaryButton={\n <TextButton\n variant=\"tertiary\"\n onPress={reportABug}\n maxFontSizeMultiplier={MAX_FONT_SIZE_MULTIPLIER_LANDMARK}\n accessibilityShowsLargeContentViewer\n accessibilityLargeContentTitle=\"Report a bug\"\n >\n Report a bug\n </TextButton>\n }\n />\n </View>\n )\n}\n\nconst useStyles = () => {\n return StyleSheet.create({\n container: {\n flex: 1,\n justifyContent: 'center',\n },\n })\n}\n"]}
|
package/build/utils/styles.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export declare const MAX_FONT_SIZE_MULTIPLIER = 1.5;
|
|
2
|
-
export declare const MAX_FONT_SIZE_MULTIPLIER_LANDMARK = 1.
|
|
2
|
+
export declare const MAX_FONT_SIZE_MULTIPLIER_LANDMARK = 1.2;
|
|
3
3
|
export declare const CONVERSATION_MESSAGE_LIST_PADDING_HORIZONTAL = 16;
|
|
4
4
|
export declare const platformFontWeightMedium: "500" | "700" | undefined;
|
|
5
5
|
export declare const platformFontWeightBold: "600" | "700" | undefined;
|
package/build/utils/styles.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Platform } from 'react-native';
|
|
2
2
|
import { tokens } from '../vendor/tapestry/tokens';
|
|
3
3
|
export const MAX_FONT_SIZE_MULTIPLIER = 1.5;
|
|
4
|
-
export const MAX_FONT_SIZE_MULTIPLIER_LANDMARK = 1.
|
|
4
|
+
export const MAX_FONT_SIZE_MULTIPLIER_LANDMARK = 1.2; // Use in headers, footers, toolbars, etc.
|
|
5
5
|
export const CONVERSATION_MESSAGE_LIST_PADDING_HORIZONTAL = 16; // TODO: move to `screens/conversation/utils/styles` when `/screens/conversation` is created
|
|
6
6
|
export const platformFontWeightMedium = Platform.select({
|
|
7
7
|
ios: tokens.fontWeightMedium,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"styles.js","sourceRoot":"","sources":["../../src/utils/styles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAA;AACvC,OAAO,EAAE,MAAM,EAAE,MAAM,2BAA2B,CAAA;AAElD,MAAM,CAAC,MAAM,wBAAwB,GAAG,GAAG,CAAA;AAC3C,MAAM,CAAC,MAAM,iCAAiC,GAAG,GAAG,CAAA,CAAC,0CAA0C;AAE/F,MAAM,CAAC,MAAM,4CAA4C,GAAG,EAAE,CAAA,CAAC,4FAA4F;AAE3J,MAAM,CAAC,MAAM,wBAAwB,GAAG,QAAQ,CAAC,MAAM,CAAC;IACtD,GAAG,EAAE,MAAM,CAAC,gBAAgB;IAC5B,OAAO,EAAE,MAAM,CAAC,cAAc;CAC/B,CAAC,CAAA;AAEF,MAAM,CAAC,MAAM,sBAAsB,GAAG,QAAQ,CAAC,MAAM,CAAC;IACpD,GAAG,EAAE,MAAM,CAAC,kBAAkB;IAC9B,OAAO,EAAE,MAAM,CAAC,cAAc;CAC/B,CAAC,CAAA;AAEF,MAAM,CAAC,MAAM,2BAA2B,GAAG,QAAQ,CAAC,MAAM,CAAC;IACzD,GAAG,EAAE,EAAE,OAAO,EAAE,GAAG,EAAE;IACrB,OAAO,EAAE,EAAE,OAAO,EAAE,CAAC,EAAE;CACxB,CAAC,CAAA","sourcesContent":["import { Platform } from 'react-native'\nimport { tokens } from '../vendor/tapestry/tokens'\n\nexport const MAX_FONT_SIZE_MULTIPLIER = 1.5\nexport const MAX_FONT_SIZE_MULTIPLIER_LANDMARK = 1.
|
|
1
|
+
{"version":3,"file":"styles.js","sourceRoot":"","sources":["../../src/utils/styles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAA;AACvC,OAAO,EAAE,MAAM,EAAE,MAAM,2BAA2B,CAAA;AAElD,MAAM,CAAC,MAAM,wBAAwB,GAAG,GAAG,CAAA;AAC3C,MAAM,CAAC,MAAM,iCAAiC,GAAG,GAAG,CAAA,CAAC,0CAA0C;AAE/F,MAAM,CAAC,MAAM,4CAA4C,GAAG,EAAE,CAAA,CAAC,4FAA4F;AAE3J,MAAM,CAAC,MAAM,wBAAwB,GAAG,QAAQ,CAAC,MAAM,CAAC;IACtD,GAAG,EAAE,MAAM,CAAC,gBAAgB;IAC5B,OAAO,EAAE,MAAM,CAAC,cAAc;CAC/B,CAAC,CAAA;AAEF,MAAM,CAAC,MAAM,sBAAsB,GAAG,QAAQ,CAAC,MAAM,CAAC;IACpD,GAAG,EAAE,MAAM,CAAC,kBAAkB;IAC9B,OAAO,EAAE,MAAM,CAAC,cAAc;CAC/B,CAAC,CAAA;AAEF,MAAM,CAAC,MAAM,2BAA2B,GAAG,QAAQ,CAAC,MAAM,CAAC;IACzD,GAAG,EAAE,EAAE,OAAO,EAAE,GAAG,EAAE;IACrB,OAAO,EAAE,EAAE,OAAO,EAAE,CAAC,EAAE;CACxB,CAAC,CAAA","sourcesContent":["import { Platform } from 'react-native'\nimport { tokens } from '../vendor/tapestry/tokens'\n\nexport const MAX_FONT_SIZE_MULTIPLIER = 1.5\nexport const MAX_FONT_SIZE_MULTIPLIER_LANDMARK = 1.2 // Use in headers, footers, toolbars, etc.\n\nexport const CONVERSATION_MESSAGE_LIST_PADDING_HORIZONTAL = 16 // TODO: move to `screens/conversation/utils/styles` when `/screens/conversation` is created\n\nexport const platformFontWeightMedium = Platform.select({\n ios: tokens.fontWeightMedium,\n android: tokens.fontWeightBold,\n})\n\nexport const platformFontWeightBold = Platform.select({\n ios: tokens.fontWeightSemiBold,\n android: tokens.fontWeightBold,\n})\n\nexport const platformPressedOpacityStyle = Platform.select({\n ios: { opacity: 0.5 },\n android: { opacity: 1 },\n})\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@planningcenter/chat-react-native",
|
|
3
|
-
"version": "3.15.0-rc.
|
|
3
|
+
"version": "3.15.0-rc.2",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "build/index.js",
|
|
6
6
|
"types": "build/index.d.ts",
|
|
@@ -55,5 +55,5 @@
|
|
|
55
55
|
"react-native-url-polyfill": "^2.0.0",
|
|
56
56
|
"typescript": "<5.6.0"
|
|
57
57
|
},
|
|
58
|
-
"gitHead": "
|
|
58
|
+
"gitHead": "e86e47d3b6a0d93a18c451a7e1595a4c35e70728"
|
|
59
59
|
}
|
|
@@ -3,7 +3,12 @@ import { StyleSheet, View, ViewStyle } from 'react-native'
|
|
|
3
3
|
import { ConversationResource } from '../../types'
|
|
4
4
|
import { AvatarGroup, Heading, Text, Badge, type BadgeProps } from '../display'
|
|
5
5
|
import { formatDatePreview } from '../../utils/date'
|
|
6
|
-
import {
|
|
6
|
+
import {
|
|
7
|
+
useTheme,
|
|
8
|
+
useAtFontScaleBreakpoint,
|
|
9
|
+
useFontScale,
|
|
10
|
+
useScalableNumberOfLines,
|
|
11
|
+
} from '../../hooks'
|
|
7
12
|
import { UnreadCountBadge } from './unread_count_badge'
|
|
8
13
|
import { ConversationActions } from './conversation_actions'
|
|
9
14
|
import { MuteIndicator } from './mute_indicator'
|
|
@@ -41,6 +46,9 @@ export const ConversationPreview = ({
|
|
|
41
46
|
const fallbackIconName = emptyConversation ? 'people.noTextMessage' : 'general.person'
|
|
42
47
|
const hasMetaContent = lastMessageCreatedAt || unreadCount > 0 || muted
|
|
43
48
|
|
|
49
|
+
const numberOfLinesScaledTitle = useScalableNumberOfLines(1)
|
|
50
|
+
const numberOfLinesScaledPreviewText = useScalableNumberOfLines(2)
|
|
51
|
+
|
|
44
52
|
const conversationPreviewText = lastMessageTextPreview
|
|
45
53
|
? `${lastMessageAuthorName}: ${lastMessageTextPreview}`
|
|
46
54
|
: EMPTY_CONVERSATION_PREVIEW_TEXT
|
|
@@ -64,12 +72,12 @@ export const ConversationPreview = ({
|
|
|
64
72
|
fallbackIconName={fallbackIconName}
|
|
65
73
|
/>
|
|
66
74
|
<View style={styles.conversationBody}>
|
|
67
|
-
<Heading numberOfLines={
|
|
75
|
+
<Heading numberOfLines={numberOfLinesScaledTitle} variant="h3" style={styles.title}>
|
|
68
76
|
{title}
|
|
69
77
|
</Heading>
|
|
70
78
|
<Text
|
|
71
79
|
variant="tertiary"
|
|
72
|
-
numberOfLines={
|
|
80
|
+
numberOfLines={numberOfLinesScaledPreviewText}
|
|
73
81
|
style={emptyConversation && styles.emptyConversationPreviewText}
|
|
74
82
|
>
|
|
75
83
|
{conversationPreviewText}
|
|
@@ -96,6 +104,7 @@ interface BadgeShape {
|
|
|
96
104
|
}
|
|
97
105
|
const ConversationBadges = ({ visible, badges }: { visible: boolean; badges?: BadgeShape[] }) => {
|
|
98
106
|
const styles = useStyles()
|
|
107
|
+
const numberOfLinesScaled = useScalableNumberOfLines(1)
|
|
99
108
|
|
|
100
109
|
if (!visible || !badges || badges.length === 0) {
|
|
101
110
|
return null
|
|
@@ -110,6 +119,7 @@ const ConversationBadges = ({ visible, badges }: { visible: boolean; badges?: Ba
|
|
|
110
119
|
productLogoName={badge.appName}
|
|
111
120
|
label={badge.pcoResourceType}
|
|
112
121
|
metaLabel={badge.text || ''}
|
|
122
|
+
numberOfLinesMetaLabel={numberOfLinesScaled}
|
|
113
123
|
/>
|
|
114
124
|
))}
|
|
115
125
|
</View>
|
|
@@ -183,6 +193,7 @@ const getConversationAccessibilityLabel = ({
|
|
|
183
193
|
const useStyles = () => {
|
|
184
194
|
const { colors } = useTheme()
|
|
185
195
|
const atFontScaleBreakpoint = useAtFontScaleBreakpoint()
|
|
196
|
+
const fontScale = useFontScale()
|
|
186
197
|
|
|
187
198
|
return StyleSheet.create({
|
|
188
199
|
previewRow: {
|
|
@@ -238,7 +249,7 @@ const useStyles = () => {
|
|
|
238
249
|
statusContainer: {
|
|
239
250
|
flexDirection: 'row',
|
|
240
251
|
alignItems: 'center',
|
|
241
|
-
gap: 4,
|
|
252
|
+
gap: 4 * fontScale,
|
|
242
253
|
},
|
|
243
254
|
})
|
|
244
255
|
}
|
|
@@ -2,13 +2,20 @@ import React from 'react'
|
|
|
2
2
|
import { StyleSheet } from 'react-native'
|
|
3
3
|
import { Icon } from '../display'
|
|
4
4
|
import { useTheme } from '../../hooks'
|
|
5
|
+
import { MAX_FONT_SIZE_MULTIPLIER } from '../../utils'
|
|
5
6
|
|
|
6
7
|
export const MuteIndicator = ({ muted }: { muted: boolean }) => {
|
|
7
8
|
const styles = useStyles()
|
|
8
9
|
|
|
9
10
|
if (!muted) return null
|
|
10
11
|
|
|
11
|
-
return
|
|
12
|
+
return (
|
|
13
|
+
<Icon
|
|
14
|
+
name="general.bellMuted"
|
|
15
|
+
style={styles.mutedIcon}
|
|
16
|
+
maxFontSizeMultiplier={MAX_FONT_SIZE_MULTIPLIER}
|
|
17
|
+
/>
|
|
18
|
+
)
|
|
12
19
|
}
|
|
13
20
|
|
|
14
21
|
const useStyles = () => {
|
|
@@ -16,6 +23,7 @@ const useStyles = () => {
|
|
|
16
23
|
return StyleSheet.create({
|
|
17
24
|
mutedIcon: {
|
|
18
25
|
color: colors.iconColorDefaultDim,
|
|
26
|
+
fontSize: 16,
|
|
19
27
|
},
|
|
20
28
|
})
|
|
21
29
|
}
|
|
@@ -3,7 +3,11 @@ import { StyleSheet } from 'react-native'
|
|
|
3
3
|
import { Pressable, type PressableProps } from 'react-native-gesture-handler'
|
|
4
4
|
import { Icon, IconString, Spinner, Text } from '../display'
|
|
5
5
|
import { useCreateAndroidRippleColor, useTheme } from '../../hooks'
|
|
6
|
-
import {
|
|
6
|
+
import {
|
|
7
|
+
MAX_FONT_SIZE_MULTIPLIER,
|
|
8
|
+
platformFontWeightMedium,
|
|
9
|
+
platformPressedOpacityStyle,
|
|
10
|
+
} from '../../utils/styles'
|
|
7
11
|
import { tokens } from '../../vendor/tapestry/tokens'
|
|
8
12
|
import { Haptic } from '../../utils/native_adapters/configuration'
|
|
9
13
|
|
|
@@ -50,8 +54,16 @@ export function SwipeableToggleButton({
|
|
|
50
54
|
<Spinner size={20} />
|
|
51
55
|
) : (
|
|
52
56
|
<>
|
|
53
|
-
<Icon
|
|
54
|
-
|
|
57
|
+
<Icon
|
|
58
|
+
name={iconName}
|
|
59
|
+
style={styles.icon}
|
|
60
|
+
maxFontSizeMultiplier={MAX_FONT_SIZE_MULTIPLIER}
|
|
61
|
+
/>
|
|
62
|
+
<Text
|
|
63
|
+
variant="footnote"
|
|
64
|
+
style={styles.text}
|
|
65
|
+
maxFontSizeMultiplier={MAX_FONT_SIZE_MULTIPLIER}
|
|
66
|
+
>
|
|
55
67
|
{label}
|
|
56
68
|
</Text>
|
|
57
69
|
</>
|
|
@@ -78,12 +90,15 @@ const useStyles = ({ backgroundColor, disabled }: Partial<SwipeableToggleButtonP
|
|
|
78
90
|
backgroundColor: buttonBackgroundColor,
|
|
79
91
|
},
|
|
80
92
|
icon: {
|
|
93
|
+
fontSize: 20,
|
|
81
94
|
color: fillColor,
|
|
82
95
|
marginTop: 4,
|
|
83
96
|
},
|
|
84
97
|
text: {
|
|
85
98
|
color: fillColor,
|
|
86
99
|
fontWeight: platformFontWeightMedium,
|
|
100
|
+
textAlign: 'center',
|
|
101
|
+
paddingHorizontal: 8,
|
|
87
102
|
},
|
|
88
103
|
})
|
|
89
104
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
2
|
import { StyleSheet, View } from 'react-native'
|
|
3
3
|
import { Text } from '../display'
|
|
4
|
-
import { useTheme } from '../../hooks'
|
|
5
|
-
import { platformFontWeightBold } from '../../utils'
|
|
4
|
+
import { useFontScale, useTheme } from '../../hooks'
|
|
5
|
+
import { MAX_FONT_SIZE_MULTIPLIER, platformFontWeightBold } from '../../utils'
|
|
6
6
|
|
|
7
7
|
export const UnreadCountBadge = ({ count, showDot }: { count: number; showDot: boolean }) => {
|
|
8
8
|
const styles = useStyles()
|
|
@@ -22,6 +22,9 @@ export const UnreadCountBadge = ({ count, showDot }: { count: number; showDot: b
|
|
|
22
22
|
|
|
23
23
|
const useStyles = () => {
|
|
24
24
|
const { colors } = useTheme()
|
|
25
|
+
const dotScaleLimit = MAX_FONT_SIZE_MULTIPLIER * 1.5
|
|
26
|
+
const fontScale = useFontScale({ maxFontSizeMultiplier: dotScaleLimit })
|
|
27
|
+
const size = 8 * fontScale
|
|
25
28
|
|
|
26
29
|
return StyleSheet.create({
|
|
27
30
|
badge: {
|
|
@@ -29,16 +32,16 @@ const useStyles = () => {
|
|
|
29
32
|
backgroundColor: colors.fillColorInteractionDefault,
|
|
30
33
|
paddingVertical: 2,
|
|
31
34
|
paddingHorizontal: 8,
|
|
32
|
-
borderRadius: 24,
|
|
35
|
+
borderRadius: 24 * fontScale,
|
|
33
36
|
},
|
|
34
37
|
count: {
|
|
35
38
|
fontWeight: platformFontWeightBold,
|
|
36
39
|
color: 'white',
|
|
37
40
|
},
|
|
38
41
|
dot: {
|
|
39
|
-
width:
|
|
40
|
-
height:
|
|
41
|
-
borderRadius:
|
|
42
|
+
width: size,
|
|
43
|
+
height: size,
|
|
44
|
+
borderRadius: size,
|
|
42
45
|
backgroundColor: colors.fillColorInteractionDefault,
|
|
43
46
|
},
|
|
44
47
|
})
|
|
@@ -58,20 +58,19 @@ export const ActionButton = ({
|
|
|
58
58
|
iconNameLeft={buttonIconNameLeft}
|
|
59
59
|
loading={loading}
|
|
60
60
|
maxFontSizeMultiplier={MAX_FONT_SIZE_MULTIPLIER_LANDMARK}
|
|
61
|
+
accessibilityShowsLargeContentViewer
|
|
62
|
+
accessibilityLargeContentTitle={title}
|
|
61
63
|
/>
|
|
62
64
|
</View>
|
|
63
65
|
</Animated.View>
|
|
64
66
|
)
|
|
65
67
|
}
|
|
66
68
|
|
|
67
|
-
const SCALE_THAT_BUTTONS_WRAP = 1.15
|
|
68
|
-
|
|
69
69
|
const useStyles = () => {
|
|
70
70
|
const { fontScale } = useWindowDimensions()
|
|
71
71
|
const { bottom } = useSafeAreaInsets()
|
|
72
72
|
const { colors } = useTheme()
|
|
73
73
|
const containerVerticalPadding = 16
|
|
74
|
-
const isButtonsWrapping = fontScale >= SCALE_THAT_BUTTONS_WRAP
|
|
75
74
|
|
|
76
75
|
return StyleSheet.create({
|
|
77
76
|
container: {
|
|
@@ -85,7 +84,7 @@ const useStyles = () => {
|
|
|
85
84
|
},
|
|
86
85
|
buttonRow: {
|
|
87
86
|
flexDirection: 'row',
|
|
88
|
-
justifyContent:
|
|
87
|
+
justifyContent: fontScale > 1 ? 'center' : 'space-between',
|
|
89
88
|
alignItems: 'center',
|
|
90
89
|
gap: 16,
|
|
91
90
|
flexWrap: 'wrap-reverse',
|