@hzblj/kara-components 0.5.0 → 0.7.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 +71 -0
- package/README.md +31 -3
- package/lib/module/atoms/checkbox/checkbox.android.js +7 -3
- package/lib/module/atoms/checkbox/checkbox.android.js.map +1 -1
- package/lib/module/atoms/chip/chip.js +1 -1
- package/lib/module/atoms/chip/chip.js.map +1 -1
- package/lib/module/atoms/date-picker/date-picker.ios.js +32 -11
- package/lib/module/atoms/date-picker/date-picker.ios.js.map +1 -1
- package/lib/module/atoms/index.js +0 -1
- package/lib/module/atoms/index.js.map +1 -1
- package/lib/module/atoms/pressable/pressable.js +11 -5
- package/lib/module/atoms/pressable/pressable.js.map +1 -1
- package/lib/module/atoms/rn-flat-list/rn-flat-list.js +10 -9
- package/lib/module/atoms/rn-flat-list/rn-flat-list.js.map +1 -1
- package/lib/module/atoms/rn-section-list/rn-section-list.js +5 -8
- package/lib/module/atoms/rn-section-list/rn-section-list.js.map +1 -1
- package/lib/module/atoms/segmented-control/index.js +1 -1
- package/lib/module/atoms/segmented-control/index.js.map +1 -1
- package/lib/module/atoms/segmented-control/segmented-control.android.js +74 -0
- package/lib/module/atoms/segmented-control/segmented-control.android.js.map +1 -0
- package/lib/module/atoms/segmented-control/segmented-control.ios.js +44 -0
- package/lib/module/atoms/segmented-control/segmented-control.ios.js.map +1 -0
- package/lib/module/atoms/slider/slider.android.js +26 -2
- package/lib/module/atoms/slider/slider.android.js.map +1 -1
- package/lib/module/atoms/switch/switch.android.js +14 -4
- package/lib/module/atoms/switch/switch.android.js.map +1 -1
- package/lib/module/haptics/haptics.js +56 -0
- package/lib/module/haptics/haptics.js.map +1 -0
- package/lib/module/haptics/index.js +5 -0
- package/lib/module/haptics/index.js.map +1 -0
- package/lib/module/haptics/use-haptic-feedback.js +33 -0
- package/lib/module/haptics/use-haptic-feedback.js.map +1 -0
- package/lib/module/index.js +1 -0
- package/lib/module/index.js.map +1 -1
- package/lib/module/molecules/search-bar/search-bar.js +15 -2
- package/lib/module/molecules/search-bar/search-bar.js.map +1 -1
- package/lib/module/molecules/tooltip/tooltip.android.js +16 -5
- package/lib/module/molecules/tooltip/tooltip.android.js.map +1 -1
- package/lib/module/organisms/action-sheet/action-sheet.android.js +41 -20
- package/lib/module/organisms/action-sheet/action-sheet.android.js.map +1 -1
- package/lib/module/organisms/action-sheet/action-sheet.ios.js +24 -8
- package/lib/module/organisms/action-sheet/action-sheet.ios.js.map +1 -1
- package/lib/module/organisms/alert/alert.ios.js +15 -2
- package/lib/module/organisms/alert/alert.ios.js.map +1 -1
- package/lib/module/organisms/context-menu/context-menu.android.js +2 -2
- package/lib/module/organisms/context-menu/context-menu.android.js.map +1 -1
- package/lib/module/organisms/form/form.android.js +22 -9
- package/lib/module/organisms/form/form.android.js.map +1 -1
- package/lib/module/organisms/swipe-actions/swipe-actions.android.js +125 -11
- package/lib/module/organisms/swipe-actions/swipe-actions.android.js.map +1 -1
- package/lib/module/organisms/swipe-actions/swipe-actions.ios.js +46 -18
- package/lib/module/organisms/swipe-actions/swipe-actions.ios.js.map +1 -1
- package/lib/module/templates/screen/screen.android.js +31 -10
- package/lib/module/templates/screen/screen.android.js.map +1 -1
- package/lib/typescript/atoms/avatar/avatar.types.d.ts +5 -0
- package/lib/typescript/atoms/badge/badge.types.d.ts +3 -0
- package/lib/typescript/atoms/button/button.types.d.ts +12 -0
- package/lib/typescript/atoms/card/card.types.d.ts +6 -0
- package/lib/typescript/atoms/checkbox/checkbox.types.d.ts +5 -0
- package/lib/typescript/atoms/chip/chip.types.d.ts +5 -0
- package/lib/typescript/atoms/color-picker/color-picker.types.d.ts +4 -0
- package/lib/typescript/atoms/date-picker/date-picker.ios.d.ts +6 -1
- package/lib/typescript/atoms/date-picker/date-picker.types.d.ts +14 -0
- package/lib/typescript/atoms/divider/divider.types.d.ts +3 -0
- package/lib/typescript/atoms/fab/fab.types.d.ts +7 -0
- package/lib/typescript/atoms/glass-view/glass-view.types.d.ts +1 -0
- package/lib/typescript/atoms/h-stack/h-stack.types.d.ts +6 -0
- package/lib/typescript/atoms/icon/icon.types.d.ts +8 -0
- package/lib/typescript/atoms/icon-button/icon-button.types.d.ts +5 -0
- package/lib/typescript/atoms/index.d.ts +0 -1
- package/lib/typescript/atoms/island/island.types.d.ts +4 -0
- package/lib/typescript/atoms/list/list.types.d.ts +2 -0
- package/lib/typescript/atoms/picker/picker.types.d.ts +12 -0
- package/lib/typescript/atoms/pressable/pressable.types.d.ts +11 -1
- package/lib/typescript/atoms/progress/progress.types.d.ts +6 -0
- package/lib/typescript/atoms/rn-flat-list/rn-flat-list.d.ts +5 -8
- package/lib/typescript/atoms/rn-flat-list/rn-flat-list.types.d.ts +3 -1
- package/lib/typescript/atoms/rn-scroll-view/rn-scroll-view.types.d.ts +4 -0
- package/lib/typescript/atoms/rn-section-list/rn-section-list.d.ts +2 -8
- package/lib/typescript/atoms/rn-section-list/rn-section-list.types.d.ts +3 -1
- package/lib/typescript/atoms/rn-text/rn-text.types.d.ts +4 -0
- package/lib/typescript/atoms/rn-view/rn-view.types.d.ts +2 -0
- package/lib/typescript/atoms/scroll-view/scroll-view.types.d.ts +4 -0
- package/lib/typescript/atoms/segmented-control/segmented-control.d.ts +1 -2
- package/lib/typescript/atoms/segmented-control/segmented-control.ios.d.ts +7 -0
- package/lib/typescript/atoms/segmented-control/segmented-control.types.d.ts +13 -0
- package/lib/typescript/atoms/skeleton/skeleton.types.d.ts +5 -0
- package/lib/typescript/atoms/slider/slider.types.d.ts +7 -0
- package/lib/typescript/atoms/spacer/spacer.types.d.ts +3 -0
- package/lib/typescript/atoms/surface/surface.types.d.ts +7 -0
- package/lib/typescript/atoms/switch/switch.types.d.ts +8 -0
- package/lib/typescript/atoms/text/text.types.d.ts +12 -0
- package/lib/typescript/atoms/text-field/text-field.types.d.ts +12 -0
- package/lib/typescript/atoms/v-stack/v-stack.types.d.ts +9 -0
- package/lib/typescript/atoms/z-stack/z-stack.types.d.ts +8 -0
- package/lib/typescript/haptics/haptics.d.ts +61 -0
- package/lib/typescript/haptics/index.d.ts +2 -0
- package/lib/typescript/haptics/use-haptic-feedback.d.ts +15 -0
- package/lib/typescript/index.d.ts +1 -0
- package/lib/typescript/molecules/collapsible/collapsible.types.d.ts +8 -0
- package/lib/typescript/molecules/empty-state/empty-state.types.d.ts +5 -0
- package/lib/typescript/molecules/label/label.types.d.ts +6 -0
- package/lib/typescript/molecules/labeled-content/labeled-content.types.d.ts +6 -0
- package/lib/typescript/molecules/link/link.types.d.ts +6 -0
- package/lib/typescript/molecules/list-item/list-item.types.d.ts +9 -0
- package/lib/typescript/molecules/navigation-bar/navigation-bar.types.d.ts +8 -0
- package/lib/typescript/molecules/pager/pager.types.d.ts +2 -0
- package/lib/typescript/molecules/radio-group/radio-group.types.d.ts +10 -0
- package/lib/typescript/molecules/rn-list-item/rn-list-item.types.d.ts +1 -1
- package/lib/typescript/molecules/rn-tooltip/rn-tooltip.types.d.ts +11 -0
- package/lib/typescript/molecules/scroll-edge-container/scroll-edge-container.types.d.ts +3 -0
- package/lib/typescript/molecules/search-bar/search-bar.types.d.ts +8 -0
- package/lib/typescript/molecules/stepper/stepper.types.d.ts +13 -0
- package/lib/typescript/molecules/tooltip/tooltip.types.d.ts +12 -0
- package/lib/typescript/organisms/action-sheet/action-sheet.types.d.ts +8 -0
- package/lib/typescript/organisms/alert/alert.types.d.ts +11 -0
- package/lib/typescript/organisms/context-menu/context-menu.types.d.ts +4 -0
- package/lib/typescript/organisms/fab-menu/fab-menu.types.d.ts +2 -0
- package/lib/typescript/organisms/form/form.types.d.ts +6 -0
- package/lib/typescript/organisms/menu/menu.types.d.ts +17 -0
- package/lib/typescript/organisms/sheet/sheet.types.d.ts +19 -0
- package/lib/typescript/organisms/snackbar/snackbar.types.d.ts +8 -0
- package/lib/typescript/organisms/swipe-actions/swipe-actions.types.d.ts +36 -13
- package/lib/typescript/templates/screen/screen.types.d.ts +9 -0
- package/package.json +5 -9
- package/src/atoms/avatar/avatar.types.ts +5 -0
- package/src/atoms/badge/badge.types.ts +3 -0
- package/src/atoms/button/button.types.ts +12 -0
- package/src/atoms/card/card.types.ts +6 -0
- package/src/atoms/checkbox/checkbox.android.tsx +7 -3
- package/src/atoms/checkbox/checkbox.types.ts +5 -0
- package/src/atoms/chip/chip.tsx +1 -1
- package/src/atoms/chip/chip.types.ts +5 -0
- package/src/atoms/color-picker/color-picker.types.ts +4 -0
- package/src/atoms/date-picker/date-picker.ios.tsx +33 -13
- package/src/atoms/date-picker/date-picker.types.ts +14 -0
- package/src/atoms/divider/divider.types.ts +3 -0
- package/src/atoms/fab/fab.types.ts +7 -0
- package/src/atoms/glass-view/glass-view.types.ts +1 -0
- package/src/atoms/h-stack/h-stack.types.ts +6 -0
- package/src/atoms/icon/icon.types.ts +8 -0
- package/src/atoms/icon-button/icon-button.types.ts +5 -0
- package/src/atoms/index.ts +0 -1
- package/src/atoms/island/island.types.ts +4 -0
- package/src/atoms/list/list.types.ts +2 -0
- package/src/atoms/picker/picker.types.ts +12 -0
- package/src/atoms/pressable/pressable.tsx +12 -5
- package/src/atoms/pressable/pressable.types.ts +12 -1
- package/src/atoms/progress/progress.types.ts +6 -0
- package/src/atoms/rn-flat-list/rn-flat-list.tsx +8 -8
- package/src/atoms/rn-flat-list/rn-flat-list.types.ts +3 -1
- package/src/atoms/rn-scroll-view/rn-scroll-view.types.ts +4 -0
- package/src/atoms/rn-section-list/rn-section-list.tsx +5 -8
- package/src/atoms/rn-section-list/rn-section-list.types.ts +3 -1
- package/src/atoms/rn-text/rn-text.types.ts +4 -0
- package/src/atoms/rn-view/rn-view.types.ts +2 -0
- package/src/atoms/scroll-view/scroll-view.types.ts +4 -0
- package/src/atoms/segmented-control/segmented-control.android.tsx +79 -0
- package/src/atoms/segmented-control/segmented-control.ios.tsx +47 -0
- package/src/atoms/segmented-control/segmented-control.types.ts +13 -0
- package/src/atoms/skeleton/skeleton.types.ts +5 -0
- package/src/atoms/slider/slider.android.tsx +33 -2
- package/src/atoms/slider/slider.types.ts +7 -0
- package/src/atoms/spacer/spacer.types.ts +3 -0
- package/src/atoms/surface/surface.types.ts +7 -0
- package/src/atoms/switch/switch.android.tsx +18 -5
- package/src/atoms/switch/switch.types.ts +8 -0
- package/src/atoms/text/text.types.ts +12 -0
- package/src/atoms/text-field/text-field.types.ts +12 -0
- package/src/atoms/v-stack/v-stack.types.ts +9 -0
- package/src/atoms/z-stack/z-stack.types.ts +8 -0
- package/src/haptics/haptics.ts +68 -0
- package/src/haptics/index.ts +2 -0
- package/src/haptics/use-haptic-feedback.ts +36 -0
- package/src/index.ts +1 -0
- package/src/molecules/collapsible/collapsible.types.ts +8 -0
- package/src/molecules/empty-state/empty-state.types.ts +5 -0
- package/src/molecules/label/label.types.ts +6 -0
- package/src/molecules/labeled-content/labeled-content.types.ts +6 -0
- package/src/molecules/link/link.types.ts +6 -0
- package/src/molecules/list-item/list-item.types.ts +9 -0
- package/src/molecules/navigation-bar/navigation-bar.types.ts +8 -0
- package/src/molecules/pager/pager.types.ts +2 -0
- package/src/molecules/radio-group/radio-group.types.ts +10 -0
- package/src/molecules/rn-list-item/rn-list-item.types.ts +1 -1
- package/src/molecules/rn-tooltip/rn-tooltip.types.ts +11 -0
- package/src/molecules/scroll-edge-container/scroll-edge-container.types.ts +3 -0
- package/src/molecules/search-bar/search-bar.tsx +9 -2
- package/src/molecules/search-bar/search-bar.types.ts +8 -0
- package/src/molecules/stepper/stepper.types.ts +13 -0
- package/src/molecules/tooltip/tooltip.android.tsx +17 -9
- package/src/molecules/tooltip/tooltip.types.ts +12 -0
- package/src/organisms/action-sheet/action-sheet.android.tsx +37 -19
- package/src/organisms/action-sheet/action-sheet.ios.tsx +22 -9
- package/src/organisms/action-sheet/action-sheet.types.ts +8 -0
- package/src/organisms/alert/alert.ios.tsx +11 -1
- package/src/organisms/alert/alert.types.ts +11 -0
- package/src/organisms/context-menu/context-menu.android.tsx +2 -2
- package/src/organisms/context-menu/context-menu.types.ts +4 -0
- package/src/organisms/fab-menu/fab-menu.types.ts +2 -0
- package/src/organisms/form/form.android.tsx +15 -7
- package/src/organisms/form/form.types.ts +6 -0
- package/src/organisms/menu/menu.types.ts +17 -0
- package/src/organisms/sheet/sheet.types.ts +19 -0
- package/src/organisms/snackbar/snackbar.types.ts +8 -0
- package/src/organisms/swipe-actions/swipe-actions.android.tsx +129 -9
- package/src/organisms/swipe-actions/swipe-actions.ios.tsx +45 -11
- package/src/organisms/swipe-actions/swipe-actions.types.ts +37 -14
- package/src/templates/screen/screen.android.tsx +33 -12
- package/src/templates/screen/screen.types.ts +9 -0
- package/lib/module/atoms/flash-list/flash-list.js +0 -31
- package/lib/module/atoms/flash-list/flash-list.js.map +0 -1
- package/lib/module/atoms/flash-list/flash-list.types.js +0 -4
- package/lib/module/atoms/flash-list/flash-list.types.js.map +0 -1
- package/lib/module/atoms/flash-list/index.js +0 -5
- package/lib/module/atoms/flash-list/index.js.map +0 -1
- package/lib/module/atoms/segmented-control/segmented-control.js +0 -28
- package/lib/module/atoms/segmented-control/segmented-control.js.map +0 -1
- package/lib/typescript/atoms/flash-list/flash-list.d.ts +0 -8
- package/lib/typescript/atoms/flash-list/flash-list.types.d.ts +0 -18
- package/lib/typescript/atoms/flash-list/index.d.ts +0 -2
- package/src/atoms/flash-list/flash-list.tsx +0 -28
- package/src/atoms/flash-list/flash-list.types.ts +0 -20
- package/src/atoms/flash-list/index.ts +0 -2
- package/src/atoms/segmented-control/segmented-control.tsx +0 -34
|
@@ -6,9 +6,13 @@ import {useMemo} from 'react'
|
|
|
6
6
|
import {useHostGuard} from '../../host-context'
|
|
7
7
|
import type {CheckboxComponent, CheckboxProps} from './checkbox.types'
|
|
8
8
|
|
|
9
|
+
/** Stands in for a missing handler: Material drops its 48dp touch target without one, and the box moves. */
|
|
10
|
+
const NOOP = () => undefined
|
|
11
|
+
|
|
9
12
|
/**
|
|
10
|
-
* Material's checkbox, tinted with the accent. With a label it is a full-width row that toggles as a whole
|
|
11
|
-
*
|
|
13
|
+
* Material's checkbox, tinted with the accent. With a label it is a full-width row that toggles as a whole. It always
|
|
14
|
+
* gets a handler, so a disabled or read-only box keeps the touch target an enabled one has, and lines up with it;
|
|
15
|
+
* `enabled` is what stops the input.
|
|
12
16
|
*/
|
|
13
17
|
export const Checkbox: CheckboxComponent = ({disabled = false, label, onValueChange, value}: CheckboxProps) => {
|
|
14
18
|
useHostGuard('Checkbox')
|
|
@@ -21,7 +25,7 @@ export const Checkbox: CheckboxComponent = ({disabled = false, label, onValueCha
|
|
|
21
25
|
<ComposeCheckbox
|
|
22
26
|
colors={{checkedColor: theme.color('fill.accent.primary'), checkmarkColor: theme.color('content.on.bg')}}
|
|
23
27
|
enabled={!disabled}
|
|
24
|
-
onCheckedChange={onValueChange}
|
|
28
|
+
onCheckedChange={onValueChange ?? NOOP}
|
|
25
29
|
value={value}
|
|
26
30
|
/>
|
|
27
31
|
)
|
|
@@ -1,9 +1,14 @@
|
|
|
1
1
|
import type {ReactNode} from 'react'
|
|
2
2
|
|
|
3
|
+
/** Material's `Checkbox` on Android. iOS has none, so there it is a SwiftUI `Toggle` — the same switch as `Switch`. */
|
|
3
4
|
export type CheckboxProps = {
|
|
5
|
+
/** Dims the control and ignores taps. */
|
|
4
6
|
disabled?: boolean
|
|
7
|
+
/** Text beside the control. On Android the whole labelled row toggles it. */
|
|
5
8
|
label?: string
|
|
9
|
+
/** Called with the new value when the user toggles it. */
|
|
6
10
|
onValueChange?: (value: boolean) => void
|
|
11
|
+
/** Whether it is checked. Controlled — update it from `onValueChange`. */
|
|
7
12
|
value: boolean
|
|
8
13
|
}
|
|
9
14
|
|
package/src/atoms/chip/chip.tsx
CHANGED
|
@@ -9,7 +9,7 @@ export const Chip: ChipComponent = ({label, onPress, selected = false, testID}:
|
|
|
9
9
|
borderColor={selected ? 'border.accent' : 'border.tertiary'}
|
|
10
10
|
borderRadius="full"
|
|
11
11
|
borderWidth={1}
|
|
12
|
-
haptic
|
|
12
|
+
haptic="selection"
|
|
13
13
|
justify="center"
|
|
14
14
|
onPress={onPress}
|
|
15
15
|
px="s12"
|
|
@@ -1,9 +1,14 @@
|
|
|
1
1
|
import type {ReactNode} from 'react'
|
|
2
2
|
|
|
3
|
+
/** A filter pill on a `Pressable`, not a native control — the React Native tier, so it needs no host. */
|
|
3
4
|
export type ChipProps = {
|
|
5
|
+
/** The text in the pill. */
|
|
4
6
|
label: string
|
|
7
|
+
/** Called when the chip is pressed, with the `selection` haptic. */
|
|
5
8
|
onPress?: () => void
|
|
9
|
+
/** Draws the chip in the accent colours. Off by default. */
|
|
6
10
|
selected?: boolean
|
|
11
|
+
/** Test identifier, forwarded to the view. */
|
|
7
12
|
testID?: string
|
|
8
13
|
}
|
|
9
14
|
|
|
@@ -5,9 +5,13 @@ import type {ReactNode} from 'react'
|
|
|
5
5
|
* renders nothing and says so in dev. Branch on `Platform.OS` if the screen needs a fallback.
|
|
6
6
|
*/
|
|
7
7
|
export type ColorPickerProps = {
|
|
8
|
+
/** Text beside the colour well. */
|
|
8
9
|
label?: string
|
|
10
|
+
/** Called with the colour the user picks. */
|
|
9
11
|
onValueChange?: (color: string) => void
|
|
12
|
+
/** Lets the user pick an opacity as well. Off by default. */
|
|
10
13
|
supportsOpacity?: boolean
|
|
14
|
+
/** Test identifier, forwarded to the native view. */
|
|
11
15
|
testID?: string
|
|
12
16
|
/** `#RRGGBB` or `#RRGGBBAA`. */
|
|
13
17
|
value: string | null
|
|
@@ -1,9 +1,22 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import {Host, DatePicker as SwiftUIDatePicker} from '@expo/ui/swift-ui'
|
|
2
|
+
import {datePickerStyle, labelsHidden, tint} from '@expo/ui/swift-ui/modifiers'
|
|
3
|
+
import {useAppTheme} from '@hzblj/kara-theme'
|
|
4
|
+
import {useMemo} from 'react'
|
|
3
5
|
|
|
4
|
-
import type {DatePickerComponent, DatePickerProps} from './date-picker.types'
|
|
6
|
+
import type {DatePickerComponent, DatePickerMode, DatePickerProps} from './date-picker.types'
|
|
5
7
|
|
|
6
|
-
|
|
8
|
+
const COMPONENTS = {
|
|
9
|
+
date: ['date'],
|
|
10
|
+
datetime: ['date', 'hourAndMinute'],
|
|
11
|
+
time: ['hourAndMinute'],
|
|
12
|
+
} as const satisfies Record<DatePickerMode, ('date' | 'hourAndMinute')[]>
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* The system's compact date picker: the value in a pill, and a tap on it opens the calendar popover UIKit owns. Its own
|
|
16
|
+
* host, sized to the pill on both axes — a host that took the width it was given would lay the pill out against the
|
|
17
|
+
* far edge of it, or past its container's — so it drops into a row the way a `Text` does. The label is the caller's,
|
|
18
|
+
* beside it; the calendar is in the accent.
|
|
19
|
+
*/
|
|
7
20
|
export const DatePicker: DatePickerComponent = ({
|
|
8
21
|
max,
|
|
9
22
|
min,
|
|
@@ -12,16 +25,23 @@ export const DatePicker: DatePickerComponent = ({
|
|
|
12
25
|
testID,
|
|
13
26
|
value,
|
|
14
27
|
}: DatePickerProps) => {
|
|
15
|
-
const
|
|
28
|
+
const theme = useAppTheme()
|
|
29
|
+
|
|
30
|
+
const modifiers = useMemo(
|
|
31
|
+
() => [datePickerStyle('compact'), labelsHidden(), tint(theme.color('fill.accent.primary'))],
|
|
32
|
+
[theme]
|
|
33
|
+
)
|
|
16
34
|
|
|
17
35
|
return (
|
|
18
|
-
<
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
36
|
+
<Host colorScheme={theme.dark ? 'dark' : 'light'} matchContents>
|
|
37
|
+
<SwiftUIDatePicker
|
|
38
|
+
displayedComponents={[...COMPONENTS[mode]]}
|
|
39
|
+
modifiers={modifiers}
|
|
40
|
+
onDateChange={onValueChange}
|
|
41
|
+
range={min || max ? {end: max, start: min} : undefined}
|
|
42
|
+
selection={value}
|
|
43
|
+
testID={testID}
|
|
44
|
+
/>
|
|
45
|
+
</Host>
|
|
26
46
|
)
|
|
27
47
|
}
|
|
@@ -2,12 +2,26 @@ import type {ReactNode} from 'react'
|
|
|
2
2
|
|
|
3
3
|
export type DatePickerMode = 'date' | 'datetime' | 'time'
|
|
4
4
|
|
|
5
|
+
/**
|
|
6
|
+
* A date or time picker — SwiftUI's compact `DatePicker` on iOS, a field that opens Material's picker dialog on a tap
|
|
7
|
+
* on Android. The React Native tier: it brings its own host and sizes itself to the value, so it sits in a row beside
|
|
8
|
+
* its label like a `Text`.
|
|
9
|
+
*/
|
|
5
10
|
export type DatePickerProps = {
|
|
11
|
+
/** The latest date that can be picked. Android ignores it in `time` mode. */
|
|
6
12
|
max?: Date
|
|
13
|
+
/** The earliest date that can be picked. Android ignores it in `time` mode. */
|
|
7
14
|
min?: Date
|
|
15
|
+
/**
|
|
16
|
+
* What it picks. `date` by default. Android has no combined dialog, so there `datetime` picks the date and keeps
|
|
17
|
+
* `value`'s time of day.
|
|
18
|
+
*/
|
|
8
19
|
mode?: DatePickerMode
|
|
20
|
+
/** Called with the new date — on iOS as it changes, on Android when the dialog is confirmed. */
|
|
9
21
|
onValueChange?: (date: Date) => void
|
|
22
|
+
/** Test identifier — on the native picker on iOS, on the tappable field on Android. */
|
|
10
23
|
testID?: string
|
|
24
|
+
/** The selected date. Controlled — update it from `onValueChange`. */
|
|
11
25
|
value: Date
|
|
12
26
|
}
|
|
13
27
|
|
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
import type {ColorToken} from '@hzblj/kara-theme'
|
|
2
2
|
import type {ReactNode} from 'react'
|
|
3
3
|
|
|
4
|
+
/** A horizontal hairline — SwiftUI `Divider` / Compose `HorizontalDivider`. */
|
|
4
5
|
export type DividerProps = {
|
|
6
|
+
/** The line's colour. `border.tertiary` by default. */
|
|
5
7
|
color?: ColorToken
|
|
8
|
+
/** Test identifier, forwarded to the native view on iOS — Android ignores it. */
|
|
6
9
|
testID?: string
|
|
7
10
|
}
|
|
8
11
|
|
|
@@ -2,9 +2,16 @@ import type {ReactNode} from 'react'
|
|
|
2
2
|
|
|
3
3
|
import type {IconName} from '../icon'
|
|
4
4
|
|
|
5
|
+
/**
|
|
6
|
+
* A floating action button — Material's `FloatingActionButton` on Android, a 56pt accent circle (a plain SwiftUI
|
|
7
|
+
* `Button`) on iOS. It renders inline; pinning it to a corner is up to the screen.
|
|
8
|
+
*/
|
|
5
9
|
export type FabProps = {
|
|
10
|
+
/** The icon, one of the app's, drawn in `content.on.bg`. */
|
|
6
11
|
name: IconName
|
|
12
|
+
/** Called when the button is pressed. */
|
|
7
13
|
onPress?: () => void
|
|
14
|
+
/** Test identifier, forwarded to the native view on iOS — Android ignores it. */
|
|
8
15
|
testID?: string
|
|
9
16
|
}
|
|
10
17
|
|
|
@@ -12,6 +12,7 @@ export type GlassViewProps = ResponsiveViewSx & {
|
|
|
12
12
|
children?: ReactNode
|
|
13
13
|
/** Swells toward the finger on touch, carrying the children with it. Wrap the view in a `Pressable` for the press. */
|
|
14
14
|
interactive?: boolean
|
|
15
|
+
/** Test identifier, forwarded to the view. */
|
|
15
16
|
testID?: string
|
|
16
17
|
/** Tints the material. Unset leaves it clear. */
|
|
17
18
|
tint?: ColorToken
|
|
@@ -4,11 +4,17 @@ import type {ReactNode} from 'react'
|
|
|
4
4
|
|
|
5
5
|
export type HStackAlign = 'center' | 'end' | 'start'
|
|
6
6
|
|
|
7
|
+
/** A horizontal stack — SwiftUI `HStack` / Compose `Row`. */
|
|
7
8
|
export type HStackProps = ResponsiveSx & {
|
|
9
|
+
/** How the children line up vertically — `start` is the top, `end` the bottom. `start` by default. */
|
|
8
10
|
align?: HStackAlign
|
|
11
|
+
/** Native views, laid out from the leading edge. */
|
|
9
12
|
children?: ReactNode
|
|
13
|
+
/** Makes the stack pressable — a tap gesture on iOS, a `clickable` with Material's ripple on Android. */
|
|
10
14
|
onPress?: () => void
|
|
15
|
+
/** The gap between children. Unset, SwiftUI puts its default spacing between them and Compose none. */
|
|
11
16
|
spacing?: SpaceSize
|
|
17
|
+
/** Test identifier, forwarded to the native view. */
|
|
12
18
|
testID?: string
|
|
13
19
|
}
|
|
14
20
|
|
|
@@ -18,12 +18,20 @@ type DeclaredIconName = keyof KaraIcons & string
|
|
|
18
18
|
*/
|
|
19
19
|
export type IconName = [DeclaredIconName] extends [never] ? string : DeclaredIconName
|
|
20
20
|
|
|
21
|
+
/**
|
|
22
|
+
* One of the app's icons, in a host — SwiftUI `Image` from the asset catalog on iOS, Material's `Icon` with the vector
|
|
23
|
+
* drawable on Android. `RnIcon` draws the same asset outside one.
|
|
24
|
+
*/
|
|
21
25
|
export type IconProps = {
|
|
22
26
|
/** What a screen reader says. Unset, the icon is decorative and hidden from it. */
|
|
23
27
|
accessibilityLabel?: string
|
|
28
|
+
/** The icon's tint. `content.primary` by default. */
|
|
24
29
|
color?: ColorToken
|
|
30
|
+
/** Which of the app's icons — a key of `KaraIcons`. */
|
|
25
31
|
name: IconName
|
|
32
|
+
/** Its width and height, a spacing token. `s24` by default. */
|
|
26
33
|
size?: SpaceSize
|
|
34
|
+
/** Test identifier, forwarded to the native view on iOS — Android ignores it. */
|
|
27
35
|
testID?: string
|
|
28
36
|
}
|
|
29
37
|
|
|
@@ -2,10 +2,15 @@ import type {ReactNode} from 'react'
|
|
|
2
2
|
|
|
3
3
|
import type {IconName} from '../icon'
|
|
4
4
|
|
|
5
|
+
/** A button that is just an icon — a plain SwiftUI `Button` on iOS, Material's `IconButton` on Android. */
|
|
5
6
|
export type IconButtonProps = {
|
|
7
|
+
/** Draws the icon in `btn.content.disabled` and stops the button responding to presses. */
|
|
6
8
|
disabled?: boolean
|
|
9
|
+
/** The icon, one of the app's. */
|
|
7
10
|
name: IconName
|
|
11
|
+
/** Called when the button is pressed. */
|
|
8
12
|
onPress?: () => void
|
|
13
|
+
/** Test identifier, forwarded to the native view on iOS — Android ignores it. */
|
|
9
14
|
testID?: string
|
|
10
15
|
}
|
|
11
16
|
|
package/src/atoms/index.ts
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import type {ReactNode} from 'react'
|
|
2
2
|
import type {StyleProp, ViewStyle} from 'react-native'
|
|
3
3
|
|
|
4
|
+
/** A host for native atoms in a React Native layout — the SwiftUI / Compose `Host` an `@expo/ui` tree mounts into. */
|
|
4
5
|
export type IslandProps = {
|
|
6
|
+
/** The native views it hosts. */
|
|
5
7
|
children?: ReactNode
|
|
6
8
|
/**
|
|
7
9
|
* Sizes the island's height to its native content while the width still comes from the parent, which
|
|
@@ -15,7 +17,9 @@ export type IslandProps = {
|
|
|
15
17
|
* hangs the main thread as soon as the views lay out on screen.
|
|
16
18
|
*/
|
|
17
19
|
matchContents?: boolean
|
|
20
|
+
/** A React Native style for the host view — its size and placement. It needs a height when `matchContents` is off. */
|
|
18
21
|
style?: StyleProp<ViewStyle>
|
|
22
|
+
/** Test identifier, forwarded to the host view on iOS — Android ignores it. */
|
|
19
23
|
testID?: string
|
|
20
24
|
}
|
|
21
25
|
|
|
@@ -10,12 +10,14 @@ import type {ReactNode} from 'react'
|
|
|
10
10
|
* the children is one too many: on iOS it becomes an empty row of its own.
|
|
11
11
|
*/
|
|
12
12
|
export type ListProps = {
|
|
13
|
+
/** The rows — native views, one row each. */
|
|
13
14
|
children: ReactNode
|
|
14
15
|
/**
|
|
15
16
|
* Enables pull-to-refresh. Async on purpose — see `ScrollViewProps.onRefresh`: the spinner runs
|
|
16
17
|
* until the promise settles, so neither platform needs a `refreshing` flag kept in sync by hand.
|
|
17
18
|
*/
|
|
18
19
|
onRefresh?: () => Promise<void>
|
|
20
|
+
/** Test identifier, forwarded to the native view on iOS — Android ignores it. */
|
|
19
21
|
testID?: string
|
|
20
22
|
}
|
|
21
23
|
|
|
@@ -1,15 +1,27 @@
|
|
|
1
1
|
import type {ReactNode} from 'react'
|
|
2
2
|
|
|
3
|
+
/** One choice of a `Picker`. */
|
|
3
4
|
export type PickerOption = {
|
|
5
|
+
/** What the user reads. */
|
|
4
6
|
label: string
|
|
7
|
+
/** What `onValueChange` reports. It also keys the option, so it must be unique. */
|
|
5
8
|
value: string
|
|
6
9
|
}
|
|
7
10
|
|
|
11
|
+
/**
|
|
12
|
+
* A single choice from a list — a SwiftUI wheel picker on iOS, Material's exposed dropdown on Android. It brings its
|
|
13
|
+
* own host, so it renders outside `Screen` and `Island` as well.
|
|
14
|
+
*/
|
|
8
15
|
export type PickerProps = {
|
|
16
|
+
/** Stops the user changing the selection, and dims the picker. */
|
|
9
17
|
disabled?: boolean
|
|
18
|
+
/** Called with the chosen option's `value`. */
|
|
10
19
|
onValueChange?: (value: string) => void
|
|
20
|
+
/** The choices, in order. */
|
|
11
21
|
options: PickerOption[]
|
|
22
|
+
/** Android: the dropdown field's test tag. iOS: `@expo/ui`'s wheel picker drops it. */
|
|
12
23
|
testID?: string
|
|
24
|
+
/** The selected option's `value`. Controlled: pass back what `onValueChange` reports. */
|
|
13
25
|
value: string
|
|
14
26
|
}
|
|
15
27
|
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import {useSplitSx} from '@hzblj/kara-sx'
|
|
2
|
-
import * as Haptics from 'expo-haptics'
|
|
3
2
|
import {useCallback} from 'react'
|
|
4
3
|
import {Pressable as RNPressable} from 'react-native'
|
|
5
4
|
import Animated, {useAnimatedStyle, useSharedValue, withSpring} from 'react-native-reanimated'
|
|
5
|
+
|
|
6
|
+
import {haptics} from '../../haptics'
|
|
6
7
|
import type {PressableComponent, PressableProps} from './pressable.types'
|
|
7
8
|
|
|
8
9
|
const SPRING = {damping: 20, stiffness: 400}
|
|
@@ -19,24 +20,30 @@ export const Pressable: PressableComponent = ({
|
|
|
19
20
|
}: PressableProps) => {
|
|
20
21
|
const [resolved, rest] = useSplitSx(props)
|
|
21
22
|
const scale = useSharedValue(1)
|
|
23
|
+
const feedback = haptic === true ? 'light' : haptic || undefined
|
|
22
24
|
|
|
23
25
|
const rStyle = useAnimatedStyle(() => ({transform: [{scale: scale.value}]}), [])
|
|
24
26
|
|
|
27
|
+
// The finger is down: the Taptic Engine has until the release to wake, so the haptic lands with the press.
|
|
25
28
|
const onPressIn = useCallback(() => {
|
|
26
29
|
scale.value = withSpring(0.96, SPRING)
|
|
27
|
-
|
|
30
|
+
|
|
31
|
+
if (feedback) {
|
|
32
|
+
haptics.prepare(feedback)
|
|
33
|
+
}
|
|
34
|
+
}, [feedback, scale])
|
|
28
35
|
|
|
29
36
|
const onPressOut = useCallback(() => {
|
|
30
37
|
scale.value = withSpring(1, SPRING)
|
|
31
38
|
}, [scale])
|
|
32
39
|
|
|
33
40
|
const onPressWithHaptic = useCallback(() => {
|
|
34
|
-
if (
|
|
35
|
-
|
|
41
|
+
if (feedback) {
|
|
42
|
+
haptics.play(feedback)
|
|
36
43
|
}
|
|
37
44
|
|
|
38
45
|
onPress?.()
|
|
39
|
-
}, [
|
|
46
|
+
}, [feedback, onPress])
|
|
40
47
|
|
|
41
48
|
return (
|
|
42
49
|
<AnimatedPressable
|
|
@@ -1,11 +1,22 @@
|
|
|
1
1
|
import type {ResponsiveViewSx} from '@hzblj/kara-sx'
|
|
2
2
|
import type {ReactNode} from 'react'
|
|
3
3
|
|
|
4
|
+
import type {Haptic} from '../../haptics'
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* React Native's `Pressable`, styled through `sx` like a `Box`: it springs down to 96% while pressed and takes
|
|
8
|
+
* touches 8 points past its edges. The React Native tier — it needs no host.
|
|
9
|
+
*/
|
|
4
10
|
export type PressableProps = ResponsiveViewSx & {
|
|
11
|
+
/** The pressable content. */
|
|
5
12
|
children?: ReactNode
|
|
13
|
+
/** Ignores presses — no `onPress`, no haptic, no spring. */
|
|
6
14
|
disabled?: boolean
|
|
7
|
-
haptic
|
|
15
|
+
/** Played on press. `true` is a `light` impact; a name picks the haptic, e.g. `selection` for a choice. */
|
|
16
|
+
haptic?: boolean | Haptic
|
|
17
|
+
/** Called when the press is released, after the `haptic` plays. */
|
|
8
18
|
onPress?: () => void
|
|
19
|
+
/** Test identifier, forwarded to the view. */
|
|
9
20
|
testID?: string
|
|
10
21
|
}
|
|
11
22
|
|
|
@@ -1,7 +1,13 @@
|
|
|
1
1
|
import type {ReactNode} from 'react'
|
|
2
2
|
|
|
3
|
+
/**
|
|
4
|
+
* A progress bar or ring, tinted `fill.accent.primary` — SwiftUI `ProgressView` / Compose's
|
|
5
|
+
* `LinearProgressIndicator` and `CircularProgressIndicator`.
|
|
6
|
+
*/
|
|
3
7
|
export type ProgressProps = {
|
|
8
|
+
/** A circular indicator instead of a bar. Off by default. */
|
|
4
9
|
circular?: boolean
|
|
10
|
+
/** Between `0` and `1`. Leave it unset for an indeterminate indicator. */
|
|
5
11
|
value?: number
|
|
6
12
|
}
|
|
7
13
|
|
|
@@ -7,14 +7,11 @@ import type {RnFlatListProps} from './rn-flat-list.types'
|
|
|
7
7
|
const NO_SX = {}
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
* ends up drawn where the layout no longer is. `VirtualizedList` renders its cells in normal flow
|
|
16
|
-
* inside a scroll view, using blank spacers for the range it has not rendered, so a hosted view stays
|
|
17
|
-
* exactly where the layout put it. This is `SectionList`'s reason to exist too, without the sections.
|
|
10
|
+
* kara's list for React Native content: React Native's own `VirtualizedList`, styled through `sx`. It renders its
|
|
11
|
+
* cells in normal flow inside a scroll view, with blank spacers for the range it has not rendered, so a row that hosts
|
|
12
|
+
* native views keeps them where the layout put it. A recycling list (absolutely positioned, reused cells) cannot
|
|
13
|
+
* promise that — an `@expo/ui` host survives neither, and draws where the layout no longer is — which is why kara
|
|
14
|
+
* ships none.
|
|
18
15
|
*/
|
|
19
16
|
export const RnFlatList = <TItem,>({content, data, renderItem, ...props}: RnFlatListProps<TItem>) => {
|
|
20
17
|
const [style, rest] = useSplitSx(props as Record<string, unknown>)
|
|
@@ -23,6 +20,9 @@ export const RnFlatList = <TItem,>({content, data, renderItem, ...props}: RnFlat
|
|
|
23
20
|
return (
|
|
24
21
|
<RNFlatList<TItem>
|
|
25
22
|
data={data}
|
|
23
|
+
// Android clips by default, and a host is measured after its first layout — at zero height it counts as
|
|
24
|
+
// off-screen, is detached, and its native view never comes back.
|
|
25
|
+
removeClippedSubviews={false}
|
|
26
26
|
renderItem={renderItem}
|
|
27
27
|
{...rest}
|
|
28
28
|
contentContainerStyle={content === undefined ? undefined : contentStyle}
|
|
@@ -3,9 +3,11 @@ import type {FlatListProps as RNFlatListProps} from 'react-native'
|
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Top-level `sx` styles the viewport; `content` styles the scrolling content container, so padding and
|
|
6
|
-
* gap belong there — the same split as `RnScrollView`.
|
|
6
|
+
* gap belong there — the same split as `RnScrollView`. `removeClippedSubviews` is off unless you turn it on:
|
|
7
|
+
* Android's default would detach a row's host before it has measured itself, and the row would stay empty.
|
|
7
8
|
*/
|
|
8
9
|
export type RnFlatListProps<TItem> = ResponsiveViewSx &
|
|
9
10
|
Omit<RNFlatListProps<TItem>, 'contentContainerStyle' | 'style'> & {
|
|
11
|
+
/** Styles the scrolling content container — padding and gap belong here. */
|
|
10
12
|
content?: ResponsiveViewSx
|
|
11
13
|
}
|
|
@@ -13,9 +13,13 @@ import type {ScrollViewAxis} from '../scroll-view'
|
|
|
13
13
|
*/
|
|
14
14
|
export type RnScrollViewProps = ResponsiveViewSx &
|
|
15
15
|
Omit<RNScrollViewProps, 'contentContainerStyle' | 'horizontal' | 'style'> & {
|
|
16
|
+
/** The scroll direction. `vertical` by default. */
|
|
16
17
|
axis?: ScrollViewAxis
|
|
18
|
+
/** The scrolling content. */
|
|
17
19
|
children?: ReactNode
|
|
20
|
+
/** Styles the scrolling content container — padding and gap belong here. */
|
|
18
21
|
content?: ResponsiveViewSx
|
|
22
|
+
/** Shows the scroll indicators. On by default. */
|
|
19
23
|
showsIndicators?: boolean
|
|
20
24
|
}
|
|
21
25
|
|
|
@@ -7,14 +7,8 @@ import type {RnSectionListProps} from './rn-section-list.types'
|
|
|
7
7
|
const NO_SX = {}
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
* FlashList is the default for lists in this codebase and should stay that way for data rows. This
|
|
13
|
-
* exists for the case it cannot serve: content that hosts native views. FlashList positions its rows
|
|
14
|
-
* absolutely and recycles their cells, and an `@expo/ui` host does not survive either — the hosted
|
|
15
|
-
* view ends up drawn where the layout no longer is. `VirtualizedList` renders its cells in normal flow
|
|
16
|
-
* inside a scroll view, using blank spacers for the range it has not rendered, so a hosted view stays
|
|
17
|
-
* exactly where the layout put it.
|
|
10
|
+
* `RnFlatList` with sections: React Native's own `VirtualizedList`, cells in normal flow inside a scroll view, so a
|
|
11
|
+
* row that hosts native views keeps them where the layout put it.
|
|
18
12
|
*
|
|
19
13
|
* Sticky headers default off, unlike React Native, where they are on for vertical lists. A header that
|
|
20
14
|
* detaches and floats over the content is a deliberate effect, not something a list should do unasked.
|
|
@@ -30,6 +24,9 @@ export const RnSectionList = <TItem, TSection = DefaultSectionT>({
|
|
|
30
24
|
|
|
31
25
|
return (
|
|
32
26
|
<RNSectionList<TItem, TSection>
|
|
27
|
+
// Android clips by default, and a host is measured after its first layout — at zero height it counts as
|
|
28
|
+
// off-screen, is detached, and its native view never comes back.
|
|
29
|
+
removeClippedSubviews={false}
|
|
33
30
|
sections={sections}
|
|
34
31
|
{...rest}
|
|
35
32
|
contentContainerStyle={content === undefined ? undefined : contentStyle}
|
|
@@ -3,9 +3,11 @@ import type {DefaultSectionT, SectionListProps as RNSectionListProps} from 'reac
|
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Top-level `sx` styles the viewport; `content` styles the scrolling content container, so padding and
|
|
6
|
-
* gap belong there — the same split as `RnScrollView` and `RnFlatList`.
|
|
6
|
+
* gap belong there — the same split as `RnScrollView` and `RnFlatList`. `removeClippedSubviews` is off unless
|
|
7
|
+
* you turn it on, as in `RnFlatList`: Android's default would leave rows with hosts in them empty.
|
|
7
8
|
*/
|
|
8
9
|
export type RnSectionListProps<TItem, TSection = DefaultSectionT> = ResponsiveViewSx &
|
|
9
10
|
Omit<RNSectionListProps<TItem, TSection>, 'contentContainerStyle' | 'style'> & {
|
|
11
|
+
/** Styles the scrolling content container — padding and gap belong here. */
|
|
10
12
|
content?: ResponsiveViewSx
|
|
11
13
|
}
|
|
@@ -2,9 +2,13 @@ import type {ColorToken, TextVariant} from '@hzblj/kara-theme'
|
|
|
2
2
|
import type {ReactNode} from 'react'
|
|
3
3
|
import type {TextProps as RNTextProps} from 'react-native'
|
|
4
4
|
|
|
5
|
+
/** React Native's `Text` in a theme typography variant — the React Native tier, for text outside a native host. */
|
|
5
6
|
export type RnTextProps = Omit<RNTextProps, 'style'> & {
|
|
7
|
+
/** Horizontal alignment, as React Native's `textAlign`. */
|
|
6
8
|
align?: 'center' | 'left' | 'right'
|
|
9
|
+
/** The text's colour. `content.primary` by default. */
|
|
7
10
|
color?: ColorToken
|
|
11
|
+
/** The typography variant. `body` by default. */
|
|
8
12
|
variant?: TextVariant
|
|
9
13
|
}
|
|
10
14
|
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type {ReactElement, ReactNode} from 'react'
|
|
2
2
|
|
|
3
|
+
/** Carries a React Native view into a SwiftUI or Compose tree — `@expo/ui`'s `RNHostView` on both platforms. */
|
|
3
4
|
export type RnViewProps = {
|
|
4
5
|
/**
|
|
5
6
|
* A single React Native *view*. It may not contain React Native text: a bare string becomes a
|
|
@@ -15,6 +16,7 @@ export type RnViewProps = {
|
|
|
15
16
|
* intrinsic size and would otherwise stretch to fill the SwiftUI parent.
|
|
16
17
|
*/
|
|
17
18
|
matchContents?: boolean
|
|
19
|
+
/** Not forwarded on either platform — give the child its own `testID`. */
|
|
18
20
|
testID?: string
|
|
19
21
|
}
|
|
20
22
|
|
|
@@ -9,7 +9,9 @@ export type ScrollViewAxis = 'horizontal' | 'vertical'
|
|
|
9
9
|
* like React Native's `contentContainerStyle` padding and scrolls with the content.
|
|
10
10
|
*/
|
|
11
11
|
export type ScrollViewProps = ResponsiveSx & {
|
|
12
|
+
/** The scroll direction. `vertical` by default. */
|
|
12
13
|
axis?: ScrollViewAxis
|
|
14
|
+
/** Laid out in a stack along `axis`. */
|
|
13
15
|
children?: ReactNode
|
|
14
16
|
/**
|
|
15
17
|
* Enables pull-to-refresh. Async on purpose: the spinner runs until the promise settles, which is
|
|
@@ -21,7 +23,9 @@ export type ScrollViewProps = ResponsiveSx & {
|
|
|
21
23
|
onRefresh?: () => Promise<void>
|
|
22
24
|
/** iOS only — Compose exposes no indicator toggle, so Android always shows the native one. */
|
|
23
25
|
showsIndicators?: boolean
|
|
26
|
+
/** The space between children. */
|
|
24
27
|
spacing?: SpaceSize
|
|
28
|
+
/** Test identifier, forwarded to the native view. */
|
|
25
29
|
testID?: string
|
|
26
30
|
}
|
|
27
31
|
|