@marktiderman/genesis-ui-native 3.9.1 → 3.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/{chunk-FM5JYR6R.js → chunk-EAHK7D7N.js} +6 -6
- package/dist/{chunk-FM5JYR6R.js.map → chunk-EAHK7D7N.js.map} +1 -1
- package/dist/{chunk-P4IN63O4.js → chunk-GGH3ZQNO.js} +4 -4
- package/dist/{chunk-P4IN63O4.js.map → chunk-GGH3ZQNO.js.map} +1 -1
- package/dist/{chunk-K2WQU3XP.js → chunk-IWWXERKQ.js} +13 -12
- package/dist/chunk-IWWXERKQ.js.map +1 -0
- package/dist/{chunk-PWS2HLDE.js → chunk-PMS2V46D.js} +2 -2
- package/dist/{chunk-PWS2HLDE.js.map → chunk-PMS2V46D.js.map} +1 -1
- package/dist/{chunk-JZ7RAGDQ.js → chunk-SG7LYX7Z.js} +4 -4
- package/dist/{chunk-JZ7RAGDQ.js.map → chunk-SG7LYX7Z.js.map} +1 -1
- package/dist/{chunk-FGIIBON3.js → chunk-VEWSY4TZ.js} +3 -3
- package/dist/{chunk-FGIIBON3.js.map → chunk-VEWSY4TZ.js.map} +1 -1
- package/dist/{chunk-GA75M5UT.js → chunk-ZUR4PK77.js} +7 -6
- package/dist/chunk-ZUR4PK77.js.map +1 -0
- package/dist/components/index.d.ts +12 -4
- package/dist/components/index.js +5 -5
- package/dist/data/index.d.ts +10 -2
- package/dist/data/index.js +13 -8
- package/dist/data/index.js.map +1 -1
- package/dist/hooks/index.d.ts +2 -2
- package/dist/hooks/index.js +1 -1
- package/dist/icons/lucide.d.ts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +7 -7
- package/dist/layouts/index.js +5 -5
- package/dist/{native-modules-CeAaO2Dh.d.ts → native-modules-Bkm1jHO-.d.ts} +2 -0
- package/package.json +3 -3
- package/src/__tests__/fake-modules.tsx +1 -0
- package/src/__tests__/native-modules.test.tsx +39 -0
- package/src/components/__tests__/gallery-grid.test.tsx +20 -0
- package/src/components/__tests__/lightbox.test.tsx +16 -0
- package/src/components/gallery-grid.tsx +1 -1
- package/src/components/image.tsx +15 -4
- package/src/components/lightbox-zoom.tsx +8 -6
- package/src/components/lightbox.tsx +2 -1
- package/src/data/resource-view/NativeResourceView.tsx +17 -2
- package/src/data/resource-view/__tests__/native-resource-gallery.test.tsx +8 -0
- package/src/data/resource-view/index.ts +1 -0
- package/src/data/resource-view/mapping.ts +4 -4
- package/src/native-modules.tsx +2 -1
- package/dist/chunk-GA75M5UT.js.map +0 -1
- package/dist/chunk-K2WQU3XP.js.map +0 -1
package/dist/hooks/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { JUMP_SETTLE_MS, UseThreadJumpOptions, useThreadJump } from '@marktiderman/genesis-core/conversation';
|
|
2
|
-
import { o as GenesisReanimatedModule, H as HapticKind } from '../native-modules-
|
|
3
|
-
export { c as GenesisHapticsModule, s as playHaptic, t as useHaptics } from '../native-modules-
|
|
2
|
+
import { o as GenesisReanimatedModule, H as HapticKind } from '../native-modules-Bkm1jHO-.js';
|
|
3
|
+
export { c as GenesisHapticsModule, s as playHaptic, t as useHaptics } from '../native-modules-Bkm1jHO-.js';
|
|
4
4
|
import { Animated, ColorValue } from 'react-native';
|
|
5
5
|
import { MotionSprings, MotionDurations, MotionEasings, MotionLevel, MotionTokens } from '@marktiderman/genesis-design-system/tokens/motion';
|
|
6
6
|
import { ThemeRole, BrandExtensions } from '@marktiderman/genesis-design-system';
|
package/dist/hooks/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { BrandExtensionsProvider, JUMP_SETTLE_MS, useGenesisExtension, useThreadJump } from '../chunk-FOJJB6AB.js';
|
|
2
|
-
export { animateMotion, motionSpring, motionTiming, playHaptic, sentBubbleColor, useHaptics, useMotion, usePressFeedback, useReducedMotion, useThemeMode, useThemeRoles } from '../chunk-
|
|
2
|
+
export { animateMotion, motionSpring, motionTiming, playHaptic, sentBubbleColor, useHaptics, useMotion, usePressFeedback, useReducedMotion, useThemeMode, useThemeRoles } from '../chunk-PMS2V46D.js';
|
|
3
3
|
import '../chunk-DGUM43GV.js';
|
|
4
4
|
//# sourceMappingURL=index.js.map
|
|
5
5
|
//# sourceMappingURL=index.js.map
|
package/dist/icons/lucide.d.ts
CHANGED
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { Box, BoxBackground, BoxProps, ComposerSendAction, FULL_SCREEN_DARK, FlexAlign, FlexJustify, Grid, GridProps, Inline, InlineProps, LIGHTBOX_DISMISS_DISTANCE, LIGHTBOX_DISMISS_VELOCITY, LIGHTBOX_DOUBLE_TAP_MS, LIGHTBOX_MAX_ZOOM, NativeAccordion, NativeAccordionContent, NativeAccordionContentProps, NativeAccordionItem, NativeAccordionItemProps, NativeAccordionProps, NativeAccordionTrigger, NativeAccordionTriggerProps, NativeAccordionType, NativeAlert, NativeAlertDescription, NativeAlertDescriptionProps, NativeAlertProps, NativeAlertTitle, NativeAlertTitleProps, NativeAvatar, NativeAvatarProps, NativeBadge, NativeBadgeProps, NativeBanner, NativeBannerProps, NativeBulkAction, NativeBulkBar, NativeBulkBarProps, NativeButton, NativeButtonProps, NativeCard, NativeCardContent, NativeCardDescription, NativeCardFooter, NativeCardHeader, NativeCardProps, NativeCardTitle, NativeCardTitleProps, NativeCheckbox, NativeCheckboxProps, NativeChip, NativeChipGroup, NativeChipGroupMode, NativeChipGroupProps, NativeChipProps, NativeChoiceCard, NativeChoiceCardProps, NativeCombobox, NativeComboboxOption, NativeComboboxProps, NativeComposerBar, NativeComposerBarProps, NativeContextMenu, NativeContextMenuAction, NativeContextMenuProps, 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, NativeGalleryCard, NativeGalleryCardProps, NativeGalleryGrid, NativeGalleryGridProps, NativeGalleryLayout, NativeGlassSurface, NativeGlassSurfaceProps, NativeHeaderCard, NativeHeaderCardProps, NativeIcon, NativeIconProps, NativeImage, NativeImageProps, NativeInlineAlert, NativeInlineAlertProps, NativeInlineAlertVariant, NativeInput, NativeInputProps, NativeLabel, NativeLabelProps, NativeLightbox, NativeLightboxLabels, NativeLightboxProps, NativeListItem, NativeListItemDivider, NativeListItemProps, NativeLiveIndicator, NativeLiveIndicatorProps, NativeLiveIndicatorState, NativeLiveIndicatorVariant, NativeLoadingState, NativeLoadingStateEdge, NativeLoadingStateProps, NativeNumberInput, NativeNumberInputProps, NativePagination, NativePaginationProps, NativePopover, NativePopoverContent, NativePopoverContentProps, NativePopoverProps, NativePopoverTrigger, NativePopoverTriggerProps, NativeProgress, NativeProgressProps, NativeRadioGroup, NativeRadioGroupItem, NativeRadioGroupItemProps, NativeRadioGroupProps, NativeRangeSlider, NativeRangeSliderProps, NativeRating, NativeRatingProps, NativeRatingSize, NativeRatingTone, NativeRefreshControl, NativeRefreshControlProps, NativeSearchBar, NativeSearchBarProps, NativeSectionListHeader, NativeSectionListHeaderProps, NativeSegmentedControl, NativeSegmentedControlOption, NativeSegmentedControlProps, NativeSelect, NativeSelectContent, NativeSelectContentProps, NativeSelectItem, NativeSelectItemProps, NativeSelectProps, NativeSelectTrigger, NativeSelectTriggerProps, NativeSeparator, NativeSeparatorProps, NativeShareSheet, NativeShareSheetProps, NativeSheet, NativeSheetLibrary, NativeSheetProps, NativeSheetProvider, NativeSheetProviderProps, NativeSheetScrollView, NativeSkeleton, NativeSkeletonProps, NativeSlider, NativeSliderProps, NativeStepper, NativeStepperProps, NativeStepperStep, NativeSwipeRow, NativeSwipeRowProps, NativeSwitch, NativeSwitchProps, NativeTabBar, NativeTabBarItem, NativeTabBarProps, NativeTabs, NativeTabsContent, NativeTabsContentProps, NativeTabsList, NativeTabsListProps, NativeTabsProps, NativeTabsTrigger, NativeTabsTriggerProps, NativeText, NativeTextProps, NativeTextarea, NativeTextareaProps, NativeThreadList, NativeThreadListHandle, NativeThreadListProps, NativeTierBadge, NativeTierBadgeProps, NativeTimePicker, NativeTimePickerProps, NativeToastOptions, NativeToastProvider, NativeToastProviderProps, NativeToastVariant, NativeToggle, NativeToggleProps, NativeTooltip, NativeTooltipContent, NativeTooltipContentProps, NativeTooltipProps, NativeTooltipTrigger, NativeTooltipTriggerProps, NativeWhatsNewNote, NativeWhatsNewSheet, NativeWhatsNewSheetProps, NativeZoomablePhoto, NativeZoomablePhotoProps, SpaceToken, SpacingPrefix, Stack, StackProps, THREAD_AT_BOTTOM_POINTS, TextPreset, ThreadRowInfo, alertVariants, badgeTextVariants, badgeVariants, buttonTextVariants, buttonVariants, defaultNativeLightboxLabels, lightboxPanLimit, lightboxPinchScale, lightboxShouldDismiss, lightboxTouchDistance, nextRating, spaceScale, spacingClass, textVariants, threadListMode, threadNearBottom, toggleVariants, useLiquidGlass, useReduceTransparency, useToast } from './components/index.js';
|
|
2
|
-
export { G as GenesisDatePickerComponent, a as GenesisDatePickerProps, b as GenesisGlassModule, c as GenesisHapticsModule, d as GenesisIconComponent, e as GenesisIconSet, f as GenesisImageComponent, g as GenesisImageProps, h as GenesisListComponent, i as GenesisListProps, j as GenesisModules, k as GenesisModulesProvider, l as GenesisModulesProviderProps, m as GenesisNavigationModule, n as GenesisNavigationTheme, o as GenesisReanimatedModule, p as GenesisSymbolComponent, q as GenesisSymbolProps, H as HapticKind, K as KeyboardAvoidingLike, N as NATIVE_ICON_NAMES, r as NativeIconName, S as SF_SYMBOLS, s as playHaptic, u as useGenesisModules, t as useHaptics } from './native-modules-
|
|
2
|
+
export { G as GenesisDatePickerComponent, a as GenesisDatePickerProps, b as GenesisGlassModule, c as GenesisHapticsModule, d as GenesisIconComponent, e as GenesisIconSet, f as GenesisImageComponent, g as GenesisImageProps, h as GenesisListComponent, i as GenesisListProps, j as GenesisModules, k as GenesisModulesProvider, l as GenesisModulesProviderProps, m as GenesisNavigationModule, n as GenesisNavigationTheme, o as GenesisReanimatedModule, p as GenesisSymbolComponent, q as GenesisSymbolProps, H as HapticKind, K as KeyboardAvoidingLike, N as NATIVE_ICON_NAMES, r as NativeIconName, S as SF_SYMBOLS, s as playHaptic, u as useGenesisModules, t as useHaptics } from './native-modules-Bkm1jHO-.js';
|
|
3
3
|
export { DEFAULT_GALLERY_RATIO, GALLERY_DEFAULTS, GalleryItem, GalleryTileAspect, JustifiedRow, JustifiedTile, galleryItemRatio, justifyRows } from '@marktiderman/genesis-core/gallery';
|
|
4
4
|
export { BrandExtensionsProvider, BrandExtensionsProviderProps, BrandExtensionsValue, MotionHow, MotionSpringConfig, MotionTimingConfig, PressFeedback, PressFeedbackOptions, ThemeMode, ThemeRoleColors, UseMotionOptions, UseThemeRolesOptions, animateMotion, motionSpring, motionTiming, sentBubbleColor, useGenesisExtension, useMotion, usePressFeedback, useReducedMotion, useThemeMode, useThemeRoles } from './hooks/index.js';
|
|
5
5
|
export { ComposerMode, ComposerTone, InboxItem, InboxSwipeAction, JUMP_SETTLE_MS, MessageTone, ThreadAttachment, ThreadComposer, ThreadLabels, ThreadMessage, ThreadMessageStatus, UseThreadJumpOptions, formatInboxTime, readReceiptFor, useThreadJump } from '@marktiderman/genesis-core/conversation';
|
package/dist/index.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
export { Box, FULL_SCREEN_DARK, Grid, Inline, LIGHTBOX_DISMISS_DISTANCE, LIGHTBOX_DISMISS_VELOCITY, LIGHTBOX_DOUBLE_TAP_MS, LIGHTBOX_MAX_ZOOM, NativeAccordion, NativeAccordionContent, NativeAccordionItem, NativeAccordionTrigger, NativeBulkBar, NativeChip, NativeChipGroup, NativeChoiceCard, NativeCombobox, NativeDialog, NativeDialogContent, NativeDialogDescription, NativeDialogFooter, NativeDialogHeader, NativeDialogTitle, NativeDrawer, NativeDropdownMenu, NativeDropdownMenuContent, NativeDropdownMenuItem, NativeDropdownMenuTrigger, NativeFullScreenModal, NativeGalleryCard, NativeGlassSurface, NativeHeaderCard, NativeLightbox, NativeLiveIndicator, NativeNumberInput, NativePagination, NativePopover, NativePopoverContent, NativePopoverTrigger, NativeProgress, NativeRadioGroup, NativeRadioGroupItem, NativeRangeSlider, NativeRating, NativeShareSheet, NativeSlider, NativeStepper, NativeTabBar, NativeTabs, NativeTabsContent, NativeTabsList, NativeTabsTrigger, NativeTierBadge, NativeToastProvider, NativeToggle, NativeTooltip, NativeTooltipContent, NativeTooltipTrigger, NativeWhatsNewSheet, NativeZoomablePhoto, Stack, defaultNativeLightboxLabels, lightboxPanLimit, lightboxPinchScale, lightboxShouldDismiss, lightboxTouchDistance, nextRating, spaceScale, spacingClass, toggleVariants, useLiquidGlass, useReduceTransparency, useToast } from './chunk-
|
|
2
|
-
export { DEFAULT_GALLERY_RATIO, GALLERY_DEFAULTS, NativeAlert, NativeAlertDescription, NativeAlertTitle, NativeAvatar, NativeBanner, NativeCard, NativeCardContent, NativeCardDescription, NativeCardFooter, NativeCardHeader, NativeCardTitle, NativeCheckbox, NativeDatePicker, NativeGalleryGrid, NativeImage, NativeInlineAlert, NativeLabel, NativeSearchBar, NativeSegmentedControl, NativeSelect, NativeSelectContent, NativeSelectItem, NativeSelectTrigger, NativeSeparator, NativeSwitch, NativeTextarea, NativeTimePicker, alertVariants, galleryItemRatio, justifyRows } from './chunk-
|
|
1
|
+
export { Box, FULL_SCREEN_DARK, Grid, Inline, LIGHTBOX_DISMISS_DISTANCE, LIGHTBOX_DISMISS_VELOCITY, LIGHTBOX_DOUBLE_TAP_MS, LIGHTBOX_MAX_ZOOM, NativeAccordion, NativeAccordionContent, NativeAccordionItem, NativeAccordionTrigger, NativeBulkBar, NativeChip, NativeChipGroup, NativeChoiceCard, NativeCombobox, NativeDialog, NativeDialogContent, NativeDialogDescription, NativeDialogFooter, NativeDialogHeader, NativeDialogTitle, NativeDrawer, NativeDropdownMenu, NativeDropdownMenuContent, NativeDropdownMenuItem, NativeDropdownMenuTrigger, NativeFullScreenModal, NativeGalleryCard, NativeGlassSurface, NativeHeaderCard, NativeLightbox, NativeLiveIndicator, NativeNumberInput, NativePagination, NativePopover, NativePopoverContent, NativePopoverTrigger, NativeProgress, NativeRadioGroup, NativeRadioGroupItem, NativeRangeSlider, NativeRating, NativeShareSheet, NativeSlider, NativeStepper, NativeTabBar, NativeTabs, NativeTabsContent, NativeTabsList, NativeTabsTrigger, NativeTierBadge, NativeToastProvider, NativeToggle, NativeTooltip, NativeTooltipContent, NativeTooltipTrigger, NativeWhatsNewSheet, NativeZoomablePhoto, Stack, defaultNativeLightboxLabels, lightboxPanLimit, lightboxPinchScale, lightboxShouldDismiss, lightboxTouchDistance, nextRating, spaceScale, spacingClass, toggleVariants, useLiquidGlass, useReduceTransparency, useToast } from './chunk-IWWXERKQ.js';
|
|
2
|
+
export { DEFAULT_GALLERY_RATIO, GALLERY_DEFAULTS, NativeAlert, NativeAlertDescription, NativeAlertTitle, NativeAvatar, NativeBanner, NativeCard, NativeCardContent, NativeCardDescription, NativeCardFooter, NativeCardHeader, NativeCardTitle, NativeCheckbox, NativeDatePicker, NativeGalleryGrid, NativeImage, NativeInlineAlert, NativeLabel, NativeSearchBar, NativeSegmentedControl, NativeSelect, NativeSelectContent, NativeSelectItem, NativeSelectTrigger, NativeSeparator, NativeSwitch, NativeTextarea, NativeTimePicker, alertVariants, galleryItemRatio, justifyRows } from './chunk-ZUR4PK77.js';
|
|
3
3
|
export { BrandExtensionsProvider, JUMP_SETTLE_MS, useGenesisExtension, useThreadJump } from './chunk-FOJJB6AB.js';
|
|
4
|
-
export { AppleSignInButton, AuthBranding, AuthForm, AuthScreen, ForgotPasswordLink, KEYBOARD_TOOLBAR_HEIGHT, KeyboardScrollProvider, NotificationsPage, SettingsPage, SettingsSubPage, SocialAuthRow, ThreadPage, appleProvider, confirmDiscardChanges, defaultStickyHeaderOffset, getNotificationsPageStackOptions, getSettingsPageStackOptions, getSettingsSubPageStackOptions, getThreadPageStackOptions, googleProvider, iosCompactNavigationBarHeight, readReceiptFor, useKeyboardScroll, useKeyboardToolbar } from './chunk-
|
|
5
|
-
export { NativeComposerBar, NativeThreadList, THREAD_AT_BOTTOM_POINTS, threadListMode, threadNearBottom } from './chunk-
|
|
6
|
-
export { InboxPage, NavBarSaveButton, NavBarSearchBar, NavBarTitle, ScreenContainer, composeHeaderOptions, formatInboxTime, getInboxPageStackOptions, showInboxActions } from './chunk-
|
|
7
|
-
export { NATIVE_ICON_NAMES, NativeBadge, NativeButton, NativeContextMenu, NativeEmptyState, NativeIcon, NativeInput, NativeListItem, NativeListItemDivider, NativeLoadingState, NativeRefreshControl, NativeSectionListHeader, NativeSheet, NativeSheetProvider, NativeSheetScrollView, NativeSkeleton, NativeSwipeRow, NativeText, SF_SYMBOLS, badgeTextVariants, badgeVariants, buttonTextVariants, buttonVariants, textVariants } from './chunk-
|
|
8
|
-
export { GenesisModulesProvider, animateMotion, motionSpring, motionTiming, playHaptic, sentBubbleColor, useGenesisModules, useHaptics, useMotion, usePressFeedback, useReducedMotion, useThemeMode, useThemeRoles } from './chunk-
|
|
4
|
+
export { AppleSignInButton, AuthBranding, AuthForm, AuthScreen, ForgotPasswordLink, KEYBOARD_TOOLBAR_HEIGHT, KeyboardScrollProvider, NotificationsPage, SettingsPage, SettingsSubPage, SocialAuthRow, ThreadPage, appleProvider, confirmDiscardChanges, defaultStickyHeaderOffset, getNotificationsPageStackOptions, getSettingsPageStackOptions, getSettingsSubPageStackOptions, getThreadPageStackOptions, googleProvider, iosCompactNavigationBarHeight, readReceiptFor, useKeyboardScroll, useKeyboardToolbar } from './chunk-EAHK7D7N.js';
|
|
5
|
+
export { NativeComposerBar, NativeThreadList, THREAD_AT_BOTTOM_POINTS, threadListMode, threadNearBottom } from './chunk-SG7LYX7Z.js';
|
|
6
|
+
export { InboxPage, NavBarSaveButton, NavBarSearchBar, NavBarTitle, ScreenContainer, composeHeaderOptions, formatInboxTime, getInboxPageStackOptions, showInboxActions } from './chunk-GGH3ZQNO.js';
|
|
7
|
+
export { NATIVE_ICON_NAMES, NativeBadge, NativeButton, NativeContextMenu, NativeEmptyState, NativeIcon, NativeInput, NativeListItem, NativeListItemDivider, NativeLoadingState, NativeRefreshControl, NativeSectionListHeader, NativeSheet, NativeSheetProvider, NativeSheetScrollView, NativeSkeleton, NativeSwipeRow, NativeText, SF_SYMBOLS, badgeTextVariants, badgeVariants, buttonTextVariants, buttonVariants, textVariants } from './chunk-VEWSY4TZ.js';
|
|
8
|
+
export { GenesisModulesProvider, animateMotion, motionSpring, motionTiming, playHaptic, sentBubbleColor, useGenesisModules, useHaptics, useMotion, usePressFeedback, useReducedMotion, useThemeMode, useThemeRoles } from './chunk-PMS2V46D.js';
|
|
9
9
|
export { cn } from './chunk-OHZD7KRO.js';
|
|
10
10
|
import './chunk-DGUM43GV.js';
|
|
11
11
|
//# sourceMappingURL=index.js.map
|
package/dist/layouts/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
export { AppleSignInButton, AuthBranding, AuthForm, AuthScreen, ForgotPasswordLink, KEYBOARD_TOOLBAR_HEIGHT, KeyboardScrollProvider, NotificationsPage, SettingsPage, SettingsSubPage, SocialAuthRow, ThreadPage, appleProvider, confirmDiscardChanges, defaultStickyHeaderOffset, getNotificationsPageStackOptions, getSettingsPageStackOptions, getSettingsSubPageStackOptions, getThreadPageStackOptions, googleProvider, iosCompactNavigationBarHeight, readReceiptFor, useKeyboardScroll, useKeyboardToolbar } from '../chunk-
|
|
2
|
-
import '../chunk-
|
|
3
|
-
export { InboxPage, NavBarSaveButton, NavBarSearchBar, NavBarTitle, ScreenContainer, composeHeaderOptions, formatInboxTime, getInboxPageStackOptions, showInboxActions } from '../chunk-
|
|
4
|
-
import '../chunk-
|
|
5
|
-
import '../chunk-
|
|
1
|
+
export { AppleSignInButton, AuthBranding, AuthForm, AuthScreen, ForgotPasswordLink, KEYBOARD_TOOLBAR_HEIGHT, KeyboardScrollProvider, NotificationsPage, SettingsPage, SettingsSubPage, SocialAuthRow, ThreadPage, appleProvider, confirmDiscardChanges, defaultStickyHeaderOffset, getNotificationsPageStackOptions, getSettingsPageStackOptions, getSettingsSubPageStackOptions, getThreadPageStackOptions, googleProvider, iosCompactNavigationBarHeight, readReceiptFor, useKeyboardScroll, useKeyboardToolbar } from '../chunk-EAHK7D7N.js';
|
|
2
|
+
import '../chunk-SG7LYX7Z.js';
|
|
3
|
+
export { InboxPage, NavBarSaveButton, NavBarSearchBar, NavBarTitle, ScreenContainer, composeHeaderOptions, formatInboxTime, getInboxPageStackOptions, showInboxActions } from '../chunk-GGH3ZQNO.js';
|
|
4
|
+
import '../chunk-VEWSY4TZ.js';
|
|
5
|
+
import '../chunk-PMS2V46D.js';
|
|
6
6
|
import '../chunk-OHZD7KRO.js';
|
|
7
7
|
import '../chunk-DGUM43GV.js';
|
|
8
8
|
//# sourceMappingURL=index.js.map
|
|
@@ -139,8 +139,10 @@ interface GenesisListProps<T> {
|
|
|
139
139
|
type GenesisListComponent = ComponentType<GenesisListProps<any>>;
|
|
140
140
|
/** The expo-image `Image` props Genesis passes. */
|
|
141
141
|
interface GenesisImageProps {
|
|
142
|
+
/** `cacheKey` keys the cache in place of the URL. */
|
|
142
143
|
source: {
|
|
143
144
|
uri: string;
|
|
145
|
+
cacheKey?: string;
|
|
144
146
|
} | number | null;
|
|
145
147
|
style?: unknown;
|
|
146
148
|
contentFit?: "cover" | "contain" | "fill" | "none" | "scale-down";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@marktiderman/genesis-ui-native",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.11.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -83,8 +83,8 @@
|
|
|
83
83
|
"@expo/ui": ">=58.0.0",
|
|
84
84
|
"@gorhom/bottom-sheet": ">=5.0.0",
|
|
85
85
|
"@hookform/resolvers": "^3.0.0 || ^4.0.0 || ^5.0.0 || ^6.0.0",
|
|
86
|
-
"@marktiderman/genesis-core": "^2.
|
|
87
|
-
"@marktiderman/genesis-design-system": "^1.
|
|
86
|
+
"@marktiderman/genesis-core": "^2.15.0",
|
|
87
|
+
"@marktiderman/genesis-design-system": "^1.11.0",
|
|
88
88
|
"@react-native-community/datetimepicker": ">=8.0.0",
|
|
89
89
|
"@shopify/flash-list": ">=2.0.0",
|
|
90
90
|
"@tanstack/react-query": "^5.0.0",
|
|
@@ -73,6 +73,7 @@ export function fakeImage() {
|
|
|
73
73
|
data-testid={props.testID}
|
|
74
74
|
data-expo-image="true"
|
|
75
75
|
data-recycling-key={props.recyclingKey ?? ""}
|
|
76
|
+
data-cache-key={typeof props.source === "object" && props.source ? props.source.cacheKey : undefined}
|
|
76
77
|
data-cache-policy={props.cachePolicy}
|
|
77
78
|
data-transition={String(props.transition)}
|
|
78
79
|
src={typeof props.source === "object" && props.source ? props.source.uri : undefined}
|
|
@@ -407,6 +407,45 @@ describe("NativeAvatar and NativeImage", () => {
|
|
|
407
407
|
expect(screen.getByTestId("img").getAttribute("aria-hidden")).toBe("true");
|
|
408
408
|
});
|
|
409
409
|
|
|
410
|
+
it("cache a rotating signed URL under its cacheKey, which is also the recycling key", () => {
|
|
411
|
+
const Image = fakeImage();
|
|
412
|
+
const ui = (src: string) => (
|
|
413
|
+
<GenesisModulesProvider modules={{ image: Image }}>
|
|
414
|
+
<NativeImage testID="img" src={src} cacheKey="photos/42.jpg" />
|
|
415
|
+
</GenesisModulesProvider>
|
|
416
|
+
);
|
|
417
|
+
const { rerender } = render(ui("https://example.com/photos/42.jpg?expires=1&sig=a"));
|
|
418
|
+
const img = () => screen.getByTestId("img-image");
|
|
419
|
+
expect(img().dataset.cacheKey).toBe("photos/42.jpg");
|
|
420
|
+
expect(img().dataset.recyclingKey).toBe("photos/42.jpg");
|
|
421
|
+
// A new signature for the same picture keeps both keys, so it's neither fetched again nor reset.
|
|
422
|
+
rerender(ui("https://example.com/photos/42.jpg?expires=2&sig=b"));
|
|
423
|
+
expect(img().getAttribute("src")).toBe("https://example.com/photos/42.jpg?expires=2&sig=b");
|
|
424
|
+
expect(img().dataset.cacheKey).toBe("photos/42.jpg");
|
|
425
|
+
expect(img().dataset.recyclingKey).toBe("photos/42.jpg");
|
|
426
|
+
});
|
|
427
|
+
|
|
428
|
+
it("let an explicit recycling key win over the cacheKey, and pass no cacheKey when none is given", () => {
|
|
429
|
+
const Image = fakeImage();
|
|
430
|
+
const { rerender } = withModules({ image: Image }, <NativeImage testID="img" src="https://example.com/c.png" cacheKey="c" recyclingKey="row-3" />);
|
|
431
|
+
expect(screen.getByTestId("img-image").dataset.recyclingKey).toBe("row-3");
|
|
432
|
+
expect(screen.getByTestId("img-image").dataset.cacheKey).toBe("c");
|
|
433
|
+
rerender(
|
|
434
|
+
<GenesisModulesProvider modules={{ image: Image }}>
|
|
435
|
+
<NativeImage testID="img" src="https://example.com/c.png" />
|
|
436
|
+
</GenesisModulesProvider>,
|
|
437
|
+
);
|
|
438
|
+
expect(screen.getByTestId("img-image").dataset.cacheKey).toBeUndefined();
|
|
439
|
+
expect(Image.mock.lastCall?.[0].source).toEqual({ uri: "https://example.com/c.png" });
|
|
440
|
+
});
|
|
441
|
+
|
|
442
|
+
it("ignore cacheKey on React Native's Image", () => {
|
|
443
|
+
render(<NativeImage testID="img" src="https://example.com/d.png?sig=a" cacheKey="d" />);
|
|
444
|
+
const img = screen.getByTestId("img-image");
|
|
445
|
+
expect(img.dataset.expoImage).toBeUndefined();
|
|
446
|
+
expect(img.dataset.cacheKey).toBeUndefined();
|
|
447
|
+
});
|
|
448
|
+
|
|
410
449
|
it("fall back to React Native's Image", () => {
|
|
411
450
|
render(<NativeAvatar testID="av" src="https://example.com/a.png" fallback="AB" />);
|
|
412
451
|
expect(screen.getByTestId("av-image").dataset.expoImage).toBeUndefined();
|
|
@@ -3,6 +3,8 @@ import { act, fireEvent, render, screen } from "@testing-library/react";
|
|
|
3
3
|
import { describe, expect, it, vi } from "vitest";
|
|
4
4
|
import { GALLERY_DEFAULTS, type GalleryItem } from "../gallery-types";
|
|
5
5
|
import { NativeGalleryGrid } from "../gallery-grid";
|
|
6
|
+
import { GenesisModulesProvider } from "../../native-modules";
|
|
7
|
+
import { fakeImage } from "../../__tests__/fake-modules";
|
|
6
8
|
|
|
7
9
|
const items: GalleryItem[] = Array.from({ length: 5 }, (_, i) => ({
|
|
8
10
|
id: `p${i}`,
|
|
@@ -141,6 +143,24 @@ describe("NativeGalleryGrid additions", () => {
|
|
|
141
143
|
expect(placeholder.getAttribute("aria-label")).toBe("Untitled");
|
|
142
144
|
});
|
|
143
145
|
|
|
146
|
+
it("passes each item's cacheKey to its image, and keys by the URL without one", () => {
|
|
147
|
+
const keyed: GalleryItem[] = [
|
|
148
|
+
{ id: "k", src: "https://example.test/k.jpg?sig=a", cacheKey: "photos/k.jpg", width: 400, height: 300 },
|
|
149
|
+
{ id: "u", src: "https://example.test/u.jpg", width: 400, height: 300 },
|
|
150
|
+
];
|
|
151
|
+
const { container } = render(
|
|
152
|
+
<GenesisModulesProvider modules={{ image: fakeImage() }}>
|
|
153
|
+
<NativeGalleryGrid items={keyed} testID="g" />
|
|
154
|
+
</GenesisModulesProvider>,
|
|
155
|
+
);
|
|
156
|
+
measure(screen.getByTestId("g"), 600);
|
|
157
|
+
const [k, u] = Array.from(container.querySelectorAll<HTMLElement>("img[data-expo-image]"));
|
|
158
|
+
expect(k!.dataset.cacheKey).toBe("photos/k.jpg");
|
|
159
|
+
expect(k!.dataset.recyclingKey).toBe("photos/k.jpg");
|
|
160
|
+
expect(u!.dataset.cacheKey).toBeUndefined();
|
|
161
|
+
expect(u!.dataset.recyclingKey).toBe("https://example.test/u.jpg");
|
|
162
|
+
});
|
|
163
|
+
|
|
144
164
|
it("shares the web's defaults", () => {
|
|
145
165
|
expect(GALLERY_DEFAULTS).toEqual({ rowHeight: 180, gap: 4, columns: 3 });
|
|
146
166
|
});
|
|
@@ -3,6 +3,8 @@ import { fireEvent, render, screen } from "@testing-library/react";
|
|
|
3
3
|
import { describe, expect, it, vi } from "vitest";
|
|
4
4
|
import type { GalleryItem } from "../gallery-types";
|
|
5
5
|
import { NativeLightbox } from "../lightbox";
|
|
6
|
+
import { GenesisModulesProvider } from "../../native-modules";
|
|
7
|
+
import { fakeImage } from "../../__tests__/fake-modules";
|
|
6
8
|
|
|
7
9
|
const items: GalleryItem[] = [
|
|
8
10
|
{ id: "a", src: "https://example.test/a.jpg", alt: "First", caption: "Warm-up" },
|
|
@@ -55,6 +57,20 @@ describe("NativeLightbox", () => {
|
|
|
55
57
|
expect(screen.getByTestId("lb-counter").textContent).toBe("3 / 3");
|
|
56
58
|
});
|
|
57
59
|
|
|
60
|
+
it("caches each page under its item's cacheKey, on the zooming page and the plain one", () => {
|
|
61
|
+
const keyed: GalleryItem[] = [{ id: "k", src: "https://example.test/k.jpg?sig=a", cacheKey: "photos/k.jpg" }];
|
|
62
|
+
for (const zoomable of [true, false]) {
|
|
63
|
+
const { container, unmount } = render(
|
|
64
|
+
<GenesisModulesProvider modules={{ image: fakeImage() }}>
|
|
65
|
+
<NativeLightbox open onOpenChange={() => undefined} items={keyed} index={0} onIndexChange={() => undefined} zoomable={zoomable} swipeToDismiss={zoomable} testID="lb" />
|
|
66
|
+
</GenesisModulesProvider>,
|
|
67
|
+
);
|
|
68
|
+
const img = container.ownerDocument.querySelector<HTMLElement>("img[data-expo-image]");
|
|
69
|
+
expect(img?.dataset.cacheKey).toBe("photos/k.jpg");
|
|
70
|
+
unmount();
|
|
71
|
+
}
|
|
72
|
+
});
|
|
73
|
+
|
|
58
74
|
it("shows no counter for a single picture", () => {
|
|
59
75
|
render(<NativeLightbox open onOpenChange={() => undefined} items={items.slice(0, 1)} index={0} onIndexChange={() => undefined} testID="lb" />);
|
|
60
76
|
expect(screen.queryByTestId("lb-counter")).toBeNull();
|
|
@@ -190,7 +190,7 @@ export function NativeGalleryGrid({
|
|
|
190
190
|
<>
|
|
191
191
|
<View className="absolute inset-0 bg-muted" />
|
|
192
192
|
{item.src ? (
|
|
193
|
-
<NativeImage src={item.src} alt={item.alt} className="h-full w-full" />
|
|
193
|
+
<NativeImage src={item.src} cacheKey={item.cacheKey} alt={item.alt} className="h-full w-full" />
|
|
194
194
|
) : (
|
|
195
195
|
// No image: a neutral tile with its words, so the count matches what's drawn. The tile's
|
|
196
196
|
// own label (alt, then caption) names a pressable tile, so the words are hidden from
|
package/src/components/image.tsx
CHANGED
|
@@ -5,7 +5,10 @@
|
|
|
5
5
|
* `GenesisModulesProvider`): cached in memory and on disk, an optional
|
|
6
6
|
* blurhash/thumbhash `placeholder`, a cross-fade that Reduce Motion turns
|
|
7
7
|
* off, and a `recyclingKey` (the URL by default) so a recycled FlashList row
|
|
8
|
-
* never flashes the previous picture.
|
|
8
|
+
* never flashes the previous picture. A `cacheKey` caches the picture under a
|
|
9
|
+
* stable key instead of its URL, for signed URLs that rotate (a new expiry or
|
|
10
|
+
* signature would otherwise miss the disk cache and download it again).
|
|
11
|
+
* Without it, React Native's `Image`.
|
|
9
12
|
*
|
|
10
13
|
* Give it a size (className or `width`/`height`). Decorative unless `alt` is
|
|
11
14
|
* given.
|
|
@@ -28,7 +31,13 @@ export interface NativeImageProps {
|
|
|
28
31
|
contentFit?: "cover" | "contain";
|
|
29
32
|
/** expo-image only: `{ blurhash }` or `{ thumbhash }` shown while loading. */
|
|
30
33
|
placeholder?: { blurhash: string } | { thumbhash: string };
|
|
31
|
-
/**
|
|
34
|
+
/**
|
|
35
|
+
* expo-image only: caches the picture under this key instead of its URL, so a signed URL
|
|
36
|
+
* that rotates (a new expiry or signature for the same file) still hits the memory and disk
|
|
37
|
+
* cache. Use a key that names the file, such as its storage path or id.
|
|
38
|
+
*/
|
|
39
|
+
cacheKey?: string;
|
|
40
|
+
/** expo-image only: resets the view when it changes (recycled rows). Default `cacheKey`, then `src`. */
|
|
32
41
|
recyclingKey?: string;
|
|
33
42
|
/** expo-image only: load order among images. */
|
|
34
43
|
priority?: "low" | "normal" | "high";
|
|
@@ -47,6 +56,7 @@ export function NativeImage({
|
|
|
47
56
|
height,
|
|
48
57
|
contentFit = "cover",
|
|
49
58
|
placeholder,
|
|
59
|
+
cacheKey,
|
|
50
60
|
recyclingKey,
|
|
51
61
|
priority,
|
|
52
62
|
onError,
|
|
@@ -68,14 +78,15 @@ export function NativeImage({
|
|
|
68
78
|
<ExpoImage
|
|
69
79
|
testID={testID ? `${testID}-image` : undefined}
|
|
70
80
|
accessible={false}
|
|
71
|
-
source={{ uri: src }}
|
|
81
|
+
source={cacheKey ? { uri: src, cacheKey } : { uri: src }}
|
|
72
82
|
style={FILL}
|
|
73
83
|
contentFit={contentFit}
|
|
74
84
|
cachePolicy="memory-disk"
|
|
75
85
|
placeholder={placeholder}
|
|
76
86
|
placeholderContentFit={contentFit}
|
|
77
87
|
transition={reducedMotion ? null : 150}
|
|
78
|
-
|
|
88
|
+
// A rotated URL for the same picture keeps the view, so it doesn't flash.
|
|
89
|
+
recyclingKey={recyclingKey ?? cacheKey ?? src}
|
|
79
90
|
priority={priority}
|
|
80
91
|
onError={onError}
|
|
81
92
|
/>
|
|
@@ -51,6 +51,8 @@ const clamp = (v: number, limit: number) => Math.max(-limit, Math.min(limit, v))
|
|
|
51
51
|
|
|
52
52
|
export interface NativeZoomablePhotoProps {
|
|
53
53
|
src: string;
|
|
54
|
+
/** Caches the photo under this key instead of its URL (`NativeImage`'s `cacheKey`). */
|
|
55
|
+
cacheKey?: string;
|
|
54
56
|
alt?: string;
|
|
55
57
|
width: number;
|
|
56
58
|
height: number;
|
|
@@ -72,8 +74,8 @@ export function NativeZoomablePhoto(props: NativeZoomablePhotoProps) {
|
|
|
72
74
|
return Platform.OS === "ios" ? <ZoomableIos {...props} /> : <ZoomablePan {...props} />;
|
|
73
75
|
}
|
|
74
76
|
|
|
75
|
-
function Photo({ src, alt, width, height, testID }: { src: string; alt?: string; width: number; height: number; testID: string }) {
|
|
76
|
-
return <NativeImage src={src} alt={alt} width={width} height={height} contentFit="contain" className="bg-transparent" testID={testID} />;
|
|
77
|
+
function Photo({ src, cacheKey, alt, width, height, testID }: { src: string; cacheKey?: string; alt?: string; width: number; height: number; testID: string }) {
|
|
78
|
+
return <NativeImage src={src} cacheKey={cacheKey} alt={alt} width={width} height={height} contentFit="contain" className="bg-transparent" testID={testID} />;
|
|
77
79
|
}
|
|
78
80
|
|
|
79
81
|
/** A tap that waits to see whether it's the first half of a double tap. */
|
|
@@ -113,7 +115,7 @@ function zoomTo(view: ZoomScrollView | null, rect: ZoomRect, animated: boolean)
|
|
|
113
115
|
}
|
|
114
116
|
|
|
115
117
|
/** iOS: the system's zooming scroll view; at full size, a pull down past the top closes. */
|
|
116
|
-
function ZoomableIos({ src, alt, width, height, active, onZoomChange, zoomable = true, onPull, onDismiss, onTap, testID }: NativeZoomablePhotoProps) {
|
|
118
|
+
function ZoomableIos({ src, cacheKey, alt, width, height, active, onZoomChange, zoomable = true, onPull, onDismiss, onTap, testID }: NativeZoomablePhotoProps) {
|
|
117
119
|
const ref = useRef<ZoomScrollView | null>(null);
|
|
118
120
|
const scale = useRef(1);
|
|
119
121
|
const reducedMotion = useReducedMotion();
|
|
@@ -158,14 +160,14 @@ function ZoomableIos({ src, alt, width, height, active, onZoomChange, zoomable =
|
|
|
158
160
|
}}
|
|
159
161
|
>
|
|
160
162
|
<Pressable accessible={false} onPress={tap} style={{ width, height }}>
|
|
161
|
-
<Photo src={src} alt={alt} width={width} height={height} testID={`${testID}-image`} />
|
|
163
|
+
<Photo src={src} cacheKey={cacheKey} alt={alt} width={width} height={height} testID={`${testID}-image`} />
|
|
162
164
|
</Pressable>
|
|
163
165
|
</ScrollView>
|
|
164
166
|
);
|
|
165
167
|
}
|
|
166
168
|
|
|
167
169
|
/** Android (no zooming ScrollView): two fingers pinch, one pans a zoomed photo or drags it down to close. */
|
|
168
|
-
function ZoomablePan({ src, alt, width, height, active, onZoomChange, zoomable = true, onPull, onDismiss, onTap, testID }: NativeZoomablePhotoProps) {
|
|
170
|
+
function ZoomablePan({ src, cacheKey, alt, width, height, active, onZoomChange, zoomable = true, onPull, onDismiss, onTap, testID }: NativeZoomablePhotoProps) {
|
|
169
171
|
const reducedMotion = useReducedMotion();
|
|
170
172
|
const scale = useRef(new Animated.Value(1)).current;
|
|
171
173
|
const tx = useRef(new Animated.Value(0)).current;
|
|
@@ -274,7 +276,7 @@ function ZoomablePan({ src, alt, width, height, active, onZoomChange, zoomable =
|
|
|
274
276
|
<View testID={testID} style={{ width, height, overflow: "hidden" }} {...responder.panHandlers}>
|
|
275
277
|
<Animated.View style={{ width, height, transform: [{ translateX: tx }, { translateY: ty }, { scale }] }}>
|
|
276
278
|
<Pressable accessible={false} onPress={tap} style={{ width, height }}>
|
|
277
|
-
<Photo src={src} alt={alt} width={width} height={height} testID={`${testID}-image`} />
|
|
279
|
+
<Photo src={src} cacheKey={cacheKey} alt={alt} width={width} height={height} testID={`${testID}-image`} />
|
|
278
280
|
</Pressable>
|
|
279
281
|
</Animated.View>
|
|
280
282
|
</View>
|
|
@@ -253,6 +253,7 @@ function LightboxBody({
|
|
|
253
253
|
) : zoomable || swipeToDismiss ? (
|
|
254
254
|
<NativeZoomablePhoto
|
|
255
255
|
src={it.src}
|
|
256
|
+
cacheKey={it.cacheKey}
|
|
256
257
|
alt={it.alt ?? labels.photo(i + 1, items.length)}
|
|
257
258
|
width={width}
|
|
258
259
|
height={size.height}
|
|
@@ -266,7 +267,7 @@ function LightboxBody({
|
|
|
266
267
|
/>
|
|
267
268
|
) : (
|
|
268
269
|
<Pressable accessible={false} onPress={toggleChrome} style={{ width, flex: 1 }}>
|
|
269
|
-
<NativeImage src={it.src} alt={it.alt ?? labels.photo(i + 1, items.length)} className="h-full w-full" contentFit="contain" />
|
|
270
|
+
<NativeImage src={it.src} cacheKey={it.cacheKey} alt={it.alt ?? labels.photo(i + 1, items.length)} className="h-full w-full" contentFit="contain" />
|
|
270
271
|
</Pressable>
|
|
271
272
|
)}
|
|
272
273
|
</View>
|
|
@@ -67,6 +67,9 @@ export type NativeResourceSwipeableProps = Omit<InboxPageSlotMap["swipeable"], "
|
|
|
67
67
|
/** How rows show: a list (the default) or cards in columns, as the web's `mode`. */
|
|
68
68
|
export type NativeResourceViewMode = "list" | "grid";
|
|
69
69
|
|
|
70
|
+
/** The view types the phone draws: list, grid and gallery (ADR 0021). @stability Beta */
|
|
71
|
+
export type NativeResourceViewType = NativeResourceViewMode | "gallery";
|
|
72
|
+
|
|
70
73
|
/**
|
|
71
74
|
* Spread onto your card's Pressable: the press (the screen's `onRowPress`, else the peek), the
|
|
72
75
|
* long press (the row's actions), and the label and actions screen readers use. The same wiring
|
|
@@ -118,9 +121,15 @@ export interface NativeResourceViewProps<T extends Row = Row> extends NativeReso
|
|
|
118
121
|
/**
|
|
119
122
|
* `"grid"`: cards in `numColumns` columns, as the web's `mode="grid"`. Sections, paging, pull to
|
|
120
123
|
* refresh, the empty and error states, long press, accessibility and swipe actions all stay.
|
|
121
|
-
* Default `"list"`.
|
|
124
|
+
* Default `"list"`. Prefer `type`; `mode` stays as its alias.
|
|
122
125
|
*/
|
|
123
126
|
mode?: NativeResourceViewMode;
|
|
127
|
+
/**
|
|
128
|
+
* The view type (ADR 0021), as the web's `<ResourceView type>`: `"list"` (default), `"grid"`, or
|
|
129
|
+
* `"gallery"` (the grid as photos, from the view's `gallery` block). The phone has no board or
|
|
130
|
+
* calendar yet. Wins over `mode`.
|
|
131
|
+
*/
|
|
132
|
+
type?: NativeResourceViewType;
|
|
124
133
|
/** Columns in grid mode (React Native's FlatList name). Default 2. */
|
|
125
134
|
numColumns?: number;
|
|
126
135
|
/**
|
|
@@ -466,7 +475,8 @@ function Screen<T extends Row = Row>(props: NativeResourceViewProps<T>) {
|
|
|
466
475
|
header,
|
|
467
476
|
emptyState,
|
|
468
477
|
searchable,
|
|
469
|
-
mode = "list",
|
|
478
|
+
mode: modeProp = "list",
|
|
479
|
+
type,
|
|
470
480
|
numColumns: columnsProp,
|
|
471
481
|
gallery: screenGallery,
|
|
472
482
|
renderCard,
|
|
@@ -474,6 +484,11 @@ function Screen<T extends Row = Row>(props: NativeResourceViewProps<T>) {
|
|
|
474
484
|
testID = "native-resource-view",
|
|
475
485
|
...options
|
|
476
486
|
} = props;
|
|
487
|
+
// `type` is the view type's name (ADR 0021); `mode` its alias. A gallery is the grid as photos.
|
|
488
|
+
const mode: NativeResourceViewMode = type === "gallery" ? "grid" : (type ?? modeProp);
|
|
489
|
+
if (type === "gallery" && !view.definition.gallery && !screenGallery?.image) {
|
|
490
|
+
throw new Error(`NativeResourceView(${view.resource}): type="gallery" needs a gallery block: the view's gallery.image, or gallery={{ image }}`);
|
|
491
|
+
}
|
|
477
492
|
void _zone;
|
|
478
493
|
const state = useNativeResourceView<T>(view, options);
|
|
479
494
|
const keyExtractor = useCallback((row: T) => recordKey(view as AnyResourceView<Row>, row), [view]);
|
|
@@ -122,4 +122,12 @@ describe("NativeResourceView gallery", () => {
|
|
|
122
122
|
await waitFor(() => expect(tile("p1")).not.toBeNull());
|
|
123
123
|
expect(tile("p3")).not.toBeNull();
|
|
124
124
|
});
|
|
125
|
+
|
|
126
|
+
it("takes the view type as `type` (ADR 0021): gallery is the grid as photos, and needs a gallery block", async () => {
|
|
127
|
+
render(<NativeResourceView view={view} type="gallery" onRowPress={() => undefined} />, { wrapper: wrap(provider()) });
|
|
128
|
+
await measured();
|
|
129
|
+
await waitFor(() => expect(tile("p1")).not.toBeNull());
|
|
130
|
+
vi.spyOn(console, "error").mockImplementation(() => {});
|
|
131
|
+
expect(() => render(<NativeResourceView view={plain} type="gallery" />, { wrapper: wrap(provider()) })).toThrow(/needs a gallery block/);
|
|
132
|
+
});
|
|
125
133
|
});
|
|
@@ -228,11 +228,11 @@ export interface NativeFormField {
|
|
|
228
228
|
/** Choices that fit a segmented control; more go to a list. */
|
|
229
229
|
const SEGMENTED_MAX = 4;
|
|
230
230
|
|
|
231
|
-
function kindFor(display: DisplayHint, options: unknown[] | undefined,
|
|
231
|
+
function kindFor(display: DisplayHint, options: unknown[] | undefined, control?: string): NativeFormFieldKind {
|
|
232
232
|
if (options) return options.length <= SEGMENTED_MAX ? "segmented" : "select";
|
|
233
|
-
// A phone number shows as text, so only the contract's `
|
|
233
|
+
// A phone number shows as text, so only the contract's `control: "tel"` (or its older `widget`) makes it one (as on the
|
|
234
234
|
// web); a column's name is never read as a type.
|
|
235
|
-
if (
|
|
235
|
+
if (control === "tel" && display === "text") return "tel";
|
|
236
236
|
switch (display) {
|
|
237
237
|
case "boolean":
|
|
238
238
|
return "switch";
|
|
@@ -311,7 +311,7 @@ export function formFieldsFor<T extends Row>(
|
|
|
311
311
|
return {
|
|
312
312
|
key: f.field.name,
|
|
313
313
|
label: f.label,
|
|
314
|
-
kind: link ? ("link" as const) : kindFor(f.display, options, f.field.widget),
|
|
314
|
+
kind: link ? ("link" as const) : kindFor(f.display, options, f.field.control ?? f.field.widget),
|
|
315
315
|
display: f.display,
|
|
316
316
|
required: !readOnly && f.required,
|
|
317
317
|
readOnly,
|
package/src/native-modules.tsx
CHANGED
|
@@ -69,7 +69,8 @@ export type GenesisListComponent = ComponentType<GenesisListProps<any>>;
|
|
|
69
69
|
|
|
70
70
|
/** The expo-image `Image` props Genesis passes. */
|
|
71
71
|
export interface GenesisImageProps {
|
|
72
|
-
|
|
72
|
+
/** `cacheKey` keys the cache in place of the URL. */
|
|
73
|
+
source: { uri: string; cacheKey?: string } | number | null;
|
|
73
74
|
style?: unknown;
|
|
74
75
|
contentFit?: "cover" | "contain" | "fill" | "none" | "scale-down";
|
|
75
76
|
cachePolicy?: "none" | "disk" | "memory" | "memory-disk";
|