react-native-system-ui 0.0.7 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +46 -31
- package/dist/cjs/components/action-sheet/ActionSheet.js +128 -142
- package/dist/cjs/components/action-sheet/tokens.js +16 -27
- package/dist/cjs/components/area/Area.js +57 -70
- package/dist/cjs/components/area/tokens.js +6 -3
- package/dist/cjs/components/avatar/Avatar.js +38 -36
- package/dist/cjs/components/badge/Badge.js +68 -73
- package/dist/cjs/components/badge/tokens.js +6 -8
- package/dist/cjs/components/button/Button.js +135 -176
- package/dist/cjs/components/button/ButtonGroup.js +11 -45
- package/dist/cjs/components/button/tokens.js +1 -8
- package/dist/cjs/components/calendar/Calendar.js +212 -223
- package/dist/cjs/components/calendar/tokens.js +3 -3
- package/dist/cjs/components/cascader/Cascader.js +257 -267
- package/dist/cjs/components/cascader/tokens.js +2 -2
- package/dist/cjs/components/cascader/useCascaderExtend.js +25 -29
- package/dist/cjs/components/cell/Cell.js +94 -104
- package/dist/cjs/components/cell/CellGroup.js +37 -49
- package/dist/cjs/components/checkbox/Checkbox.js +140 -132
- package/dist/cjs/components/checkbox/CheckboxGroup.js +21 -51
- package/dist/cjs/components/checkbox/tokens.js +7 -10
- package/dist/cjs/components/circle/Circle.js +87 -74
- package/dist/cjs/components/collapse/Collapse.js +88 -104
- package/dist/cjs/components/config-provider/ConfigProvider.js +17 -4
- package/dist/cjs/components/config-provider/DirectionContext.js +15 -0
- package/dist/cjs/components/config-provider/index.js +7 -0
- package/dist/cjs/components/config-provider/locale/en-US.js +32 -0
- package/dist/cjs/components/config-provider/locale/zh-CN.js +32 -0
- package/dist/cjs/components/config-provider/useDirection.js +16 -0
- package/dist/cjs/components/count-down/CountDown.js +32 -27
- package/dist/cjs/components/datetime-picker/DatetimePicker.js +80 -104
- package/dist/cjs/components/datetime-picker/tokens.js +14 -3
- package/dist/cjs/components/dialog/Dialog.js +159 -121
- package/dist/cjs/components/dialog/imperative.js +24 -43
- package/dist/cjs/components/dialog/tokens.js +1 -0
- package/dist/cjs/components/divider/Divider.js +57 -62
- package/dist/cjs/components/empty/Empty.js +53 -52
- package/dist/cjs/components/error-boundary/ErrorBoundary.js +74 -0
- package/dist/cjs/components/error-boundary/index.js +19 -0
- package/dist/cjs/components/field/Field.js +109 -106
- package/dist/cjs/components/flex/Flex.js +32 -32
- package/dist/cjs/components/flex/FlexItem.js +27 -27
- package/dist/cjs/components/form/Form.js +178 -196
- package/dist/cjs/components/form/FormItem.js +87 -109
- package/dist/cjs/components/form/FormList.js +57 -45
- package/dist/cjs/components/form/tokens.js +6 -3
- package/dist/cjs/components/form/utils.js +15 -34
- package/dist/cjs/components/grid/Grid.js +44 -43
- package/dist/cjs/components/grid/GridItem.js +92 -86
- package/dist/cjs/components/image/Image.js +76 -79
- package/dist/cjs/components/image/tokens.js +5 -3
- package/dist/cjs/components/image-preview/ImagePreview.js +125 -113
- package/dist/cjs/components/image-preview/imperative.js +4 -13
- package/dist/cjs/components/image-preview/tokens.js +3 -1
- package/dist/cjs/components/index.js +13 -0
- package/dist/cjs/components/input/Input.js +40 -35
- package/dist/cjs/components/loading/Loading.js +32 -33
- package/dist/cjs/components/nav-bar/NavBar.js +88 -100
- package/dist/cjs/components/nav-bar/tokens.js +4 -10
- package/dist/cjs/components/notice-bar/NoticeBar.js +81 -80
- package/dist/cjs/components/notice-bar/tokens.js +3 -1
- package/dist/cjs/components/notify/Notify.js +89 -84
- package/dist/cjs/components/notify/imperative.js +32 -55
- package/dist/cjs/components/notify/tokens.js +2 -11
- package/dist/cjs/components/number-keyboard/NumberKeyboard.js +277 -283
- package/dist/cjs/components/number-keyboard/tokens.js +7 -1
- package/dist/cjs/components/overlay/Overlay.js +37 -52
- package/dist/cjs/components/overlay/tokens.js +5 -3
- package/dist/cjs/components/password-input/PasswordInput.js +114 -95
- package/dist/cjs/components/picker/Picker.js +465 -454
- package/dist/cjs/components/picker/tokens.js +1 -1
- package/dist/cjs/components/popup/Popup.js +269 -299
- package/dist/cjs/components/popup/tokens.js +1 -0
- package/dist/cjs/components/portal/Portal.js +12 -30
- package/dist/cjs/components/portal/PortalHost.js +151 -234
- package/dist/cjs/components/progress/Progress.js +103 -101
- package/dist/cjs/components/progress/tokens.js +1 -0
- package/dist/cjs/components/radio/Radio.js +98 -91
- package/dist/cjs/components/radio/RadioGroup.js +13 -45
- package/dist/cjs/components/radio/tokens.js +7 -10
- package/dist/cjs/components/safe-area-view/SafeAreaView.js +22 -26
- package/dist/cjs/components/search/Search.js +65 -57
- package/dist/cjs/components/selector/Selector.js +21 -27
- package/dist/cjs/components/share-sheet/ShareSheet.js +165 -161
- package/dist/cjs/components/share-sheet/tokens.js +3 -1
- package/dist/cjs/components/sidebar/Sidebar.js +51 -51
- package/dist/cjs/components/sidebar/SidebarContext.js +1 -2
- package/dist/cjs/components/sidebar/SidebarItem.js +19 -21
- package/dist/cjs/components/sidebar/tokens.js +4 -4
- package/dist/cjs/components/skeleton/Skeleton.js +71 -77
- package/dist/cjs/components/skeleton/tokens.js +1 -2
- package/dist/cjs/components/slider/Slider.js +156 -135
- package/dist/cjs/components/space/Space.js +57 -76
- package/dist/cjs/components/space/tokens.js +7 -1
- package/dist/cjs/components/stepper/Stepper.js +182 -158
- package/dist/cjs/components/stepper/tokens.js +1 -0
- package/dist/cjs/components/swiper/Swiper.js +256 -255
- package/dist/cjs/components/swiper/SwiperPagIndicator.js +26 -27
- package/dist/cjs/components/swiper/tokens.js +10 -3
- package/dist/cjs/components/switch/Switch.js +23 -25
- package/dist/cjs/components/tabbar/Tabbar.js +48 -40
- package/dist/cjs/components/tabbar/TabbarContext.js +1 -2
- package/dist/cjs/components/tabbar/TabbarItem.js +65 -68
- package/dist/cjs/components/tabs/Tabs.js +402 -439
- package/dist/cjs/components/tabs/tokens.js +3 -1
- package/dist/cjs/components/tag/Tag.js +68 -59
- package/dist/cjs/components/toast/Toast.js +91 -90
- package/dist/cjs/components/toast/imperative.js +16 -41
- package/dist/cjs/components/toast/tokens.js +1 -0
- package/dist/cjs/components/typography/Typography.js +25 -25
- package/dist/cjs/components/water-mark/WaterMark.js +80 -78
- package/dist/cjs/design-system/Text.js +38 -0
- package/dist/cjs/design-system/ThemeProvider.js +5 -11
- package/dist/cjs/design-system/createComponentTokensHook.js +11 -13
- package/dist/cjs/design-system/index.js +7 -0
- package/dist/cjs/design-system/mergeTokensOverride.js +1 -4
- package/dist/cjs/design-system/presets.js +2 -3
- package/dist/cjs/design-system/tokens.js +2 -11
- package/dist/cjs/hooks/animation/index.js +25 -0
- package/dist/cjs/hooks/animation/useAnimatedTransition.js +72 -0
- package/dist/cjs/hooks/animation/useReducedMotion.js +75 -0
- package/dist/cjs/hooks/aria/useAriaListBox.js +8 -16
- package/dist/cjs/hooks/aria/useAriaOverlay.js +3 -3
- package/dist/cjs/hooks/aria/useAriaPress.js +8 -21
- package/dist/cjs/hooks/aria/useAriaToggle.js +3 -3
- package/dist/cjs/hooks/gesture/useGestureScroll.js +60 -61
- package/dist/cjs/hooks/index.js +12 -0
- package/dist/cjs/hooks/overlay/OverlayStackStore.js +49 -69
- package/dist/cjs/hooks/overlay/useOverlayStack.js +13 -19
- package/dist/cjs/hooks/useControllableValue.js +13 -24
- package/dist/cjs/hooks/useCountDown.js +30 -38
- package/dist/cjs/hooks/useHairline.js +17 -29
- package/dist/cjs/hooks/useSafeAreaPadding.js +1 -4
- package/dist/cjs/index.js +67 -1
- package/dist/cjs/platform/animation.js +10 -2
- package/dist/cjs/platform/measure.js +21 -37
- package/dist/cjs/utils/color.js +20 -39
- package/dist/cjs/utils/compare.js +7 -12
- package/dist/cjs/utils/createPlatformShadow.js +28 -39
- package/dist/cjs/utils/date.js +20 -50
- package/dist/cjs/utils/deepMerge.js +16 -26
- package/dist/cjs/utils/hairline.js +75 -71
- package/dist/cjs/utils/index.js +22 -0
- package/dist/cjs/utils/number.js +21 -29
- package/dist/cjs/utils/render.js +21 -0
- package/dist/cjs/utils/rtl.js +25 -0
- package/dist/cjs/utils/string.js +8 -25
- package/dist/cjs/utils/validate.js +2 -4
- package/dist/es/components/action-sheet/ActionSheet.js +130 -144
- package/dist/es/components/action-sheet/tokens.js +16 -27
- package/dist/es/components/area/Area.js +58 -71
- package/dist/es/components/area/tokens.js +6 -3
- package/dist/es/components/avatar/Avatar.js +38 -36
- package/dist/es/components/avatar/index.js +1 -2
- package/dist/es/components/badge/Badge.js +70 -75
- package/dist/es/components/badge/tokens.js +6 -8
- package/dist/es/components/button/Button.js +136 -177
- package/dist/es/components/button/ButtonGroup.js +12 -46
- package/dist/es/components/button/tokens.js +2 -3
- package/dist/es/components/calendar/Calendar.js +214 -225
- package/dist/es/components/calendar/tokens.js +3 -3
- package/dist/es/components/cascader/Cascader.js +260 -270
- package/dist/es/components/cascader/tokens.js +2 -2
- package/dist/es/components/cascader/useCascaderExtend.js +25 -29
- package/dist/es/components/cell/Cell.js +95 -105
- package/dist/es/components/cell/CellGroup.js +37 -48
- package/dist/es/components/checkbox/Checkbox.js +141 -133
- package/dist/es/components/checkbox/CheckboxGroup.js +22 -52
- package/dist/es/components/checkbox/tokens.js +7 -10
- package/dist/es/components/circle/Circle.js +87 -73
- package/dist/es/components/collapse/Collapse.js +90 -105
- package/dist/es/components/config-provider/ConfigProvider.js +11 -4
- package/dist/es/components/config-provider/DirectionContext.js +2 -0
- package/dist/es/components/config-provider/index.js +1 -0
- package/dist/es/components/config-provider/locale/en-US.js +32 -0
- package/dist/es/components/config-provider/locale/zh-CN.js +32 -0
- package/dist/es/components/config-provider/useDirection.js +3 -0
- package/dist/es/components/count-down/CountDown.js +35 -30
- package/dist/es/components/datetime-picker/DatetimePicker.js +80 -104
- package/dist/es/components/datetime-picker/tokens.js +14 -3
- package/dist/es/components/dialog/Dialog.js +160 -121
- package/dist/es/components/dialog/imperative.js +24 -43
- package/dist/es/components/dialog/tokens.js +1 -0
- package/dist/es/components/divider/Divider.js +59 -63
- package/dist/es/components/empty/Empty.js +54 -52
- package/dist/es/components/error-boundary/ErrorBoundary.js +62 -0
- package/dist/es/components/error-boundary/index.js +1 -0
- package/dist/es/components/field/Field.js +109 -106
- package/dist/es/components/flex/Flex.js +32 -31
- package/dist/es/components/flex/FlexItem.js +28 -27
- package/dist/es/components/form/Form.js +179 -197
- package/dist/es/components/form/FormItem.js +86 -107
- package/dist/es/components/form/FormList.js +57 -45
- package/dist/es/components/form/tokens.js +6 -3
- package/dist/es/components/form/utils.js +15 -34
- package/dist/es/components/grid/Grid.js +44 -42
- package/dist/es/components/grid/GridItem.js +94 -87
- package/dist/es/components/image/Image.js +79 -82
- package/dist/es/components/image/tokens.js +5 -3
- package/dist/es/components/image-preview/ImagePreview.js +125 -113
- package/dist/es/components/image-preview/imperative.js +4 -13
- package/dist/es/components/image-preview/tokens.js +3 -1
- package/dist/es/components/index.js +3 -1
- package/dist/es/components/input/Input.js +41 -36
- package/dist/es/components/loading/Loading.js +34 -34
- package/dist/es/components/nav-bar/NavBar.js +88 -100
- package/dist/es/components/nav-bar/tokens.js +4 -4
- package/dist/es/components/notice-bar/NoticeBar.js +81 -79
- package/dist/es/components/notice-bar/tokens.js +3 -1
- package/dist/es/components/notify/Notify.js +93 -87
- package/dist/es/components/notify/imperative.js +33 -56
- package/dist/es/components/notify/tokens.js +2 -5
- package/dist/es/components/number-keyboard/NumberKeyboard.js +277 -283
- package/dist/es/components/number-keyboard/tokens.js +7 -1
- package/dist/es/components/overlay/Overlay.js +36 -51
- package/dist/es/components/overlay/tokens.js +5 -3
- package/dist/es/components/password-input/PasswordInput.js +114 -95
- package/dist/es/components/picker/Picker.js +465 -454
- package/dist/es/components/picker/tokens.js +1 -1
- package/dist/es/components/popup/Popup.js +269 -298
- package/dist/es/components/popup/tokens.js +1 -0
- package/dist/es/components/portal/Portal.js +13 -30
- package/dist/es/components/portal/PortalHost.js +152 -234
- package/dist/es/components/progress/Progress.js +103 -101
- package/dist/es/components/progress/tokens.js +1 -0
- package/dist/es/components/radio/Radio.js +100 -93
- package/dist/es/components/radio/RadioGroup.js +15 -46
- package/dist/es/components/radio/tokens.js +7 -10
- package/dist/es/components/safe-area-view/SafeAreaView.js +22 -25
- package/dist/es/components/search/Search.js +66 -58
- package/dist/es/components/selector/Selector.js +21 -27
- package/dist/es/components/share-sheet/ShareSheet.js +167 -163
- package/dist/es/components/share-sheet/tokens.js +3 -1
- package/dist/es/components/sidebar/Sidebar.js +53 -53
- package/dist/es/components/sidebar/SidebarContext.js +1 -2
- package/dist/es/components/sidebar/SidebarItem.js +19 -20
- package/dist/es/components/sidebar/tokens.js +4 -4
- package/dist/es/components/skeleton/Skeleton.js +71 -77
- package/dist/es/components/skeleton/tokens.js +1 -2
- package/dist/es/components/slider/Slider.js +156 -134
- package/dist/es/components/space/Space.js +59 -78
- package/dist/es/components/space/tokens.js +7 -1
- package/dist/es/components/stepper/Stepper.js +183 -159
- package/dist/es/components/stepper/tokens.js +1 -0
- package/dist/es/components/swiper/Swiper.js +258 -257
- package/dist/es/components/swiper/SwiperPagIndicator.js +26 -27
- package/dist/es/components/swiper/tokens.js +10 -3
- package/dist/es/components/switch/Switch.js +23 -25
- package/dist/es/components/tabbar/Tabbar.js +49 -41
- package/dist/es/components/tabbar/TabbarContext.js +1 -2
- package/dist/es/components/tabbar/TabbarItem.js +66 -69
- package/dist/es/components/tabs/Tabs.js +403 -440
- package/dist/es/components/tabs/tokens.js +3 -1
- package/dist/es/components/tag/Tag.js +71 -61
- package/dist/es/components/toast/Toast.js +94 -91
- package/dist/es/components/toast/imperative.js +16 -41
- package/dist/es/components/toast/tokens.js +1 -0
- package/dist/es/components/typography/Typography.js +25 -25
- package/dist/es/components/water-mark/WaterMark.js +81 -79
- package/dist/es/design-system/Text.js +19 -0
- package/dist/es/design-system/ThemeProvider.js +5 -11
- package/dist/es/design-system/createComponentTokensHook.js +11 -13
- package/dist/es/design-system/index.js +1 -0
- package/dist/es/design-system/mergeTokensOverride.js +1 -4
- package/dist/es/design-system/presets.js +2 -3
- package/dist/es/design-system/tokens.js +1 -9
- package/dist/es/hooks/animation/index.js +2 -0
- package/dist/es/hooks/animation/useAnimatedTransition.js +53 -0
- package/dist/es/hooks/animation/useReducedMotion.js +54 -0
- package/dist/es/hooks/aria/useAriaListBox.js +8 -16
- package/dist/es/hooks/aria/useAriaOverlay.js +3 -3
- package/dist/es/hooks/aria/useAriaPress.js +8 -21
- package/dist/es/hooks/aria/useAriaToggle.js +3 -3
- package/dist/es/hooks/gesture/useGestureScroll.js +60 -61
- package/dist/es/hooks/index.js +1 -0
- package/dist/es/hooks/overlay/OverlayStackStore.js +49 -69
- package/dist/es/hooks/overlay/useOverlayStack.js +13 -19
- package/dist/es/hooks/useControllableValue.js +13 -24
- package/dist/es/hooks/useCountDown.js +30 -38
- package/dist/es/hooks/useHairline.js +16 -28
- package/dist/es/hooks/useSafeAreaPadding.js +1 -4
- package/dist/es/index.js +8 -1
- package/dist/es/platform/animation.js +9 -1
- package/dist/es/platform/measure.js +21 -37
- package/dist/es/utils/color.js +18 -35
- package/dist/es/utils/compare.js +7 -12
- package/dist/es/utils/createPlatformShadow.js +28 -39
- package/dist/es/utils/date.js +20 -50
- package/dist/es/utils/deepMerge.js +16 -26
- package/dist/es/utils/hairline.js +74 -65
- package/dist/es/utils/index.js +2 -0
- package/dist/es/utils/number.js +21 -29
- package/dist/es/utils/render.js +7 -0
- package/dist/es/utils/rtl.js +17 -0
- package/dist/es/utils/string.js +8 -25
- package/dist/es/utils/validate.js +1 -2
- package/dist/types/components/action-sheet/ActionSheet.d.ts +1 -1
- package/dist/types/components/area/Area.d.ts +1 -1
- package/dist/types/components/area/tokens.d.ts +4 -0
- package/dist/types/components/avatar/Avatar.d.ts +1 -1
- package/dist/types/components/avatar/index.d.ts +1 -2
- package/dist/types/components/badge/Badge.d.ts +1 -1
- package/dist/types/components/button/Button.d.ts +1 -1
- package/dist/types/components/button/index.d.ts +1 -1
- package/dist/types/components/calendar/Calendar.d.ts +1 -1
- package/dist/types/components/cascader/Cascader.d.ts +1 -1
- package/dist/types/components/cell/Cell.d.ts +1 -1
- package/dist/types/components/cell/CellGroup.d.ts +1 -1
- package/dist/types/components/cell/index.d.ts +2 -2
- package/dist/types/components/checkbox/Checkbox.d.ts +1 -1
- package/dist/types/components/circle/Circle.d.ts +1 -1
- package/dist/types/components/collapse/Collapse.d.ts +1 -2
- package/dist/types/components/config-provider/DirectionContext.d.ts +3 -0
- package/dist/types/components/config-provider/index.d.ts +2 -1
- package/dist/types/components/config-provider/locale/en-US.d.ts +32 -0
- package/dist/types/components/config-provider/locale/zh-CN.d.ts +32 -0
- package/dist/types/components/config-provider/useDirection.d.ts +1 -0
- package/dist/types/components/count-down/CountDown.d.ts +1 -1
- package/dist/types/components/datetime-picker/DatetimePicker.d.ts +1 -1
- package/dist/types/components/datetime-picker/tokens.d.ts +12 -0
- package/dist/types/components/dialog/Dialog.d.ts +1 -1
- package/dist/types/components/dialog/tokens.d.ts +1 -0
- package/dist/types/components/divider/Divider.d.ts +1 -1
- package/dist/types/components/empty/Empty.d.ts +1 -1
- package/dist/types/components/error-boundary/ErrorBoundary.d.ts +6 -0
- package/dist/types/components/error-boundary/index.d.ts +2 -0
- package/dist/types/components/field/Field.d.ts +1 -1
- package/dist/types/components/flex/Flex.d.ts +1 -1
- package/dist/types/components/flex/FlexItem.d.ts +1 -1
- package/dist/types/components/flex/index.d.ts +2 -2
- package/dist/types/components/form/Form.d.ts +1 -1
- package/dist/types/components/form/FormItem.d.ts +2 -1
- package/dist/types/components/form/index.d.ts +2 -2
- package/dist/types/components/form/tokens.d.ts +4 -0
- package/dist/types/components/grid/Grid.d.ts +1 -1
- package/dist/types/components/grid/GridItem.d.ts +1 -1
- package/dist/types/components/grid/index.d.ts +2 -2
- package/dist/types/components/image/Image.d.ts +1 -1
- package/dist/types/components/image-preview/ImagePreview.d.ts +1 -1
- package/dist/types/components/image-preview/tokens.d.ts +1 -0
- package/dist/types/components/index.d.ts +4 -1
- package/dist/types/components/input/Input.d.ts +3 -3
- package/dist/types/components/loading/Loading.d.ts +1 -1
- package/dist/types/components/nav-bar/NavBar.d.ts +1 -1
- package/dist/types/components/nav-bar/tokens.d.ts +1 -1
- package/dist/types/components/notice-bar/NoticeBar.d.ts +1 -1
- package/dist/types/components/notice-bar/tokens.d.ts +1 -0
- package/dist/types/components/notify/Notify.d.ts +2 -2
- package/dist/types/components/notify/index.d.ts +1 -1
- package/dist/types/components/number-keyboard/tokens.d.ts +5 -0
- package/dist/types/components/overlay/Overlay.d.ts +1 -5
- package/dist/types/components/overlay/tokens.d.ts +3 -0
- package/dist/types/components/password-input/PasswordInput.d.ts +1 -1
- package/dist/types/components/picker/Picker.d.ts +6 -6
- package/dist/types/components/popup/Popup.d.ts +3 -42
- package/dist/types/components/popup/tokens.d.ts +1 -0
- package/dist/types/components/portal/Portal.d.ts +9 -6
- package/dist/types/components/portal/PortalHost.d.ts +1 -1
- package/dist/types/components/radio/RadioGroup.d.ts +1 -1
- package/dist/types/components/safe-area-view/SafeAreaView.d.ts +1 -1
- package/dist/types/components/search/Search.d.ts +1 -1
- package/dist/types/components/share-sheet/ShareSheet.d.ts +1 -1
- package/dist/types/components/share-sheet/tokens.d.ts +1 -0
- package/dist/types/components/sidebar/Sidebar.d.ts +1 -1
- package/dist/types/components/sidebar/SidebarContext.d.ts +1 -1
- package/dist/types/components/sidebar/SidebarItem.d.ts +1 -1
- package/dist/types/components/sidebar/index.d.ts +2 -2
- package/dist/types/components/skeleton/Skeleton.d.ts +1 -1
- package/dist/types/components/slider/Slider.d.ts +1 -1
- package/dist/types/components/stepper/Stepper.d.ts +1 -1
- package/dist/types/components/stepper/tokens.d.ts +1 -0
- package/dist/types/components/swiper/Swiper.d.ts +1 -1
- package/dist/types/components/swiper/index.d.ts +1 -1
- package/dist/types/components/swiper/tokens.d.ts +8 -0
- package/dist/types/components/tabbar/Tabbar.d.ts +2 -2
- package/dist/types/components/tabbar/TabbarContext.d.ts +1 -1
- package/dist/types/components/tabbar/TabbarItem.d.ts +2 -2
- package/dist/types/components/tabs/Tabs.d.ts +1 -1
- package/dist/types/components/tabs/index.d.ts +1 -1
- package/dist/types/components/tabs/tokens.d.ts +1 -0
- package/dist/types/components/tag/Tag.d.ts +1 -1
- package/dist/types/components/toast/Toast.d.ts +2 -2
- package/dist/types/components/toast/index.d.ts +1 -1
- package/dist/types/components/toast/tokens.d.ts +1 -0
- package/dist/types/components/water-mark/WaterMark.d.ts +1 -1
- package/dist/types/design-system/Text.d.ts +3 -0
- package/dist/types/design-system/index.d.ts +1 -0
- package/dist/types/design-system/tokens.d.ts +0 -1
- package/dist/types/hooks/animation/index.d.ts +3 -0
- package/dist/types/hooks/animation/useAnimatedTransition.d.ts +13 -0
- package/dist/types/hooks/animation/useReducedMotion.d.ts +3 -0
- package/dist/types/hooks/aria/useAriaOverlay.d.ts +1 -1
- package/dist/types/hooks/gesture/useGestureScroll.d.ts +11 -10
- package/dist/types/hooks/index.d.ts +1 -0
- package/dist/types/hooks/overlay/OverlayStackStore.d.ts +8 -8
- package/dist/types/hooks/useCountDown.d.ts +1 -1
- package/dist/types/hooks/useHairline.d.ts +1 -1
- package/dist/types/index.d.ts +5 -0
- package/dist/types/platform/animation.d.ts +8 -0
- package/dist/types/platform/measure.d.ts +1 -1
- package/dist/types/utils/color.d.ts +0 -2
- package/dist/types/utils/compare.d.ts +1 -1
- package/dist/types/utils/createPlatformShadow.d.ts +2 -2
- package/dist/types/utils/date.d.ts +2 -2
- package/dist/types/utils/hairline.d.ts +5 -10
- package/dist/types/utils/index.d.ts +2 -0
- package/dist/types/utils/number.d.ts +2 -2
- package/dist/types/utils/render.d.ts +5 -0
- package/dist/types/utils/rtl.d.ts +5 -0
- package/dist/types/utils/validate.d.ts +0 -1
- package/package.json +25 -4
|
@@ -2,130 +2,115 @@ function _extends() { return _extends = Object.assign ? Object.assign.bind() : f
|
|
|
2
2
|
import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
3
3
|
import { Pressable, Text, View, Platform, StyleSheet, ScrollView, PanResponder } from 'react-native';
|
|
4
4
|
import Loading from '../loading';
|
|
5
|
+
import { useLocale } from '../config-provider/useLocale';
|
|
5
6
|
import { withAlpha } from '../../utils/color';
|
|
6
7
|
import { isFiniteNumber, isText } from '../../utils/validate';
|
|
7
8
|
import { clamp, isObject, shallowEqualArray } from '../../utils';
|
|
8
9
|
import { usePickerTokens } from './tokens';
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
if (value === undefined || value === null) return [];
|
|
12
|
-
return [value];
|
|
13
|
-
};
|
|
10
|
+
import { createHairlineView } from '../../utils/hairline';
|
|
11
|
+
export const toArrayValue = value => Array.isArray(value) ? value.filter(v => v !== undefined && v !== null) : value == null ? [] : [value];
|
|
14
12
|
const isColumnWithOptions = col => !!col && isObject(col) && 'options' in col && Array.isArray(col.options);
|
|
15
|
-
const hasChildren = option =>
|
|
16
|
-
|
|
17
|
-
};
|
|
18
|
-
export const findEnabledIndex = (options, startIndex) => {
|
|
13
|
+
const hasChildren = option => !!option && isObject(option) && Array.isArray(option.children) && option.children.length > 0;
|
|
14
|
+
export const findEnabledIndex = (options, startIdx) => {
|
|
19
15
|
if (!options.length) return -1;
|
|
20
|
-
const
|
|
21
|
-
if (!options[
|
|
22
|
-
for (let i =
|
|
16
|
+
const clampIdx = Math.min(Math.max(startIdx, 0), options.length - 1);
|
|
17
|
+
if (!options[clampIdx]?.disabled) return clampIdx;
|
|
18
|
+
for (let i = clampIdx + 1; i < options.length; i += 1) {
|
|
23
19
|
if (!options[i]?.disabled) return i;
|
|
24
20
|
}
|
|
25
|
-
for (let i =
|
|
21
|
+
for (let i = clampIdx - 1; i >= 0; i -= 1) {
|
|
26
22
|
if (!options[i]?.disabled) return i;
|
|
27
23
|
}
|
|
28
24
|
return -1;
|
|
29
25
|
};
|
|
30
|
-
const normalizeMultiple = (
|
|
31
|
-
const
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
const
|
|
35
|
-
const
|
|
36
|
-
const
|
|
37
|
-
const
|
|
38
|
-
const
|
|
39
|
-
const
|
|
40
|
-
const valid =
|
|
41
|
-
|
|
42
|
-
|
|
26
|
+
const normalizeMultiple = (cols, defs, raw) => {
|
|
27
|
+
const vals = [],
|
|
28
|
+
opts = [];
|
|
29
|
+
cols.forEach((colOpts, idx) => {
|
|
30
|
+
const curr = raw[idx];
|
|
31
|
+
const defIdx = defs[idx] !== undefined ? colOpts.findIndex(item => item.value === defs[idx]) : -1;
|
|
32
|
+
const currIdx = colOpts.findIndex(item => item.value === curr);
|
|
33
|
+
const startIdx = currIdx >= 0 ? currIdx : defIdx >= 0 ? defIdx : 0;
|
|
34
|
+
const tgtIdx = findEnabledIndex(colOpts, startIdx);
|
|
35
|
+
const tgt = tgtIdx >= 0 ? colOpts[tgtIdx] : undefined;
|
|
36
|
+
const valid = currIdx >= 0 && !colOpts[currIdx]?.disabled;
|
|
37
|
+
vals[idx] = valid ? curr : tgt?.value ?? defs[idx] ?? colOpts[0]?.value;
|
|
38
|
+
opts[idx] = tgt;
|
|
43
39
|
});
|
|
44
40
|
return {
|
|
45
|
-
columns:
|
|
46
|
-
values,
|
|
47
|
-
options
|
|
41
|
+
columns: cols,
|
|
42
|
+
values: vals,
|
|
43
|
+
options: opts
|
|
48
44
|
};
|
|
49
45
|
};
|
|
50
|
-
const normalizeCascade = (
|
|
51
|
-
const
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
let
|
|
55
|
-
let
|
|
56
|
-
while (
|
|
57
|
-
|
|
58
|
-
const
|
|
59
|
-
const
|
|
60
|
-
const
|
|
61
|
-
const
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
if (
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
} else
|
|
68
|
-
break;
|
|
69
|
-
}
|
|
46
|
+
const normalizeCascade = (root, raw) => {
|
|
47
|
+
const cols = [],
|
|
48
|
+
vals = [],
|
|
49
|
+
opts = [];
|
|
50
|
+
let curr = root;
|
|
51
|
+
let d = 0;
|
|
52
|
+
while (curr && curr.length && d < 10) {
|
|
53
|
+
cols.push(curr);
|
|
54
|
+
const c = raw[d];
|
|
55
|
+
const startIdx = curr.findIndex(item => item.value === c || String(item.value) === String(c));
|
|
56
|
+
const tgtIdx = findEnabledIndex(curr, startIdx >= 0 ? startIdx : 0);
|
|
57
|
+
const tgt = tgtIdx >= 0 ? curr[tgtIdx] : curr[0];
|
|
58
|
+
vals[d] = tgt?.value;
|
|
59
|
+
opts[d] = tgt;
|
|
60
|
+
if (tgt && hasChildren(tgt)) {
|
|
61
|
+
curr = tgt.children;
|
|
62
|
+
d += 1;
|
|
63
|
+
} else break;
|
|
70
64
|
}
|
|
71
65
|
return {
|
|
72
|
-
columns,
|
|
73
|
-
values,
|
|
74
|
-
options
|
|
66
|
+
columns: cols,
|
|
67
|
+
values: vals,
|
|
68
|
+
options: opts
|
|
75
69
|
};
|
|
76
70
|
};
|
|
77
|
-
export const prepareColumns = (
|
|
78
|
-
if (!Array.isArray(
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
const c = col;
|
|
110
|
-
columnsList.push(c.options ?? []);
|
|
111
|
-
defaults.push(c.defaultValue);
|
|
112
|
-
}
|
|
113
|
-
});
|
|
114
|
-
}
|
|
71
|
+
export const prepareColumns = (input = []) => {
|
|
72
|
+
if (!Array.isArray(input) || input.length === 0) return {
|
|
73
|
+
type: 'single',
|
|
74
|
+
columnsList: [],
|
|
75
|
+
defaults: [],
|
|
76
|
+
cascadeRoot: []
|
|
77
|
+
};
|
|
78
|
+
const everyPlain = input.every(item => !Array.isArray(item) && !isColumnWithOptions(item));
|
|
79
|
+
const cascade = everyPlain && input.some(item => hasChildren(item));
|
|
80
|
+
if (cascade) return {
|
|
81
|
+
type: 'cascade',
|
|
82
|
+
columnsList: [],
|
|
83
|
+
defaults: [],
|
|
84
|
+
cascadeRoot: input
|
|
85
|
+
};
|
|
86
|
+
const asArray = input;
|
|
87
|
+
const cols = [],
|
|
88
|
+
defs = [];
|
|
89
|
+
const treatAsSingle = everyPlain && !cascade;
|
|
90
|
+
if (treatAsSingle) {
|
|
91
|
+
cols.push(input);
|
|
92
|
+
defs.push(undefined);
|
|
93
|
+
} else asArray.forEach(col => {
|
|
94
|
+
if (Array.isArray(col)) {
|
|
95
|
+
cols.push(col);
|
|
96
|
+
defs.push(undefined);
|
|
97
|
+
} else if (isColumnWithOptions(col)) {
|
|
98
|
+
const c = col;
|
|
99
|
+
cols.push(c.options ?? []);
|
|
100
|
+
defs.push(c.defaultValue);
|
|
101
|
+
}
|
|
102
|
+
});
|
|
115
103
|
return {
|
|
116
104
|
type: 'multiple',
|
|
117
|
-
columnsList,
|
|
118
|
-
defaults
|
|
105
|
+
columnsList: cols,
|
|
106
|
+
defaults: defs
|
|
119
107
|
};
|
|
120
108
|
};
|
|
121
|
-
export const normalizePicker = (
|
|
122
|
-
const
|
|
123
|
-
|
|
124
|
-
return normalizeCascade(prepared.cascadeRoot, rawValue);
|
|
125
|
-
}
|
|
126
|
-
return normalizeMultiple(prepared.columnsList, prepared.defaults, rawValue);
|
|
109
|
+
export const normalizePicker = (prep, raw = []) => {
|
|
110
|
+
const rawVal = Array.isArray(raw) ? raw : [];
|
|
111
|
+
return prep.type === 'cascade' && prep.cascadeRoot?.length ? normalizeCascade(prep.cascadeRoot, rawVal) : normalizeMultiple(prep.columnsList, prep.defaults, rawVal);
|
|
127
112
|
};
|
|
128
|
-
const
|
|
113
|
+
const W = StyleSheet.create({
|
|
129
114
|
column: {
|
|
130
115
|
flex: 1
|
|
131
116
|
},
|
|
@@ -133,13 +118,10 @@ const wheelStyles = StyleSheet.create({
|
|
|
133
118
|
justifyContent: 'center',
|
|
134
119
|
alignItems: 'center'
|
|
135
120
|
},
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
borderTopWidth: StyleSheet.hairlineWidth,
|
|
141
|
-
borderBottomWidth: StyleSheet.hairlineWidth,
|
|
142
|
-
zIndex: 3
|
|
121
|
+
grab: {
|
|
122
|
+
cursor: 'pointer',
|
|
123
|
+
userSelect: 'none',
|
|
124
|
+
touchAction: 'none'
|
|
143
125
|
}
|
|
144
126
|
});
|
|
145
127
|
const WheelPickerItemInner = ({
|
|
@@ -155,44 +137,44 @@ const WheelPickerItemInner = ({
|
|
|
155
137
|
disabled
|
|
156
138
|
});
|
|
157
139
|
return /*#__PURE__*/React.createElement(View, {
|
|
158
|
-
style: [
|
|
140
|
+
style: [W.option, {
|
|
159
141
|
height: itemHeight
|
|
160
142
|
}]
|
|
161
143
|
}, content);
|
|
162
144
|
};
|
|
163
|
-
const WheelPickerItem = /*#__PURE__*/React.memo(WheelPickerItemInner
|
|
164
|
-
const getVelocityBucket =
|
|
165
|
-
const abs = Math.abs(
|
|
145
|
+
const WheelPickerItem = /*#__PURE__*/React.memo(WheelPickerItemInner);
|
|
146
|
+
const getVelocityBucket = v => {
|
|
147
|
+
const abs = Math.abs(v);
|
|
166
148
|
if (abs > 1.2) return 2;
|
|
167
149
|
if (abs > 0.6) return 1;
|
|
168
150
|
return 0;
|
|
169
151
|
};
|
|
170
|
-
const adjustIndex = (
|
|
171
|
-
const total =
|
|
152
|
+
const adjustIndex = (idx, opts) => {
|
|
153
|
+
const total = opts.length;
|
|
172
154
|
if (!total) return 0;
|
|
173
|
-
const i = clamp(
|
|
174
|
-
const next = findEnabledIndex(
|
|
155
|
+
const i = clamp(idx, 0, total - 1);
|
|
156
|
+
const next = findEnabledIndex(opts, i);
|
|
175
157
|
return next >= 0 ? next : i;
|
|
176
158
|
};
|
|
177
|
-
const indexToOffset = (
|
|
178
|
-
const offsetToIndex = (
|
|
179
|
-
const
|
|
180
|
-
const
|
|
181
|
-
let
|
|
182
|
-
|
|
183
|
-
const
|
|
159
|
+
const indexToOffset = (idx, h) => -idx * h;
|
|
160
|
+
const offsetToIndex = (off, h, total, opts) => {
|
|
161
|
+
const minOff = -Math.max(0, total - 1) * h;
|
|
162
|
+
const offClamped = clamp(off, minOff, 0);
|
|
163
|
+
let idx = Math.round(-offClamped / h);
|
|
164
|
+
idx = adjustIndex(idx, opts);
|
|
165
|
+
const snapOff = indexToOffset(idx, h);
|
|
184
166
|
return {
|
|
185
|
-
index,
|
|
186
|
-
snapOffset
|
|
167
|
+
index: idx,
|
|
168
|
+
snapOffset: snapOff
|
|
187
169
|
};
|
|
188
170
|
};
|
|
189
|
-
const shouldMomentum = (
|
|
190
|
-
const momentumTarget = (
|
|
191
|
-
const speed = Math.abs(
|
|
192
|
-
const extra = speed / 0.0025 * (
|
|
193
|
-
const
|
|
194
|
-
const
|
|
195
|
-
return indexToOffset(
|
|
171
|
+
const shouldMomentum = (dist, dur) => dur < 500 && Math.abs(dist) > 8;
|
|
172
|
+
const momentumTarget = (dist, dur, currOff, h, minOff) => {
|
|
173
|
+
const speed = Math.abs(dist / dur);
|
|
174
|
+
const extra = speed / 0.0025 * (dist < 0 ? -1 : 1);
|
|
175
|
+
const tgt = clamp(currOff + extra, minOff, 0);
|
|
176
|
+
const snapIdx = Math.round(-tgt / h);
|
|
177
|
+
return indexToOffset(snapIdx, h);
|
|
196
178
|
};
|
|
197
179
|
const WheelPickerInner = ({
|
|
198
180
|
data,
|
|
@@ -214,86 +196,89 @@ const WheelPickerInner = ({
|
|
|
214
196
|
swipeDuration = 300
|
|
215
197
|
}) => {
|
|
216
198
|
const isWeb = Platform.OS === 'web';
|
|
217
|
-
const listRef = useRef(null)
|
|
218
|
-
|
|
199
|
+
const listRef = useRef(null),
|
|
200
|
+
scrollRef = useRef(null);
|
|
219
201
|
const spacerHeight = visibleRest * itemHeight;
|
|
220
202
|
const total = data.length;
|
|
221
|
-
const
|
|
222
|
-
const
|
|
203
|
+
const maxIdx = Math.max(0, total - 1);
|
|
204
|
+
const minOff = -maxIdx * itemHeight;
|
|
223
205
|
const containerHeight = itemHeight * (visibleRest * 2 + 1);
|
|
224
|
-
const
|
|
225
|
-
const
|
|
226
|
-
const
|
|
227
|
-
const
|
|
228
|
-
const effectiveScrollThrottle = total >
|
|
229
|
-
const webVirtualEnabled = total >
|
|
206
|
+
const rawSelIdx = clamp(selectedIndex, 0, maxIdx);
|
|
207
|
+
const enabledSelIdx = findEnabledIndex(data, rawSelIdx);
|
|
208
|
+
const safeSelIdx = enabledSelIdx >= 0 ? enabledSelIdx : rawSelIdx;
|
|
209
|
+
const visibleCnt = visibleRest * 2 + 1;
|
|
210
|
+
const effectiveScrollThrottle = total > visibleCnt * 20 ? 32 : scrollEventThrottle;
|
|
211
|
+
const webVirtualEnabled = total > visibleCnt * 4;
|
|
230
212
|
const Spacer = useCallback(() => /*#__PURE__*/React.createElement(View, {
|
|
231
213
|
style: {
|
|
232
214
|
height: spacerHeight
|
|
233
215
|
}
|
|
234
216
|
}), [spacerHeight]);
|
|
235
|
-
const indicatorStyle = useMemo(() => [
|
|
217
|
+
const indicatorStyle = useMemo(() => [S.indicator, {
|
|
236
218
|
height: itemHeight,
|
|
237
|
-
top: itemHeight * visibleRest
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
const lastOffsetRef = useRef(0);
|
|
219
|
+
top: itemHeight * visibleRest
|
|
220
|
+
}], [itemHeight, visibleRest]);
|
|
221
|
+
const dragEndTimerRef = useRef(null),
|
|
222
|
+
momentumRef = useRef(false),
|
|
223
|
+
lastOffsetRef = useRef(0);
|
|
243
224
|
const clearDragEndTimer = useCallback(() => {
|
|
244
225
|
if (dragEndTimerRef.current) {
|
|
245
226
|
clearTimeout(dragEndTimerRef.current);
|
|
246
227
|
dragEndTimerRef.current = null;
|
|
247
228
|
}
|
|
248
229
|
}, []);
|
|
249
|
-
const
|
|
230
|
+
const emitIdx = useCallback((offsetY, animated) => {
|
|
250
231
|
if (readOnly) return;
|
|
251
232
|
const {
|
|
252
233
|
index,
|
|
253
234
|
snapOffset
|
|
254
235
|
} = offsetToIndex(-offsetY, itemHeight, total, data);
|
|
255
|
-
const
|
|
256
|
-
if (Math.abs(
|
|
236
|
+
const nextOff = -snapOffset;
|
|
237
|
+
if (Math.abs(nextOff - offsetY) > 0.5) {
|
|
257
238
|
listRef.current?.scrollToOffset({
|
|
258
|
-
offset:
|
|
239
|
+
offset: nextOff,
|
|
259
240
|
animated
|
|
260
241
|
});
|
|
261
242
|
}
|
|
262
243
|
onChange(index);
|
|
263
244
|
}, [data, itemHeight, onChange, readOnly, total]);
|
|
264
245
|
useEffect(() => {
|
|
265
|
-
const offset =
|
|
246
|
+
const offset = safeSelIdx * itemHeight;
|
|
266
247
|
if (isWeb) return;
|
|
267
248
|
scrollRef.current?.scrollTo({
|
|
268
249
|
y: offset,
|
|
269
250
|
animated: false
|
|
270
251
|
});
|
|
271
|
-
}, [isWeb, itemHeight,
|
|
272
|
-
const [webOffset, setWebOffset] = useState(() => indexToOffset(
|
|
273
|
-
const webOffsetRef = useRef(webOffset)
|
|
274
|
-
|
|
275
|
-
|
|
252
|
+
}, [isWeb, itemHeight, safeSelIdx]);
|
|
253
|
+
const [webOffset, setWebOffset] = useState(() => indexToOffset(safeSelIdx, itemHeight));
|
|
254
|
+
const webOffsetRef = useRef(webOffset),
|
|
255
|
+
startOffsetRef = useRef(0),
|
|
256
|
+
startTimeRef = useRef(0);
|
|
276
257
|
const [webTransition, setWebTransition] = useState(0);
|
|
277
258
|
const [webVelocityBucket, setWebVelocityBucket] = useState(0);
|
|
278
|
-
const webVelocityBucketRef = useRef(0)
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
const
|
|
259
|
+
const webVelocityBucketRef = useRef(0),
|
|
260
|
+
lastWheelTimeRef = useRef(null),
|
|
261
|
+
wheelDeltaRef = useRef(0),
|
|
262
|
+
wheelRafRef = useRef(null),
|
|
263
|
+
pendingIndexRef = useRef(null),
|
|
264
|
+
pendingTimerRef = useRef(null),
|
|
265
|
+
rafIdRef = useRef(null),
|
|
266
|
+
isInteractingRef = useRef(false);
|
|
267
|
+
const onInteractStartRef = useRef(onInteractStart);
|
|
268
|
+
onInteractStartRef.current = onInteractStart;
|
|
269
|
+
const onInteractEndRef = useRef(onInteractEnd);
|
|
270
|
+
onInteractEndRef.current = onInteractEnd;
|
|
271
|
+
const notifyStart = useCallback(() => {
|
|
287
272
|
if (readOnly) return;
|
|
288
273
|
if (isInteractingRef.current) return;
|
|
289
274
|
isInteractingRef.current = true;
|
|
290
|
-
|
|
291
|
-
}, [
|
|
292
|
-
const
|
|
275
|
+
onInteractStartRef.current?.();
|
|
276
|
+
}, [readOnly]);
|
|
277
|
+
const notifyEnd = useCallback(() => {
|
|
293
278
|
if (!isInteractingRef.current) return;
|
|
294
279
|
isInteractingRef.current = false;
|
|
295
|
-
|
|
296
|
-
}, [
|
|
280
|
+
onInteractEndRef.current?.();
|
|
281
|
+
}, []);
|
|
297
282
|
const stopRaf = useCallback(() => {
|
|
298
283
|
if (rafIdRef.current != null && typeof cancelAnimationFrame !== 'undefined') {
|
|
299
284
|
cancelAnimationFrame(rafIdRef.current);
|
|
@@ -338,44 +323,42 @@ const WheelPickerInner = ({
|
|
|
338
323
|
clearPendingTimer();
|
|
339
324
|
pendingIndexRef.current = null;
|
|
340
325
|
setWebTransition(0);
|
|
341
|
-
const next = indexToOffset(
|
|
326
|
+
const next = indexToOffset(safeSelIdx, itemHeight);
|
|
342
327
|
webOffsetRef.current = next;
|
|
343
328
|
setWebOffset(next);
|
|
344
|
-
}, [clearPendingTimer, isWeb, itemHeight,
|
|
329
|
+
}, [clearPendingTimer, isWeb, itemHeight, safeSelIdx, setWebTransition]);
|
|
345
330
|
const finalizePendingChange = useCallback(() => {
|
|
346
331
|
if (readOnly) return;
|
|
347
|
-
const
|
|
348
|
-
if (
|
|
332
|
+
const nextIdx = pendingIndexRef.current;
|
|
333
|
+
if (nextIdx == null) return;
|
|
349
334
|
pendingIndexRef.current = null;
|
|
350
335
|
clearPendingTimer();
|
|
351
336
|
setWebTransition(0);
|
|
352
|
-
|
|
353
|
-
onChange(
|
|
337
|
+
notifyEnd();
|
|
338
|
+
onChange(nextIdx);
|
|
354
339
|
}, [clearPendingTimer, onChange, readOnly, setWebTransition]);
|
|
355
|
-
const startWebSnap = useCallback(
|
|
340
|
+
const startWebSnap = useCallback(targetIdx => {
|
|
356
341
|
if (readOnly) return;
|
|
357
|
-
|
|
358
|
-
const
|
|
359
|
-
const
|
|
342
|
+
notifyStart();
|
|
343
|
+
const clampedIdx = clamp(targetIdx, 0, maxIdx);
|
|
344
|
+
const targetOff = indexToOffset(clampedIdx, itemHeight);
|
|
360
345
|
clearPendingTimer();
|
|
361
|
-
pendingIndexRef.current =
|
|
362
|
-
webOffsetRef.current =
|
|
346
|
+
pendingIndexRef.current = clampedIdx;
|
|
347
|
+
webOffsetRef.current = targetOff;
|
|
363
348
|
setWebTransition(swipeDuration);
|
|
364
|
-
setWebOffset(
|
|
349
|
+
setWebOffset(targetOff);
|
|
365
350
|
if (swipeDuration <= 0) {
|
|
366
351
|
finalizePendingChange();
|
|
367
352
|
} else {
|
|
368
353
|
pendingTimerRef.current = setTimeout(finalizePendingChange, swipeDuration + 80);
|
|
369
354
|
}
|
|
370
|
-
}, [clearPendingTimer, finalizePendingChange, itemHeight,
|
|
355
|
+
}, [clearPendingTimer, finalizePendingChange, itemHeight, maxIdx, readOnly, swipeDuration]);
|
|
371
356
|
const handleWheel = useCallback(event => {
|
|
372
357
|
if (readOnly) return;
|
|
373
358
|
const delta = event.nativeEvent?.deltaY ?? 0;
|
|
374
359
|
if (!delta) return;
|
|
375
360
|
wheelDeltaRef.current += delta;
|
|
376
|
-
if (wheelRafRef.current != null || typeof requestAnimationFrame === 'undefined')
|
|
377
|
-
return;
|
|
378
|
-
}
|
|
361
|
+
if (wheelRafRef.current != null || typeof requestAnimationFrame === 'undefined') return;
|
|
379
362
|
wheelRafRef.current = requestAnimationFrame(() => {
|
|
380
363
|
wheelRafRef.current = null;
|
|
381
364
|
const queued = wheelDeltaRef.current;
|
|
@@ -386,11 +369,11 @@ const WheelPickerInner = ({
|
|
|
386
369
|
const {
|
|
387
370
|
index
|
|
388
371
|
} = offsetToIndex(webOffsetRef.current, itemHeight, total, data);
|
|
389
|
-
const
|
|
390
|
-
startWebSnap(
|
|
372
|
+
const nextIdx = clamp(index + direction, 0, maxIdx);
|
|
373
|
+
startWebSnap(nextIdx);
|
|
391
374
|
});
|
|
392
|
-
}, [data, itemHeight,
|
|
393
|
-
const
|
|
375
|
+
}, [data, itemHeight, maxIdx, readOnly, startWebSnap, total, updateWheelVelocity]);
|
|
376
|
+
const webIdx = clamp(Math.round(-webOffset / itemHeight), 0, maxIdx);
|
|
394
377
|
const webRender = useMemo(() => {
|
|
395
378
|
if (!isWeb || total <= 0) {
|
|
396
379
|
return {
|
|
@@ -399,17 +382,17 @@ const WheelPickerInner = ({
|
|
|
399
382
|
bottomSpacer: null
|
|
400
383
|
};
|
|
401
384
|
}
|
|
402
|
-
let
|
|
403
|
-
let
|
|
385
|
+
let startIdx = 0;
|
|
386
|
+
let endIdx = maxIdx;
|
|
404
387
|
if (webVirtualEnabled) {
|
|
405
|
-
const baseBuffer = Math.max(
|
|
406
|
-
const velocityBoost = webVelocityBucket === 2 ?
|
|
407
|
-
const buffer = Math.min(baseBuffer + velocityBoost, Math.max(
|
|
408
|
-
|
|
409
|
-
|
|
388
|
+
const baseBuffer = Math.max(visibleCnt * 2, 8);
|
|
389
|
+
const velocityBoost = webVelocityBucket === 2 ? visibleCnt * 4 : webVelocityBucket === 1 ? visibleCnt * 2 : 0;
|
|
390
|
+
const buffer = Math.min(baseBuffer + velocityBoost, Math.max(visibleCnt * 6, 24));
|
|
391
|
+
startIdx = clamp(webIdx - buffer, 0, maxIdx);
|
|
392
|
+
endIdx = clamp(webIdx + buffer, 0, maxIdx);
|
|
410
393
|
}
|
|
411
394
|
const items = [];
|
|
412
|
-
for (let index =
|
|
395
|
+
for (let index = startIdx; index <= endIdx; index += 1) {
|
|
413
396
|
const item = data[index];
|
|
414
397
|
if (!item) continue;
|
|
415
398
|
items.push(/*#__PURE__*/React.createElement(WheelPickerItem, {
|
|
@@ -417,27 +400,27 @@ const WheelPickerInner = ({
|
|
|
417
400
|
item: item,
|
|
418
401
|
index: index,
|
|
419
402
|
itemHeight: itemHeight,
|
|
420
|
-
active: index ===
|
|
403
|
+
active: index === safeSelIdx,
|
|
421
404
|
disabled: !!item.disabled,
|
|
422
405
|
renderItem: renderItem
|
|
423
406
|
}));
|
|
424
407
|
}
|
|
425
|
-
const
|
|
426
|
-
const
|
|
408
|
+
const topH = startIdx * itemHeight;
|
|
409
|
+
const bottomH = (maxIdx - endIdx) * itemHeight;
|
|
427
410
|
return {
|
|
428
411
|
items,
|
|
429
|
-
topSpacer:
|
|
412
|
+
topSpacer: topH > 0 && /*#__PURE__*/React.createElement(View, {
|
|
430
413
|
style: {
|
|
431
|
-
height:
|
|
414
|
+
height: topH
|
|
432
415
|
}
|
|
433
416
|
}),
|
|
434
|
-
bottomSpacer:
|
|
417
|
+
bottomSpacer: bottomH > 0 && /*#__PURE__*/React.createElement(View, {
|
|
435
418
|
style: {
|
|
436
|
-
height:
|
|
419
|
+
height: bottomH
|
|
437
420
|
}
|
|
438
421
|
})
|
|
439
422
|
};
|
|
440
|
-
}, [data, isWeb, itemHeight,
|
|
423
|
+
}, [data, isWeb, itemHeight, maxIdx, renderItem, safeSelIdx, total, visibleCnt, webIdx, webVelocityBucket, webVirtualEnabled]);
|
|
441
424
|
const webTransform = useMemo(() => ({
|
|
442
425
|
transform: [{
|
|
443
426
|
translateY: webOffset
|
|
@@ -445,7 +428,7 @@ const WheelPickerInner = ({
|
|
|
445
428
|
}), [webOffset]);
|
|
446
429
|
const webTransitionStyle = useMemo(() => webTransition ? {
|
|
447
430
|
transitionProperty: 'transform',
|
|
448
|
-
transitionDuration:
|
|
431
|
+
transitionDuration: webTransition + 'ms',
|
|
449
432
|
transitionTimingFunction: 'cubic-bezier(0.23, 1, 0.68, 1)',
|
|
450
433
|
willChange: 'transform'
|
|
451
434
|
} : undefined, [webTransition]);
|
|
@@ -460,7 +443,7 @@ const WheelPickerInner = ({
|
|
|
460
443
|
onPanResponderGrant: () => {
|
|
461
444
|
stopRaf();
|
|
462
445
|
pendingIndexRef.current = null;
|
|
463
|
-
|
|
446
|
+
notifyStart();
|
|
464
447
|
setWebTransition(0);
|
|
465
448
|
startOffsetRef.current = webOffsetRef.current;
|
|
466
449
|
startTimeRef.current = Date.now();
|
|
@@ -468,7 +451,7 @@ const WheelPickerInner = ({
|
|
|
468
451
|
onPanResponderMove: (_, gesture) => {
|
|
469
452
|
if (readOnly) return;
|
|
470
453
|
setVelocityBucket(gesture.vy);
|
|
471
|
-
const next = clamp(startOffsetRef.current + gesture.dy,
|
|
454
|
+
const next = clamp(startOffsetRef.current + gesture.dy, minOff, 0);
|
|
472
455
|
webOffsetRef.current = next;
|
|
473
456
|
if (typeof requestAnimationFrame === 'undefined') {
|
|
474
457
|
setWebOffset(next);
|
|
@@ -485,9 +468,9 @@ const WheelPickerInner = ({
|
|
|
485
468
|
setVelocityBucket(0);
|
|
486
469
|
const duration = Date.now() - startTimeRef.current;
|
|
487
470
|
const distance = gesture.dy;
|
|
488
|
-
let target = clamp(startOffsetRef.current + distance,
|
|
471
|
+
let target = clamp(startOffsetRef.current + distance, minOff, 0);
|
|
489
472
|
if (shouldMomentum(distance, duration)) {
|
|
490
|
-
target = momentumTarget(distance, duration, startOffsetRef.current, itemHeight,
|
|
473
|
+
target = momentumTarget(distance, duration, startOffsetRef.current, itemHeight, minOff);
|
|
491
474
|
}
|
|
492
475
|
const {
|
|
493
476
|
index
|
|
@@ -496,37 +479,99 @@ const WheelPickerInner = ({
|
|
|
496
479
|
},
|
|
497
480
|
onPanResponderTerminationRequest: () => false,
|
|
498
481
|
onPanResponderTerminate: () => {
|
|
499
|
-
|
|
482
|
+
notifyEnd();
|
|
500
483
|
setWebTransition(0);
|
|
501
484
|
}
|
|
502
|
-
}), [data, itemHeight,
|
|
485
|
+
}), [data, itemHeight, minOff, notifyEnd, notifyStart, readOnly, setVelocityBucket, startWebSnap, stopRaf, total]);
|
|
486
|
+
const shouldCapture = !readOnly;
|
|
487
|
+
const handleResponderCapture = useCallback(() => shouldCapture, [shouldCapture]);
|
|
488
|
+
const nativeContainerStyle = useMemo(() => ({
|
|
489
|
+
paddingVertical: spacerHeight
|
|
490
|
+
}), [spacerHeight]);
|
|
491
|
+
const handleScroll = useCallback(e => {
|
|
492
|
+
lastOffsetRef.current = e.nativeEvent.contentOffset.y;
|
|
493
|
+
}, []);
|
|
494
|
+
const onDragStart = useCallback(() => {
|
|
495
|
+
momentumRef.current = false;
|
|
496
|
+
clearDragEndTimer();
|
|
497
|
+
notifyStart();
|
|
498
|
+
}, [clearDragEndTimer, notifyStart]);
|
|
499
|
+
const handleScrollEndDrag = useCallback(e => {
|
|
500
|
+
if (readOnly) return;
|
|
501
|
+
const y = e.nativeEvent.contentOffset.y;
|
|
502
|
+
lastOffsetRef.current = y;
|
|
503
|
+
clearDragEndTimer();
|
|
504
|
+
dragEndTimerRef.current = setTimeout(() => {
|
|
505
|
+
if (!momentumRef.current) {
|
|
506
|
+
emitIdx(lastOffsetRef.current, true);
|
|
507
|
+
notifyEnd();
|
|
508
|
+
}
|
|
509
|
+
}, 80);
|
|
510
|
+
}, [clearDragEndTimer, emitIdx, notifyEnd, readOnly]);
|
|
511
|
+
const handleMomentumScrollBegin = useCallback(() => {
|
|
512
|
+
momentumRef.current = true;
|
|
513
|
+
clearDragEndTimer();
|
|
514
|
+
notifyStart();
|
|
515
|
+
}, [clearDragEndTimer, notifyStart]);
|
|
516
|
+
const onMomEnd = useCallback(e => {
|
|
517
|
+
momentumRef.current = false;
|
|
518
|
+
clearDragEndTimer();
|
|
519
|
+
const y = e.nativeEvent.contentOffset.y;
|
|
520
|
+
lastOffsetRef.current = y;
|
|
521
|
+
emitIdx(y, false);
|
|
522
|
+
notifyEnd();
|
|
523
|
+
}, [clearDragEndTimer, emitIdx, notifyEnd]);
|
|
503
524
|
if (isWeb) {
|
|
504
525
|
return /*#__PURE__*/React.createElement(View, _extends({
|
|
505
|
-
style: [
|
|
526
|
+
style: [W.column, {
|
|
506
527
|
height: containerHeight
|
|
507
|
-
},
|
|
528
|
+
}, W.grab],
|
|
508
529
|
onWheel: handleWheel
|
|
509
530
|
}, panResponder.panHandlers), /*#__PURE__*/React.createElement(View, {
|
|
510
531
|
style: indicatorStyle,
|
|
511
532
|
pointerEvents: "none"
|
|
533
|
+
}, /*#__PURE__*/React.createElement(View, {
|
|
534
|
+
style: createHairlineView({
|
|
535
|
+
position: 'top',
|
|
536
|
+
color: indicatorColor,
|
|
537
|
+
left: 0,
|
|
538
|
+
right: 0
|
|
539
|
+
})
|
|
512
540
|
}), /*#__PURE__*/React.createElement(View, {
|
|
513
|
-
style:
|
|
541
|
+
style: createHairlineView({
|
|
542
|
+
position: 'bottom',
|
|
543
|
+
color: indicatorColor,
|
|
544
|
+
left: 0,
|
|
545
|
+
right: 0
|
|
546
|
+
})
|
|
547
|
+
})), /*#__PURE__*/React.createElement(View, {
|
|
548
|
+
style: [webTransform, webTransitionStyle],
|
|
514
549
|
onTransitionEnd: handleWebTransitionEnd
|
|
515
550
|
}, /*#__PURE__*/React.createElement(Spacer, null), webRender.topSpacer, webRender.items, webRender.bottomSpacer, /*#__PURE__*/React.createElement(Spacer, null)));
|
|
516
551
|
}
|
|
517
|
-
const shouldCapture = !readOnly;
|
|
518
|
-
const contentContainerStyle = useMemo(() => ({
|
|
519
|
-
paddingVertical: spacerHeight
|
|
520
|
-
}), [spacerHeight]);
|
|
521
552
|
return /*#__PURE__*/React.createElement(View, {
|
|
522
|
-
style: [
|
|
553
|
+
style: [W.column, {
|
|
523
554
|
height: containerHeight
|
|
524
555
|
}],
|
|
525
556
|
collapsable: false
|
|
526
557
|
}, /*#__PURE__*/React.createElement(View, {
|
|
527
558
|
style: indicatorStyle,
|
|
528
559
|
pointerEvents: "none"
|
|
529
|
-
}
|
|
560
|
+
}, /*#__PURE__*/React.createElement(View, {
|
|
561
|
+
style: createHairlineView({
|
|
562
|
+
position: 'top',
|
|
563
|
+
color: indicatorColor,
|
|
564
|
+
left: 0,
|
|
565
|
+
right: 0
|
|
566
|
+
})
|
|
567
|
+
}), /*#__PURE__*/React.createElement(View, {
|
|
568
|
+
style: createHairlineView({
|
|
569
|
+
position: 'bottom',
|
|
570
|
+
color: indicatorColor,
|
|
571
|
+
left: 0,
|
|
572
|
+
right: 0
|
|
573
|
+
})
|
|
574
|
+
})), /*#__PURE__*/React.createElement(ScrollView, {
|
|
530
575
|
ref: scrollRef,
|
|
531
576
|
showsVerticalScrollIndicator: false,
|
|
532
577
|
scrollEventThrottle: effectiveScrollThrottle,
|
|
@@ -536,61 +581,26 @@ const WheelPickerInner = ({
|
|
|
536
581
|
bounces: false,
|
|
537
582
|
overScrollMode: "never",
|
|
538
583
|
nestedScrollEnabled: true,
|
|
539
|
-
contentContainerStyle:
|
|
540
|
-
onStartShouldSetResponderCapture:
|
|
541
|
-
onMoveShouldSetResponderCapture:
|
|
542
|
-
onScroll:
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
clearDragEndTimer();
|
|
548
|
-
notifyInteractStart();
|
|
549
|
-
},
|
|
550
|
-
onScrollEndDrag: e => {
|
|
551
|
-
if (readOnly) return;
|
|
552
|
-
const y = e.nativeEvent.contentOffset.y;
|
|
553
|
-
lastOffsetRef.current = y;
|
|
554
|
-
clearDragEndTimer();
|
|
555
|
-
dragEndTimerRef.current = setTimeout(() => {
|
|
556
|
-
if (!momentumRef.current) {
|
|
557
|
-
emitIndexFromOffset(lastOffsetRef.current, true);
|
|
558
|
-
notifyInteractEnd();
|
|
559
|
-
}
|
|
560
|
-
}, 80);
|
|
561
|
-
},
|
|
562
|
-
onMomentumScrollBegin: () => {
|
|
563
|
-
momentumRef.current = true;
|
|
564
|
-
clearDragEndTimer();
|
|
565
|
-
notifyInteractStart();
|
|
566
|
-
},
|
|
567
|
-
onMomentumScrollEnd: e => {
|
|
568
|
-
momentumRef.current = false;
|
|
569
|
-
clearDragEndTimer();
|
|
570
|
-
const y = e.nativeEvent.contentOffset.y;
|
|
571
|
-
lastOffsetRef.current = y;
|
|
572
|
-
emitIndexFromOffset(y, false);
|
|
573
|
-
notifyInteractEnd();
|
|
574
|
-
},
|
|
584
|
+
contentContainerStyle: nativeContainerStyle,
|
|
585
|
+
onStartShouldSetResponderCapture: handleResponderCapture,
|
|
586
|
+
onMoveShouldSetResponderCapture: handleResponderCapture,
|
|
587
|
+
onScroll: handleScroll,
|
|
588
|
+
onScrollBeginDrag: onDragStart,
|
|
589
|
+
onScrollEndDrag: handleScrollEndDrag,
|
|
590
|
+
onMomentumScrollBegin: handleMomentumScrollBegin,
|
|
591
|
+
onMomentumScrollEnd: onMomEnd,
|
|
575
592
|
scrollEnabled: !readOnly
|
|
576
593
|
}, data.map((item, index) => /*#__PURE__*/React.createElement(WheelPickerItem, {
|
|
577
594
|
key: `${index}-${String(item.value ?? '')}`,
|
|
578
595
|
item: item,
|
|
579
596
|
index: index,
|
|
580
597
|
itemHeight: itemHeight,
|
|
581
|
-
active: index ===
|
|
598
|
+
active: index === safeSelIdx,
|
|
582
599
|
disabled: !!item.disabled,
|
|
583
600
|
renderItem: renderItem
|
|
584
601
|
}))));
|
|
585
602
|
};
|
|
586
603
|
const WheelPicker = /*#__PURE__*/React.memo(WheelPickerInner);
|
|
587
|
-
const webOnlyStyles = StyleSheet.create({
|
|
588
|
-
grab: {
|
|
589
|
-
cursor: 'pointer',
|
|
590
|
-
userSelect: 'none',
|
|
591
|
-
touchAction: 'none'
|
|
592
|
-
}
|
|
593
|
-
});
|
|
594
604
|
export function usePickerValue({
|
|
595
605
|
columns,
|
|
596
606
|
valueProp,
|
|
@@ -599,13 +609,15 @@ export function usePickerValue({
|
|
|
599
609
|
onChange,
|
|
600
610
|
onConfirm
|
|
601
611
|
}) {
|
|
602
|
-
const
|
|
612
|
+
const prep = useMemo(() => prepareColumns(columns), [columns]);
|
|
603
613
|
const isControlled = valueProp !== undefined;
|
|
604
|
-
const
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
614
|
+
const onChangeRef = useRef(onChange);
|
|
615
|
+
const onConfirmRef = useRef(onConfirm);
|
|
616
|
+
onChangeRef.current = onChange;
|
|
617
|
+
onConfirmRef.current = onConfirm;
|
|
618
|
+
const [innerValue, setInnerValue] = useState(() => normalizePicker(prep, toArrayValue(valueProp ?? defaultValue)).values);
|
|
608
619
|
const innerValueRef = useRef(innerValue);
|
|
620
|
+
innerValueRef.current = innerValue;
|
|
609
621
|
const commitValue = useCallback(next => {
|
|
610
622
|
innerValueRef.current = next;
|
|
611
623
|
setInnerValue(next);
|
|
@@ -613,91 +625,79 @@ export function usePickerValue({
|
|
|
613
625
|
useEffect(() => {
|
|
614
626
|
if (!isControlled) return;
|
|
615
627
|
const next = toArrayValue(valueProp);
|
|
616
|
-
if (!shallowEqualArray(innerValueRef.current, next))
|
|
617
|
-
commitValue(next);
|
|
618
|
-
}
|
|
628
|
+
if (!shallowEqualArray(innerValueRef.current, next)) commitValue(next);
|
|
619
629
|
}, [commitValue, isControlled, valueProp]);
|
|
620
|
-
const
|
|
630
|
+
const norm = useMemo(() => normalizePicker(prep, innerValue), [prep, innerValue]);
|
|
621
631
|
useEffect(() => {
|
|
622
632
|
if (isControlled) return;
|
|
623
|
-
if (!shallowEqualArray(innerValue,
|
|
624
|
-
commitValue(
|
|
625
|
-
|
|
626
|
-
if (emitConfirmOnAutoSelect)
|
|
627
|
-
onConfirm?.(normalized.values, normalized.options);
|
|
628
|
-
}
|
|
633
|
+
if (!shallowEqualArray(innerValue, norm.values)) {
|
|
634
|
+
commitValue(norm.values);
|
|
635
|
+
onChangeRef.current?.(norm.values, norm.options);
|
|
636
|
+
if (emitConfirmOnAutoSelect) onConfirmRef.current?.(norm.values, norm.options);
|
|
629
637
|
}
|
|
630
|
-
}, [commitValue, emitConfirmOnAutoSelect, innerValue, isControlled,
|
|
631
|
-
const handleSelect = useCallback((option,
|
|
638
|
+
}, [commitValue, emitConfirmOnAutoSelect, innerValue, isControlled, norm]);
|
|
639
|
+
const handleSelect = useCallback((option, colIdx) => {
|
|
632
640
|
const next = [...innerValueRef.current];
|
|
633
|
-
next[
|
|
634
|
-
if (
|
|
635
|
-
|
|
636
|
-
}
|
|
637
|
-
const final = normalizePicker(preparedColumns, next);
|
|
641
|
+
next[colIdx] = option.value;
|
|
642
|
+
if (prep.type === 'cascade') next.length = colIdx + 1;
|
|
643
|
+
const final = normalizePicker(prep, next);
|
|
638
644
|
if (shallowEqualArray(innerValueRef.current, final.values)) return;
|
|
639
645
|
commitValue(final.values);
|
|
640
|
-
|
|
641
|
-
}, [commitValue,
|
|
646
|
+
onChangeRef.current?.(final.values, final.options);
|
|
647
|
+
}, [commitValue, prep]);
|
|
642
648
|
const handleConfirm = useCallback(() => {
|
|
643
|
-
|
|
644
|
-
}, [
|
|
649
|
+
onConfirmRef.current?.(norm.values, norm.options);
|
|
650
|
+
}, [norm]);
|
|
645
651
|
return {
|
|
646
|
-
preparedColumns,
|
|
647
|
-
normalized,
|
|
652
|
+
preparedColumns: prep,
|
|
653
|
+
normalized: norm,
|
|
648
654
|
handleSelect,
|
|
649
655
|
handleConfirm
|
|
650
656
|
};
|
|
651
657
|
}
|
|
652
658
|
const getVisibleCount = count => {
|
|
653
|
-
const
|
|
654
|
-
return
|
|
659
|
+
const n = isFiniteNumber(count) ? Math.max(3, Math.floor(count)) : 5;
|
|
660
|
+
return n % 2 === 0 ? n + 1 : n;
|
|
655
661
|
};
|
|
656
662
|
const GRADIENT_OVERLAY_ALPHA = 0.25;
|
|
657
663
|
const GRADIENT_STEPS = [0.95, 0.75, 0.55, 0.35];
|
|
658
|
-
const GRADIENT_STEPS_REVERSED = [
|
|
664
|
+
const GRADIENT_STEPS_REVERSED = [0.35, 0.55, 0.75, 0.95];
|
|
659
665
|
const GradientMask = ({
|
|
660
666
|
height,
|
|
661
667
|
color,
|
|
662
668
|
position,
|
|
663
669
|
maskType
|
|
664
670
|
}) => {
|
|
665
|
-
const
|
|
666
|
-
const baseStyle = useMemo(() => [styles.gradientMask, {
|
|
671
|
+
const baseStyle = [S.gMask, {
|
|
667
672
|
height
|
|
668
673
|
}, position === 'top' ? {
|
|
669
674
|
top: 0
|
|
670
675
|
} : {
|
|
671
676
|
bottom: 0
|
|
672
|
-
}]
|
|
673
|
-
const overlayColor =
|
|
674
|
-
if (maskType === 'solid') {
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
}
|
|
682
|
-
if (isWeb) {
|
|
677
|
+
}];
|
|
678
|
+
const overlayColor = withAlpha(color, GRADIENT_OVERLAY_ALPHA);
|
|
679
|
+
if (maskType === 'solid') return /*#__PURE__*/React.createElement(View, {
|
|
680
|
+
pointerEvents: "none",
|
|
681
|
+
style: [...baseStyle, {
|
|
682
|
+
backgroundColor: withAlpha(color, 0.9)
|
|
683
|
+
}]
|
|
684
|
+
});
|
|
685
|
+
if (Platform.OS === 'web') {
|
|
683
686
|
const angle = position === 'top' ? '180deg' : '0deg';
|
|
684
|
-
const gradientStart = withAlpha(color, 0.98);
|
|
685
|
-
const gradientEnd = withAlpha(color, 0.4);
|
|
686
687
|
return /*#__PURE__*/React.createElement(View, {
|
|
687
688
|
pointerEvents: "none",
|
|
688
689
|
style: [...baseStyle, {
|
|
689
690
|
backgroundColor: overlayColor,
|
|
690
|
-
backgroundImage: `linear-gradient(${angle}, ${
|
|
691
|
+
backgroundImage: `linear-gradient(${angle}, ${withAlpha(color, 0.98)}, ${withAlpha(color, 0.4)})`
|
|
691
692
|
}]
|
|
692
693
|
});
|
|
693
694
|
}
|
|
694
|
-
const steps = position === 'top' ? GRADIENT_STEPS : GRADIENT_STEPS_REVERSED;
|
|
695
695
|
return /*#__PURE__*/React.createElement(View, {
|
|
696
696
|
pointerEvents: "none",
|
|
697
697
|
style: [...baseStyle, {
|
|
698
698
|
backgroundColor: overlayColor
|
|
699
699
|
}]
|
|
700
|
-
},
|
|
700
|
+
}, (position === 'top' ? GRADIENT_STEPS : GRADIENT_STEPS_REVERSED).map((opacity, idx) => /*#__PURE__*/React.createElement(View, {
|
|
701
701
|
key: idx,
|
|
702
702
|
style: {
|
|
703
703
|
flex: 1,
|
|
@@ -723,74 +723,85 @@ const PickerColumn = /*#__PURE__*/React.memo(props => {
|
|
|
723
723
|
swipeDuration
|
|
724
724
|
} = props;
|
|
725
725
|
const restVisible = Math.max(1, Math.floor((visibleItemCount - 1) / 2));
|
|
726
|
-
const valueIndexMap = useMemo(() => new Map(options.map((
|
|
727
|
-
const
|
|
726
|
+
const valueIndexMap = useMemo(() => new Map(options.map((opt, idx) => [opt.value, idx])), [options]);
|
|
727
|
+
const selIdx = useMemo(() => {
|
|
728
728
|
if (!options.length) return 0;
|
|
729
729
|
const idx = valueIndexMap.get(value);
|
|
730
|
-
const
|
|
731
|
-
return findEnabledIndex(options,
|
|
730
|
+
const startIdx = typeof idx === 'number' && idx >= 0 ? idx : 0;
|
|
731
|
+
return findEnabledIndex(options, startIdx);
|
|
732
732
|
}, [options, value, valueIndexMap]);
|
|
733
733
|
const handleChange = useCallback(index => {
|
|
734
|
-
const
|
|
735
|
-
const
|
|
736
|
-
if (!
|
|
737
|
-
onSelect(
|
|
734
|
+
const tgt = findEnabledIndex(options, index);
|
|
735
|
+
const opt = options[tgt];
|
|
736
|
+
if (!opt || opt.disabled) return;
|
|
737
|
+
onSelect(opt, columnIndex, tgt);
|
|
738
738
|
}, [columnIndex, onSelect, options]);
|
|
739
|
+
const {
|
|
740
|
+
text: cText,
|
|
741
|
+
textDisabled: cDisabled,
|
|
742
|
+
textMuted: cMuted
|
|
743
|
+
} = tokens.colors;
|
|
744
|
+
const optFont = {
|
|
745
|
+
fontSize: tokens.typography.optionSize,
|
|
746
|
+
fontFamily: tokens.typography.fontFamily,
|
|
747
|
+
fontWeight: tokens.typography.optionWeight
|
|
748
|
+
};
|
|
749
|
+
const renderItemStable = useCallback((item, _index, meta) => {
|
|
750
|
+
const {
|
|
751
|
+
active = false,
|
|
752
|
+
disabled = false
|
|
753
|
+
} = meta ?? {};
|
|
754
|
+
const clr = disabled ? cDisabled : active ? cText : cMuted;
|
|
755
|
+
const cnt = optionRender ? optionRender(item, {
|
|
756
|
+
columnIndex,
|
|
757
|
+
active
|
|
758
|
+
}) : item.label ?? item.value;
|
|
759
|
+
const testID = getOptionTestID?.(item, {
|
|
760
|
+
columnIndex,
|
|
761
|
+
active
|
|
762
|
+
});
|
|
763
|
+
const a11y = getOptionA11yLabel?.(item, {
|
|
764
|
+
columnIndex,
|
|
765
|
+
active
|
|
766
|
+
});
|
|
767
|
+
return /*#__PURE__*/React.createElement(View, {
|
|
768
|
+
style: [W.option, {
|
|
769
|
+
opacity: disabled ? 0.5 : 1,
|
|
770
|
+
minHeight: itemHeight
|
|
771
|
+
}],
|
|
772
|
+
testID: testID,
|
|
773
|
+
accessible: !!a11y,
|
|
774
|
+
accessibilityLabel: a11y
|
|
775
|
+
}, isText(cnt) ? /*#__PURE__*/React.createElement(Text, {
|
|
776
|
+
numberOfLines: 1,
|
|
777
|
+
style: [S.optTxt, optFont, {
|
|
778
|
+
color: clr
|
|
779
|
+
}]
|
|
780
|
+
}, cnt) : cnt);
|
|
781
|
+
}, [cText, cDisabled, cMuted, columnIndex, getOptionA11yLabel, getOptionTestID, itemHeight, optFont, optionRender]);
|
|
739
782
|
return /*#__PURE__*/React.createElement(View, {
|
|
740
|
-
style: [
|
|
783
|
+
style: [W.column, {
|
|
741
784
|
height: itemHeight * visibleItemCount
|
|
742
785
|
}]
|
|
743
786
|
}, /*#__PURE__*/React.createElement(WheelPicker, {
|
|
744
787
|
data: options,
|
|
745
788
|
itemHeight: itemHeight,
|
|
746
789
|
visibleRest: restVisible,
|
|
747
|
-
selectedIndex: Math.max(0,
|
|
790
|
+
selectedIndex: Math.max(0, selIdx),
|
|
748
791
|
onChange: handleChange,
|
|
749
792
|
readOnly: readOnly,
|
|
750
793
|
indicatorColor: tokens.colors.indicator,
|
|
751
794
|
decelerationRate: decelerationRate,
|
|
752
795
|
scrollEventThrottle: scrollEventThrottle,
|
|
753
796
|
swipeDuration: swipeDuration,
|
|
754
|
-
renderItem:
|
|
755
|
-
const active = meta?.active ?? false;
|
|
756
|
-
const disabled = meta?.disabled ?? false;
|
|
757
|
-
const textColor = disabled ? tokens.colors.textDisabled : active ? tokens.colors.text : tokens.colors.textMuted;
|
|
758
|
-
const content = optionRender ? optionRender(item, {
|
|
759
|
-
columnIndex,
|
|
760
|
-
active
|
|
761
|
-
}) : item.label ?? item.value;
|
|
762
|
-
const testID = getOptionTestID?.(item, {
|
|
763
|
-
columnIndex,
|
|
764
|
-
active
|
|
765
|
-
});
|
|
766
|
-
const a11yLabel = getOptionA11yLabel?.(item, {
|
|
767
|
-
columnIndex,
|
|
768
|
-
active
|
|
769
|
-
});
|
|
770
|
-
return /*#__PURE__*/React.createElement(View, {
|
|
771
|
-
style: [styles.option, {
|
|
772
|
-
opacity: disabled ? 0.5 : 1,
|
|
773
|
-
minHeight: itemHeight
|
|
774
|
-
}],
|
|
775
|
-
testID: testID,
|
|
776
|
-
accessible: !!a11yLabel,
|
|
777
|
-
accessibilityLabel: a11yLabel
|
|
778
|
-
}, isText(content) ? /*#__PURE__*/React.createElement(Text, {
|
|
779
|
-
numberOfLines: 1,
|
|
780
|
-
style: [styles.optionText, {
|
|
781
|
-
color: textColor,
|
|
782
|
-
fontSize: tokens.typography.optionSize,
|
|
783
|
-
fontFamily: tokens.typography.fontFamily,
|
|
784
|
-
fontWeight: tokens.typography.optionWeight
|
|
785
|
-
}]
|
|
786
|
-
}, content) : content);
|
|
787
|
-
}
|
|
797
|
+
renderItem: renderItemStable
|
|
788
798
|
}));
|
|
789
799
|
});
|
|
790
|
-
const
|
|
800
|
+
const PickerImpl = props => {
|
|
791
801
|
const {
|
|
792
802
|
tokensOverride
|
|
793
803
|
} = props;
|
|
804
|
+
const locale = useLocale();
|
|
794
805
|
const tokens = usePickerTokens(tokensOverride);
|
|
795
806
|
const {
|
|
796
807
|
columns = [],
|
|
@@ -799,8 +810,8 @@ const Picker = props => {
|
|
|
799
810
|
title,
|
|
800
811
|
showToolbar = tokens.defaults.showToolbar,
|
|
801
812
|
toolbarPosition = tokens.defaults.toolbarPosition,
|
|
802
|
-
confirmButtonText = '
|
|
803
|
-
cancelButtonText = '
|
|
813
|
+
confirmButtonText = locale?.confirm ?? 'Confirm',
|
|
814
|
+
cancelButtonText = locale?.cancel ?? 'Cancel',
|
|
804
815
|
itemHeight = tokens.defaults.itemHeight,
|
|
805
816
|
visibleItemCount: visibleItemCountProp = tokens.defaults.visibleItemCount,
|
|
806
817
|
loading = false,
|
|
@@ -827,12 +838,12 @@ const Picker = props => {
|
|
|
827
838
|
testID,
|
|
828
839
|
...rest
|
|
829
840
|
} = props;
|
|
830
|
-
const
|
|
841
|
+
const visCnt = getVisibleCount(visibleItemCountProp ?? tokens.defaults.visibleItemCount);
|
|
831
842
|
const {
|
|
832
|
-
normalized,
|
|
843
|
+
normalized: norm,
|
|
833
844
|
handleSelect,
|
|
834
845
|
handleConfirm,
|
|
835
|
-
preparedColumns
|
|
846
|
+
preparedColumns: prep
|
|
836
847
|
} = usePickerValue({
|
|
837
848
|
columns,
|
|
838
849
|
valueProp,
|
|
@@ -841,52 +852,33 @@ const Picker = props => {
|
|
|
841
852
|
onChange,
|
|
842
853
|
onConfirm
|
|
843
854
|
});
|
|
844
|
-
const isCascade =
|
|
845
|
-
const
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
alignItems: 'center',
|
|
850
|
-
justifyContent: 'center'
|
|
851
|
-
}
|
|
852
|
-
}, content);
|
|
853
|
-
if (isText(content)) return /*#__PURE__*/React.createElement(Text, {
|
|
854
|
-
numberOfLines: 1,
|
|
855
|
-
style: [styles.actionText, {
|
|
856
|
-
color,
|
|
857
|
-
fontSize: tokens.typography.toolbarSize,
|
|
858
|
-
fontFamily: tokens.typography.fontFamily,
|
|
859
|
-
fontWeight: tokens.typography.toolbarWeight
|
|
860
|
-
}]
|
|
861
|
-
}, content);
|
|
862
|
-
return /*#__PURE__*/React.createElement(View, {
|
|
863
|
-
style: {
|
|
864
|
-
minWidth: 44
|
|
865
|
-
}
|
|
866
|
-
});
|
|
867
|
-
};
|
|
868
|
-
const renderTitleContent = content => {
|
|
869
|
-
if (content == null) return /*#__PURE__*/React.createElement(View, null);
|
|
870
|
-
if (/*#__PURE__*/React.isValidElement(content)) return /*#__PURE__*/React.createElement(View, {
|
|
871
|
-
style: [styles.title, {
|
|
872
|
-
alignItems: 'center',
|
|
873
|
-
justifyContent: 'center'
|
|
874
|
-
}]
|
|
875
|
-
}, content);
|
|
876
|
-
return /*#__PURE__*/React.createElement(Text, {
|
|
877
|
-
style: [styles.title, {
|
|
878
|
-
fontSize: tokens.typography.toolbarSize,
|
|
879
|
-
fontFamily: tokens.typography.fontFamily,
|
|
880
|
-
color: tokens.colors.text,
|
|
881
|
-
fontWeight: tokens.typography.toolbarWeight
|
|
882
|
-
}],
|
|
883
|
-
numberOfLines: 1
|
|
884
|
-
}, content);
|
|
855
|
+
const isCascade = prep.type === 'cascade';
|
|
856
|
+
const toolbarFont = {
|
|
857
|
+
fontSize: tokens.typography.toolbarSize,
|
|
858
|
+
fontFamily: tokens.typography.fontFamily,
|
|
859
|
+
fontWeight: tokens.typography.toolbarWeight
|
|
885
860
|
};
|
|
861
|
+
const renderActionContent = (content, color) => /*#__PURE__*/React.isValidElement(content) ? /*#__PURE__*/React.createElement(View, {
|
|
862
|
+
style: S.actW
|
|
863
|
+
}, content) : isText(content) ? /*#__PURE__*/React.createElement(Text, {
|
|
864
|
+
numberOfLines: 1,
|
|
865
|
+
style: [S.actTxt, toolbarFont, {
|
|
866
|
+
color
|
|
867
|
+
}]
|
|
868
|
+
}, content) : /*#__PURE__*/React.createElement(View, {
|
|
869
|
+
style: S.actW
|
|
870
|
+
});
|
|
871
|
+
const renderTitleContent = content => content == null ? /*#__PURE__*/React.createElement(View, null) : /*#__PURE__*/React.isValidElement(content) ? /*#__PURE__*/React.createElement(View, {
|
|
872
|
+
style: S.ttlW
|
|
873
|
+
}, content) : /*#__PURE__*/React.createElement(Text, {
|
|
874
|
+
style: [S.title, toolbarFont, {
|
|
875
|
+
color: tokens.colors.text
|
|
876
|
+
}],
|
|
877
|
+
numberOfLines: 1
|
|
878
|
+
}, content);
|
|
886
879
|
const toolbar = showToolbar ? /*#__PURE__*/React.createElement(View, {
|
|
887
|
-
style: [
|
|
880
|
+
style: [S.toolbar, {
|
|
888
881
|
height: tokens.spacing.toolbarHeight,
|
|
889
|
-
borderColor: tokens.colors.indicator,
|
|
890
882
|
paddingHorizontal: tokens.spacing.actionPadding
|
|
891
883
|
}]
|
|
892
884
|
}, /*#__PURE__*/React.createElement(Pressable, {
|
|
@@ -895,22 +887,29 @@ const Picker = props => {
|
|
|
895
887
|
}, renderActionContent(cancelButtonText, tokens.colors.cancel)), renderTitleContent(title), /*#__PURE__*/React.createElement(Pressable, {
|
|
896
888
|
onPress: handleConfirm,
|
|
897
889
|
accessibilityRole: "button"
|
|
898
|
-
}, renderActionContent(confirmButtonText, tokens.colors.confirm))
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
890
|
+
}, renderActionContent(confirmButtonText, tokens.colors.confirm)), /*#__PURE__*/React.createElement(View, {
|
|
891
|
+
style: createHairlineView({
|
|
892
|
+
position: 'bottom',
|
|
893
|
+
color: tokens.colors.indicator,
|
|
894
|
+
left: 0,
|
|
895
|
+
right: 0
|
|
896
|
+
})
|
|
897
|
+
})) : null;
|
|
898
|
+
const wrapperH = itemHeight * visCnt;
|
|
899
|
+
const maskVisCnt = Math.max(1, Math.floor((visCnt - 1) / 2));
|
|
900
|
+
const indicatorOff = itemHeight * maskVisCnt;
|
|
901
|
+
const maskH = indicatorOff;
|
|
902
|
+
const hasCols = norm.columns.length > 0;
|
|
903
|
+
const effMaskColor = maskColor ?? tokens.colors.mask;
|
|
904
|
+
const columnsContent = hasCols ? norm.columns.map((column, colIdx) => {
|
|
905
|
+
const key = isCascade ? `${colIdx}-${norm.values.slice(0, colIdx).map(String).join('|')}` : String(colIdx);
|
|
907
906
|
return /*#__PURE__*/React.createElement(PickerColumn, {
|
|
908
907
|
key: key,
|
|
909
|
-
columnIndex:
|
|
908
|
+
columnIndex: colIdx,
|
|
910
909
|
options: column,
|
|
911
|
-
value:
|
|
910
|
+
value: norm.values[colIdx],
|
|
912
911
|
itemHeight: itemHeight,
|
|
913
|
-
visibleItemCount:
|
|
912
|
+
visibleItemCount: visCnt,
|
|
914
913
|
decelerationRate: decelerationRate,
|
|
915
914
|
scrollEventThrottle: scrollEventThrottle,
|
|
916
915
|
optionRender: optionRender,
|
|
@@ -923,43 +922,55 @@ const Picker = props => {
|
|
|
923
922
|
});
|
|
924
923
|
}) : null;
|
|
925
924
|
return /*#__PURE__*/React.createElement(View, _extends({}, rest, {
|
|
926
|
-
style: [
|
|
925
|
+
style: [{
|
|
927
926
|
backgroundColor: tokens.colors.background,
|
|
928
927
|
borderRadius: tokens.radius.container
|
|
929
928
|
}, style],
|
|
930
929
|
testID: testID
|
|
931
930
|
}), toolbarPosition === 'top' && toolbar, /*#__PURE__*/React.createElement(View, {
|
|
932
|
-
style: [
|
|
933
|
-
height:
|
|
931
|
+
style: [S.body, {
|
|
932
|
+
height: wrapperH
|
|
934
933
|
}]
|
|
935
934
|
}, /*#__PURE__*/React.createElement(View, {
|
|
936
|
-
style:
|
|
935
|
+
style: S.columns,
|
|
937
936
|
pointerEvents: loading ? 'none' : 'auto'
|
|
938
|
-
}, columnsTop, columnsContent, columnsBottom,
|
|
937
|
+
}, columnsTop, columnsContent, columnsBottom, hasCols && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(View, {
|
|
939
938
|
pointerEvents: "none",
|
|
940
|
-
style: [
|
|
941
|
-
top:
|
|
942
|
-
height: itemHeight
|
|
943
|
-
borderColor: tokens.colors.indicator
|
|
939
|
+
style: [S.indicator, {
|
|
940
|
+
top: indicatorOff,
|
|
941
|
+
height: itemHeight
|
|
944
942
|
}]
|
|
945
|
-
}
|
|
943
|
+
}, /*#__PURE__*/React.createElement(View, {
|
|
944
|
+
style: createHairlineView({
|
|
945
|
+
position: 'top',
|
|
946
|
+
color: tokens.colors.indicator,
|
|
947
|
+
left: 0,
|
|
948
|
+
right: 0
|
|
949
|
+
})
|
|
950
|
+
}), /*#__PURE__*/React.createElement(View, {
|
|
951
|
+
style: createHairlineView({
|
|
952
|
+
position: 'bottom',
|
|
953
|
+
color: tokens.colors.indicator,
|
|
954
|
+
left: 0,
|
|
955
|
+
right: 0
|
|
956
|
+
})
|
|
957
|
+
})), /*#__PURE__*/React.createElement(GradientMask, {
|
|
946
958
|
position: "top",
|
|
947
|
-
height:
|
|
948
|
-
color:
|
|
959
|
+
height: maskH,
|
|
960
|
+
color: effMaskColor,
|
|
949
961
|
maskType: maskType
|
|
950
962
|
}), /*#__PURE__*/React.createElement(GradientMask, {
|
|
951
963
|
position: "bottom",
|
|
952
|
-
height:
|
|
953
|
-
color:
|
|
964
|
+
height: maskH,
|
|
965
|
+
color: effMaskColor,
|
|
954
966
|
maskType: maskType
|
|
955
967
|
}))), loading && /*#__PURE__*/React.createElement(View, {
|
|
956
|
-
style: [
|
|
968
|
+
style: [S.loading, {
|
|
957
969
|
backgroundColor: tokens.colors.loadingMask
|
|
958
970
|
}]
|
|
959
971
|
}, /*#__PURE__*/React.createElement(Loading, null))), toolbarPosition === 'bottom' && toolbar);
|
|
960
972
|
};
|
|
961
|
-
const
|
|
962
|
-
container: {},
|
|
973
|
+
const S = StyleSheet.create({
|
|
963
974
|
body: {
|
|
964
975
|
position: 'relative',
|
|
965
976
|
overflow: 'hidden'
|
|
@@ -968,25 +979,16 @@ const styles = StyleSheet.create({
|
|
|
968
979
|
flex: 1,
|
|
969
980
|
flexDirection: 'row'
|
|
970
981
|
},
|
|
971
|
-
|
|
972
|
-
flex: 1
|
|
973
|
-
},
|
|
974
|
-
option: {
|
|
975
|
-
justifyContent: 'center',
|
|
976
|
-
alignItems: 'center'
|
|
977
|
-
},
|
|
978
|
-
optionText: {
|
|
982
|
+
optTxt: {
|
|
979
983
|
includeFontPadding: false
|
|
980
984
|
},
|
|
981
985
|
indicator: {
|
|
982
986
|
position: 'absolute',
|
|
983
987
|
left: 0,
|
|
984
988
|
right: 0,
|
|
985
|
-
borderTopWidth: StyleSheet.hairlineWidth,
|
|
986
|
-
borderBottomWidth: StyleSheet.hairlineWidth,
|
|
987
989
|
zIndex: 3
|
|
988
990
|
},
|
|
989
|
-
|
|
991
|
+
gMask: {
|
|
990
992
|
position: 'absolute',
|
|
991
993
|
left: 0,
|
|
992
994
|
right: 0,
|
|
@@ -995,17 +997,26 @@ const styles = StyleSheet.create({
|
|
|
995
997
|
toolbar: {
|
|
996
998
|
flexDirection: 'row',
|
|
997
999
|
alignItems: 'center',
|
|
998
|
-
justifyContent: 'space-between'
|
|
999
|
-
borderBottomWidth: StyleSheet.hairlineWidth
|
|
1000
|
+
justifyContent: 'space-between'
|
|
1000
1001
|
},
|
|
1001
1002
|
title: {
|
|
1002
1003
|
flex: 1,
|
|
1003
1004
|
textAlign: 'center'
|
|
1004
1005
|
},
|
|
1005
|
-
|
|
1006
|
+
ttlW: {
|
|
1007
|
+
flex: 1,
|
|
1008
|
+
alignItems: 'center',
|
|
1009
|
+
justifyContent: 'center'
|
|
1010
|
+
},
|
|
1011
|
+
actTxt: {
|
|
1006
1012
|
minWidth: 44,
|
|
1007
1013
|
textAlign: 'center'
|
|
1008
1014
|
},
|
|
1015
|
+
actW: {
|
|
1016
|
+
minWidth: 44,
|
|
1017
|
+
alignItems: 'center',
|
|
1018
|
+
justifyContent: 'center'
|
|
1019
|
+
},
|
|
1009
1020
|
loading: {
|
|
1010
1021
|
position: 'absolute',
|
|
1011
1022
|
top: 0,
|
|
@@ -1016,5 +1027,5 @@ const styles = StyleSheet.create({
|
|
|
1016
1027
|
justifyContent: 'center'
|
|
1017
1028
|
}
|
|
1018
1029
|
});
|
|
1019
|
-
Picker
|
|
1030
|
+
const Picker = /*#__PURE__*/React.memo(PickerImpl);
|
|
1020
1031
|
export default Picker;
|