react-native-terra-ui 0.5.1 → 0.6.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/CHANGELOG.md +25 -0
- package/lib/module/components/avatar/Avatar.js +60 -60
- package/lib/module/components/avatar/Avatar.js.map +1 -1
- package/lib/module/components/box/Box.js +2 -2
- package/lib/module/components/box/Box.js.map +1 -1
- package/lib/module/components/box/utils.js +19 -19
- package/lib/module/components/box/utils.js.map +1 -1
- package/lib/module/components/button/Button.js +54 -48
- package/lib/module/components/button/Button.js.map +1 -1
- package/lib/module/components/chip/Chip.js +94 -94
- package/lib/module/components/chip/Chip.js.map +1 -1
- package/lib/module/components/chip/utils.js +3 -3
- package/lib/module/components/empty-state/EmptyState.js +40 -40
- package/lib/module/components/empty-state/EmptyState.js.map +1 -1
- package/lib/module/components/header/header-buttons.js +5 -5
- package/lib/module/components/header/header-buttons.js.map +1 -1
- package/lib/module/components/header/parts/HeaderGradientOverlay.js +2 -2
- package/lib/module/components/header/parts/HeaderGradientOverlay.js.map +1 -1
- package/lib/module/components/header/variants/LargeTitleHeader/index.js +58 -58
- package/lib/module/components/header/variants/LargeTitleHeader/index.js.map +1 -1
- package/lib/module/components/header/variants/TitleHeader/index.js +27 -27
- package/lib/module/components/header/variants/TitleHeader/index.js.map +1 -1
- package/lib/module/components/icon/Icon.js +6 -6
- package/lib/module/components/icon/Icon.js.map +1 -1
- package/lib/module/components/image/Image.js +6 -6
- package/lib/module/components/image/Image.js.map +1 -1
- package/lib/module/components/page-indicator/PageIndicator.js +1 -1
- package/lib/module/components/page-indicator/PageIndicatorRoot.js.map +1 -1
- package/lib/module/components/page-indicator/hooks/use-page-indicator-colors.js +8 -8
- package/lib/module/components/page-indicator/hooks/use-page-indicator-colors.js.map +1 -1
- package/lib/module/components/page-indicator/hooks/use-page-indicator-core.js.map +1 -1
- package/lib/module/components/page-indicator/hooks/use-page-indicator-progress.js +6 -6
- package/lib/module/components/page-indicator/hooks/use-page-indicator-progress.js.map +1 -1
- package/lib/module/components/page-indicator/utils.js +8 -8
- package/lib/module/components/page-indicator/utils.js.map +1 -1
- package/lib/module/components/page-indicator/variants/DotIndicator/InactiveDot.js +2 -2
- package/lib/module/components/page-indicator/variants/DotIndicator/InactiveDot.js.map +1 -1
- package/lib/module/components/page-indicator/variants/DotIndicator/LoadingOrbit.js +9 -9
- package/lib/module/components/page-indicator/variants/DotIndicator/LoadingOrbit.js.map +1 -1
- package/lib/module/components/page-indicator/variants/DotIndicator/TravelingPill.js +2 -2
- package/lib/module/components/page-indicator/variants/DotIndicator/TravelingPill.js.map +1 -1
- package/lib/module/components/page-indicator/variants/DotIndicator/index.js +3 -3
- package/lib/module/components/page-indicator/variants/DotIndicator/index.js.map +1 -1
- package/lib/module/components/page-indicator/variants/DotIndicator/utils.js +1 -1
- package/lib/module/components/page-indicator/variants/DotIndicator/utils.js.map +1 -1
- package/lib/module/components/page-indicator/variants/PillIndicator/PillIndicatorDot.js +1 -1
- package/lib/module/components/page-indicator/variants/PillIndicator/PillIndicatorDot.js.map +1 -1
- package/lib/module/components/page-indicator/variants/PillIndicator/index.js +5 -5
- package/lib/module/components/page-indicator/variants/PillIndicator/index.js.map +1 -1
- package/lib/module/components/page-indicator/variants/PillIndicator/utils.js +3 -3
- package/lib/module/components/portal/Portal.js +1 -1
- package/lib/module/components/portal/PortalContext.js +1 -1
- package/lib/module/components/portal/PortalHost.js +1 -1
- package/lib/module/components/portal/PortalProvider.js +1 -1
- package/lib/module/components/portal/PortalProvider.js.map +1 -1
- package/lib/module/components/screen/Screen.js +8 -8
- package/lib/module/components/screen/Screen.js.map +1 -1
- package/lib/module/components/screen/ScreenContext.js +6 -6
- package/lib/module/components/screen/ScreenContext.js.map +1 -1
- package/lib/module/components/screen/ScreenFlatList.js +3 -3
- package/lib/module/components/screen/ScreenFlatList.js.map +1 -1
- package/lib/module/components/screen/ScreenList.js +5 -5
- package/lib/module/components/screen/ScreenList.js.map +1 -1
- package/lib/module/components/screen/ScreenScrollView.js +6 -6
- package/lib/module/components/screen/ScreenScrollView.js.map +1 -1
- package/lib/module/components/screen/parts/BottomSafeArea.js +1 -1
- package/lib/module/components/screen/parts/BottomSafeArea.js.map +1 -1
- package/lib/module/components/screen/parts/ScreenPlaceholder.js +3 -3
- package/lib/module/components/screen/parts/ScreenPlaceholder.js.map +1 -1
- package/lib/module/components/screen/utils.js +3 -3
- package/lib/module/components/screen/utils.js.map +1 -1
- package/lib/module/components/slot/Slot.js +2 -2
- package/lib/module/components/slot/Slot.js.map +1 -1
- package/lib/module/components/slot/utils.js +3 -3
- package/lib/module/components/slot/utils.js.map +1 -1
- package/lib/module/components/spinner/Spinner.js +10 -10
- package/lib/module/components/spinner/Spinner.js.map +1 -1
- package/lib/module/components/surface/Surface.js +14 -14
- package/lib/module/components/surface/Surface.js.map +1 -1
- package/lib/module/components/text/Text.js +13 -13
- package/lib/module/components/text/Text.js.map +1 -1
- package/lib/module/components/toast/Toast.js +46 -46
- package/lib/module/components/toast/Toast.js.map +1 -1
- package/lib/module/components/toast/ToastProvider.js +32 -32
- package/lib/module/components/toast/ToastProvider.js.map +1 -1
- package/lib/module/components/toast/parts/ToastAnimatedItem.js +10 -10
- package/lib/module/components/toast/parts/ToastAnimatedItem.js.map +1 -1
- package/lib/module/components/toast/utils/controller.js +2 -2
- package/lib/module/components/toast/utils/controller.js.map +1 -1
- package/lib/module/components/toolbar/Toolbar.js +25 -25
- package/lib/module/components/toolbar/Toolbar.js.map +1 -1
- package/lib/module/context/ThemeProvider.js +5 -5
- package/lib/module/context/ThemeProvider.js.map +1 -1
- package/lib/module/theme/breakpoints.js.map +1 -1
- package/lib/module/theme/defaults/icons.js +11 -11
- package/lib/module/theme/defaults/icons.js.map +1 -1
- package/lib/module/theme/defaults/image.js +7 -7
- package/lib/module/theme/defaults/image.js.map +1 -1
- package/lib/module/theme/registry.js +11 -11
- package/lib/module/theme/registry.js.map +1 -1
- package/lib/module/theme/runtime.js +3 -3
- package/lib/module/theme/runtime.js.map +1 -1
- package/lib/module/theme/theme.js +9 -9
- package/lib/module/theme/theme.js.map +1 -1
- package/lib/module/theme/tokens/dark.js +67 -67
- package/lib/module/theme/tokens/light.js +67 -67
- package/lib/module/theme/tokens/primitives.js +417 -417
- package/lib/module/utils/accent-utils.js +16 -16
- package/lib/module/utils/accent-utils.js.map +1 -1
- package/lib/module/utils/color-utils.js +3 -3
- package/lib/module/utils/deep-merge.js +1 -1
- package/lib/module/utils/resolve-theme-color.js +2 -2
- package/lib/module/utils/resolve-theme-color.js.map +1 -1
- package/lib/module/utils/typography.js +5 -5
- package/lib/module/utils/typography.js.map +1 -1
- package/lib/module/utils/unflatten.js +2 -2
- package/lib/typescript/src/components/avatar/Avatar.d.ts +1 -1
- package/lib/typescript/src/components/avatar/Avatar.d.ts.map +1 -1
- package/lib/typescript/src/components/avatar/index.d.ts +2 -2
- package/lib/typescript/src/components/avatar/types.d.ts +7 -7
- package/lib/typescript/src/components/avatar/types.d.ts.map +1 -1
- package/lib/typescript/src/components/box/Box.d.ts +2 -2
- package/lib/typescript/src/components/box/Box.d.ts.map +1 -1
- package/lib/typescript/src/components/box/index.d.ts +3 -3
- package/lib/typescript/src/components/box/utils.d.ts +7 -7
- package/lib/typescript/src/components/box/utils.d.ts.map +1 -1
- package/lib/typescript/src/components/button/Button.d.ts +15 -8
- package/lib/typescript/src/components/button/Button.d.ts.map +1 -1
- package/lib/typescript/src/components/button/index.d.ts +2 -2
- package/lib/typescript/src/components/chip/Chip.d.ts +5 -5
- package/lib/typescript/src/components/chip/Chip.d.ts.map +1 -1
- package/lib/typescript/src/components/chip/index.d.ts +3 -3
- package/lib/typescript/src/components/chip/types.d.ts +3 -3
- package/lib/typescript/src/components/chip/utils.d.ts +1 -1
- package/lib/typescript/src/components/empty-state/EmptyState.d.ts +5 -5
- package/lib/typescript/src/components/empty-state/EmptyState.d.ts.map +1 -1
- package/lib/typescript/src/components/empty-state/index.d.ts +3 -3
- package/lib/typescript/src/components/empty-state/types.d.ts +1 -1
- package/lib/typescript/src/components/header/Header.d.ts +2 -2
- package/lib/typescript/src/components/header/header-buttons.d.ts +3 -3
- package/lib/typescript/src/components/header/header-buttons.d.ts.map +1 -1
- package/lib/typescript/src/components/header/index.d.ts +6 -6
- package/lib/typescript/src/components/header/parts/HeaderGradientOverlay.d.ts.map +1 -1
- package/lib/typescript/src/components/header/variants/LargeTitleHeader/index.d.ts +1 -1
- package/lib/typescript/src/components/header/variants/LargeTitleHeader/index.d.ts.map +1 -1
- package/lib/typescript/src/components/header/variants/TitleHeader/index.d.ts +4 -4
- package/lib/typescript/src/components/header/variants/TitleHeader/index.d.ts.map +1 -1
- package/lib/typescript/src/components/icon/Icon.d.ts +3 -3
- package/lib/typescript/src/components/icon/Icon.d.ts.map +1 -1
- package/lib/typescript/src/components/icon/index.d.ts +2 -2
- package/lib/typescript/src/components/image/Image.d.ts +1 -1
- package/lib/typescript/src/components/image/Image.d.ts.map +1 -1
- package/lib/typescript/src/components/image/index.d.ts +2 -2
- package/lib/typescript/src/components/image/types.d.ts +1 -1
- package/lib/typescript/src/components/index.d.ts +17 -17
- package/lib/typescript/src/components/page-indicator/PageIndicator.d.ts +10 -10
- package/lib/typescript/src/components/page-indicator/PageIndicatorRoot.d.ts +2 -2
- package/lib/typescript/src/components/page-indicator/PageIndicatorRoot.d.ts.map +1 -1
- package/lib/typescript/src/components/page-indicator/hooks/use-page-indicator-colors.d.ts +1 -1
- package/lib/typescript/src/components/page-indicator/hooks/use-page-indicator-colors.d.ts.map +1 -1
- package/lib/typescript/src/components/page-indicator/hooks/use-page-indicator-core.d.ts +3 -3
- package/lib/typescript/src/components/page-indicator/hooks/use-page-indicator-core.d.ts.map +1 -1
- package/lib/typescript/src/components/page-indicator/hooks/use-page-indicator-progress.d.ts +2 -2
- package/lib/typescript/src/components/page-indicator/hooks/use-page-indicator-progress.d.ts.map +1 -1
- package/lib/typescript/src/components/page-indicator/index.d.ts +3 -3
- package/lib/typescript/src/components/page-indicator/utils.d.ts +2 -2
- package/lib/typescript/src/components/page-indicator/utils.d.ts.map +1 -1
- package/lib/typescript/src/components/page-indicator/variants/DotIndicator/InactiveDot.d.ts +1 -1
- package/lib/typescript/src/components/page-indicator/variants/DotIndicator/InactiveDot.d.ts.map +1 -1
- package/lib/typescript/src/components/page-indicator/variants/DotIndicator/LoadingOrbit.d.ts +2 -2
- package/lib/typescript/src/components/page-indicator/variants/DotIndicator/LoadingOrbit.d.ts.map +1 -1
- package/lib/typescript/src/components/page-indicator/variants/DotIndicator/TravelingPill.d.ts +2 -2
- package/lib/typescript/src/components/page-indicator/variants/DotIndicator/TravelingPill.d.ts.map +1 -1
- package/lib/typescript/src/components/page-indicator/variants/DotIndicator/index.d.ts +3 -3
- package/lib/typescript/src/components/page-indicator/variants/DotIndicator/index.d.ts.map +1 -1
- package/lib/typescript/src/components/page-indicator/variants/DotIndicator/utils.d.ts.map +1 -1
- package/lib/typescript/src/components/page-indicator/variants/PillIndicator/PillIndicatorDot.d.ts +2 -2
- package/lib/typescript/src/components/page-indicator/variants/PillIndicator/PillIndicatorDot.d.ts.map +1 -1
- package/lib/typescript/src/components/page-indicator/variants/PillIndicator/index.d.ts +3 -3
- package/lib/typescript/src/components/page-indicator/variants/PillIndicator/index.d.ts.map +1 -1
- package/lib/typescript/src/components/page-indicator/variants/PillIndicator/utils.d.ts +1 -1
- package/lib/typescript/src/components/portal/Portal.d.ts +3 -3
- package/lib/typescript/src/components/portal/PortalContext.d.ts +1 -1
- package/lib/typescript/src/components/portal/PortalHost.d.ts +2 -2
- package/lib/typescript/src/components/portal/PortalProvider.d.ts +1 -1
- package/lib/typescript/src/components/portal/PortalProvider.d.ts.map +1 -1
- package/lib/typescript/src/components/portal/index.d.ts +7 -7
- package/lib/typescript/src/components/screen/Screen.d.ts +10 -10
- package/lib/typescript/src/components/screen/Screen.d.ts.map +1 -1
- package/lib/typescript/src/components/screen/ScreenContext.d.ts +3 -3
- package/lib/typescript/src/components/screen/ScreenContext.d.ts.map +1 -1
- package/lib/typescript/src/components/screen/ScreenFlatList.d.ts +3 -3
- package/lib/typescript/src/components/screen/ScreenFlatList.d.ts.map +1 -1
- package/lib/typescript/src/components/screen/ScreenList.d.ts +5 -5
- package/lib/typescript/src/components/screen/ScreenList.d.ts.map +1 -1
- package/lib/typescript/src/components/screen/ScreenScrollView.d.ts +5 -5
- package/lib/typescript/src/components/screen/ScreenScrollView.d.ts.map +1 -1
- package/lib/typescript/src/components/screen/index.d.ts +11 -11
- package/lib/typescript/src/components/screen/parts/BottomSafeArea.d.ts.map +1 -1
- package/lib/typescript/src/components/screen/parts/ScreenPlaceholder.d.ts +3 -3
- package/lib/typescript/src/components/screen/parts/ScreenPlaceholder.d.ts.map +1 -1
- package/lib/typescript/src/components/screen/types.d.ts +2 -2
- package/lib/typescript/src/components/screen/utils.d.ts +2 -2
- package/lib/typescript/src/components/screen/utils.d.ts.map +1 -1
- package/lib/typescript/src/components/slot/Slot.d.ts +2 -2
- package/lib/typescript/src/components/slot/Slot.d.ts.map +1 -1
- package/lib/typescript/src/components/slot/index.d.ts +3 -3
- package/lib/typescript/src/components/slot/utils.d.ts +1 -1
- package/lib/typescript/src/components/slot/utils.d.ts.map +1 -1
- package/lib/typescript/src/components/spinner/Spinner.d.ts +2 -2
- package/lib/typescript/src/components/spinner/Spinner.d.ts.map +1 -1
- package/lib/typescript/src/components/spinner/index.d.ts +2 -2
- package/lib/typescript/src/components/surface/Surface.d.ts +4 -4
- package/lib/typescript/src/components/surface/Surface.d.ts.map +1 -1
- package/lib/typescript/src/components/surface/index.d.ts +2 -2
- package/lib/typescript/src/components/text/Text.d.ts +4 -4
- package/lib/typescript/src/components/text/Text.d.ts.map +1 -1
- package/lib/typescript/src/components/text/index.d.ts +2 -2
- package/lib/typescript/src/components/toast/Toast.d.ts +18 -18
- package/lib/typescript/src/components/toast/Toast.d.ts.map +1 -1
- package/lib/typescript/src/components/toast/ToastProvider.d.ts +1 -1
- package/lib/typescript/src/components/toast/ToastProvider.d.ts.map +1 -1
- package/lib/typescript/src/components/toast/index.d.ts +4 -4
- package/lib/typescript/src/components/toast/parts/ToastAnimatedItem.d.ts +3 -3
- package/lib/typescript/src/components/toast/parts/ToastAnimatedItem.d.ts.map +1 -1
- package/lib/typescript/src/components/toast/types.d.ts +10 -10
- package/lib/typescript/src/components/toast/types.d.ts.map +1 -1
- package/lib/typescript/src/components/toast/utils/controller.d.ts +2 -2
- package/lib/typescript/src/components/toast/utils/controller.d.ts.map +1 -1
- package/lib/typescript/src/components/toolbar/Toolbar.d.ts +5 -5
- package/lib/typescript/src/components/toolbar/Toolbar.d.ts.map +1 -1
- package/lib/typescript/src/components/toolbar/index.d.ts +2 -2
- package/lib/typescript/src/context/ThemeProvider.d.ts +3 -3
- package/lib/typescript/src/context/ThemeProvider.d.ts.map +1 -1
- package/lib/typescript/src/context/index.d.ts +2 -2
- package/lib/typescript/src/index.d.ts +3 -3
- package/lib/typescript/src/theme/breakpoints.d.ts +2 -2
- package/lib/typescript/src/theme/breakpoints.d.ts.map +1 -1
- package/lib/typescript/src/theme/defaults/icons.d.ts +1 -1
- package/lib/typescript/src/theme/defaults/icons.d.ts.map +1 -1
- package/lib/typescript/src/theme/defaults/image.d.ts +1 -1
- package/lib/typescript/src/theme/defaults/image.d.ts.map +1 -1
- package/lib/typescript/src/theme/index.d.ts +14 -14
- package/lib/typescript/src/theme/registry.d.ts +2 -2
- package/lib/typescript/src/theme/registry.d.ts.map +1 -1
- package/lib/typescript/src/theme/runtime.d.ts +1 -1
- package/lib/typescript/src/theme/runtime.d.ts.map +1 -1
- package/lib/typescript/src/theme/screen-margin.d.ts +2 -2
- package/lib/typescript/src/theme/theme.d.ts +2 -2
- package/lib/typescript/src/theme/theme.d.ts.map +1 -1
- package/lib/typescript/src/theme/tokens/dark.d.ts +67 -67
- package/lib/typescript/src/theme/tokens/light.d.ts +67 -67
- package/lib/typescript/src/theme/tokens/primitives.d.ts +417 -417
- package/lib/typescript/src/theme/types.d.ts +84 -84
- package/lib/typescript/src/theme/types.d.ts.map +1 -1
- package/lib/typescript/src/utils/accent-utils.d.ts +1 -1
- package/lib/typescript/src/utils/accent-utils.d.ts.map +1 -1
- package/lib/typescript/src/utils/resolve-theme-color.d.ts +1 -1
- package/lib/typescript/src/utils/resolve-theme-color.d.ts.map +1 -1
- package/lib/typescript/src/utils/typography.d.ts +2 -2
- package/lib/typescript/src/utils/typography.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/components/avatar/Avatar.tsx +66 -71
- package/src/components/avatar/index.ts +2 -2
- package/src/components/avatar/types.ts +7 -12
- package/src/components/box/Box.tsx +7 -18
- package/src/components/box/index.ts +3 -3
- package/src/components/box/utils.ts +59 -81
- package/src/components/button/Button.tsx +119 -144
- package/src/components/button/index.ts +2 -2
- package/src/components/chip/Chip.tsx +107 -143
- package/src/components/chip/index.ts +3 -3
- package/src/components/chip/types.ts +7 -7
- package/src/components/chip/utils.ts +5 -5
- package/src/components/empty-state/EmptyState.tsx +44 -60
- package/src/components/empty-state/index.ts +3 -3
- package/src/components/empty-state/types.ts +1 -1
- package/src/components/header/Header.ts +2 -2
- package/src/components/header/header-buttons.tsx +10 -18
- package/src/components/header/index.ts +6 -6
- package/src/components/header/parts/HeaderGradientOverlay.tsx +3 -7
- package/src/components/header/variants/LargeTitleHeader/index.tsx +75 -139
- package/src/components/header/variants/TitleHeader/index.tsx +40 -62
- package/src/components/icon/Icon.tsx +31 -39
- package/src/components/icon/index.ts +2 -2
- package/src/components/image/Image.tsx +12 -10
- package/src/components/image/index.ts +2 -2
- package/src/components/image/types.ts +1 -1
- package/src/components/index.ts +17 -17
- package/src/components/page-indicator/PageIndicator.tsx +14 -14
- package/src/components/page-indicator/PageIndicatorRoot.tsx +4 -12
- package/src/components/page-indicator/hooks/use-page-indicator-colors.ts +17 -35
- package/src/components/page-indicator/hooks/use-page-indicator-core.ts +6 -8
- package/src/components/page-indicator/hooks/use-page-indicator-progress.ts +10 -30
- package/src/components/page-indicator/index.ts +3 -3
- package/src/components/page-indicator/utils.ts +20 -48
- package/src/components/page-indicator/variants/DotIndicator/InactiveDot.tsx +5 -16
- package/src/components/page-indicator/variants/DotIndicator/LoadingOrbit.tsx +21 -63
- package/src/components/page-indicator/variants/DotIndicator/TravelingPill.tsx +6 -16
- package/src/components/page-indicator/variants/DotIndicator/index.tsx +20 -38
- package/src/components/page-indicator/variants/DotIndicator/utils.ts +2 -6
- package/src/components/page-indicator/variants/PillIndicator/PillIndicatorDot.tsx +12 -50
- package/src/components/page-indicator/variants/PillIndicator/index.tsx +19 -41
- package/src/components/page-indicator/variants/PillIndicator/utils.ts +4 -4
- package/src/components/portal/Portal.tsx +4 -4
- package/src/components/portal/PortalContext.tsx +1 -1
- package/src/components/portal/PortalHost.tsx +4 -4
- package/src/components/portal/PortalProvider.tsx +24 -35
- package/src/components/portal/index.ts +7 -7
- package/src/components/screen/Screen.tsx +45 -52
- package/src/components/screen/ScreenContext.tsx +8 -17
- package/src/components/screen/ScreenFlatList.tsx +17 -36
- package/src/components/screen/ScreenList.tsx +31 -63
- package/src/components/screen/ScreenScrollView.tsx +17 -30
- package/src/components/screen/index.ts +11 -11
- package/src/components/screen/parts/BottomSafeArea.tsx +5 -6
- package/src/components/screen/parts/ScreenPlaceholder.tsx +9 -14
- package/src/components/screen/types.ts +2 -2
- package/src/components/screen/utils.ts +6 -19
- package/src/components/slot/Slot.tsx +5 -20
- package/src/components/slot/index.ts +3 -3
- package/src/components/slot/utils.ts +5 -8
- package/src/components/spinner/Spinner.tsx +19 -52
- package/src/components/spinner/index.ts +2 -2
- package/src/components/surface/Surface.tsx +34 -43
- package/src/components/surface/index.ts +2 -2
- package/src/components/text/Text.tsx +75 -85
- package/src/components/text/index.ts +2 -2
- package/src/components/toast/Toast.tsx +195 -251
- package/src/components/toast/ToastProvider.tsx +61 -136
- package/src/components/toast/index.ts +4 -4
- package/src/components/toast/parts/ToastAnimatedItem.tsx +14 -22
- package/src/components/toast/types.ts +11 -14
- package/src/components/toast/utils/controller.ts +4 -6
- package/src/components/toolbar/Toolbar.tsx +42 -61
- package/src/components/toolbar/index.ts +2 -2
- package/src/context/ThemeProvider.tsx +13 -28
- package/src/context/index.ts +2 -2
- package/src/index.tsx +3 -3
- package/src/theme/breakpoints.ts +3 -5
- package/src/theme/defaults/icons.tsx +15 -30
- package/src/theme/defaults/image.tsx +9 -14
- package/src/theme/index.ts +14 -14
- package/src/theme/registry.ts +30 -49
- package/src/theme/runtime.ts +6 -7
- package/src/theme/screen-margin.ts +3 -3
- package/src/theme/theme.ts +39 -60
- package/src/theme/tokens/dark.ts +67 -67
- package/src/theme/tokens/light.ts +67 -67
- package/src/theme/tokens/primitives.ts +417 -417
- package/src/theme/types.ts +123 -135
- package/src/utils/accent-utils.ts +21 -30
- package/src/utils/color-utils.ts +3 -3
- package/src/utils/deep-merge.ts +1 -1
- package/src/utils/resolve-theme-color.ts +8 -11
- package/src/utils/typography.ts +7 -10
- package/src/utils/unflatten.ts +2 -2
|
@@ -9,30 +9,31 @@ import {
|
|
|
9
9
|
type PropsWithChildren,
|
|
10
10
|
type ReactNode,
|
|
11
11
|
useMemo,
|
|
12
|
-
} from
|
|
13
|
-
import { View } from
|
|
14
|
-
import type { ViewProps } from 'react-native-svg/lib/typescript/fabric/utils';
|
|
15
|
-
import { StyleSheet, useUnistyles } from 'react-native-unistyles';
|
|
16
|
-
import type { ColorToken } from '#theme/types';
|
|
17
|
-
import { resolveThemeColor } from '#utils/resolve-theme-color';
|
|
18
|
-
import { PortalProvider } from '../portal';
|
|
19
|
-
import { ScreenScrollProvider } from './ScreenContext';
|
|
20
|
-
import { ScreenFlatList } from './ScreenFlatList';
|
|
21
|
-
import { ScreenList } from './ScreenList';
|
|
22
|
-
import { ScreenScrollView } from './ScreenScrollView';
|
|
23
|
-
import type { ScreenMargins } from './types';
|
|
12
|
+
} from "react";
|
|
13
|
+
import { View } from "react-native";
|
|
24
14
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
15
|
+
import type { ViewProps } from "react-native-svg/lib/typescript/fabric/utils";
|
|
16
|
+
import { StyleSheet, useUnistyles } from "react-native-unistyles";
|
|
17
|
+
|
|
18
|
+
import type { ColorToken } from "#theme/types";
|
|
19
|
+
import { resolveThemeColor } from "#utils/resolve-theme-color";
|
|
20
|
+
import { PortalProvider } from "../portal";
|
|
21
|
+
import { ScreenScrollProvider } from "./ScreenContext";
|
|
22
|
+
import { ScreenFlatList } from "./ScreenFlatList";
|
|
23
|
+
import { ScreenList } from "./ScreenList";
|
|
24
|
+
import { ScreenScrollView } from "./ScreenScrollView";
|
|
25
|
+
import type { ScreenMargins } from "./types";
|
|
26
|
+
|
|
27
|
+
export type ScreenHeaderProps<T extends ElementType = typeof Fragment> = PropsWithChildren<
|
|
28
|
+
{
|
|
29
|
+
/**
|
|
30
|
+
* Component to render the header as. Defaults to `Fragment` (no
|
|
31
|
+
* wrapper). Use this to cast the header to a different container,
|
|
32
|
+
* e.g. `as={View}` — any extra props are forwarded to it.
|
|
33
|
+
*/
|
|
34
|
+
as?: T;
|
|
35
|
+
} & Omit<ComponentPropsWithoutRef<T>, "children">
|
|
36
|
+
>;
|
|
36
37
|
|
|
37
38
|
/**
|
|
38
39
|
* Marker slot identifying the screen's header — its purpose is to let
|
|
@@ -54,7 +55,7 @@ function ScreenHeader<T extends ElementType = typeof Fragment>({
|
|
|
54
55
|
const Component = as ?? Fragment;
|
|
55
56
|
return <Component {...rest}>{children}</Component>;
|
|
56
57
|
}
|
|
57
|
-
ScreenHeader.displayName =
|
|
58
|
+
ScreenHeader.displayName = "Screen.Header";
|
|
58
59
|
|
|
59
60
|
/** True if `children` directly contains a `Screen.Header`. */
|
|
60
61
|
function hasScreenHeader(children: ReactNode): boolean {
|
|
@@ -63,8 +64,8 @@ function hasScreenHeader(children: ReactNode): boolean {
|
|
|
63
64
|
if (found) return;
|
|
64
65
|
if (
|
|
65
66
|
isValidElement(child) &&
|
|
66
|
-
typeof child.type !==
|
|
67
|
-
(child.type as { displayName?: string }).displayName ===
|
|
67
|
+
typeof child.type !== "string" &&
|
|
68
|
+
(child.type as { displayName?: string }).displayName === "Screen.Header"
|
|
68
69
|
)
|
|
69
70
|
found = true;
|
|
70
71
|
});
|
|
@@ -74,7 +75,7 @@ function hasScreenHeader(children: ReactNode): boolean {
|
|
|
74
75
|
export interface ScreenProps extends ViewProps {
|
|
75
76
|
children: ReactNode;
|
|
76
77
|
/** Background color token. Defaults to the `background` token. */
|
|
77
|
-
|
|
78
|
+
background?: ColorToken;
|
|
78
79
|
/** Hosted inside a tab navigator? Exposed via `useScreen()`. Default false. */
|
|
79
80
|
inTabView?: boolean;
|
|
80
81
|
/**
|
|
@@ -89,9 +90,7 @@ export interface ScreenProps extends ViewProps {
|
|
|
89
90
|
hasMargins?: boolean;
|
|
90
91
|
}
|
|
91
92
|
|
|
92
|
-
type ScreenComponent = ReturnType<
|
|
93
|
-
typeof forwardRef<ComponentRef<typeof View>, ScreenProps>
|
|
94
|
-
> & {
|
|
93
|
+
type ScreenComponent = ReturnType<typeof forwardRef<ComponentRef<typeof View>, ScreenProps>> & {
|
|
95
94
|
Header: typeof ScreenHeader;
|
|
96
95
|
ScrollView: typeof ScreenScrollView;
|
|
97
96
|
/** @deprecated Use {@link ScreenList} (`Screen.List`) instead. */
|
|
@@ -112,29 +111,23 @@ type ScreenComponent = ReturnType<
|
|
|
112
111
|
* </Screen>
|
|
113
112
|
* ```
|
|
114
113
|
*/
|
|
115
|
-
const ScreenBase = forwardRef<ComponentRef<typeof View>, ScreenProps>(
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
)
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
const resolvedBg = resolveThemeColor(bg, theme) ?? theme.color.background;
|
|
114
|
+
const ScreenBase = forwardRef<ComponentRef<typeof View>, ScreenProps>(function Screen(
|
|
115
|
+
{ children, background = "background", margins, hasMargins, style, ...rest },
|
|
116
|
+
_ref
|
|
117
|
+
) {
|
|
118
|
+
const hasHeader = useMemo(() => hasScreenHeader(children), [children]);
|
|
119
|
+
const resolvedMargins = margins ?? (hasMargins === false ? "none" : "all");
|
|
120
|
+
const { theme } = useUnistyles();
|
|
121
|
+
const resolvedBackground = resolveThemeColor(background, theme) ?? theme.color.background;
|
|
124
122
|
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
</ScreenScrollProvider>
|
|
134
|
-
</View>
|
|
135
|
-
);
|
|
136
|
-
}
|
|
137
|
-
) as ScreenComponent;
|
|
123
|
+
return (
|
|
124
|
+
<View style={[styles.container, style]} {...rest}>
|
|
125
|
+
<ScreenScrollProvider background={resolvedBackground} margins={resolvedMargins} hasHeader={hasHeader}>
|
|
126
|
+
<PortalProvider>{children}</PortalProvider>
|
|
127
|
+
</ScreenScrollProvider>
|
|
128
|
+
</View>
|
|
129
|
+
);
|
|
130
|
+
}) as ScreenComponent;
|
|
138
131
|
|
|
139
132
|
ScreenBase.Header = ScreenHeader;
|
|
140
133
|
ScreenBase.ScrollView = ScreenScrollView;
|
|
@@ -1,11 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
createContext,
|
|
3
|
-
type ReactNode,
|
|
4
|
-
useCallback,
|
|
5
|
-
useContext,
|
|
6
|
-
useMemo,
|
|
7
|
-
useState,
|
|
8
|
-
} from 'react';
|
|
1
|
+
import { createContext, type ReactNode, useCallback, useContext, useMemo, useState } from "react";
|
|
9
2
|
|
|
10
3
|
import Animated, {
|
|
11
4
|
type AnimatedRef,
|
|
@@ -14,14 +7,14 @@ import Animated, {
|
|
|
14
7
|
useAnimatedRef,
|
|
15
8
|
useAnimatedScrollHandler,
|
|
16
9
|
useSharedValue,
|
|
17
|
-
} from
|
|
10
|
+
} from "react-native-reanimated";
|
|
18
11
|
|
|
19
|
-
import type { ScreenMargins } from
|
|
12
|
+
import type { ScreenMargins } from "./types";
|
|
20
13
|
|
|
21
14
|
export type ScreenScrollRef = AnimatedRef<Animated.ScrollView>;
|
|
22
15
|
|
|
23
16
|
/** `PortalHost` name shared by `Screen.ScrollView` / `Screen.FlatList` and header variants that portal content into them. */
|
|
24
|
-
export const SCREEN_HEADER_PORTAL_HOST =
|
|
17
|
+
export const SCREEN_HEADER_PORTAL_HOST = "screen-header";
|
|
25
18
|
|
|
26
19
|
export interface ScreenContextValue {
|
|
27
20
|
/**
|
|
@@ -77,9 +70,9 @@ export interface ScreenScrollProviderProps {
|
|
|
77
70
|
* scroll containers bind the ref via {@link useScreen}.
|
|
78
71
|
*/
|
|
79
72
|
export function ScreenScrollProvider({
|
|
80
|
-
background =
|
|
73
|
+
background = "transparent",
|
|
81
74
|
children,
|
|
82
|
-
margins =
|
|
75
|
+
margins = "all",
|
|
83
76
|
hasHeader = false,
|
|
84
77
|
}: ScreenScrollProviderProps) {
|
|
85
78
|
const scrollY = useSharedValue(0);
|
|
@@ -127,9 +120,7 @@ export function ScreenScrollProvider({
|
|
|
127
120
|
]
|
|
128
121
|
);
|
|
129
122
|
|
|
130
|
-
return
|
|
131
|
-
<ScreenContext.Provider value={value}>{children}</ScreenContext.Provider>
|
|
132
|
-
);
|
|
123
|
+
return <ScreenContext.Provider value={value}>{children}</ScreenContext.Provider>;
|
|
133
124
|
}
|
|
134
125
|
|
|
135
126
|
/**
|
|
@@ -145,7 +136,7 @@ export function ScreenScrollProvider({
|
|
|
145
136
|
export function useScreen(): ScreenContextValue {
|
|
146
137
|
const context = useContext(ScreenContext);
|
|
147
138
|
if (!context) {
|
|
148
|
-
throw new Error(
|
|
139
|
+
throw new Error("useScreen must be used within a Screen component");
|
|
149
140
|
}
|
|
150
141
|
return context;
|
|
151
142
|
}
|
|
@@ -1,24 +1,19 @@
|
|
|
1
|
-
import {
|
|
2
|
-
type FlatListProps,
|
|
3
|
-
type NativeScrollEvent,
|
|
4
|
-
type NativeSyntheticEvent,
|
|
5
|
-
View,
|
|
6
|
-
} from 'react-native';
|
|
1
|
+
import { type FlatListProps, type NativeScrollEvent, type NativeSyntheticEvent, View } from "react-native";
|
|
7
2
|
|
|
8
3
|
import Animated, {
|
|
9
4
|
type AnimatedRef,
|
|
10
5
|
useAnimatedScrollHandler,
|
|
11
6
|
useComposedEventHandler,
|
|
12
|
-
} from
|
|
13
|
-
import { StyleSheet } from
|
|
7
|
+
} from "react-native-reanimated";
|
|
8
|
+
import { StyleSheet } from "react-native-unistyles";
|
|
14
9
|
|
|
15
|
-
import { resolveScreenMargin } from
|
|
16
|
-
import { PortalHost } from
|
|
17
|
-
import { BottomSafeArea } from
|
|
18
|
-
import { renderScreenPlaceholder } from
|
|
19
|
-
import { SCREEN_HEADER_PORTAL_HOST, useScreen } from
|
|
20
|
-
import type { ScreenMargins, ScreenScrollableProps } from
|
|
21
|
-
import { hasXMargin, hasYMargin, renderListHeader } from
|
|
10
|
+
import { resolveScreenMargin } from "#theme/screen-margin";
|
|
11
|
+
import { PortalHost } from "../portal";
|
|
12
|
+
import { BottomSafeArea } from "./parts/BottomSafeArea";
|
|
13
|
+
import { renderScreenPlaceholder } from "./parts/ScreenPlaceholder";
|
|
14
|
+
import { SCREEN_HEADER_PORTAL_HOST, useScreen } from "./ScreenContext";
|
|
15
|
+
import type { ScreenMargins, ScreenScrollableProps } from "./types";
|
|
16
|
+
import { hasXMargin, hasYMargin, renderListHeader } from "./utils";
|
|
22
17
|
|
|
23
18
|
/**
|
|
24
19
|
* @deprecated Use {@link ScreenListProps} (`Screen.List`) instead —
|
|
@@ -27,7 +22,7 @@ import { hasXMargin, hasYMargin, renderListHeader } from './utils';
|
|
|
27
22
|
* any other FlatList-shaped list (e.g. `FlashList`) via its `as` prop.
|
|
28
23
|
*/
|
|
29
24
|
export interface ScreenFlatListProps<T>
|
|
30
|
-
extends Omit<FlatListProps<T>,
|
|
25
|
+
extends Omit<FlatListProps<T>, "CellRendererComponent" | "horizontal">,
|
|
31
26
|
ScreenScrollableProps {
|
|
32
27
|
/**
|
|
33
28
|
* Extra bottom padding on the list content — clearance for a tab bar or home
|
|
@@ -105,16 +100,12 @@ export function ScreenFlatList<T>({
|
|
|
105
100
|
|
|
106
101
|
const jsScrollHandler = useAnimatedScrollHandler(
|
|
107
102
|
(event) => {
|
|
108
|
-
if (onScroll)
|
|
109
|
-
onScroll(event as unknown as NativeSyntheticEvent<NativeScrollEvent>);
|
|
103
|
+
if (onScroll) onScroll(event as unknown as NativeSyntheticEvent<NativeScrollEvent>);
|
|
110
104
|
},
|
|
111
105
|
[onScroll]
|
|
112
106
|
);
|
|
113
107
|
|
|
114
|
-
const composedHandler = useComposedEventHandler([
|
|
115
|
-
scrollHandler,
|
|
116
|
-
jsScrollHandler,
|
|
117
|
-
]);
|
|
108
|
+
const composedHandler = useComposedEventHandler([scrollHandler, jsScrollHandler]);
|
|
118
109
|
|
|
119
110
|
// A caller naming its own `bottomInset` has taken the bottom over entirely,
|
|
120
111
|
// and a horizontal list has no bottom edge to clear.
|
|
@@ -147,11 +138,8 @@ export function ScreenFlatList<T>({
|
|
|
147
138
|
data={loading ? [] : data}
|
|
148
139
|
style={[{ backgroundColor: background }, style]}
|
|
149
140
|
horizontal={horizontal}
|
|
150
|
-
contentInsetAdjustmentBehavior={hasHeader ?
|
|
151
|
-
contentContainerStyle={[
|
|
152
|
-
styles.content(resolvedMargins, hasHeader, bottomInset),
|
|
153
|
-
contentContainerStyle,
|
|
154
|
-
]}
|
|
141
|
+
contentInsetAdjustmentBehavior={hasHeader ? "never" : undefined}
|
|
142
|
+
contentContainerStyle={[styles.content(resolvedMargins, hasHeader, bottomInset), contentContainerStyle]}
|
|
155
143
|
ListHeaderComponent={headerComponent}
|
|
156
144
|
ListFooterComponent={footerComponent}
|
|
157
145
|
ListEmptyComponent={placeholder ?? ListEmptyComponent}
|
|
@@ -174,15 +162,8 @@ const styles = StyleSheet.create((theme, runtime) => ({
|
|
|
174
162
|
scrollContent: {
|
|
175
163
|
flexGrow: 1,
|
|
176
164
|
},
|
|
177
|
-
content: (
|
|
178
|
-
|
|
179
|
-
hasHeader: boolean,
|
|
180
|
-
bottomInset: number | undefined
|
|
181
|
-
) => {
|
|
182
|
-
const { x: marginX, y: marginY } = resolveScreenMargin(
|
|
183
|
-
theme,
|
|
184
|
-
runtime.breakpoint
|
|
185
|
-
);
|
|
165
|
+
content: (margins: ScreenMargins, hasHeader: boolean, bottomInset: number | undefined) => {
|
|
166
|
+
const { x: marginX, y: marginY } = resolveScreenMargin(theme, runtime.breakpoint);
|
|
186
167
|
return {
|
|
187
168
|
flexGrow: 1,
|
|
188
169
|
// The header is absolutely positioned, so the list reserves its full
|
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
type ElementType,
|
|
5
5
|
type ReactElement,
|
|
6
6
|
useMemo,
|
|
7
|
-
} from
|
|
7
|
+
} from "react";
|
|
8
8
|
import {
|
|
9
9
|
FlatList,
|
|
10
10
|
type NativeScrollEvent,
|
|
@@ -12,48 +12,40 @@ import {
|
|
|
12
12
|
type StyleProp,
|
|
13
13
|
View,
|
|
14
14
|
type ViewStyle,
|
|
15
|
-
} from
|
|
15
|
+
} from "react-native";
|
|
16
16
|
|
|
17
17
|
import Animated, {
|
|
18
18
|
type AnimatedRef,
|
|
19
19
|
useAnimatedScrollHandler,
|
|
20
20
|
useComposedEventHandler,
|
|
21
|
-
} from
|
|
22
|
-
import { StyleSheet } from
|
|
21
|
+
} from "react-native-reanimated";
|
|
22
|
+
import { StyleSheet } from "react-native-unistyles";
|
|
23
23
|
|
|
24
|
-
import { resolveScreenMargin } from
|
|
25
|
-
import { PortalHost } from
|
|
26
|
-
import { BottomSafeArea } from
|
|
27
|
-
import { renderScreenPlaceholder } from
|
|
28
|
-
import { SCREEN_HEADER_PORTAL_HOST, useScreen } from
|
|
29
|
-
import type { ScreenMargins, ScreenScrollableProps } from
|
|
30
|
-
import {
|
|
31
|
-
hasXMargin,
|
|
32
|
-
hasYMargin,
|
|
33
|
-
type ListHeaderComponent,
|
|
34
|
-
renderListHeader,
|
|
35
|
-
} from './utils';
|
|
24
|
+
import { resolveScreenMargin } from "#theme/screen-margin";
|
|
25
|
+
import { PortalHost } from "../portal";
|
|
26
|
+
import { BottomSafeArea } from "./parts/BottomSafeArea";
|
|
27
|
+
import { renderScreenPlaceholder } from "./parts/ScreenPlaceholder";
|
|
28
|
+
import { SCREEN_HEADER_PORTAL_HOST, useScreen } from "./ScreenContext";
|
|
29
|
+
import type { ScreenMargins, ScreenScrollableProps } from "./types";
|
|
30
|
+
import { hasXMargin, hasYMargin, type ListHeaderComponent, renderListHeader } from "./utils";
|
|
36
31
|
|
|
37
32
|
export interface ScreenListRenderItemInfo<T> {
|
|
38
33
|
item: T;
|
|
39
34
|
index: number;
|
|
40
35
|
}
|
|
41
36
|
|
|
42
|
-
export type ScreenListProps<
|
|
43
|
-
T = unknown,
|
|
44
|
-
As extends ElementType = typeof FlatList,
|
|
45
|
-
> = ScreenScrollableProps &
|
|
37
|
+
export type ScreenListProps<T = unknown, As extends ElementType = typeof FlatList> = ScreenScrollableProps &
|
|
46
38
|
Omit<
|
|
47
39
|
ComponentPropsWithoutRef<As>,
|
|
48
|
-
|
|
|
49
|
-
|
|
|
50
|
-
|
|
|
51
|
-
|
|
|
52
|
-
|
|
|
53
|
-
|
|
|
54
|
-
|
|
|
55
|
-
|
|
|
56
|
-
|
|
|
40
|
+
| "data"
|
|
41
|
+
| "renderItem"
|
|
42
|
+
| "keyExtractor"
|
|
43
|
+
| "style"
|
|
44
|
+
| "contentContainerStyle"
|
|
45
|
+
| "onScroll"
|
|
46
|
+
| "ListHeaderComponent"
|
|
47
|
+
| "ListFooterComponent"
|
|
48
|
+
| "ListEmptyComponent"
|
|
57
49
|
| keyof ScreenScrollableProps
|
|
58
50
|
> & {
|
|
59
51
|
/**
|
|
@@ -108,10 +100,7 @@ export type ScreenListProps<
|
|
|
108
100
|
* />
|
|
109
101
|
* ```
|
|
110
102
|
*/
|
|
111
|
-
export function ScreenList<
|
|
112
|
-
T = unknown,
|
|
113
|
-
As extends ElementType = typeof FlatList,
|
|
114
|
-
>({
|
|
103
|
+
export function ScreenList<T = unknown, As extends ElementType = typeof FlatList>({
|
|
115
104
|
as,
|
|
116
105
|
data,
|
|
117
106
|
renderItem,
|
|
@@ -136,10 +125,7 @@ export function ScreenList<
|
|
|
136
125
|
// not on every render — `as` is arbitrary here (not a fixed module-scope
|
|
137
126
|
// reference like `Screen.FlatList` uses), so it's memoized on the resolved
|
|
138
127
|
// component instead of hoisted to module scope.
|
|
139
|
-
const AnimatedComponent = useMemo(
|
|
140
|
-
() => Animated.createAnimatedComponent(Component),
|
|
141
|
-
[Component]
|
|
142
|
-
);
|
|
128
|
+
const AnimatedComponent = useMemo(() => Animated.createAnimatedComponent(Component), [Component]);
|
|
143
129
|
|
|
144
130
|
const {
|
|
145
131
|
background,
|
|
@@ -164,16 +150,12 @@ export function ScreenList<
|
|
|
164
150
|
|
|
165
151
|
const jsScrollHandler = useAnimatedScrollHandler(
|
|
166
152
|
(event) => {
|
|
167
|
-
if (onScroll)
|
|
168
|
-
onScroll(event as unknown as NativeSyntheticEvent<NativeScrollEvent>);
|
|
153
|
+
if (onScroll) onScroll(event as unknown as NativeSyntheticEvent<NativeScrollEvent>);
|
|
169
154
|
},
|
|
170
155
|
[onScroll]
|
|
171
156
|
);
|
|
172
157
|
|
|
173
|
-
const composedHandler = useComposedEventHandler([
|
|
174
|
-
scrollHandler,
|
|
175
|
-
jsScrollHandler,
|
|
176
|
-
]);
|
|
158
|
+
const composedHandler = useComposedEventHandler([scrollHandler, jsScrollHandler]);
|
|
177
159
|
|
|
178
160
|
// A caller naming its own `bottomInset` has taken the bottom over entirely,
|
|
179
161
|
// and a horizontal list has no bottom edge to clear.
|
|
@@ -202,20 +184,13 @@ export function ScreenList<
|
|
|
202
184
|
|
|
203
185
|
return (
|
|
204
186
|
<AnimatedComponent
|
|
205
|
-
ref={
|
|
206
|
-
isDefaultFlatList
|
|
207
|
-
? (scrollRef as unknown as AnimatedRef<never>)
|
|
208
|
-
: undefined
|
|
209
|
-
}
|
|
187
|
+
ref={isDefaultFlatList ? (scrollRef as unknown as AnimatedRef<never>) : undefined}
|
|
210
188
|
data={loading ? [] : data}
|
|
211
189
|
renderItem={renderItem}
|
|
212
190
|
style={[{ backgroundColor: background }, style]}
|
|
213
191
|
horizontal={horizontal}
|
|
214
|
-
contentInsetAdjustmentBehavior={hasHeader ?
|
|
215
|
-
contentContainerStyle={[
|
|
216
|
-
styles.content(resolvedMargins, hasHeader, bottomInset),
|
|
217
|
-
contentContainerStyle,
|
|
218
|
-
]}
|
|
192
|
+
contentInsetAdjustmentBehavior={hasHeader ? "never" : undefined}
|
|
193
|
+
contentContainerStyle={[styles.content(resolvedMargins, hasHeader, bottomInset), contentContainerStyle]}
|
|
219
194
|
ListHeaderComponent={headerComponent}
|
|
220
195
|
ListFooterComponent={footerComponent}
|
|
221
196
|
ListEmptyComponent={placeholder ?? ListEmptyComponent}
|
|
@@ -227,7 +202,7 @@ export function ScreenList<
|
|
|
227
202
|
/>
|
|
228
203
|
);
|
|
229
204
|
}
|
|
230
|
-
ScreenList.displayName =
|
|
205
|
+
ScreenList.displayName = "Screen.List";
|
|
231
206
|
|
|
232
207
|
// `resolveScreenMargin` is called *inside* each dynamic function below, not
|
|
233
208
|
// hoisted to the factory's top level — the Babel plugin only attributes a
|
|
@@ -236,15 +211,8 @@ ScreenList.displayName = 'Screen.List';
|
|
|
236
211
|
// it would silently drop the dependency, so the margin would freeze at
|
|
237
212
|
// whatever breakpoint was active on mount and never update on rotation.
|
|
238
213
|
const styles = StyleSheet.create((theme, runtime) => ({
|
|
239
|
-
content: (
|
|
240
|
-
|
|
241
|
-
hasHeader: boolean,
|
|
242
|
-
bottomInset: number | undefined
|
|
243
|
-
) => {
|
|
244
|
-
const { x: marginX, y: marginY } = resolveScreenMargin(
|
|
245
|
-
theme,
|
|
246
|
-
runtime.breakpoint
|
|
247
|
-
);
|
|
214
|
+
content: (margins: ScreenMargins, hasHeader: boolean, bottomInset: number | undefined) => {
|
|
215
|
+
const { x: marginX, y: marginY } = resolveScreenMargin(theme, runtime.breakpoint);
|
|
248
216
|
return {
|
|
249
217
|
flexGrow: 1,
|
|
250
218
|
// The header is absolutely positioned, so the list reserves its full
|
|
@@ -1,30 +1,23 @@
|
|
|
1
|
-
import { Children, type ReactNode } from
|
|
2
|
-
import {
|
|
3
|
-
type NativeScrollEvent,
|
|
4
|
-
type NativeSyntheticEvent,
|
|
5
|
-
type ScrollViewProps,
|
|
6
|
-
View,
|
|
7
|
-
} from 'react-native';
|
|
1
|
+
import { Children, type ReactNode } from "react";
|
|
2
|
+
import { type NativeScrollEvent, type NativeSyntheticEvent, type ScrollViewProps, View } from "react-native";
|
|
8
3
|
|
|
9
4
|
import Animated, {
|
|
10
5
|
type ScrollHandlerProcessed,
|
|
11
6
|
useAnimatedScrollHandler,
|
|
12
7
|
useComposedEventHandler,
|
|
13
|
-
} from
|
|
14
|
-
import { StyleSheet } from
|
|
15
|
-
import { scheduleOnRN } from
|
|
8
|
+
} from "react-native-reanimated";
|
|
9
|
+
import { StyleSheet } from "react-native-unistyles";
|
|
10
|
+
import { scheduleOnRN } from "react-native-worklets";
|
|
16
11
|
|
|
17
|
-
import { resolveScreenMargin } from
|
|
18
|
-
import { PortalHost } from
|
|
19
|
-
import { BottomSafeArea } from
|
|
20
|
-
import { renderScreenPlaceholder } from
|
|
21
|
-
import { SCREEN_HEADER_PORTAL_HOST, useScreen } from
|
|
22
|
-
import type { ScreenMargins, ScreenScrollableProps } from
|
|
23
|
-
import { hasXMargin, hasYMargin } from
|
|
12
|
+
import { resolveScreenMargin } from "#theme/screen-margin";
|
|
13
|
+
import { PortalHost } from "../portal";
|
|
14
|
+
import { BottomSafeArea } from "./parts/BottomSafeArea";
|
|
15
|
+
import { renderScreenPlaceholder } from "./parts/ScreenPlaceholder";
|
|
16
|
+
import { SCREEN_HEADER_PORTAL_HOST, useScreen } from "./ScreenContext";
|
|
17
|
+
import type { ScreenMargins, ScreenScrollableProps } from "./types";
|
|
18
|
+
import { hasXMargin, hasYMargin } from "./utils";
|
|
24
19
|
|
|
25
|
-
export interface ScreenScrollViewProps
|
|
26
|
-
extends Omit<ScrollViewProps, 'horizontal'>,
|
|
27
|
-
ScreenScrollableProps {
|
|
20
|
+
export interface ScreenScrollViewProps extends Omit<ScrollViewProps, "horizontal">, ScreenScrollableProps {
|
|
28
21
|
children?: ReactNode;
|
|
29
22
|
/**
|
|
30
23
|
* Reanimated scroll handler for custom scroll-driven animation, composed
|
|
@@ -144,7 +137,7 @@ export function ScreenScrollView({
|
|
|
144
137
|
ref={scrollRef}
|
|
145
138
|
style={[{ backgroundColor: background }, style]}
|
|
146
139
|
horizontal={horizontal}
|
|
147
|
-
contentInsetAdjustmentBehavior={hasHeader ?
|
|
140
|
+
contentInsetAdjustmentBehavior={hasHeader ? "never" : undefined}
|
|
148
141
|
showsVerticalScrollIndicator={false}
|
|
149
142
|
scrollEventThrottle={16}
|
|
150
143
|
contentContainerStyle={styles.scrollContent(hasHeader, resolvedMargins)}
|
|
@@ -156,12 +149,7 @@ export function ScreenScrollView({
|
|
|
156
149
|
<View>
|
|
157
150
|
<PortalHost name={SCREEN_HEADER_PORTAL_HOST} />
|
|
158
151
|
</View>
|
|
159
|
-
<View
|
|
160
|
-
style={[
|
|
161
|
-
styles.content(horizontal, resolvedMargins),
|
|
162
|
-
contentContainerStyle,
|
|
163
|
-
]}
|
|
164
|
-
>
|
|
152
|
+
<View style={[styles.content(horizontal, resolvedMargins), contentContainerStyle]}>
|
|
165
153
|
{placeholder ?? children}
|
|
166
154
|
</View>
|
|
167
155
|
{/* Outside the padded content view so the horizontal margins do not
|
|
@@ -187,8 +175,7 @@ const styles = StyleSheet.create((theme, rt) => ({
|
|
|
187
175
|
// The header inset and the safe area are structural — they apply
|
|
188
176
|
// whether or not margins are on; the y margin stacks on top of them.
|
|
189
177
|
paddingTop:
|
|
190
|
-
(hasHeader ? theme.layout.header.height + rt.insets.top : 0) +
|
|
191
|
-
(hasYMargin(margins) ? marginY : 0),
|
|
178
|
+
(hasHeader ? theme.layout.header.height + rt.insets.top : 0) + (hasYMargin(margins) ? marginY : 0),
|
|
192
179
|
// The safe area is `BottomSafeArea`'s job; counting it here as well
|
|
193
180
|
// would leave a gap the height of the gesture bar.
|
|
194
181
|
paddingBottom: hasYMargin(margins) ? marginY : 0,
|
|
@@ -200,7 +187,7 @@ const styles = StyleSheet.create((theme, rt) => ({
|
|
|
200
187
|
return {
|
|
201
188
|
flexGrow: 1,
|
|
202
189
|
paddingHorizontal: hasXMargin(margins) ? marginX : 0,
|
|
203
|
-
flexDirection: horizontal ?
|
|
190
|
+
flexDirection: horizontal ? "row" : "column",
|
|
204
191
|
};
|
|
205
192
|
},
|
|
206
193
|
}));
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
export type { ScreenHeaderProps, ScreenProps } from
|
|
2
|
-
export { Screen } from
|
|
3
|
-
export type { ScreenContextValue } from
|
|
4
|
-
export { useScreen } from
|
|
5
|
-
export type { ScreenFlatListProps } from
|
|
6
|
-
export { ScreenFlatList } from
|
|
7
|
-
export type { ScreenListProps } from
|
|
8
|
-
export { ScreenList } from
|
|
9
|
-
export type { ScreenScrollViewProps } from
|
|
10
|
-
export { ScreenScrollView } from
|
|
11
|
-
export type { ScreenMargins, ScreenScrollableProps } from
|
|
1
|
+
export type { ScreenHeaderProps, ScreenProps } from "./Screen";
|
|
2
|
+
export { Screen } from "./Screen";
|
|
3
|
+
export type { ScreenContextValue } from "./ScreenContext";
|
|
4
|
+
export { useScreen } from "./ScreenContext";
|
|
5
|
+
export type { ScreenFlatListProps } from "./ScreenFlatList";
|
|
6
|
+
export { ScreenFlatList } from "./ScreenFlatList";
|
|
7
|
+
export type { ScreenListProps } from "./ScreenList";
|
|
8
|
+
export { ScreenList } from "./ScreenList";
|
|
9
|
+
export type { ScreenScrollViewProps } from "./ScreenScrollView";
|
|
10
|
+
export { ScreenScrollView } from "./ScreenScrollView";
|
|
11
|
+
export type { ScreenMargins, ScreenScrollableProps } from "./types";
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import type { ComponentType } from
|
|
1
|
+
import type { ComponentType } from "react";
|
|
2
2
|
|
|
3
3
|
type SafeAreaViewProps = {
|
|
4
4
|
edges: { readonly bottom: true };
|
|
5
|
-
insetType:
|
|
5
|
+
insetType: "all";
|
|
6
6
|
style: { readonly flex: 0 };
|
|
7
7
|
};
|
|
8
8
|
|
|
@@ -19,10 +19,9 @@ type SafeAreaViewProps = {
|
|
|
19
19
|
* written against.
|
|
20
20
|
*/
|
|
21
21
|
// eslint-disable-next-line @typescript-eslint/no-require-imports
|
|
22
|
-
const { SafeAreaView } =
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
};
|
|
22
|
+
const { SafeAreaView } = require("react-native-screens/src/components/safe-area") as {
|
|
23
|
+
SafeAreaView: ComponentType<SafeAreaViewProps>;
|
|
24
|
+
};
|
|
26
25
|
|
|
27
26
|
const BOTTOM_EDGE = { bottom: true } as const;
|
|
28
27
|
const SPACER = { flex: 0 } as const;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import type { ReactElement, ReactNode } from
|
|
2
|
-
import { View } from
|
|
1
|
+
import type { ReactElement, ReactNode } from "react";
|
|
2
|
+
import { View } from "react-native";
|
|
3
3
|
|
|
4
|
-
import { StyleSheet } from
|
|
4
|
+
import { StyleSheet } from "react-native-unistyles";
|
|
5
5
|
|
|
6
|
-
import { Spinner } from
|
|
7
|
-
import type { ScreenScrollableProps } from
|
|
6
|
+
import { Spinner } from "../../spinner";
|
|
7
|
+
import type { ScreenScrollableProps } from "../types";
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
10
|
* Centres a loading/empty placeholder in whatever space the content leaves.
|
|
@@ -16,10 +16,7 @@ export function ScreenPlaceholder({ children }: { children: ReactNode }) {
|
|
|
16
16
|
}
|
|
17
17
|
|
|
18
18
|
interface PlaceholderInput
|
|
19
|
-
extends Pick<
|
|
20
|
-
ScreenScrollableProps,
|
|
21
|
-
'loading' | 'LoadingComponent' | 'EmptyComponent'
|
|
22
|
-
> {
|
|
19
|
+
extends Pick<ScreenScrollableProps, "loading" | "LoadingComponent" | "EmptyComponent"> {
|
|
23
20
|
/** Whether the container has nothing to render (empty `data`, no children). */
|
|
24
21
|
isEmpty: boolean;
|
|
25
22
|
}
|
|
@@ -36,9 +33,7 @@ export function renderScreenPlaceholder({
|
|
|
36
33
|
isEmpty,
|
|
37
34
|
}: PlaceholderInput): ReactElement | null {
|
|
38
35
|
if (loading) {
|
|
39
|
-
return
|
|
40
|
-
<ScreenPlaceholder>{LoadingComponent ?? <Spinner />}</ScreenPlaceholder>
|
|
41
|
-
);
|
|
36
|
+
return <ScreenPlaceholder>{LoadingComponent ?? <Spinner />}</ScreenPlaceholder>;
|
|
42
37
|
}
|
|
43
38
|
if (isEmpty && EmptyComponent) {
|
|
44
39
|
return <ScreenPlaceholder>{EmptyComponent}</ScreenPlaceholder>;
|
|
@@ -49,7 +44,7 @@ export function renderScreenPlaceholder({
|
|
|
49
44
|
const styles = StyleSheet.create(() => ({
|
|
50
45
|
placeholder: {
|
|
51
46
|
flexGrow: 1,
|
|
52
|
-
alignItems:
|
|
53
|
-
justifyContent:
|
|
47
|
+
alignItems: "center",
|
|
48
|
+
justifyContent: "center",
|
|
54
49
|
},
|
|
55
50
|
}));
|