@planningcenter/chat-react-native 3.15.0-rc.1 → 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.
@@ -27,13 +27,11 @@ export const ActionButton = ({ visible = true, disabled = false, onPress, title,
27
27
  </View>
28
28
  </Animated.View>);
29
29
  };
30
- const SCALE_THAT_BUTTONS_WRAP = 1.15;
31
30
  const useStyles = () => {
32
31
  const { fontScale } = useWindowDimensions();
33
32
  const { bottom } = useSafeAreaInsets();
34
33
  const { colors } = useTheme();
35
34
  const containerVerticalPadding = 16;
36
- const isButtonsWrapping = fontScale >= SCALE_THAT_BUTTONS_WRAP;
37
35
  return StyleSheet.create({
38
36
  container: {
39
37
  backgroundColor: colors.surfaceColor090,
@@ -46,7 +44,7 @@ const useStyles = () => {
46
44
  },
47
45
  buttonRow: {
48
46
  flexDirection: 'row',
49
- justifyContent: isButtonsWrapping ? 'center' : 'space-between',
47
+ justifyContent: fontScale > 1 ? 'center' : 'space-between',
50
48
  alignItems: 'center',
51
49
  gap: 16,
52
50
  flexWrap: 'wrap-reverse',
@@ -1 +1 @@
1
- {"version":3,"file":"action_button.js","sourceRoot":"","sources":["../../../src/components/display/action_button.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AACvC,OAAO,EAAE,QAAQ,EAAE,eAAe,EAAE,UAAU,EAAE,mBAAmB,EAAE,IAAI,EAAE,MAAM,cAAc,CAAA;AAC/F,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAA;AACjC,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AACjC,OAAO,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAA;AAClE,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA;AACtC,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAA;AAE7B,OAAO,EAAE,iCAAiC,EAAE,MAAM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AA;AACJ,CAAC,CAAA","sourcesContent":["import React, { useState } from 'react'\nimport { Animated, LayoutAnimation, StyleSheet, useWindowDimensions, View } from 'react-native'\nimport { Button } from './button'\nimport { useEffect } from 'react'\nimport { useSafeAreaInsets } from 'react-native-safe-area-context'\nimport { useTheme } from '../../hooks'\nimport { Text } from './text'\nimport { IconString } from './icon'\nimport { MAX_FONT_SIZE_MULTIPLIER_LANDMARK } from '../../utils'\n\nexport const ActionButton = ({\n visible = true,\n disabled = false,\n onPress,\n title,\n infoText,\n buttonIconNameLeft,\n secondaryButton,\n loading = false,\n}: {\n visible?: boolean\n disabled?: boolean\n onPress: () => void\n title: string\n infoText?: string\n buttonIconNameLeft?: IconString\n secondaryButton?: React.ReactNode\n loading?: boolean\n}) => {\n const styles = useStyles()\n const [show, setShow] = useState(visible)\n\n useEffect(() => {\n if (show === visible) return\n\n setShow(visible)\n LayoutAnimation.configureNext(LayoutAnimation.Presets.easeInEaseOut)\n }, [show, visible])\n\n if (!visible) return null\n\n return (\n <Animated.View style={styles.container}>\n {Boolean(infoText) && (\n <Text style={styles.infoText} variant=\"footnote\">\n {infoText}\n </Text>\n )}\n <View style={styles.buttonRow}>\n {secondaryButton}\n <Button\n variant=\"fill\"\n size=\"lg\"\n onPress={onPress}\n title={title}\n disabled={disabled}\n style={secondaryButton ? null : styles.fullWidthButton}\n iconNameLeft={buttonIconNameLeft}\n loading={loading}\n maxFontSizeMultiplier={MAX_FONT_SIZE_MULTIPLIER_LANDMARK}\n accessibilityShowsLargeContentViewer\n accessibilityLargeContentTitle={title}\n />\n </View>\n </Animated.View>\n )\n}\n\nconst SCALE_THAT_BUTTONS_WRAP = 1.15\n\nconst useStyles = () => {\n const { fontScale } = useWindowDimensions()\n const { bottom } = useSafeAreaInsets()\n const { colors } = useTheme()\n const containerVerticalPadding = 16\n const isButtonsWrapping = fontScale >= SCALE_THAT_BUTTONS_WRAP\n\n return StyleSheet.create({\n container: {\n backgroundColor: colors.surfaceColor090,\n paddingHorizontal: 24,\n paddingTop: containerVerticalPadding,\n paddingBottom: bottom + containerVerticalPadding,\n borderTopWidth: 1,\n borderTopColor: colors.borderColorDefaultDim,\n gap: 16,\n },\n buttonRow: {\n flexDirection: 'row',\n justifyContent: isButtonsWrapping ? 'center' : 'space-between',\n alignItems: 'center',\n gap: 16,\n flexWrap: 'wrap-reverse',\n },\n fullWidthButton: {\n flexGrow: 1,\n },\n infoText: {\n textAlign: 'center',\n },\n })\n}\n"]}
1
+ {"version":3,"file":"action_button.js","sourceRoot":"","sources":["../../../src/components/display/action_button.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AACvC,OAAO,EAAE,QAAQ,EAAE,eAAe,EAAE,UAAU,EAAE,mBAAmB,EAAE,IAAI,EAAE,MAAM,cAAc,CAAA;AAC/F,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAA;AACjC,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AACjC,OAAO,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAA;AAClE,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA;AACtC,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAA;AAE7B,OAAO,EAAE,iCAAiC,EAAE,MAAM,aAAa,CAAA;AAE/D,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,EAC3B,OAAO,GAAG,IAAI,EACd,QAAQ,GAAG,KAAK,EAChB,OAAO,EACP,KAAK,EACL,QAAQ,EACR,kBAAkB,EAClB,eAAe,EACf,OAAO,GAAG,KAAK,GAUhB,EAAE,EAAE;IACH,MAAM,MAAM,GAAG,SAAS,EAAE,CAAA;IAC1B,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,GAAG,QAAQ,CAAC,OAAO,CAAC,CAAA;IAEzC,SAAS,CAAC,GAAG,EAAE;QACb,IAAI,IAAI,KAAK,OAAO;YAAE,OAAM;QAE5B,OAAO,C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AAM,EAAE,MAAM,EAAE,GAAG,iBAAiB,EAAE,CAAA;IACtC,MAAM,EAAE,MAAM,EAAE,GAAG,QAAQ,EAAE,CAAA;IAC7B,MAAM,wBAAwB,GAAG,EAAE,CAAA;IAEnC,OAAO,UAAU,CAAC,MAAM,CAAC;QACvB,SAAS,EAAE;YACT,eAAe,EAAE,MAAM,CAAC,eAAe;YACvC,iBAAiB,EAAE,EAAE;YACrB,UAAU,EAAE,wBAAwB;YACpC,aAAa,EAAE,MAAM,GAAG,wBAAwB;YAChD,cAAc,EAAE,CAAC;YACjB,cAAc,EAAE,MAAM,CAAC,qBAAqB;YAC5C,GAAG,EAAE,EAAE;SACR;QACD,SAAS,EAAE;YACT,aAAa,EAAE,KAAK;YACpB,cAAc,EAAE,SAAS,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,eAAe;YAC1D,UAAU,EAAE,QAAQ;YACpB,GAAG,EAAE,EAAE;YACP,QAAQ,EAAE,cAAc;SACzB;QACD,eAAe,EAAE;YACf,QAAQ,EAAE,CAAC;SACZ;QACD,QAAQ,EAAE;YACR,SAAS,EAAE,QAAQ;SACpB;KACF,CAAC,CAAA;AACJ,CAAC,CAAA","sourcesContent":["import React, { useState } from 'react'\nimport { Animated, LayoutAnimation, StyleSheet, useWindowDimensions, View } from 'react-native'\nimport { Button } from './button'\nimport { useEffect } from 'react'\nimport { useSafeAreaInsets } from 'react-native-safe-area-context'\nimport { useTheme } from '../../hooks'\nimport { Text } from './text'\nimport { IconString } from './icon'\nimport { MAX_FONT_SIZE_MULTIPLIER_LANDMARK } from '../../utils'\n\nexport const ActionButton = ({\n visible = true,\n disabled = false,\n onPress,\n title,\n infoText,\n buttonIconNameLeft,\n secondaryButton,\n loading = false,\n}: {\n visible?: boolean\n disabled?: boolean\n onPress: () => void\n title: string\n infoText?: string\n buttonIconNameLeft?: IconString\n secondaryButton?: React.ReactNode\n loading?: boolean\n}) => {\n const styles = useStyles()\n const [show, setShow] = useState(visible)\n\n useEffect(() => {\n if (show === visible) return\n\n setShow(visible)\n LayoutAnimation.configureNext(LayoutAnimation.Presets.easeInEaseOut)\n }, [show, visible])\n\n if (!visible) return null\n\n return (\n <Animated.View style={styles.container}>\n {Boolean(infoText) && (\n <Text style={styles.infoText} variant=\"footnote\">\n {infoText}\n </Text>\n )}\n <View style={styles.buttonRow}>\n {secondaryButton}\n <Button\n variant=\"fill\"\n size=\"lg\"\n onPress={onPress}\n title={title}\n disabled={disabled}\n style={secondaryButton ? null : styles.fullWidthButton}\n iconNameLeft={buttonIconNameLeft}\n loading={loading}\n maxFontSizeMultiplier={MAX_FONT_SIZE_MULTIPLIER_LANDMARK}\n accessibilityShowsLargeContentViewer\n accessibilityLargeContentTitle={title}\n />\n </View>\n </Animated.View>\n )\n}\n\nconst useStyles = () => {\n const { fontScale } = useWindowDimensions()\n const { bottom } = useSafeAreaInsets()\n const { colors } = useTheme()\n const containerVerticalPadding = 16\n\n return StyleSheet.create({\n container: {\n backgroundColor: colors.surfaceColor090,\n paddingHorizontal: 24,\n paddingTop: containerVerticalPadding,\n paddingBottom: bottom + containerVerticalPadding,\n borderTopWidth: 1,\n borderTopColor: colors.borderColorDefaultDim,\n gap: 16,\n },\n buttonRow: {\n flexDirection: 'row',\n justifyContent: fontScale > 1 ? 'center' : 'space-between',\n alignItems: 'center',\n gap: 16,\n flexWrap: 'wrap-reverse',\n },\n fullWidthButton: {\n flexGrow: 1,\n },\n infoText: {\n textAlign: 'center',\n },\n })\n}\n"]}
@@ -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;AAMhF;;;;;;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,gBAAgB,EAAE,KAAK,CAAC,EAAE,CAAC,8BAA8B,CAAC,CAAA;IAC1D,YAAY,EAAE,KAAK,CAAC,EAAE,CAAC,0BAA0B,CAAC,CAAA;CACnD,CAAA;wBAE2B,mBAAmB;AAA/C,wBAA+C;AAC/C,YAAY,EACV,oBAAoB,EACpB,2BAA2B,EAC3B,0BAA0B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,CAAC,CAAA;IAC5B,YAAY,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAA;IACnC,uBAAuB,CAAC,EAAE,OAAO,CAAA;CAClC;AAED,wBAAgB,aAAa,CAAC,EAC5B,QAAQ,EACR,KAAK,EACL,YAAY,EACZ,uBAA8B,GAC/B,EAAE,kBAAkB,qBASpB;yBAde,aAAa;;;AAmC7B,UAAU,oBAAoB;IAC5B,QAAQ,EAAE,SAAS,CAAA;IACnB,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAA;CAC7B;AAkBD,UAAU,yBAAyB;IACjC,QAAQ,EAAE,SAAS,CAAA;CACpB;AAsBD,UAAU,2BAA2B;IACnC,QAAQ,EAAE,SAAS,CAAA;CACpB;AAiBD,UAAU,8BACR,SAAQ,IAAI,CAAC,eAAe,EAAE,uBAAuB,GAAG,aAAa,CAAC;IACtE,QAAQ,EAAE,MAAM,CAAA;CACjB;AAoBD,UAAU,0BACR,SAAQ,IAAI,CAAC,WAAW,EAAE,uBAAuB,GAAG,aAAa,CAAC;CAAG;AAmBvE,QAAA,MAAM,6BAA6B;;;CAGzB,CAAA;AAEV,KAAK,8BAA8B,GACjC,CAAC,OAAO,6BAA6B,CAAC,CAAC,MAAM,OAAO,6BAA6B,CAAC,CAAA;AAEpF,UAAU,oBAAoB;IAC5B,KAAK,EAAE,MAAM,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={1}>
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={1}/>;
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={1}/>;
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/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;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;;;;;;GAM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AAC,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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@planningcenter/chat-react-native",
3
- "version": "3.15.0-rc.1",
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": "374e1b143d5267e4dfd7b35e50df600adda5f3c1"
58
+ "gitHead": "e86e47d3b6a0d93a18c451a7e1595a4c35e70728"
59
59
  }
@@ -66,14 +66,11 @@ export const ActionButton = ({
66
66
  )
67
67
  }
68
68
 
69
- const SCALE_THAT_BUTTONS_WRAP = 1.15
70
-
71
69
  const useStyles = () => {
72
70
  const { fontScale } = useWindowDimensions()
73
71
  const { bottom } = useSafeAreaInsets()
74
72
  const { colors } = useTheme()
75
73
  const containerVerticalPadding = 16
76
- const isButtonsWrapping = fontScale >= SCALE_THAT_BUTTONS_WRAP
77
74
 
78
75
  return StyleSheet.create({
79
76
  container: {
@@ -87,7 +84,7 @@ const useStyles = () => {
87
84
  },
88
85
  buttonRow: {
89
86
  flexDirection: 'row',
90
- justifyContent: isButtonsWrapping ? 'center' : 'space-between',
87
+ justifyContent: fontScale > 1 ? 'center' : 'space-between',
91
88
  alignItems: 'center',
92
89
  gap: 16,
93
90
  flexWrap: 'wrap-reverse',
@@ -14,6 +14,7 @@ import { useSafeAreaInsets } from 'react-native-safe-area-context'
14
14
  import { useTheme } from '../../hooks'
15
15
  import type { ButtonProps, TextButtonProps } from '../display'
16
16
  import { Button, Heading, Icon, IconString, Text, TextButton } from '../display'
17
+ import { MAX_FONT_SIZE_MULTIPLIER_LANDMARK } from '../../utils'
17
18
 
18
19
  // =================================
19
20
  // ====== Exports ==================
@@ -146,7 +147,11 @@ function FormSheetHeaderTitle({ children }: FormSheetHeaderTitleProps) {
146
147
  const styles = useStyles()
147
148
 
148
149
  return (
149
- <Heading variant="h3" style={styles.headerTitle} maxFontSizeMultiplier={1}>
150
+ <Heading
151
+ variant="h3"
152
+ style={styles.headerTitle}
153
+ maxFontSizeMultiplier={MAX_FONT_SIZE_MULTIPLIER_LANDMARK}
154
+ >
150
155
  {children}
151
156
  </Heading>
152
157
  )
@@ -174,10 +179,23 @@ FormSheetHeaderActions.displayName = 'FormSheet.HeaderActions'
174
179
  // ====== FormSheetHeaderTextButton ==========
175
180
  // ===========================================
176
181
 
177
- interface FormSheetHeaderTextButtonProps extends Omit<TextButtonProps, 'maxFontSizeMultiplier'> {}
182
+ // We are omitting `onLongPress` because we are instead supporting `accessibilityShowsLargeContentViewer`.
183
+ // This is triggered by an `onLongPress` event when an iOS device is in Apple's accessible font scale range.
184
+ // Triggering this prop will display an almost full screen iOS a11y button.
185
+ interface FormSheetHeaderTextButtonProps
186
+ extends Omit<TextButtonProps, 'maxFontSizeMultiplier' | 'onLongPress'> {
187
+ children: string
188
+ }
178
189
 
179
190
  function FormSheetHeaderTextButton(props: FormSheetHeaderTextButtonProps) {
180
- return <TextButton {...props} maxFontSizeMultiplier={1} />
191
+ return (
192
+ <TextButton
193
+ {...props}
194
+ maxFontSizeMultiplier={MAX_FONT_SIZE_MULTIPLIER_LANDMARK}
195
+ accessibilityShowsLargeContentViewer
196
+ accessibilityLargeContentTitle={props.children}
197
+ />
198
+ )
181
199
  }
182
200
 
183
201
  FormSheetHeaderTextButton.displayName = 'FormSheet.HeaderTextButton'
@@ -186,10 +204,19 @@ FormSheetHeaderTextButton.displayName = 'FormSheet.HeaderTextButton'
186
204
  // ====== FormSheetHeaderButton ============
187
205
  // =========================================
188
206
 
189
- interface FormSheetHeaderButtonProps extends Omit<ButtonProps, 'maxFontSizeMultiplier'> {}
207
+ // Same `onLongPress`note as `FormSheetHeaderTextButtonProps`
208
+ interface FormSheetHeaderButtonProps
209
+ extends Omit<ButtonProps, 'maxFontSizeMultiplier' | 'onLongPress'> {}
190
210
 
191
211
  function FormSheetHeaderButton(props: FormSheetHeaderButtonProps) {
192
- return <Button {...props} maxFontSizeMultiplier={1} />
212
+ return (
213
+ <Button
214
+ {...props}
215
+ maxFontSizeMultiplier={MAX_FONT_SIZE_MULTIPLIER_LANDMARK}
216
+ accessibilityShowsLargeContentViewer
217
+ accessibilityLargeContentTitle={props.title}
218
+ />
219
+ )
193
220
  }
194
221
 
195
222
  FormSheetHeaderButton.displayName = 'FormSheet.HeaderButton'
@@ -324,6 +351,7 @@ const useStyles = ({ appearance = 'neutral' }: Styles = {}) => {
324
351
  },
325
352
  headerTitle: {
326
353
  textAlign: 'left',
354
+ flex: 1,
327
355
  },
328
356
  headerActions: {
329
357
  flexDirection: 'row',