@marktiderman/genesis-ui-native 2.4.0 → 2.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2,7 +2,7 @@ import * as react from 'react';
2
2
  import react__default, { ReactNode } from 'react';
3
3
  import * as class_variance_authority_types from 'class-variance-authority/types';
4
4
  import { VariantProps } from 'class-variance-authority';
5
- import { TextProps, ScrollViewProps, TextInputProps, ViewProps, SwitchProps, ColorValue } from 'react-native';
5
+ import { TextProps, ScrollViewProps, TextInputProps, ViewProps, ColorValue, SwitchProps } from 'react-native';
6
6
  import { o as NativeIconName, b as GenesisGlassModule } from '../native-modules-_Q5vIbd5.js';
7
7
  export { G as GenesisDatePickerComponent, a as GenesisDatePickerProps, c as GenesisIconComponent, d as GenesisIconSet, e as GenesisImageComponent, f as GenesisImageProps, g as GenesisListComponent, h as GenesisListProps, i as GenesisModules, j as GenesisModulesProvider, k as GenesisModulesProviderProps, l as GenesisReanimatedModule, m as GenesisSymbolComponent, n as GenesisSymbolProps, N as NATIVE_ICON_NAMES, S as SF_SYMBOLS, u as useGenesisModules } from '../native-modules-_Q5vIbd5.js';
8
8
 
@@ -134,6 +134,14 @@ interface NativeSheetProps {
134
134
  initialSnapIndex?: number;
135
135
  /** Keep the sheet open when the user taps the backdrop, swipes it down or presses Android back. Default false. */
136
136
  disableBackdropDismiss?: boolean;
137
+ /**
138
+ * As tall as its content (up to 90% of the screen) instead of the full page sheet, for a short
139
+ * menu or form. On iOS this is a bottom panel over a scrim, like Android's (a tap on the scrim
140
+ * or the VoiceOver escape gesture closes it; it doesn't follow a swipe down), and it moves above
141
+ * the keyboard. Under `NativeSheetProvider` the library sizes it (`enableDynamicSizing`) and
142
+ * `snapPoints` is ignored. Default false.
143
+ */
144
+ fitContent?: boolean;
137
145
  children: ReactNode;
138
146
  testID?: string;
139
147
  }
@@ -589,6 +597,30 @@ interface NativeSkeletonProps {
589
597
  }
590
598
  declare function NativeSkeleton(props: NativeSkeletonProps): react.JSX.Element;
591
599
 
600
+ type NativeLoadingStateEdge = "top" | "bottom" | "left" | "right";
601
+ interface NativeLoadingStateProps {
602
+ /** Text shown under the spinner. It is also what screen readers announce. */
603
+ label?: string;
604
+ /** What screen readers announce when no `label` is shown. Default `"Loading"`. */
605
+ accessibilityLabel?: string;
606
+ /** Spinner size. Default `"large"`. */
607
+ size?: "small" | "large";
608
+ /**
609
+ * `true` (default): fill the screen on the theme background, inside the
610
+ * safe area. `false`: a padded, centred block that fills its parent, for a
611
+ * screen body, a section or a list footer.
612
+ */
613
+ fullScreen?: boolean;
614
+ /** Safe-area edges when `fullScreen`. Default all four. */
615
+ safeAreaEdges?: NativeLoadingStateEdge[];
616
+ /** Spinner color. Defaults to the theme tint. */
617
+ color?: ColorValue;
618
+ className?: string;
619
+ /** testID on the root; the spinner is `${testID}-spinner`, the label `${testID}-label`. Default `"loading-state"`. */
620
+ testID?: string;
621
+ }
622
+ declare function NativeLoadingState({ label, accessibilityLabel, size, fullScreen, safeAreaEdges, color, className, testID, }: NativeLoadingStateProps): react.JSX.Element;
623
+
592
624
  declare const alertVariants: (props?: ({
593
625
  variant?: "default" | "destructive" | "info" | "success" | "warning" | null | undefined;
594
626
  } & class_variance_authority_types.ClassProp) | undefined) => string;
@@ -1056,4 +1088,4 @@ interface NativeGlassSurfaceProps {
1056
1088
  }
1057
1089
  declare function NativeGlassSurface({ children, className, fallbackClassName, radius, tintColor, interactive, glassEffectStyle, testID, }: NativeGlassSurfaceProps): react.JSX.Element;
1058
1090
 
1059
- export { Box, type BoxBackground, type BoxProps, FULL_SCREEN_DARK, type FlexAlign, type FlexJustify, GenesisGlassModule, Grid, type GridProps, Inline, type InlineProps, NativeAccordion, NativeAccordionContent, type NativeAccordionContentProps, NativeAccordionItem, type NativeAccordionItemProps, type NativeAccordionProps, NativeAccordionTrigger, type NativeAccordionTriggerProps, type NativeAccordionType, NativeAlert, NativeAlertDescription, type NativeAlertDescriptionProps, type NativeAlertProps, NativeAlertTitle, type NativeAlertTitleProps, NativeAvatar, type NativeAvatarProps, NativeBadge, type NativeBadgeProps, NativeBanner, type NativeBannerProps, NativeButton, type NativeButtonProps, NativeCard, NativeCardContent, NativeCardDescription, NativeCardFooter, NativeCardHeader, type NativeCardProps, NativeCardTitle, type NativeCardTitleProps, NativeCheckbox, type NativeCheckboxProps, NativeChip, NativeChipGroup, type NativeChipGroupMode, type NativeChipGroupProps, type NativeChipProps, NativeCombobox, type NativeComboboxOption, type NativeComboboxProps, NativeDatePicker, type NativeDatePickerProps, NativeDialog, NativeDialogContent, type NativeDialogContentProps, NativeDialogDescription, type NativeDialogDescriptionProps, NativeDialogFooter, type NativeDialogFooterProps, NativeDialogHeader, type NativeDialogHeaderProps, type NativeDialogProps, NativeDialogTitle, type NativeDialogTitleProps, NativeDrawer, type NativeDrawerProps, NativeDropdownMenu, NativeDropdownMenuContent, type NativeDropdownMenuContentProps, NativeDropdownMenuItem, type NativeDropdownMenuItemProps, type NativeDropdownMenuProps, NativeDropdownMenuTrigger, type NativeDropdownMenuTriggerProps, NativeEmptyState, type NativeEmptyStateProps, type NativeEmptyStateVariant, NativeFullScreenModal, type NativeFullScreenModalProps, NativeGlassSurface, type NativeGlassSurfaceProps, NativeHeaderCard, type NativeHeaderCardProps, NativeIcon, NativeIconName, type NativeIconProps, NativeImage, type NativeImageProps, NativeInlineAlert, type NativeInlineAlertProps, type NativeInlineAlertVariant, NativeInput, type NativeInputProps, NativeLabel, type NativeLabelProps, NativeListItem, NativeListItemDivider, type NativeListItemProps, NativeNumberInput, type NativeNumberInputProps, NativePagination, type NativePaginationProps, NativePopover, NativePopoverContent, type NativePopoverContentProps, type NativePopoverProps, NativePopoverTrigger, type NativePopoverTriggerProps, NativeProgress, type NativeProgressProps, NativeRadioGroup, NativeRadioGroupItem, type NativeRadioGroupItemProps, type NativeRadioGroupProps, NativeRangeSlider, type NativeRangeSliderProps, NativeRefreshControl, type NativeRefreshControlProps, NativeSearchBar, type NativeSearchBarProps, NativeSectionListHeader, type NativeSectionListHeaderProps, NativeSegmentedControl, type NativeSegmentedControlOption, type NativeSegmentedControlProps, NativeSelect, NativeSelectContent, type NativeSelectContentProps, NativeSelectItem, type NativeSelectItemProps, type NativeSelectProps, NativeSelectTrigger, type NativeSelectTriggerProps, NativeSeparator, type NativeSeparatorProps, NativeSheet, type NativeSheetLibrary, type NativeSheetProps, NativeSheetProvider, type NativeSheetProviderProps, NativeSheetScrollView, NativeSkeleton, type NativeSkeletonProps, NativeSlider, type NativeSliderProps, NativeStepper, type NativeStepperProps, type NativeStepperStep, NativeSwitch, type NativeSwitchProps, NativeTabs, NativeTabsContent, type NativeTabsContentProps, NativeTabsList, type NativeTabsListProps, type NativeTabsProps, NativeTabsTrigger, type NativeTabsTriggerProps, NativeText, type NativeTextProps, NativeTextarea, type NativeTextareaProps, NativeTimePicker, type NativeTimePickerProps, type NativeToastOptions, NativeToastProvider, type NativeToastProviderProps, type NativeToastVariant, NativeToggle, type NativeToggleProps, NativeTooltip, NativeTooltipContent, type NativeTooltipContentProps, type NativeTooltipProps, NativeTooltipTrigger, type NativeTooltipTriggerProps, type SpaceToken, type SpacingPrefix, Stack, type StackProps, type TextPreset, alertVariants, badgeTextVariants, badgeVariants, buttonTextVariants, buttonVariants, spaceScale, spacingClass, textVariants, toggleVariants, useLiquidGlass, useReduceTransparency, useToast };
1091
+ export { Box, type BoxBackground, type BoxProps, FULL_SCREEN_DARK, type FlexAlign, type FlexJustify, GenesisGlassModule, Grid, type GridProps, Inline, type InlineProps, NativeAccordion, NativeAccordionContent, type NativeAccordionContentProps, NativeAccordionItem, type NativeAccordionItemProps, type NativeAccordionProps, NativeAccordionTrigger, type NativeAccordionTriggerProps, type NativeAccordionType, NativeAlert, NativeAlertDescription, type NativeAlertDescriptionProps, type NativeAlertProps, NativeAlertTitle, type NativeAlertTitleProps, NativeAvatar, type NativeAvatarProps, NativeBadge, type NativeBadgeProps, NativeBanner, type NativeBannerProps, NativeButton, type NativeButtonProps, NativeCard, NativeCardContent, NativeCardDescription, NativeCardFooter, NativeCardHeader, type NativeCardProps, NativeCardTitle, type NativeCardTitleProps, NativeCheckbox, type NativeCheckboxProps, NativeChip, NativeChipGroup, type NativeChipGroupMode, type NativeChipGroupProps, type NativeChipProps, NativeCombobox, type NativeComboboxOption, type NativeComboboxProps, NativeDatePicker, type NativeDatePickerProps, NativeDialog, NativeDialogContent, type NativeDialogContentProps, NativeDialogDescription, type NativeDialogDescriptionProps, NativeDialogFooter, type NativeDialogFooterProps, NativeDialogHeader, type NativeDialogHeaderProps, type NativeDialogProps, NativeDialogTitle, type NativeDialogTitleProps, NativeDrawer, type NativeDrawerProps, NativeDropdownMenu, NativeDropdownMenuContent, type NativeDropdownMenuContentProps, NativeDropdownMenuItem, type NativeDropdownMenuItemProps, type NativeDropdownMenuProps, NativeDropdownMenuTrigger, type NativeDropdownMenuTriggerProps, NativeEmptyState, type NativeEmptyStateProps, type NativeEmptyStateVariant, NativeFullScreenModal, type NativeFullScreenModalProps, NativeGlassSurface, type NativeGlassSurfaceProps, NativeHeaderCard, type NativeHeaderCardProps, NativeIcon, NativeIconName, type NativeIconProps, NativeImage, type NativeImageProps, NativeInlineAlert, type NativeInlineAlertProps, type NativeInlineAlertVariant, NativeInput, type NativeInputProps, NativeLabel, type NativeLabelProps, NativeListItem, NativeListItemDivider, type NativeListItemProps, NativeLoadingState, type NativeLoadingStateEdge, type NativeLoadingStateProps, NativeNumberInput, type NativeNumberInputProps, NativePagination, type NativePaginationProps, NativePopover, NativePopoverContent, type NativePopoverContentProps, type NativePopoverProps, NativePopoverTrigger, type NativePopoverTriggerProps, NativeProgress, type NativeProgressProps, NativeRadioGroup, NativeRadioGroupItem, type NativeRadioGroupItemProps, type NativeRadioGroupProps, NativeRangeSlider, type NativeRangeSliderProps, NativeRefreshControl, type NativeRefreshControlProps, NativeSearchBar, type NativeSearchBarProps, NativeSectionListHeader, type NativeSectionListHeaderProps, NativeSegmentedControl, type NativeSegmentedControlOption, type NativeSegmentedControlProps, NativeSelect, NativeSelectContent, type NativeSelectContentProps, NativeSelectItem, type NativeSelectItemProps, type NativeSelectProps, NativeSelectTrigger, type NativeSelectTriggerProps, NativeSeparator, type NativeSeparatorProps, NativeSheet, type NativeSheetLibrary, type NativeSheetProps, NativeSheetProvider, type NativeSheetProviderProps, NativeSheetScrollView, NativeSkeleton, type NativeSkeletonProps, NativeSlider, type NativeSliderProps, NativeStepper, type NativeStepperProps, type NativeStepperStep, NativeSwitch, type NativeSwitchProps, NativeTabs, NativeTabsContent, type NativeTabsContentProps, NativeTabsList, type NativeTabsListProps, type NativeTabsProps, NativeTabsTrigger, type NativeTabsTriggerProps, NativeText, type NativeTextProps, NativeTextarea, type NativeTextareaProps, NativeTimePicker, type NativeTimePickerProps, type NativeToastOptions, NativeToastProvider, type NativeToastProviderProps, type NativeToastVariant, NativeToggle, type NativeToggleProps, NativeTooltip, NativeTooltipContent, type NativeTooltipContentProps, type NativeTooltipProps, NativeTooltipTrigger, type NativeTooltipTriggerProps, type SpaceToken, type SpacingPrefix, Stack, type StackProps, type TextPreset, alertVariants, badgeTextVariants, badgeVariants, buttonTextVariants, buttonVariants, spaceScale, spacingClass, textVariants, toggleVariants, useLiquidGlass, useReduceTransparency, useToast };
@@ -1,7 +1,7 @@
1
- export { Box, FULL_SCREEN_DARK, Grid, Inline, NativeAccordion, NativeAccordionContent, NativeAccordionItem, NativeAccordionTrigger, NativeAvatar, NativeBanner, NativeChip, NativeChipGroup, NativeCombobox, NativeDatePicker, NativeDialog, NativeDialogContent, NativeDialogDescription, NativeDialogFooter, NativeDialogHeader, NativeDialogTitle, NativeDrawer, NativeDropdownMenu, NativeDropdownMenuContent, NativeDropdownMenuItem, NativeDropdownMenuTrigger, NativeFullScreenModal, NativeGlassSurface, NativeHeaderCard, NativeImage, NativeInlineAlert, NativeNumberInput, NativePagination, NativePopover, NativePopoverContent, NativePopoverTrigger, NativeProgress, NativeRadioGroup, NativeRadioGroupItem, NativeRangeSlider, NativeSearchBar, NativeSegmentedControl, NativeSheet, NativeSheetProvider, NativeSheetScrollView, NativeSlider, NativeStepper, NativeTabs, NativeTabsContent, NativeTabsList, NativeTabsTrigger, NativeTimePicker, NativeToastProvider, NativeToggle, NativeTooltip, NativeTooltipContent, NativeTooltipTrigger, Stack, spaceScale, spacingClass, toggleVariants, useLiquidGlass, useReduceTransparency, useToast } from '../chunk-7VSW3XWJ.js';
1
+ export { Box, FULL_SCREEN_DARK, Grid, Inline, NativeAccordion, NativeAccordionContent, NativeAccordionItem, NativeAccordionTrigger, NativeAvatar, NativeBanner, NativeChip, NativeChipGroup, NativeCombobox, NativeDatePicker, NativeDialog, NativeDialogContent, NativeDialogDescription, NativeDialogFooter, NativeDialogHeader, NativeDialogTitle, NativeDrawer, NativeDropdownMenu, NativeDropdownMenuContent, NativeDropdownMenuItem, NativeDropdownMenuTrigger, NativeFullScreenModal, NativeGlassSurface, NativeHeaderCard, NativeImage, NativeInlineAlert, NativeNumberInput, NativePagination, NativePopover, NativePopoverContent, NativePopoverTrigger, NativeProgress, NativeRadioGroup, NativeRadioGroupItem, NativeRangeSlider, NativeSearchBar, NativeSegmentedControl, NativeSheet, NativeSheetProvider, NativeSheetScrollView, NativeSlider, NativeStepper, NativeTabs, NativeTabsContent, NativeTabsList, NativeTabsTrigger, NativeTimePicker, NativeToastProvider, NativeToggle, NativeTooltip, NativeTooltipContent, NativeTooltipTrigger, Stack, spaceScale, spacingClass, toggleVariants, useLiquidGlass, useReduceTransparency, useToast } from '../chunk-YJV5MMZX.js';
2
2
  export { NativeAlert, NativeAlertDescription, NativeAlertTitle, NativeCard, NativeCardContent, NativeCardDescription, NativeCardFooter, NativeCardHeader, NativeCardTitle, NativeCheckbox, NativeLabel, NativeSelect, NativeSelectContent, NativeSelectItem, NativeSelectTrigger, NativeSeparator, NativeSkeleton, NativeSwitch, NativeTextarea, alertVariants } from '../chunk-FIITITXO.js';
3
3
  import '../chunk-7PCWEY6R.js';
4
- export { NATIVE_ICON_NAMES, NativeEmptyState, NativeIcon, NativeListItem, NativeListItemDivider, NativeRefreshControl, NativeSectionListHeader, SF_SYMBOLS } from '../chunk-BPD5DCFP.js';
4
+ export { NATIVE_ICON_NAMES, NativeEmptyState, NativeIcon, NativeListItem, NativeListItemDivider, NativeLoadingState, NativeRefreshControl, NativeSectionListHeader, SF_SYMBOLS } from '../chunk-IDHW2NOP.js';
5
5
  export { GenesisModulesProvider, NativeBadge, NativeButton, NativeInput, NativeText, badgeTextVariants, badgeVariants, buttonTextVariants, buttonVariants, textVariants, useGenesisModules } from '../chunk-EFXCJ5AN.js';
6
6
  import '../chunk-Z3AQYVUA.js';
7
7
  import '../chunk-OHZD7KRO.js';
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export { Box, BoxBackground, BoxProps, FULL_SCREEN_DARK, FlexAlign, FlexJustify, Grid, GridProps, Inline, InlineProps, NativeAccordion, NativeAccordionContent, NativeAccordionContentProps, NativeAccordionItem, NativeAccordionItemProps, NativeAccordionProps, NativeAccordionTrigger, NativeAccordionTriggerProps, NativeAccordionType, NativeAlert, NativeAlertDescription, NativeAlertDescriptionProps, NativeAlertProps, NativeAlertTitle, NativeAlertTitleProps, NativeAvatar, NativeAvatarProps, NativeBadge, NativeBadgeProps, NativeBanner, NativeBannerProps, NativeButton, NativeButtonProps, NativeCard, NativeCardContent, NativeCardDescription, NativeCardFooter, NativeCardHeader, NativeCardProps, NativeCardTitle, NativeCardTitleProps, NativeCheckbox, NativeCheckboxProps, NativeChip, NativeChipGroup, NativeChipGroupMode, NativeChipGroupProps, NativeChipProps, NativeCombobox, NativeComboboxOption, NativeComboboxProps, NativeDatePicker, NativeDatePickerProps, NativeDialog, NativeDialogContent, NativeDialogContentProps, NativeDialogDescription, NativeDialogDescriptionProps, NativeDialogFooter, NativeDialogFooterProps, NativeDialogHeader, NativeDialogHeaderProps, NativeDialogProps, NativeDialogTitle, NativeDialogTitleProps, NativeDrawer, NativeDrawerProps, NativeDropdownMenu, NativeDropdownMenuContent, NativeDropdownMenuContentProps, NativeDropdownMenuItem, NativeDropdownMenuItemProps, NativeDropdownMenuProps, NativeDropdownMenuTrigger, NativeDropdownMenuTriggerProps, NativeEmptyState, NativeEmptyStateProps, NativeEmptyStateVariant, NativeFullScreenModal, NativeFullScreenModalProps, NativeGlassSurface, NativeGlassSurfaceProps, NativeHeaderCard, NativeHeaderCardProps, NativeIcon, NativeIconProps, NativeImage, NativeImageProps, NativeInlineAlert, NativeInlineAlertProps, NativeInlineAlertVariant, NativeInput, NativeInputProps, NativeLabel, NativeLabelProps, NativeListItem, NativeListItemDivider, NativeListItemProps, NativeNumberInput, NativeNumberInputProps, NativePagination, NativePaginationProps, NativePopover, NativePopoverContent, NativePopoverContentProps, NativePopoverProps, NativePopoverTrigger, NativePopoverTriggerProps, NativeProgress, NativeProgressProps, NativeRadioGroup, NativeRadioGroupItem, NativeRadioGroupItemProps, NativeRadioGroupProps, NativeRangeSlider, NativeRangeSliderProps, NativeRefreshControl, NativeRefreshControlProps, NativeSearchBar, NativeSearchBarProps, NativeSectionListHeader, NativeSectionListHeaderProps, NativeSegmentedControl, NativeSegmentedControlOption, NativeSegmentedControlProps, NativeSelect, NativeSelectContent, NativeSelectContentProps, NativeSelectItem, NativeSelectItemProps, NativeSelectProps, NativeSelectTrigger, NativeSelectTriggerProps, NativeSeparator, NativeSeparatorProps, NativeSheet, NativeSheetLibrary, NativeSheetProps, NativeSheetProvider, NativeSheetProviderProps, NativeSheetScrollView, NativeSkeleton, NativeSkeletonProps, NativeSlider, NativeSliderProps, NativeStepper, NativeStepperProps, NativeStepperStep, NativeSwitch, NativeSwitchProps, NativeTabs, NativeTabsContent, NativeTabsContentProps, NativeTabsList, NativeTabsListProps, NativeTabsProps, NativeTabsTrigger, NativeTabsTriggerProps, NativeText, NativeTextProps, NativeTextarea, NativeTextareaProps, NativeTimePicker, NativeTimePickerProps, NativeToastOptions, NativeToastProvider, NativeToastProviderProps, NativeToastVariant, NativeToggle, NativeToggleProps, NativeTooltip, NativeTooltipContent, NativeTooltipContentProps, NativeTooltipProps, NativeTooltipTrigger, NativeTooltipTriggerProps, SpaceToken, SpacingPrefix, Stack, StackProps, TextPreset, alertVariants, badgeTextVariants, badgeVariants, buttonTextVariants, buttonVariants, spaceScale, spacingClass, textVariants, toggleVariants, useLiquidGlass, useReduceTransparency, useToast } from './components/index.js';
1
+ export { Box, BoxBackground, BoxProps, FULL_SCREEN_DARK, FlexAlign, FlexJustify, Grid, GridProps, Inline, InlineProps, NativeAccordion, NativeAccordionContent, NativeAccordionContentProps, NativeAccordionItem, NativeAccordionItemProps, NativeAccordionProps, NativeAccordionTrigger, NativeAccordionTriggerProps, NativeAccordionType, NativeAlert, NativeAlertDescription, NativeAlertDescriptionProps, NativeAlertProps, NativeAlertTitle, NativeAlertTitleProps, NativeAvatar, NativeAvatarProps, NativeBadge, NativeBadgeProps, NativeBanner, NativeBannerProps, NativeButton, NativeButtonProps, NativeCard, NativeCardContent, NativeCardDescription, NativeCardFooter, NativeCardHeader, NativeCardProps, NativeCardTitle, NativeCardTitleProps, NativeCheckbox, NativeCheckboxProps, NativeChip, NativeChipGroup, NativeChipGroupMode, NativeChipGroupProps, NativeChipProps, NativeCombobox, NativeComboboxOption, NativeComboboxProps, NativeDatePicker, NativeDatePickerProps, NativeDialog, NativeDialogContent, NativeDialogContentProps, NativeDialogDescription, NativeDialogDescriptionProps, NativeDialogFooter, NativeDialogFooterProps, NativeDialogHeader, NativeDialogHeaderProps, NativeDialogProps, NativeDialogTitle, NativeDialogTitleProps, NativeDrawer, NativeDrawerProps, NativeDropdownMenu, NativeDropdownMenuContent, NativeDropdownMenuContentProps, NativeDropdownMenuItem, NativeDropdownMenuItemProps, NativeDropdownMenuProps, NativeDropdownMenuTrigger, NativeDropdownMenuTriggerProps, NativeEmptyState, NativeEmptyStateProps, NativeEmptyStateVariant, NativeFullScreenModal, NativeFullScreenModalProps, NativeGlassSurface, NativeGlassSurfaceProps, NativeHeaderCard, NativeHeaderCardProps, NativeIcon, NativeIconProps, NativeImage, NativeImageProps, NativeInlineAlert, NativeInlineAlertProps, NativeInlineAlertVariant, NativeInput, NativeInputProps, NativeLabel, NativeLabelProps, NativeListItem, NativeListItemDivider, NativeListItemProps, NativeLoadingState, NativeLoadingStateEdge, NativeLoadingStateProps, NativeNumberInput, NativeNumberInputProps, NativePagination, NativePaginationProps, NativePopover, NativePopoverContent, NativePopoverContentProps, NativePopoverProps, NativePopoverTrigger, NativePopoverTriggerProps, NativeProgress, NativeProgressProps, NativeRadioGroup, NativeRadioGroupItem, NativeRadioGroupItemProps, NativeRadioGroupProps, NativeRangeSlider, NativeRangeSliderProps, NativeRefreshControl, NativeRefreshControlProps, NativeSearchBar, NativeSearchBarProps, NativeSectionListHeader, NativeSectionListHeaderProps, NativeSegmentedControl, NativeSegmentedControlOption, NativeSegmentedControlProps, NativeSelect, NativeSelectContent, NativeSelectContentProps, NativeSelectItem, NativeSelectItemProps, NativeSelectProps, NativeSelectTrigger, NativeSelectTriggerProps, NativeSeparator, NativeSeparatorProps, NativeSheet, NativeSheetLibrary, NativeSheetProps, NativeSheetProvider, NativeSheetProviderProps, NativeSheetScrollView, NativeSkeleton, NativeSkeletonProps, NativeSlider, NativeSliderProps, NativeStepper, NativeStepperProps, NativeStepperStep, NativeSwitch, NativeSwitchProps, NativeTabs, NativeTabsContent, NativeTabsContentProps, NativeTabsList, NativeTabsListProps, NativeTabsProps, NativeTabsTrigger, NativeTabsTriggerProps, NativeText, NativeTextProps, NativeTextarea, NativeTextareaProps, NativeTimePicker, NativeTimePickerProps, NativeToastOptions, NativeToastProvider, NativeToastProviderProps, NativeToastVariant, NativeToggle, NativeToggleProps, NativeTooltip, NativeTooltipContent, NativeTooltipContentProps, NativeTooltipProps, NativeTooltipTrigger, NativeTooltipTriggerProps, SpaceToken, SpacingPrefix, Stack, StackProps, TextPreset, alertVariants, badgeTextVariants, badgeVariants, buttonTextVariants, buttonVariants, spaceScale, spacingClass, textVariants, toggleVariants, useLiquidGlass, useReduceTransparency, useToast } from './components/index.js';
2
2
  export { G as GenesisDatePickerComponent, a as GenesisDatePickerProps, b as GenesisGlassModule, c as GenesisIconComponent, d as GenesisIconSet, e as GenesisImageComponent, f as GenesisImageProps, g as GenesisListComponent, h as GenesisListProps, i as GenesisModules, j as GenesisModulesProvider, k as GenesisModulesProviderProps, l as GenesisReanimatedModule, m as GenesisSymbolComponent, n as GenesisSymbolProps, N as NATIVE_ICON_NAMES, o as NativeIconName, S as SF_SYMBOLS, u as useGenesisModules } from './native-modules-_Q5vIbd5.js';
3
3
  export { BrandExtensionsProvider, BrandExtensionsProviderProps, BrandExtensionsValue, ThemeMode, ThemeRoleColors, UseThemeRolesOptions, useGenesisExtension, useReducedMotion, useThemeMode, useThemeRoles } from './hooks/index.js';
4
4
  export { AppleButtonModuleLike, AppleProviderOptions, AppleSignInButton, AppleSignInButtonProps, AuthBranding, AuthBrandingProps, AuthForm, AuthFormProps, AuthFormValues, AuthScreen, AuthScreenProps, AuthScreenSlotMap, ForgotPasswordLink, GoogleProviderOptions, InboxItem, InboxPage, InboxPageProps, InboxPageSlotMap, InboxSwipeAction, KEYBOARD_TOOLBAR_HEIGHT, KeyboardScrollProps, KeyboardScrollProvider, KeyboardToolbarProps, NavBarSaveButton, NavBarSaveButtonProps, NavBarSearchBar, NavBarSearchBarProps, NavBarTitle, NavBarTitleProps, NotificationItem, NotificationsPage, NotificationsPageProps, NotificationsPageSlotMap, SafeAreaEdge, ScreenContainer, ScreenContainerProps, ScreenHeaderProps, ScrollEdgeBehavior, SettingsPage, SettingsPageDangerousAction, SettingsPageProps, SettingsPageRow, SettingsPageSection, SettingsPageSlotMap, SettingsSubPage, SettingsSubPageProps, SocialAuthProvider, SocialAuthRow, SocialAuthRowProps, ThreadAttachment, ThreadComposer, ThreadLabels, ThreadMessage, ThreadPage, ThreadPageProps, ThreadPageSlotMap, appleProvider, composeHeaderOptions, confirmDiscardChanges, defaultStickyHeaderOffset, formatInboxTime, getInboxPageStackOptions, getNotificationsPageStackOptions, getSettingsPageStackOptions, getSettingsSubPageStackOptions, getThreadPageStackOptions, googleProvider, iosCompactNavigationBarHeight, readReceiptFor, showInboxActions, useKeyboardScroll, useKeyboardToolbar } from './layouts/index.js';
package/dist/index.js CHANGED
@@ -1,9 +1,9 @@
1
- export { Box, FULL_SCREEN_DARK, Grid, Inline, NativeAccordion, NativeAccordionContent, NativeAccordionItem, NativeAccordionTrigger, NativeAvatar, NativeBanner, NativeChip, NativeChipGroup, NativeCombobox, NativeDatePicker, NativeDialog, NativeDialogContent, NativeDialogDescription, NativeDialogFooter, NativeDialogHeader, NativeDialogTitle, NativeDrawer, NativeDropdownMenu, NativeDropdownMenuContent, NativeDropdownMenuItem, NativeDropdownMenuTrigger, NativeFullScreenModal, NativeGlassSurface, NativeHeaderCard, NativeImage, NativeInlineAlert, NativeNumberInput, NativePagination, NativePopover, NativePopoverContent, NativePopoverTrigger, NativeProgress, NativeRadioGroup, NativeRadioGroupItem, NativeRangeSlider, NativeSearchBar, NativeSegmentedControl, NativeSheet, NativeSheetProvider, NativeSheetScrollView, NativeSlider, NativeStepper, NativeTabs, NativeTabsContent, NativeTabsList, NativeTabsTrigger, NativeTimePicker, NativeToastProvider, NativeToggle, NativeTooltip, NativeTooltipContent, NativeTooltipTrigger, Stack, spaceScale, spacingClass, toggleVariants, useLiquidGlass, useReduceTransparency, useToast } from './chunk-7VSW3XWJ.js';
1
+ export { Box, FULL_SCREEN_DARK, Grid, Inline, NativeAccordion, NativeAccordionContent, NativeAccordionItem, NativeAccordionTrigger, NativeAvatar, NativeBanner, NativeChip, NativeChipGroup, NativeCombobox, NativeDatePicker, NativeDialog, NativeDialogContent, NativeDialogDescription, NativeDialogFooter, NativeDialogHeader, NativeDialogTitle, NativeDrawer, NativeDropdownMenu, NativeDropdownMenuContent, NativeDropdownMenuItem, NativeDropdownMenuTrigger, NativeFullScreenModal, NativeGlassSurface, NativeHeaderCard, NativeImage, NativeInlineAlert, NativeNumberInput, NativePagination, NativePopover, NativePopoverContent, NativePopoverTrigger, NativeProgress, NativeRadioGroup, NativeRadioGroupItem, NativeRangeSlider, NativeSearchBar, NativeSegmentedControl, NativeSheet, NativeSheetProvider, NativeSheetScrollView, NativeSlider, NativeStepper, NativeTabs, NativeTabsContent, NativeTabsList, NativeTabsTrigger, NativeTimePicker, NativeToastProvider, NativeToggle, NativeTooltip, NativeTooltipContent, NativeTooltipTrigger, Stack, spaceScale, spacingClass, toggleVariants, useLiquidGlass, useReduceTransparency, useToast } from './chunk-YJV5MMZX.js';
2
2
  export { NativeAlert, NativeAlertDescription, NativeAlertTitle, NativeCard, NativeCardContent, NativeCardDescription, NativeCardFooter, NativeCardHeader, NativeCardTitle, NativeCheckbox, NativeLabel, NativeSelect, NativeSelectContent, NativeSelectItem, NativeSelectTrigger, NativeSeparator, NativeSkeleton, NativeSwitch, NativeTextarea, alertVariants } from './chunk-FIITITXO.js';
3
3
  export { BrandExtensionsProvider, useGenesisExtension } from './chunk-D5RKSPMH.js';
4
4
  export { useReducedMotion } from './chunk-7PCWEY6R.js';
5
- export { AppleSignInButton, AuthBranding, AuthForm, AuthScreen, ForgotPasswordLink, InboxPage, KEYBOARD_TOOLBAR_HEIGHT, KeyboardScrollProvider, NavBarSaveButton, NavBarSearchBar, NavBarTitle, NotificationsPage, ScreenContainer, SettingsPage, SettingsSubPage, SocialAuthRow, ThreadPage, appleProvider, composeHeaderOptions, confirmDiscardChanges, defaultStickyHeaderOffset, formatInboxTime, getInboxPageStackOptions, getNotificationsPageStackOptions, getSettingsPageStackOptions, getSettingsSubPageStackOptions, getThreadPageStackOptions, googleProvider, iosCompactNavigationBarHeight, readReceiptFor, showInboxActions, useKeyboardScroll, useKeyboardToolbar } from './chunk-6TLBCRS6.js';
6
- export { NATIVE_ICON_NAMES, NativeEmptyState, NativeIcon, NativeListItem, NativeListItemDivider, NativeRefreshControl, NativeSectionListHeader, SF_SYMBOLS } from './chunk-BPD5DCFP.js';
5
+ export { AppleSignInButton, AuthBranding, AuthForm, AuthScreen, ForgotPasswordLink, InboxPage, KEYBOARD_TOOLBAR_HEIGHT, KeyboardScrollProvider, NavBarSaveButton, NavBarSearchBar, NavBarTitle, NotificationsPage, ScreenContainer, SettingsPage, SettingsSubPage, SocialAuthRow, ThreadPage, appleProvider, composeHeaderOptions, confirmDiscardChanges, defaultStickyHeaderOffset, formatInboxTime, getInboxPageStackOptions, getNotificationsPageStackOptions, getSettingsPageStackOptions, getSettingsSubPageStackOptions, getThreadPageStackOptions, googleProvider, iosCompactNavigationBarHeight, readReceiptFor, showInboxActions, useKeyboardScroll, useKeyboardToolbar } from './chunk-YI7XVY2D.js';
6
+ export { NATIVE_ICON_NAMES, NativeEmptyState, NativeIcon, NativeListItem, NativeListItemDivider, NativeLoadingState, NativeRefreshControl, NativeSectionListHeader, SF_SYMBOLS } from './chunk-IDHW2NOP.js';
7
7
  export { GenesisModulesProvider, NativeBadge, NativeButton, NativeInput, NativeText, badgeTextVariants, badgeVariants, buttonTextVariants, buttonVariants, textVariants, useGenesisModules } from './chunk-EFXCJ5AN.js';
8
8
  export { useThemeMode, useThemeRoles } from './chunk-Z3AQYVUA.js';
9
9
  export { cn } from './chunk-OHZD7KRO.js';
@@ -33,6 +33,15 @@ interface ScreenContainerProps {
33
33
  * Only used when `scroll` is true.
34
34
  */
35
35
  keyboardShouldPersistTaps?: "always" | "never" | "handled";
36
+ /**
37
+ * When `true`, a centred `NativeLoadingState` (theme-tinted spinner,
38
+ * announced as loading) replaces the body, inside the same safe area and
39
+ * background. Use it for redirect and first-load screens: the body is
40
+ * unmounted while it's on, so a form underneath loses its state. Default `false`.
41
+ */
42
+ loading?: boolean;
43
+ /** Text under the spinner while `loading`, and what screen readers announce: pass translated text. */
44
+ loadingLabel?: string;
36
45
  /** Style on the root, e.g. a theme-role background color. */
37
46
  style?: ViewStyle;
38
47
  /** testID on the root container. */
@@ -73,7 +82,7 @@ interface ScreenHeaderProps {
73
82
  * return <><Stack.Screen options={opts} /><ScreenContainer>...</ScreenContainer></>;
74
83
  */
75
84
  declare function composeHeaderOptions(props: ScreenHeaderProps): Record<string, unknown>;
76
- declare function ScreenContainer({ children, scroll, safeAreaEdges, statusBar, themeMode, className, contentClassName, keyboardShouldPersistTaps, style, testID, }: ScreenContainerProps): react.JSX.Element;
85
+ declare function ScreenContainer({ children, scroll, safeAreaEdges, statusBar, themeMode, className, contentClassName, keyboardShouldPersistTaps, loading, loadingLabel, style, testID, }: ScreenContainerProps): react.JSX.Element;
77
86
 
78
87
  interface NavBarSaveButtonProps {
79
88
  /** Press handler. Disabled when not provided OR when `disabled`/`loading`. */
@@ -1,5 +1,5 @@
1
- export { AppleSignInButton, AuthBranding, AuthForm, AuthScreen, ForgotPasswordLink, InboxPage, KEYBOARD_TOOLBAR_HEIGHT, KeyboardScrollProvider, NavBarSaveButton, NavBarSearchBar, NavBarTitle, NotificationsPage, ScreenContainer, SettingsPage, SettingsSubPage, SocialAuthRow, ThreadPage, appleProvider, composeHeaderOptions, confirmDiscardChanges, defaultStickyHeaderOffset, formatInboxTime, getInboxPageStackOptions, getNotificationsPageStackOptions, getSettingsPageStackOptions, getSettingsSubPageStackOptions, getThreadPageStackOptions, googleProvider, iosCompactNavigationBarHeight, readReceiptFor, showInboxActions, useKeyboardScroll, useKeyboardToolbar } from '../chunk-6TLBCRS6.js';
2
- import '../chunk-BPD5DCFP.js';
1
+ export { AppleSignInButton, AuthBranding, AuthForm, AuthScreen, ForgotPasswordLink, InboxPage, KEYBOARD_TOOLBAR_HEIGHT, KeyboardScrollProvider, NavBarSaveButton, NavBarSearchBar, NavBarTitle, NotificationsPage, ScreenContainer, SettingsPage, SettingsSubPage, SocialAuthRow, ThreadPage, appleProvider, composeHeaderOptions, confirmDiscardChanges, defaultStickyHeaderOffset, formatInboxTime, getInboxPageStackOptions, getNotificationsPageStackOptions, getSettingsPageStackOptions, getSettingsSubPageStackOptions, getThreadPageStackOptions, googleProvider, iosCompactNavigationBarHeight, readReceiptFor, showInboxActions, useKeyboardScroll, useKeyboardToolbar } from '../chunk-YI7XVY2D.js';
2
+ import '../chunk-IDHW2NOP.js';
3
3
  import '../chunk-EFXCJ5AN.js';
4
4
  import '../chunk-Z3AQYVUA.js';
5
5
  import '../chunk-OHZD7KRO.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@marktiderman/genesis-ui-native",
3
- "version": "2.4.0",
3
+ "version": "2.5.0",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "sideEffects": false,
@@ -69,7 +69,7 @@
69
69
  "@expo/ui": ">=58.0.0",
70
70
  "@gorhom/bottom-sheet": ">=5.0.0",
71
71
  "@hookform/resolvers": "^3.0.0 || ^4.0.0 || ^5.0.0",
72
- "@marktiderman/genesis-core": "^1.7.0",
72
+ "@marktiderman/genesis-core": "^1.10.0",
73
73
  "@marktiderman/genesis-design-system": "^1.5.0",
74
74
  "@react-native-community/datetimepicker": ">=8.0.0",
75
75
  "@shopify/flash-list": ">=2.0.0",
@@ -0,0 +1,41 @@
1
+ // @feat:native-layouts
2
+ import { render, screen } from "@testing-library/react";
3
+ import { describe, expect, it } from "vitest";
4
+ import { NativeLoadingState } from "../loading-state";
5
+
6
+ describe("NativeLoadingState", () => {
7
+ it("fills the screen inside every safe-area edge, announced as one loading progress bar", () => {
8
+ render(<NativeLoadingState />);
9
+ const root = screen.getByTestId("loading-state");
10
+ expect(root.getAttribute("data-edges")).toBe("top,bottom,left,right");
11
+ const content = screen.getByTestId("loading-state-content");
12
+ expect(content.getAttribute("role")).toBe("progressbar");
13
+ expect(content.getAttribute("aria-label")).toBe("Loading");
14
+ expect(screen.getByTestId("loading-state-spinner")).toBeTruthy();
15
+ expect(screen.queryByTestId("loading-state-label")).toBeNull();
16
+ });
17
+
18
+ it("shows a label under the spinner and announces it", () => {
19
+ render(<NativeLoadingState label="Signing you in" testID="boot" />);
20
+ expect(screen.getByTestId("boot-label").textContent).toBe("Signing you in");
21
+ expect(screen.getByTestId("boot-content").getAttribute("aria-label")).toBe("Signing you in");
22
+ });
23
+
24
+ it("inline: no safe-area wrapper, the block is the root and takes the accessibility label", () => {
25
+ render(<NativeLoadingState fullScreen={false} size="small" accessibilityLabel="Loading more" testID="more" />);
26
+ const root = screen.getByTestId("more");
27
+ expect(root.getAttribute("data-edges")).toBeNull();
28
+ expect(root.getAttribute("role")).toBe("progressbar");
29
+ expect(root.getAttribute("aria-label")).toBe("Loading more");
30
+ expect(screen.queryByTestId("more-content")).toBeNull();
31
+ });
32
+
33
+ it("colors the spinner with the theme tint unless told otherwise", () => {
34
+ const { unmount } = render(<NativeLoadingState testID="a" />);
35
+ const tinted = screen.getByTestId("a-spinner").getAttribute("color");
36
+ expect(tinted).toBeTruthy();
37
+ unmount();
38
+ render(<NativeLoadingState testID="b" color="#ff0000" />);
39
+ expect(screen.getByTestId("b-spinner").getAttribute("color")).toBe("#ff0000");
40
+ });
41
+ });
@@ -118,6 +118,18 @@ describe("NativeSheet without a provider", () => {
118
118
  expect(onOpenChange).not.toHaveBeenCalled();
119
119
  });
120
120
 
121
+ it("fits its content on iOS with fitContent: a bottom panel over a scrim, not the page sheet", async () => {
122
+ Platform.OS = "ios";
123
+ const onOpenChange = vi.fn();
124
+ render(sheet({ onOpenChange, testID: "s", fitContent: true }));
125
+ const modal = await screen.findByRole("dialog");
126
+ expect(modal.getAttribute("data-presentation-style")).toBeNull();
127
+ expect(modal.getAttribute("data-transparent")).toBe("true");
128
+ expect(screen.getByTestId("s").textContent).toBe("body");
129
+ fireEvent.click(screen.getByTestId("s-backdrop"));
130
+ expect(onOpenChange).toHaveBeenCalledWith(false);
131
+ });
132
+
121
133
  it("renders nothing while closed", async () => {
122
134
  render(sheet({ open: false }));
123
135
  await act(async () => {});
@@ -146,6 +158,7 @@ describe("NativeSheet under NativeSheetProvider", () => {
146
158
  expect(present).toHaveBeenCalledTimes(1);
147
159
  // The given snap points are the sheet's only ones (v5 would add a content-height one).
148
160
  expect(modalProps).toHaveBeenLastCalledWith(expect.objectContaining({ snapPoints: ["25%"], enableDynamicSizing: false }));
161
+ expect((modalProps.mock.calls.at(-1)![0] as { maxDynamicContentSize?: number }).maxDynamicContentSize).toBeUndefined();
149
162
 
150
163
  // The user closing it reports; the app closing it doesn't report back.
151
164
  fireEvent.click(screen.getByTestId("gorhom-modal"));
@@ -157,6 +170,20 @@ describe("NativeSheet under NativeSheetProvider", () => {
157
170
  expect(onOpenChange).not.toHaveBeenCalled();
158
171
  });
159
172
 
173
+ it("lets the library size a sheet that fits its content", () => {
174
+ const { library, modalProps } = fakeLibrary();
175
+ render(
176
+ <NativeSheetProvider bottomSheet={library}>
177
+ <NativeSheet open onOpenChange={() => {}} fitContent>
178
+ <span>body</span>
179
+ </NativeSheet>
180
+ </NativeSheetProvider>,
181
+ );
182
+ expect(modalProps).toHaveBeenLastCalledWith(expect.objectContaining({ snapPoints: undefined, index: 0, enableDynamicSizing: true }));
183
+ // Capped below the full height, so long content never runs under the status bar.
184
+ expect((modalProps.mock.calls.at(-1)![0] as { maxDynamicContentSize?: number }).maxDynamicContentSize).toBeGreaterThan(0);
185
+ });
186
+
160
187
  it("doesn't report a dismiss that finishes after the app reopened the sheet", () => {
161
188
  const { library } = fakeLibrary();
162
189
  const onOpenChange = vi.fn();
@@ -138,6 +138,9 @@ export type { NativeSeparatorProps } from "./separator";
138
138
  export { NativeSkeleton } from "./skeleton";
139
139
  export type { NativeSkeletonProps } from "./skeleton";
140
140
 
141
+ export { NativeLoadingState } from "./loading-state";
142
+ export type { NativeLoadingStateProps, NativeLoadingStateEdge } from "./loading-state";
143
+
141
144
  export {
142
145
  NativeAlert,
143
146
  NativeAlertTitle,
@@ -0,0 +1,92 @@
1
+ /**
2
+ * LoadingState — a centred spinner for a screen (or part of one) that is
3
+ * waiting: a redirect while the session loads, the first fetch of a page.
4
+ *
5
+ * Use it instead of a hand-rolled `<View><ActivityIndicator /></View>`: the
6
+ * spinner takes the theme tint, screen readers hear one "Loading" progress
7
+ * bar (or your `label`), and the full-screen form sits inside the safe area
8
+ * on the screen background. For content-shaped placeholders (a list about to
9
+ * appear) use `NativeSkeleton`; for known progress use `NativeProgress`.
10
+ *
11
+ * if (!session) return <NativeLoadingState />; // whole screen
12
+ * <NativeLoadingState fullScreen={false} label="Loading more" size="small" />
13
+ *
14
+ * `ScreenContainer loading` renders the inline form in place of its body.
15
+ *
16
+ * @stability Beta
17
+ */
18
+ import { ActivityIndicator, View, type ColorValue } from "react-native";
19
+ import { SafeAreaView } from "react-native-safe-area-context";
20
+ import { cn } from "../utils";
21
+ import { useThemeRoles } from "../hooks/use-theme-roles";
22
+ import { NativeText } from "./text";
23
+
24
+ export type NativeLoadingStateEdge = "top" | "bottom" | "left" | "right";
25
+
26
+ export interface NativeLoadingStateProps {
27
+ /** Text shown under the spinner. It is also what screen readers announce. */
28
+ label?: string;
29
+ /** What screen readers announce when no `label` is shown. Default `"Loading"`. */
30
+ accessibilityLabel?: string;
31
+ /** Spinner size. Default `"large"`. */
32
+ size?: "small" | "large";
33
+ /**
34
+ * `true` (default): fill the screen on the theme background, inside the
35
+ * safe area. `false`: a padded, centred block that fills its parent, for a
36
+ * screen body, a section or a list footer.
37
+ */
38
+ fullScreen?: boolean;
39
+ /** Safe-area edges when `fullScreen`. Default all four. */
40
+ safeAreaEdges?: NativeLoadingStateEdge[];
41
+ /** Spinner color. Defaults to the theme tint. */
42
+ color?: ColorValue;
43
+ className?: string;
44
+ /** testID on the root; the spinner is `${testID}-spinner`, the label `${testID}-label`. Default `"loading-state"`. */
45
+ testID?: string;
46
+ }
47
+
48
+ const ALL_EDGES: NativeLoadingStateEdge[] = ["top", "bottom", "left", "right"];
49
+
50
+ export function NativeLoadingState({
51
+ label,
52
+ accessibilityLabel,
53
+ size = "large",
54
+ fullScreen = true,
55
+ safeAreaEdges = ALL_EDGES,
56
+ color,
57
+ className,
58
+ testID = "loading-state",
59
+ }: NativeLoadingStateProps) {
60
+ const roles = useThemeRoles();
61
+ const spoken = label ?? accessibilityLabel ?? "Loading";
62
+
63
+ const content = (
64
+ <View
65
+ testID={fullScreen ? `${testID}-content` : testID}
66
+ className={cn("items-center justify-center gap-3 px-4 py-8", !fullScreen && "flex-grow", !fullScreen && className)}
67
+ accessible
68
+ accessibilityRole="progressbar"
69
+ accessibilityLabel={spoken}
70
+ accessibilityState={{ busy: true }}
71
+ >
72
+ <ActivityIndicator testID={`${testID}-spinner`} size={size} color={(color ?? roles.tint) as string} />
73
+ {label ? (
74
+ <NativeText testID={`${testID}-label`} preset="body-sm" className="text-muted-foreground text-center">
75
+ {label}
76
+ </NativeText>
77
+ ) : null}
78
+ </View>
79
+ );
80
+
81
+ if (!fullScreen) return content;
82
+
83
+ return (
84
+ <SafeAreaView
85
+ testID={testID}
86
+ edges={safeAreaEdges}
87
+ className={cn("flex-1 items-center justify-center bg-background", className)}
88
+ >
89
+ {content}
90
+ </SafeAreaView>
91
+ );
92
+ }
@@ -20,6 +20,8 @@
20
20
  * `GestureHandlerRootView` at the root and Reanimated set up.
21
21
  * `snapPoints` and `initialSnapIndex` apply only to that path.
22
22
  *
23
+ * A short menu or form passes `fitContent`: the sheet is as tall as what is in it.
24
+ *
23
25
  * A sheet that is a screen of its own (a link can open it) belongs in the
24
26
  * router instead: an expo-router screen with `presentation: "formSheet"` and
25
27
  * `sheetAllowedDetents` (e.g. `[0.5, 1]`) is the system sheet with detents.
@@ -36,7 +38,7 @@ import {
36
38
  type ComponentType,
37
39
  type ReactNode,
38
40
  } from "react";
39
- import { AccessibilityInfo, Modal, Platform, Pressable, ScrollView, View, type ScrollViewProps, type ViewStyle } from "react-native";
41
+ import { AccessibilityInfo, Dimensions, KeyboardAvoidingView, Modal, Platform, Pressable, ScrollView, View, type ScrollViewProps, type ViewStyle } from "react-native";
40
42
  import { SafeAreaProvider, useSafeAreaInsets } from "react-native-safe-area-context";
41
43
  import { useThemeRoles } from "../hooks/use-theme-roles";
42
44
 
@@ -51,6 +53,14 @@ export interface NativeSheetProps {
51
53
  initialSnapIndex?: number;
52
54
  /** Keep the sheet open when the user taps the backdrop, swipes it down or presses Android back. Default false. */
53
55
  disableBackdropDismiss?: boolean;
56
+ /**
57
+ * As tall as its content (up to 90% of the screen) instead of the full page sheet, for a short
58
+ * menu or form. On iOS this is a bottom panel over a scrim, like Android's (a tap on the scrim
59
+ * or the VoiceOver escape gesture closes it; it doesn't follow a swipe down), and it moves above
60
+ * the keyboard. Under `NativeSheetProvider` the library sizes it (`enableDynamicSizing`) and
61
+ * `snapPoints` is ignored. Default false.
62
+ */
63
+ fitContent?: boolean;
54
64
  children: ReactNode;
55
65
  testID?: string;
56
66
  }
@@ -156,6 +166,7 @@ function LibrarySheet({
156
166
  snapPoints = ["50%", "90%"],
157
167
  initialSnapIndex = 0,
158
168
  disableBackdropDismiss = false,
169
+ fitContent = false,
159
170
  testID,
160
171
  children,
161
172
  }: NativeSheetProps & { library: NativeSheetLibrary }) {
@@ -198,10 +209,13 @@ function LibrarySheet({
198
209
  return (
199
210
  <BottomSheetModal
200
211
  ref={sheet}
201
- snapPoints={snapPoints}
202
- index={initialSnapIndex}
203
- // v5 sizes to the content by default and adds that as a snap point, which would shift the indexes.
204
- enableDynamicSizing={false}
212
+ snapPoints={fitContent ? undefined : snapPoints}
213
+ index={fitContent ? 0 : initialSnapIndex}
214
+ // v5 sizes to the content by default and adds that as a snap point, which would shift the
215
+ // indexes: only a sheet that fits its content asks for it, and then it is the only one.
216
+ enableDynamicSizing={fitContent}
217
+ // Long content would otherwise grow the sheet to the full height, under the status bar.
218
+ {...(fitContent ? { maxDynamicContentSize: Math.round(Dimensions.get("window").height * 0.9) } : {})}
205
219
  onDismiss={onDismiss}
206
220
  enablePanDownToClose={!disableBackdropDismiss}
207
221
  backdropComponent={backdrop}
@@ -238,9 +252,10 @@ function useReduceMotionAnswer(): boolean | null {
238
252
  * sheet (`presentationStyle="pageSheet"`), following the finger when swiped
239
253
  * down (`allowSwipeDismissal`); with `disableBackdropDismiss` a swipe only
240
254
  * asks and the sheet springs back. Android: a transparent modal with a scrim
241
- * and a panel at the bottom, drawn under the system bars.
255
+ * and a panel at the bottom, drawn under the system bars. `fitContent` on iOS: the same bottom
256
+ * panel, kept above the keyboard.
242
257
  */
243
- function ModalSheet({ open, onOpenChange, disableBackdropDismiss = false, testID, children }: NativeSheetProps) {
258
+ function ModalSheet({ open, onOpenChange, disableBackdropDismiss = false, fitContent = false, testID, children }: NativeSheetProps) {
244
259
  const reducedMotion = useReduceMotionAnswer();
245
260
  const roles = useThemeRoles();
246
261
  const requestClose = () => {
@@ -250,7 +265,8 @@ function ModalSheet({ open, onOpenChange, disableBackdropDismiss = false, testID
250
265
  const animationType = reducedMotion ? "none" : "slide";
251
266
  const id = testID ?? "native-sheet";
252
267
 
253
- if (Platform.OS === "ios") {
268
+ const ios = Platform.OS === "ios";
269
+ if (ios && !fitContent) {
254
270
  return (
255
271
  <Modal
256
272
  visible={visible}
@@ -283,7 +299,7 @@ function ModalSheet({ open, onOpenChange, disableBackdropDismiss = false, testID
283
299
  onRequestClose={requestClose}
284
300
  >
285
301
  <SafeAreaProvider>
286
- <View style={{ flex: 1, justifyContent: "flex-end" }}>
302
+ <KeyboardPanel ios={ios}>
287
303
  <Pressable
288
304
  testID={`${id}-backdrop`}
289
305
  accessibilityRole="button"
@@ -295,6 +311,7 @@ function ModalSheet({ open, onOpenChange, disableBackdropDismiss = false, testID
295
311
  />
296
312
  <SheetBody
297
313
  testID={id}
314
+ onAccessibilityEscape={disableBackdropDismiss ? undefined : requestClose}
298
315
  style={{
299
316
  maxHeight: "90%",
300
317
  borderTopLeftRadius: 28,
@@ -308,12 +325,25 @@ function ModalSheet({ open, onOpenChange, disableBackdropDismiss = false, testID
308
325
  />
309
326
  {children}
310
327
  </SheetBody>
311
- </View>
328
+ </KeyboardPanel>
312
329
  </SafeAreaProvider>
313
330
  </Modal>
314
331
  );
315
332
  }
316
333
 
334
+ /**
335
+ * The bottom panel's frame: on iOS it moves up with the keyboard, less the home indicator's
336
+ * inset the sheet already pads, so it sits on the keyboard without a gap.
337
+ */
338
+ function KeyboardPanel({ ios, children }: { ios: boolean; children: ReactNode }) {
339
+ const insets = useSafeAreaInsets();
340
+ return (
341
+ <KeyboardAvoidingView behavior={ios ? "padding" : undefined} keyboardVerticalOffset={ios ? -insets.bottom : 0} style={{ flex: 1, justifyContent: "flex-end" }}>
342
+ {children}
343
+ </KeyboardAvoidingView>
344
+ );
345
+ }
346
+
317
347
  /** The sheet's root, padded by the sheet's own bottom inset (the home indicator, the navigation bar). */
318
348
  function SheetBody({
319
349
  testID,
@@ -46,7 +46,8 @@ describe("InboxPage", () => {
46
46
  it("shows a spinner while the first page loads, and an error (with Try again) when the read failed", () => {
47
47
  const onRefresh = vi.fn();
48
48
  const { unmount } = render(<InboxPage testID="inbox" items={[]} loading emptyTitle="No reports" />);
49
- expect(screen.getByTestId("inbox-loading")).toBeTruthy();
49
+ expect(screen.getByTestId("inbox-loading").getAttribute("role")).toBe("progressbar");
50
+ expect(screen.getByTestId("inbox-loading").getAttribute("aria-label")).toBe("Loading");
50
51
  expect(screen.queryByTestId("inbox-empty")).toBeNull();
51
52
  unmount();
52
53
  render(<InboxPage testID="inbox" items={[]} error errorTitle="Couldn't load" onRefresh={onRefresh} />);
@@ -78,3 +78,30 @@ describe("composeHeaderOptions", () => {
78
78
  expect(opts.headerRight).toBe(right);
79
79
  });
80
80
  });
81
+
82
+ describe("ScreenContainer loading", () => {
83
+ it("replaces the body with a centred loading state inside the same safe area", () => {
84
+ render(
85
+ <ScreenContainer testID="screen" loading loadingLabel="Opening your space" scroll>
86
+ <span data-testid="child">Hello</span>
87
+ </ScreenContainer>,
88
+ );
89
+ expect(screen.queryByTestId("child")).toBeNull();
90
+ expect(screen.queryByTestId("screen-scroll")).toBeNull();
91
+ expect(screen.getByTestId("screen-body")).toBeTruthy();
92
+ const loading = screen.getByTestId("screen-loading");
93
+ expect(loading.getAttribute("role")).toBe("progressbar");
94
+ expect(loading.getAttribute("aria-label")).toBe("Opening your space");
95
+ expect(screen.getByTestId("screen").getAttribute("data-edges")).toBe("left,right");
96
+ });
97
+
98
+ it("renders the children once loading ends", () => {
99
+ render(
100
+ <ScreenContainer testID="screen" loading={false}>
101
+ <span data-testid="child">Hello</span>
102
+ </ScreenContainer>,
103
+ );
104
+ expect(screen.getByTestId("child")).toBeTruthy();
105
+ expect(screen.queryByTestId("screen-loading")).toBeNull();
106
+ });
107
+ });
@@ -31,7 +31,7 @@
31
31
  */
32
32
  import { Fragment, useState, type ReactNode } from "react";
33
33
  import { renderSlot, type SlotPropsFor, type Slots } from "@marktiderman/genesis-core/slots";
34
- import { ActivityIndicator, Alert, FlatList, Platform, Pressable, ScrollView, StyleSheet, View } from "react-native";
34
+ import { Alert, FlatList, Platform, Pressable, ScrollView, StyleSheet, View } from "react-native";
35
35
  import { SafeAreaView } from "react-native-safe-area-context";
36
36
  import { useThemeRoles } from "../hooks/use-theme-roles";
37
37
  import { NativeEmptyState } from "../components/empty-state";
@@ -39,6 +39,7 @@ import { NativeText } from "../components/text";
39
39
  import { NativeButton } from "../components/button";
40
40
  import { NativeBadge } from "../components/badge";
41
41
  import { NativeRefreshControl } from "../components/refresh-control";
42
+ import { NativeLoadingState } from "../components/loading-state";
42
43
  import { composeHeaderOptions, type ScreenHeaderProps } from "./screen-container";
43
44
 
44
45
  /** An action on a row: swipe, long press, or an accessibility action. */
@@ -220,9 +221,7 @@ export function InboxPage({
220
221
  >
221
222
  {headerNode}
222
223
  {loading ? (
223
- <View testID={`${testID}-loading`} style={{ paddingVertical: 32 }}>
224
- <ActivityIndicator accessibilityLabel="Loading" />
225
- </View>
224
+ <NativeLoadingState fullScreen={false} testID={`${testID}-loading`} />
226
225
  ) : (
227
226
  renderSlot(
228
227
  DefaultEmpty,
@@ -430,9 +429,7 @@ function UnreadDot({ unread, testID, color }: { unread: boolean; testID: string;
430
429
  function DefaultFooter({ loadingMore, testID }: InboxPageSlotMap["footer"]) {
431
430
  if (!loadingMore) return null;
432
431
  return (
433
- <View testID={testID} style={{ paddingVertical: 16 }}>
434
- <ActivityIndicator accessibilityLabel="Loading more" />
435
- </View>
432
+ <NativeLoadingState fullScreen={false} size="small" accessibilityLabel="Loading more" className="py-4" testID={testID} />
436
433
  );
437
434
  }
438
435