react-native-system-ui 0.0.7 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +46 -31
- package/dist/cjs/components/action-sheet/ActionSheet.js +97 -105
- package/dist/cjs/components/action-sheet/tokens.js +16 -27
- package/dist/cjs/components/area/Area.js +54 -67
- package/dist/cjs/components/area/tokens.js +6 -3
- package/dist/cjs/components/avatar/Avatar.js +25 -23
- package/dist/cjs/components/badge/Badge.js +31 -31
- package/dist/cjs/components/badge/tokens.js +6 -8
- package/dist/cjs/components/button/Button.js +115 -151
- package/dist/cjs/components/button/ButtonGroup.js +8 -42
- 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 +177 -180
- 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 +70 -83
- package/dist/cjs/components/cell/CellGroup.js +16 -29
- package/dist/cjs/components/checkbox/Checkbox.js +139 -132
- package/dist/cjs/components/checkbox/CheckboxGroup.js +4 -35
- package/dist/cjs/components/checkbox/tokens.js +7 -10
- package/dist/cjs/components/circle/Circle.js +25 -24
- package/dist/cjs/components/collapse/Collapse.js +75 -91
- package/dist/cjs/components/config-provider/ConfigProvider.js +16 -3
- 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 +20 -15
- package/dist/cjs/components/datetime-picker/DatetimePicker.js +61 -84
- package/dist/cjs/components/datetime-picker/tokens.js +14 -3
- package/dist/cjs/components/dialog/Dialog.js +153 -121
- package/dist/cjs/components/dialog/imperative.js +17 -30
- package/dist/cjs/components/divider/Divider.js +26 -28
- package/dist/cjs/components/empty/Empty.js +35 -39
- package/dist/cjs/components/error-boundary/ErrorBoundary.js +73 -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 +18 -18
- package/dist/cjs/components/flex/FlexItem.js +26 -27
- package/dist/cjs/components/form/Form.js +142 -161
- package/dist/cjs/components/form/FormItem.js +69 -97
- package/dist/cjs/components/form/FormList.js +49 -37
- 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 +30 -29
- package/dist/cjs/components/grid/GridItem.js +84 -85
- package/dist/cjs/components/image/Image.js +55 -59
- package/dist/cjs/components/image/tokens.js +2 -2
- package/dist/cjs/components/image-preview/ImagePreview.js +124 -112
- package/dist/cjs/components/image-preview/imperative.js +4 -13
- package/dist/cjs/components/index.js +13 -0
- package/dist/cjs/components/input/Input.js +30 -22
- package/dist/cjs/components/loading/Loading.js +14 -15
- package/dist/cjs/components/nav-bar/NavBar.js +68 -83
- package/dist/cjs/components/nav-bar/tokens.js +1 -9
- package/dist/cjs/components/notice-bar/NoticeBar.js +74 -77
- package/dist/cjs/components/notify/Notify.js +88 -84
- package/dist/cjs/components/notify/imperative.js +20 -43
- package/dist/cjs/components/notify/tokens.js +1 -11
- package/dist/cjs/components/number-keyboard/NumberKeyboard.js +187 -209
- 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 +98 -79
- package/dist/cjs/components/picker/Picker.js +440 -421
- package/dist/cjs/components/picker/tokens.js +1 -1
- package/dist/cjs/components/popup/Popup.js +263 -293
- package/dist/cjs/components/portal/Portal.js +12 -29
- package/dist/cjs/components/portal/PortalHost.js +151 -234
- package/dist/cjs/components/progress/Progress.js +51 -48
- package/dist/cjs/components/radio/Radio.js +45 -42
- package/dist/cjs/components/radio/RadioGroup.js +8 -40
- 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 +51 -43
- package/dist/cjs/components/selector/Selector.js +14 -13
- package/dist/cjs/components/share-sheet/ShareSheet.js +160 -161
- package/dist/cjs/components/sidebar/Sidebar.js +39 -45
- package/dist/cjs/components/sidebar/SidebarContext.js +1 -2
- package/dist/cjs/components/sidebar/SidebarItem.js +13 -16
- package/dist/cjs/components/sidebar/tokens.js +1 -3
- package/dist/cjs/components/skeleton/Skeleton.js +30 -37
- 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 +46 -69
- package/dist/cjs/components/stepper/Stepper.js +177 -155
- package/dist/cjs/components/swiper/Swiper.js +251 -253
- package/dist/cjs/components/swiper/SwiperPagIndicator.js +25 -27
- package/dist/cjs/components/swiper/tokens.js +10 -3
- package/dist/cjs/components/switch/Switch.js +13 -15
- package/dist/cjs/components/tabbar/Tabbar.js +35 -27
- 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 +286 -313
- package/dist/cjs/components/tag/Tag.js +46 -37
- package/dist/cjs/components/toast/Toast.js +90 -90
- package/dist/cjs/components/toast/imperative.js +16 -41
- package/dist/cjs/components/typography/Typography.js +3 -5
- package/dist/cjs/components/water-mark/WaterMark.js +31 -29
- package/dist/cjs/design-system/ThemeProvider.js +5 -11
- package/dist/cjs/design-system/createComponentTokensHook.js +11 -13
- 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 +10 -21
- package/dist/cjs/hooks/useCountDown.js +14 -22
- 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 +18 -36
- package/dist/cjs/utils/color.js +21 -35
- 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 +74 -71
- package/dist/cjs/utils/index.js +22 -0
- package/dist/cjs/utils/number.js +21 -29
- package/dist/cjs/utils/render.js +27 -0
- package/dist/cjs/utils/rtl.js +25 -0
- package/dist/cjs/utils/string.js +8 -25
- package/dist/es/components/action-sheet/ActionSheet.js +99 -107
- package/dist/es/components/action-sheet/tokens.js +16 -27
- package/dist/es/components/area/Area.js +55 -68
- package/dist/es/components/area/tokens.js +6 -3
- package/dist/es/components/avatar/Avatar.js +25 -23
- package/dist/es/components/avatar/index.js +1 -2
- package/dist/es/components/badge/Badge.js +33 -33
- package/dist/es/components/badge/tokens.js +6 -8
- package/dist/es/components/button/Button.js +116 -152
- package/dist/es/components/button/ButtonGroup.js +9 -43
- 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 +180 -183
- 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 +71 -84
- package/dist/es/components/cell/CellGroup.js +16 -28
- package/dist/es/components/checkbox/Checkbox.js +140 -133
- package/dist/es/components/checkbox/CheckboxGroup.js +5 -36
- package/dist/es/components/checkbox/tokens.js +7 -10
- package/dist/es/components/circle/Circle.js +25 -23
- package/dist/es/components/collapse/Collapse.js +77 -92
- package/dist/es/components/config-provider/ConfigProvider.js +10 -3
- 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 +23 -18
- package/dist/es/components/datetime-picker/DatetimePicker.js +61 -84
- package/dist/es/components/datetime-picker/tokens.js +14 -3
- package/dist/es/components/dialog/Dialog.js +154 -121
- package/dist/es/components/dialog/imperative.js +17 -30
- package/dist/es/components/divider/Divider.js +28 -29
- package/dist/es/components/empty/Empty.js +36 -39
- package/dist/es/components/error-boundary/ErrorBoundary.js +61 -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 +18 -17
- package/dist/es/components/flex/FlexItem.js +27 -27
- package/dist/es/components/form/Form.js +143 -162
- package/dist/es/components/form/FormItem.js +68 -95
- package/dist/es/components/form/FormList.js +49 -37
- 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 +30 -28
- package/dist/es/components/grid/GridItem.js +84 -84
- package/dist/es/components/image/Image.js +58 -62
- package/dist/es/components/image/tokens.js +2 -2
- package/dist/es/components/image-preview/ImagePreview.js +124 -112
- package/dist/es/components/image-preview/imperative.js +4 -13
- package/dist/es/components/index.js +3 -1
- package/dist/es/components/input/Input.js +31 -23
- package/dist/es/components/loading/Loading.js +16 -16
- package/dist/es/components/nav-bar/NavBar.js +68 -83
- package/dist/es/components/nav-bar/tokens.js +1 -3
- package/dist/es/components/notice-bar/NoticeBar.js +74 -76
- package/dist/es/components/notify/Notify.js +92 -87
- package/dist/es/components/notify/imperative.js +21 -44
- package/dist/es/components/notify/tokens.js +1 -5
- package/dist/es/components/number-keyboard/NumberKeyboard.js +187 -209
- 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 +98 -79
- package/dist/es/components/picker/Picker.js +440 -421
- package/dist/es/components/picker/tokens.js +1 -1
- package/dist/es/components/popup/Popup.js +263 -292
- package/dist/es/components/portal/Portal.js +13 -29
- package/dist/es/components/portal/PortalHost.js +152 -234
- package/dist/es/components/progress/Progress.js +51 -48
- package/dist/es/components/radio/Radio.js +47 -44
- package/dist/es/components/radio/RadioGroup.js +10 -41
- 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 +52 -44
- package/dist/es/components/selector/Selector.js +14 -13
- package/dist/es/components/share-sheet/ShareSheet.js +162 -163
- package/dist/es/components/sidebar/Sidebar.js +41 -47
- package/dist/es/components/sidebar/SidebarContext.js +1 -2
- package/dist/es/components/sidebar/SidebarItem.js +13 -15
- package/dist/es/components/sidebar/tokens.js +1 -3
- package/dist/es/components/skeleton/Skeleton.js +30 -37
- 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 +48 -71
- package/dist/es/components/stepper/Stepper.js +178 -156
- package/dist/es/components/swiper/Swiper.js +252 -254
- package/dist/es/components/swiper/SwiperPagIndicator.js +25 -27
- package/dist/es/components/swiper/tokens.js +10 -3
- package/dist/es/components/switch/Switch.js +13 -15
- package/dist/es/components/tabbar/Tabbar.js +36 -28
- 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 +286 -313
- package/dist/es/components/tag/Tag.js +49 -39
- package/dist/es/components/toast/Toast.js +93 -91
- package/dist/es/components/toast/imperative.js +16 -41
- package/dist/es/components/typography/Typography.js +3 -5
- package/dist/es/components/water-mark/WaterMark.js +32 -30
- package/dist/es/design-system/ThemeProvider.js +5 -11
- package/dist/es/design-system/createComponentTokensHook.js +11 -13
- 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 +10 -21
- package/dist/es/hooks/useCountDown.js +14 -22
- 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 +18 -36
- package/dist/es/utils/color.js +21 -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 +73 -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/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/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/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/notice-bar/NoticeBar.d.ts +1 -1
- package/dist/types/components/notify/Notify.d.ts +2 -2
- package/dist/types/components/notify/index.d.ts +1 -1
- 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 +5 -5
- package/dist/types/components/popup/Popup.d.ts +3 -42
- 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/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/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/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/water-mark/WaterMark.d.ts +1 -1
- 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/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/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/package.json +9 -2
|
@@ -2,26 +2,22 @@ function _extends() { return _extends = Object.assign ? Object.assign.bind() : f
|
|
|
2
2
|
import React, { memo, useCallback, useEffect, useImperativeHandle, useRef, useState, useMemo, Children, isValidElement, Fragment } from 'react';
|
|
3
3
|
import { Animated, Pressable, StyleSheet, Text, ScrollView, View, Platform } from 'react-native';
|
|
4
4
|
import { useAriaPress, useControllableValue } from '../../hooks';
|
|
5
|
+
import { useReducedMotion } from '../../hooks/animation';
|
|
6
|
+
import { createHairlineView } from '../../utils/hairline';
|
|
5
7
|
import { parseNumberLike } from '../../utils/number';
|
|
6
8
|
import { isBoolean, isFunction, isObject, isRenderable, isText } from '../../utils/validate';
|
|
7
9
|
import { useTabsTokens } from './tokens';
|
|
8
10
|
const TabPane = () => null;
|
|
9
11
|
TabPane.displayName = 'Tabs.TabPane';
|
|
10
|
-
const
|
|
11
|
-
const requestFrame =
|
|
12
|
+
const hasRaf = typeof requestAnimationFrame === 'function' && typeof cancelAnimationFrame === 'function';
|
|
13
|
+
const requestFrame = hasRaf ? requestAnimationFrame : cb => setTimeout(cb, 16);
|
|
12
14
|
const cancelFrame = id => {
|
|
13
|
-
if (id
|
|
14
|
-
if (canUseRaf) {
|
|
15
|
-
cancelAnimationFrame(id);
|
|
16
|
-
} else {
|
|
17
|
-
clearTimeout(id);
|
|
18
|
-
}
|
|
15
|
+
if (id != null) (hasRaf ? cancelAnimationFrame : clearTimeout)(id);
|
|
19
16
|
};
|
|
20
17
|
const isTabPaneElement = child => {
|
|
21
18
|
if (! /*#__PURE__*/React.isValidElement(child)) return false;
|
|
22
19
|
if (child.type === TabPane) return true;
|
|
23
|
-
|
|
24
|
-
return type.displayName === 'Tabs.TabPane';
|
|
20
|
+
return child.type.displayName === 'Tabs.TabPane';
|
|
25
21
|
};
|
|
26
22
|
const useTabsAnimation = ({
|
|
27
23
|
type,
|
|
@@ -39,6 +35,7 @@ const useTabsAnimation = ({
|
|
|
39
35
|
const indicatorX = useRef(new Animated.Value(0)).current;
|
|
40
36
|
const indicatorWidth = useRef(new Animated.Value(0)).current;
|
|
41
37
|
const indicatorInitializedRef = useRef(false);
|
|
38
|
+
const indicatorAnimRef = useRef(null);
|
|
42
39
|
const animateIndicator = useCallback((name, immediate) => {
|
|
43
40
|
if (name == null || type !== 'line') return false;
|
|
44
41
|
const shouldUseEqualWidth = !scrollable && align !== 'start' && navContainerWidthRef.current > 0 && panes.length > 0;
|
|
@@ -48,27 +45,35 @@ const useTabsAnimation = ({
|
|
|
48
45
|
x: Math.max(index, 0) * equalTabWidth,
|
|
49
46
|
width: equalTabWidth
|
|
50
47
|
} : layoutMap.current.get(name);
|
|
51
|
-
if (!layout || index < 0)
|
|
52
|
-
|
|
53
|
-
}
|
|
48
|
+
if (!layout || index < 0) return false;
|
|
49
|
+
indicatorAnimRef.current?.stop();
|
|
54
50
|
const timing = (value, toValue) => Animated.timing(value, {
|
|
55
51
|
toValue,
|
|
56
52
|
duration: immediate || !animated ? 0 : resolvedDuration,
|
|
57
|
-
useNativeDriver: false
|
|
53
|
+
useNativeDriver: false,
|
|
54
|
+
isInteraction: false
|
|
58
55
|
});
|
|
59
56
|
const targetWidth = resolvedLineWidth ?? layout.width;
|
|
60
57
|
const targetX = resolvedLineWidth ? layout.x + (layout.width - targetWidth) / 2 : layout.x;
|
|
61
|
-
Animated.parallel([timing(indicatorX, targetX), timing(indicatorWidth, targetWidth)])
|
|
58
|
+
const anim = Animated.parallel([timing(indicatorX, targetX), timing(indicatorWidth, targetWidth)]);
|
|
59
|
+
indicatorAnimRef.current = anim;
|
|
60
|
+
anim.start(({
|
|
61
|
+
finished
|
|
62
|
+
}) => {
|
|
63
|
+
if (finished) indicatorAnimRef.current = null;
|
|
64
|
+
});
|
|
62
65
|
return true;
|
|
63
66
|
}, [align, animated, indicatorWidth, indicatorX, nameIndexMap, panes.length, resolvedDuration, resolvedLineWidth, scrollable, type, layoutMap, navContainerWidthRef]);
|
|
64
67
|
useEffect(() => {
|
|
65
68
|
if (currentName == null) return;
|
|
66
69
|
const shouldAnimate = indicatorInitializedRef.current;
|
|
67
70
|
const didAnimate = animateIndicator(currentName, !shouldAnimate);
|
|
68
|
-
if (didAnimate && !indicatorInitializedRef.current)
|
|
69
|
-
indicatorInitializedRef.current = true;
|
|
70
|
-
}
|
|
71
|
+
if (didAnimate && !indicatorInitializedRef.current) indicatorInitializedRef.current = true;
|
|
71
72
|
}, [animateIndicator, currentName]);
|
|
73
|
+
useEffect(() => () => {
|
|
74
|
+
indicatorAnimRef.current?.stop();
|
|
75
|
+
indicatorAnimRef.current = null;
|
|
76
|
+
}, []);
|
|
72
77
|
return {
|
|
73
78
|
indicatorX,
|
|
74
79
|
indicatorWidth,
|
|
@@ -100,12 +105,8 @@ const useTabsScroll = ({
|
|
|
100
105
|
const targetX = layout.x - (containerWidth - layout.width) / 2;
|
|
101
106
|
const maxScroll = Math.max(contentWidth - containerWidth, 0);
|
|
102
107
|
const clampedX = Math.max(0, Math.min(targetX, maxScroll));
|
|
103
|
-
if (maxScroll <= 0)
|
|
104
|
-
|
|
105
|
-
}
|
|
106
|
-
if (Math.abs(clampedX - navLastScrollXRef.current) < 1) {
|
|
107
|
-
return;
|
|
108
|
-
}
|
|
108
|
+
if (maxScroll <= 0) return;
|
|
109
|
+
if (Math.abs(clampedX - navLastScrollXRef.current) < 1) return;
|
|
109
110
|
if (navScrollAnimRef.current) {
|
|
110
111
|
navScrollAnimRef.current.stop();
|
|
111
112
|
navScrollAnimRef.current = null;
|
|
@@ -126,16 +127,15 @@ const useTabsScroll = ({
|
|
|
126
127
|
navScrollAnimRef.current = Animated.timing(navScrollX, {
|
|
127
128
|
toValue: clampedX,
|
|
128
129
|
duration: resolvedDuration,
|
|
129
|
-
useNativeDriver: false
|
|
130
|
+
useNativeDriver: false,
|
|
131
|
+
isInteraction: false
|
|
130
132
|
});
|
|
131
133
|
navScrollAnimRef.current.start(({
|
|
132
134
|
finished
|
|
133
135
|
}) => {
|
|
134
136
|
navScrollAnimRef.current = null;
|
|
135
137
|
navAutoScrollingRef.current = false;
|
|
136
|
-
if (!finished)
|
|
137
|
-
return;
|
|
138
|
-
}
|
|
138
|
+
if (!finished) return;
|
|
139
139
|
navLastScrollXRef.current = clampedX;
|
|
140
140
|
});
|
|
141
141
|
}, [animated, currentName, navScrollX, resolvedDuration, scrollable, layoutMap, navContainerWidthRef, navContentWidthRef]);
|
|
@@ -146,9 +146,7 @@ const useTabsScroll = ({
|
|
|
146
146
|
}) => {
|
|
147
147
|
const prev = navLastScrollXRef.current;
|
|
148
148
|
navLastScrollXRef.current = value;
|
|
149
|
-
if (Math.abs(value - prev) < 0.5)
|
|
150
|
-
return;
|
|
151
|
-
}
|
|
149
|
+
if (Math.abs(value - prev) < 0.5) return;
|
|
152
150
|
navScrollRef.current?.scrollTo({
|
|
153
151
|
x: value,
|
|
154
152
|
y: 0,
|
|
@@ -174,9 +172,7 @@ const useTabsScroll = ({
|
|
|
174
172
|
navLastScrollXRef.current = event.nativeEvent.contentOffset.x;
|
|
175
173
|
}, []);
|
|
176
174
|
const handleNavScroll = useCallback(event => {
|
|
177
|
-
if (navAutoScrollingRef.current)
|
|
178
|
-
return;
|
|
179
|
-
}
|
|
175
|
+
if (navAutoScrollingRef.current) return;
|
|
180
176
|
navLastScrollXRef.current = event.nativeEvent.contentOffset.x;
|
|
181
177
|
}, []);
|
|
182
178
|
return {
|
|
@@ -230,7 +226,19 @@ const TabBarItemInner = ({
|
|
|
230
226
|
const isCompactType = isCard || isJumbo || isCapsule;
|
|
231
227
|
const horizontalPadding = isCompactType ? 0 : tokens.tabList.paddingHorizontal;
|
|
232
228
|
const verticalPadding = isCompactType ? 0 : tokens.tabList.paddingVertical;
|
|
233
|
-
const labelWrapperStyles = [
|
|
229
|
+
const labelWrapperStyles = [S.lblW, isJumbo && S.lblWJ, isCard && S.cardLbl, isCard && {
|
|
230
|
+
paddingHorizontal: tokens.card.paddingHorizontal,
|
|
231
|
+
paddingVertical: tokens.card.paddingVertical
|
|
232
|
+
}, isCapsule && {
|
|
233
|
+
flex: 1,
|
|
234
|
+
alignSelf: 'stretch',
|
|
235
|
+
paddingHorizontal: tokens.capsule.paddingHorizontal,
|
|
236
|
+
paddingVertical: tokens.capsule.paddingVertical
|
|
237
|
+
}, isJumbo && {
|
|
238
|
+
paddingHorizontal: tokens.jumbo.paddingHorizontal,
|
|
239
|
+
paddingVertical: tokens.jumbo.paddingVertical,
|
|
240
|
+
alignItems: 'center'
|
|
241
|
+
}].filter(Boolean);
|
|
234
242
|
const labelTextWrapperStyles = isCapsule ? [{
|
|
235
243
|
flex: 1,
|
|
236
244
|
alignSelf: 'stretch',
|
|
@@ -239,40 +247,13 @@ const TabBarItemInner = ({
|
|
|
239
247
|
borderRadius: tokens.capsule.radius,
|
|
240
248
|
backgroundColor: isActive ? color ?? tokens.colors.capsuleActiveBackground : tokens.colors.capsuleBackground
|
|
241
249
|
}] : null;
|
|
242
|
-
|
|
243
|
-
labelWrapperStyles.push(styles.labelWrapperJumbo);
|
|
244
|
-
}
|
|
245
|
-
if (isCard) {
|
|
246
|
-
labelWrapperStyles.push(styles.cardLabel);
|
|
247
|
-
labelWrapperStyles.push({
|
|
248
|
-
paddingHorizontal: tokens.card.paddingHorizontal,
|
|
249
|
-
paddingVertical: tokens.card.paddingVertical
|
|
250
|
-
});
|
|
251
|
-
}
|
|
252
|
-
if (isCapsule) {
|
|
253
|
-
labelWrapperStyles.push({
|
|
254
|
-
flex: 1,
|
|
255
|
-
alignSelf: 'stretch'
|
|
256
|
-
});
|
|
257
|
-
labelWrapperStyles.push({
|
|
258
|
-
paddingHorizontal: tokens.capsule.paddingHorizontal,
|
|
259
|
-
paddingVertical: tokens.capsule.paddingVertical
|
|
260
|
-
});
|
|
261
|
-
}
|
|
262
|
-
if (isJumbo) {
|
|
263
|
-
labelWrapperStyles.push({
|
|
264
|
-
paddingHorizontal: tokens.jumbo.paddingHorizontal,
|
|
265
|
-
paddingVertical: tokens.jumbo.paddingVertical,
|
|
266
|
-
alignItems: 'center'
|
|
267
|
-
});
|
|
268
|
-
}
|
|
269
|
-
const titleTextStyle = [styles.title, {
|
|
250
|
+
const titleTextStyle = [S.title, {
|
|
270
251
|
color: textColor,
|
|
271
252
|
fontSize: isJumbo ? tokens.typography.jumboTitleSize : tokens.typography.titleSize,
|
|
272
253
|
fontWeight: isActive ? tokens.typography.titleActiveWeight : tokens.typography.titleWeight,
|
|
273
254
|
lineHeight: isJumbo ? tokens.typography.jumboLineHeight : undefined,
|
|
274
255
|
textAlign: 'center'
|
|
275
|
-
}, ellipsis && !isJumbo ?
|
|
256
|
+
}, ellipsis && !isJumbo ? S.ellipsis : null, titleStyle];
|
|
276
257
|
const titleNode = /*#__PURE__*/React.createElement(Text, {
|
|
277
258
|
style: titleTextStyle,
|
|
278
259
|
numberOfLines: ellipsis && !isJumbo ? 1 : undefined
|
|
@@ -284,24 +265,25 @@ const TabBarItemInner = ({
|
|
|
284
265
|
paddingVertical: tokens.jumbo.descriptionPaddingVertical,
|
|
285
266
|
borderRadius: tokens.jumbo.descriptionRadius
|
|
286
267
|
} : null;
|
|
287
|
-
const descriptionTextStyle = [
|
|
268
|
+
const descriptionTextStyle = [S.descTxt, {
|
|
288
269
|
color: descriptionColor,
|
|
289
270
|
fontSize: tokens.typography.descriptionSize,
|
|
290
271
|
marginTop: descriptionMarginTop,
|
|
291
272
|
textAlign: 'center'
|
|
292
273
|
}, descriptionJumboStyle, descriptionStyle];
|
|
293
|
-
const descriptionViewStyle = [
|
|
274
|
+
const descriptionViewStyle = [{
|
|
294
275
|
marginTop: descriptionMarginTop,
|
|
295
276
|
alignItems: 'center'
|
|
296
277
|
}, descriptionJumboStyle];
|
|
278
|
+
const handleLayout = useCallback(event => {
|
|
279
|
+
onLayout(pane.name, event);
|
|
280
|
+
}, [onLayout, pane.name]);
|
|
297
281
|
return /*#__PURE__*/React.createElement(Pressable, _extends({}, ariaPress.interactionProps, {
|
|
298
|
-
onLayout:
|
|
299
|
-
style: [
|
|
282
|
+
onLayout: handleLayout,
|
|
283
|
+
style: [S.tabI, shouldFlex ? S.flexI : null, {
|
|
300
284
|
paddingHorizontal: horizontalPadding,
|
|
301
285
|
paddingVertical: verticalPadding
|
|
302
286
|
}, isCard ? {
|
|
303
|
-
borderRightWidth: isLast ? 0 : StyleSheet.hairlineWidth,
|
|
304
|
-
borderRightColor: color ?? tokens.colors.cardBorder,
|
|
305
287
|
backgroundColor: isActive ? color ?? tokens.colors.cardActiveBackground : tokens.colors.cardBackground
|
|
306
288
|
} : null, tabStyle]
|
|
307
289
|
}), /*#__PURE__*/React.createElement(View, {
|
|
@@ -313,15 +295,22 @@ const TabBarItemInner = ({
|
|
|
313
295
|
}, renderDescription) : /*#__PURE__*/React.createElement(View, {
|
|
314
296
|
style: descriptionViewStyle
|
|
315
297
|
}, renderDescription)), isRenderable(pane.badge) && /*#__PURE__*/React.createElement(View, {
|
|
316
|
-
style:
|
|
298
|
+
style: {
|
|
317
299
|
marginTop: tokens.spacing.badgeMarginTop
|
|
318
|
-
}
|
|
300
|
+
}
|
|
319
301
|
}, isText(pane.badge) ? /*#__PURE__*/React.createElement(Text, {
|
|
320
|
-
style:
|
|
302
|
+
style: {
|
|
321
303
|
color: tokens.colors.badgeText,
|
|
322
304
|
fontSize: tokens.typography.badgeTextSize
|
|
323
|
-
}
|
|
324
|
-
}, pane.badge) : pane.badge))
|
|
305
|
+
}
|
|
306
|
+
}, pane.badge) : pane.badge)), isCard && !isLast && /*#__PURE__*/React.createElement(View, {
|
|
307
|
+
style: createHairlineView({
|
|
308
|
+
position: 'right',
|
|
309
|
+
color: color ?? tokens.colors.cardBorder,
|
|
310
|
+
top: 0,
|
|
311
|
+
bottom: 0
|
|
312
|
+
})
|
|
313
|
+
}));
|
|
325
314
|
};
|
|
326
315
|
const TabBarItem = /*#__PURE__*/memo(TabBarItemInner);
|
|
327
316
|
const TabsBaseInner = (props, ref) => {
|
|
@@ -360,6 +349,7 @@ const TabsBaseInner = (props, ref) => {
|
|
|
360
349
|
...rest
|
|
361
350
|
} = props;
|
|
362
351
|
const tokens = useTabsTokens(tokensOverride);
|
|
352
|
+
const reducedMotion = useReducedMotion();
|
|
363
353
|
const type = typeProp ?? tokens.defaults.type;
|
|
364
354
|
const align = alignProp ?? tokens.defaults.align;
|
|
365
355
|
const ellipsis = ellipsisProp ?? tokens.defaults.ellipsis;
|
|
@@ -369,18 +359,18 @@ const TabsBaseInner = (props, ref) => {
|
|
|
369
359
|
const lazyRender = lazyRenderProp ?? tokens.defaults.lazyRender;
|
|
370
360
|
const background = backgroundProp ?? tokens.tabList.background;
|
|
371
361
|
const parsedLineWidth = parseNumberLike(lineWidth ?? tokens.indicator.width);
|
|
372
|
-
const
|
|
373
|
-
const
|
|
374
|
-
const
|
|
375
|
-
const
|
|
376
|
-
const
|
|
362
|
+
const resLineW = parsedLineWidth != null && parsedLineWidth < 0 ? undefined : parsedLineWidth;
|
|
363
|
+
const resLineH = Math.max(0, parseNumberLike(lineHeight) ?? tokens.indicator.height);
|
|
364
|
+
const resDur = reducedMotion ? 0 : Math.max(0, parseNumberLike(duration) ?? tokens.defaults.duration);
|
|
365
|
+
const resSwipeTh = Math.max(0, parseNumberLike(swipeThreshold) ?? tokens.defaults.swipeThreshold);
|
|
366
|
+
const swipeCfg = !swipeable ? undefined : isObject(swipeable) ? {
|
|
377
367
|
autoHeight: swipeable.autoHeight ?? true,
|
|
378
368
|
preventScroll: swipeable.preventScroll ?? true
|
|
379
369
|
} : {
|
|
380
370
|
autoHeight: true,
|
|
381
371
|
preventScroll: true
|
|
382
372
|
};
|
|
383
|
-
const
|
|
373
|
+
const isSwipe = !!swipeCfg;
|
|
384
374
|
const panes = useMemo(() => {
|
|
385
375
|
const result = [];
|
|
386
376
|
let paneIndex = 0;
|
|
@@ -392,9 +382,7 @@ const TabsBaseInner = (props, ref) => {
|
|
|
392
382
|
walk(element.props.children);
|
|
393
383
|
return;
|
|
394
384
|
}
|
|
395
|
-
if (!isTabPaneElement(element))
|
|
396
|
-
return;
|
|
397
|
-
}
|
|
385
|
+
if (!isTabPaneElement(element)) return;
|
|
398
386
|
const paneProps = element.props;
|
|
399
387
|
const name = paneProps.name ?? paneIndex;
|
|
400
388
|
result.push({
|
|
@@ -410,75 +398,69 @@ const TabsBaseInner = (props, ref) => {
|
|
|
410
398
|
return result;
|
|
411
399
|
}, [children]);
|
|
412
400
|
const firstPaneName = panes[0]?.name;
|
|
413
|
-
const [
|
|
401
|
+
const [actVal, setActVal] = useControllableValue(props, {
|
|
414
402
|
defaultValue: firstPaneName,
|
|
415
403
|
valuePropName: 'active',
|
|
416
404
|
defaultValuePropName: 'defaultActive',
|
|
417
405
|
trigger: 'onChange'
|
|
418
406
|
});
|
|
419
|
-
const
|
|
420
|
-
const
|
|
407
|
+
const curName = actVal == null ? firstPaneName : panes.some(pane => pane.name === actVal) ? actVal : firstPaneName;
|
|
408
|
+
const curNameRef = useRef(curName);
|
|
421
409
|
useEffect(() => {
|
|
422
|
-
|
|
423
|
-
}, [
|
|
424
|
-
const
|
|
410
|
+
curNameRef.current = curName;
|
|
411
|
+
}, [curName]);
|
|
412
|
+
const nameIdxMap = useMemo(() => {
|
|
425
413
|
const map = new Map();
|
|
426
414
|
panes.forEach(pane => {
|
|
427
415
|
map.set(pane.name, pane.index);
|
|
428
416
|
});
|
|
429
417
|
return map;
|
|
430
418
|
}, [panes]);
|
|
431
|
-
const
|
|
432
|
-
const
|
|
419
|
+
const actIdx = curName == null ? -1 : nameIdxMap.get(curName) ?? -1;
|
|
420
|
+
const visRef = useRef(new Set());
|
|
421
|
+
const layMap = useRef(new Map());
|
|
422
|
+
const navCtrWRef = useRef(0);
|
|
423
|
+
const navCntWRef = useRef(0);
|
|
424
|
+
const navCntSyncRef = useRef(null);
|
|
425
|
+
const paneLayMap = useRef(new Map());
|
|
426
|
+
const swipeScrRef = useRef(null);
|
|
427
|
+
const swipeChgRef = useRef(false);
|
|
428
|
+
const [ctrW, setCtrW] = useState(0);
|
|
429
|
+
const [swipeH, setSwipeH] = useState(undefined);
|
|
433
430
|
useEffect(() => {
|
|
434
|
-
if (
|
|
435
|
-
|
|
436
|
-
}, [
|
|
431
|
+
if (curName == null) return;
|
|
432
|
+
visRef.current.add(curName);
|
|
433
|
+
}, [curName]);
|
|
437
434
|
useEffect(() => {
|
|
438
435
|
const validNames = new Set(panes.map(pane => pane.name));
|
|
439
|
-
Array.from(
|
|
440
|
-
if (!validNames.has(name))
|
|
436
|
+
Array.from(paneLayMap.current.keys()).forEach(name => {
|
|
437
|
+
if (!validNames.has(name)) paneLayMap.current.delete(name);
|
|
441
438
|
});
|
|
442
|
-
Array.from(
|
|
443
|
-
if (!validNames.has(name))
|
|
439
|
+
Array.from(layMap.current.keys()).forEach(name => {
|
|
440
|
+
if (!validNames.has(name)) layMap.current.delete(name);
|
|
444
441
|
});
|
|
445
442
|
}, [panes]);
|
|
446
|
-
const
|
|
443
|
+
const trackPaneLay = isSwipe && swipeCfg?.autoHeight;
|
|
447
444
|
useEffect(() => {
|
|
448
|
-
if (!
|
|
449
|
-
|
|
450
|
-
}
|
|
451
|
-
}, [shouldTrackPaneLayouts]);
|
|
445
|
+
if (!trackPaneLay) paneLayMap.current.clear();
|
|
446
|
+
}, [trackPaneLay]);
|
|
452
447
|
useEffect(() => {
|
|
453
|
-
if (!
|
|
454
|
-
|
|
448
|
+
if (!isSwipe || !swipeCfg?.autoHeight) {
|
|
449
|
+
setSwipeH(undefined);
|
|
455
450
|
return;
|
|
456
451
|
}
|
|
457
|
-
const layout =
|
|
458
|
-
if (layout)
|
|
459
|
-
|
|
460
|
-
} else {
|
|
461
|
-
setSwipeableHeight(undefined);
|
|
462
|
-
}
|
|
463
|
-
}, [currentName, isSwipeable, swipeableConfig?.autoHeight]);
|
|
464
|
-
const layoutMap = useRef(new Map());
|
|
465
|
-
const navContainerWidthRef = useRef(0);
|
|
466
|
-
const navContentWidthRef = useRef(0);
|
|
467
|
-
const navContentSizeSyncFrameRef = useRef(null);
|
|
468
|
-
const paneLayoutMap = useRef(new Map());
|
|
469
|
-
const swipeableScrollRef = useRef(null);
|
|
470
|
-
const swipeableChangeByScrollRef = useRef(false);
|
|
471
|
-
const [containerWidth, setContainerWidth] = useState(0);
|
|
472
|
-
const [swipeableHeight, setSwipeableHeight] = useState(undefined);
|
|
452
|
+
const layout = curName != null ? paneLayMap.current.get(curName) : undefined;
|
|
453
|
+
if (layout) setSwipeH(layout.height);else setSwipeH(undefined);
|
|
454
|
+
}, [curName, isSwipe, swipeCfg?.autoHeight]);
|
|
473
455
|
useEffect(() => {
|
|
474
456
|
return () => {
|
|
475
|
-
cancelFrame(
|
|
476
|
-
|
|
457
|
+
cancelFrame(navCntSyncRef.current);
|
|
458
|
+
navCntSyncRef.current = null;
|
|
477
459
|
};
|
|
478
460
|
}, []);
|
|
479
|
-
const scrollable = isBoolean(scrollableProp) ? scrollableProp : panes.length >
|
|
480
|
-
const
|
|
481
|
-
const
|
|
461
|
+
const scrollable = isBoolean(scrollableProp) ? scrollableProp : panes.length > resSwipeTh || ellipsis === false;
|
|
462
|
+
const indColor = color ?? tokens.colors.indicator;
|
|
463
|
+
const indRad = resLineH ? resLineH / 2 : tokens.indicator.radius;
|
|
482
464
|
const {
|
|
483
465
|
indicatorX,
|
|
484
466
|
indicatorWidth,
|
|
@@ -490,13 +472,13 @@ const TabsBaseInner = (props, ref) => {
|
|
|
490
472
|
scrollable,
|
|
491
473
|
align,
|
|
492
474
|
panes,
|
|
493
|
-
nameIndexMap,
|
|
494
|
-
resolvedLineWidth,
|
|
495
|
-
resolvedLineHeight,
|
|
496
|
-
resolvedDuration,
|
|
497
|
-
currentName,
|
|
498
|
-
layoutMap,
|
|
499
|
-
navContainerWidthRef
|
|
475
|
+
nameIndexMap: nameIdxMap,
|
|
476
|
+
resolvedLineWidth: resLineW,
|
|
477
|
+
resolvedLineHeight: resLineH,
|
|
478
|
+
resolvedDuration: resDur,
|
|
479
|
+
currentName: curName,
|
|
480
|
+
layoutMap: layMap,
|
|
481
|
+
navContainerWidthRef: navCtrWRef
|
|
500
482
|
});
|
|
501
483
|
const {
|
|
502
484
|
navScrollRef,
|
|
@@ -506,171 +488,162 @@ const TabsBaseInner = (props, ref) => {
|
|
|
506
488
|
} = useTabsScroll({
|
|
507
489
|
scrollable,
|
|
508
490
|
animated,
|
|
509
|
-
currentName,
|
|
510
|
-
resolvedDuration,
|
|
511
|
-
layoutMap,
|
|
512
|
-
navContainerWidthRef,
|
|
513
|
-
navContentWidthRef
|
|
491
|
+
currentName: curName,
|
|
492
|
+
resolvedDuration: resDur,
|
|
493
|
+
layoutMap: layMap,
|
|
494
|
+
navContainerWidthRef: navCtrWRef,
|
|
495
|
+
navContentWidthRef: navCntWRef
|
|
514
496
|
});
|
|
515
|
-
const
|
|
497
|
+
const onTabLayout = useCallback((name, event) => {
|
|
516
498
|
const {
|
|
517
499
|
x,
|
|
518
500
|
width
|
|
519
501
|
} = event.nativeEvent.layout;
|
|
520
|
-
|
|
502
|
+
layMap.current.set(name, {
|
|
521
503
|
x,
|
|
522
504
|
width
|
|
523
505
|
});
|
|
524
|
-
if (name ===
|
|
506
|
+
if (name === curNameRef.current) {
|
|
525
507
|
const shouldAnimate = indicatorInitializedRef.current;
|
|
526
508
|
const didAnimate = animateIndicator(name, !shouldAnimate);
|
|
527
509
|
if (didAnimate && !indicatorInitializedRef.current) indicatorInitializedRef.current = true;
|
|
528
510
|
}
|
|
529
511
|
}, [animateIndicator, indicatorInitializedRef]);
|
|
530
|
-
const
|
|
512
|
+
const onNavCtrLayout = useCallback(event => {
|
|
531
513
|
const {
|
|
532
514
|
width
|
|
533
515
|
} = event.nativeEvent.layout;
|
|
534
|
-
|
|
535
|
-
if (!scrollable && align !== 'start' && type === 'line' &&
|
|
516
|
+
navCtrWRef.current = width;
|
|
517
|
+
if (!scrollable && align !== 'start' && type === 'line' && curName !== undefined && curName !== null) {
|
|
536
518
|
const shouldAnimate = indicatorInitializedRef.current;
|
|
537
|
-
const didAnimate = animateIndicator(
|
|
519
|
+
const didAnimate = animateIndicator(curName, !shouldAnimate);
|
|
538
520
|
if (didAnimate && !indicatorInitializedRef.current) indicatorInitializedRef.current = true;
|
|
539
521
|
}
|
|
540
|
-
}, [align, animateIndicator,
|
|
541
|
-
const
|
|
542
|
-
const
|
|
543
|
-
|
|
522
|
+
}, [align, animateIndicator, curName, scrollable, type, indicatorInitializedRef]);
|
|
523
|
+
const onCtrLayout = useCallback(event => {
|
|
524
|
+
const nextW = event.nativeEvent.layout.width;
|
|
525
|
+
setCtrW(prev => prev === nextW ? prev : nextW);
|
|
544
526
|
}, []);
|
|
545
|
-
const
|
|
546
|
-
|
|
527
|
+
const beforeChgRef = useRef(beforeChange);
|
|
528
|
+
beforeChgRef.current = beforeChange;
|
|
529
|
+
const runBeforeChg = useCallback(name => {
|
|
530
|
+
if (!beforeChgRef.current) return Promise.resolve(true);
|
|
547
531
|
try {
|
|
548
|
-
return Promise.resolve(
|
|
532
|
+
return Promise.resolve(beforeChgRef.current(name)).then(res => res !== false).catch(() => false);
|
|
549
533
|
} catch (error) {
|
|
550
534
|
return Promise.resolve(false);
|
|
551
535
|
}
|
|
552
|
-
}, [
|
|
553
|
-
const
|
|
554
|
-
const
|
|
555
|
-
|
|
556
|
-
const seq =
|
|
557
|
-
|
|
536
|
+
}, []);
|
|
537
|
+
const chgSeqRef = useRef(0);
|
|
538
|
+
const reqChg = useCallback((name, index) => {
|
|
539
|
+
chgSeqRef.current += 1;
|
|
540
|
+
const seq = chgSeqRef.current;
|
|
541
|
+
runBeforeChg(name).then(canChange => {
|
|
558
542
|
if (!canChange) return;
|
|
559
|
-
if (
|
|
560
|
-
|
|
543
|
+
if (chgSeqRef.current !== seq) return;
|
|
544
|
+
setActVal(name, index);
|
|
561
545
|
});
|
|
562
|
-
}, [
|
|
563
|
-
const
|
|
564
|
-
if (
|
|
546
|
+
}, [runBeforeChg, setActVal]);
|
|
547
|
+
const onPaneLayout = useCallback((name, event) => {
|
|
548
|
+
if (isSwipe && swipeCfg?.autoHeight) {
|
|
565
549
|
const {
|
|
566
550
|
height
|
|
567
551
|
} = event.nativeEvent.layout;
|
|
568
|
-
|
|
552
|
+
paneLayMap.current.set(name, {
|
|
569
553
|
height
|
|
570
554
|
});
|
|
571
|
-
if (name ===
|
|
555
|
+
if (name === curName) setSwipeH(height);
|
|
572
556
|
}
|
|
573
|
-
}, [
|
|
574
|
-
const
|
|
557
|
+
}, [curName, isSwipe, swipeCfg?.autoHeight]);
|
|
558
|
+
const swipeEndIdxRef = useRef(null);
|
|
575
559
|
useEffect(() => {
|
|
576
|
-
|
|
577
|
-
}, [
|
|
578
|
-
const
|
|
579
|
-
if (!
|
|
580
|
-
const
|
|
581
|
-
if (
|
|
582
|
-
|
|
583
|
-
const nextPane = panes[
|
|
584
|
-
if (!nextPane || nextPane.name ===
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
}, [
|
|
588
|
-
const
|
|
589
|
-
|
|
590
|
-
}, [
|
|
591
|
-
const
|
|
592
|
-
|
|
593
|
-
}, [
|
|
560
|
+
swipeEndIdxRef.current = null;
|
|
561
|
+
}, [curName]);
|
|
562
|
+
const onSwipeEnd = useCallback(offsetX => {
|
|
563
|
+
if (!isSwipe || ctrW <= 0) return;
|
|
564
|
+
const pageIdx = Math.round(offsetX / ctrW);
|
|
565
|
+
if (swipeEndIdxRef.current === pageIdx) return;
|
|
566
|
+
swipeEndIdxRef.current = pageIdx;
|
|
567
|
+
const nextPane = panes[pageIdx];
|
|
568
|
+
if (!nextPane || nextPane.name === curNameRef.current) return;
|
|
569
|
+
swipeChgRef.current = true;
|
|
570
|
+
reqChg(nextPane.name, nextPane.index);
|
|
571
|
+
}, [ctrW, isSwipe, panes, reqChg]);
|
|
572
|
+
const onSwipeMomentumScrollEnd = useCallback(event => {
|
|
573
|
+
onSwipeEnd(event.nativeEvent.contentOffset.x);
|
|
574
|
+
}, [onSwipeEnd]);
|
|
575
|
+
const onSwipeScrollEndDrag = useCallback(event => {
|
|
576
|
+
onSwipeEnd(event.nativeEvent.contentOffset.x);
|
|
577
|
+
}, [onSwipeEnd]);
|
|
594
578
|
useEffect(() => {
|
|
595
|
-
if (!
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
if (swipeableChangeByScrollRef.current) {
|
|
599
|
-
swipeableChangeByScrollRef.current = false;
|
|
600
|
-
return;
|
|
601
|
-
}
|
|
602
|
-
if (activeIndex < 0) {
|
|
603
|
-
return;
|
|
604
|
-
}
|
|
605
|
-
const node = swipeableScrollRef.current?.getNode?.() ?? swipeableScrollRef.current;
|
|
606
|
-
if (!node?.scrollTo) {
|
|
579
|
+
if (!isSwipe || !swipeScrRef.current || ctrW <= 0) return;
|
|
580
|
+
if (swipeChgRef.current) {
|
|
581
|
+
swipeChgRef.current = false;
|
|
607
582
|
return;
|
|
608
583
|
}
|
|
584
|
+
if (actIdx < 0) return;
|
|
585
|
+
const node = swipeScrRef.current?.getNode?.() ?? swipeScrRef.current;
|
|
586
|
+
if (!node?.scrollTo) return;
|
|
609
587
|
node.scrollTo({
|
|
610
|
-
x:
|
|
588
|
+
x: ctrW * actIdx,
|
|
611
589
|
y: 0,
|
|
612
590
|
animated: true
|
|
613
591
|
});
|
|
614
|
-
}, [
|
|
615
|
-
const
|
|
592
|
+
}, [actIdx, ctrW, isSwipe]);
|
|
593
|
+
const onClickTabRef = useRef(onClickTab);
|
|
594
|
+
onClickTabRef.current = onClickTab;
|
|
595
|
+
const onSel = useCallback((pane, index, event) => {
|
|
616
596
|
const payload = {
|
|
617
597
|
name: pane.name,
|
|
618
598
|
index,
|
|
619
599
|
disabled: !!pane.disabled,
|
|
620
600
|
event
|
|
621
601
|
};
|
|
622
|
-
|
|
623
|
-
if (pane.disabled || pane.name ===
|
|
624
|
-
|
|
625
|
-
}, [
|
|
602
|
+
onClickTabRef.current?.(payload);
|
|
603
|
+
if (pane.disabled || pane.name === curNameRef.current) return;
|
|
604
|
+
reqChg(pane.name, index);
|
|
605
|
+
}, [reqChg]);
|
|
626
606
|
const scrollTo = useCallback((name, _options) => {
|
|
627
607
|
const target = panes.find(pane => pane.name === name && !pane.disabled);
|
|
628
608
|
if (!target) return;
|
|
629
|
-
|
|
630
|
-
}, [panes,
|
|
609
|
+
setActVal(target.name, target.index);
|
|
610
|
+
}, [panes, setActVal]);
|
|
631
611
|
useImperativeHandle(ref, () => ({
|
|
632
612
|
scrollTo
|
|
633
613
|
}), [scrollTo]);
|
|
634
|
-
const
|
|
614
|
+
const firstRndRef = useRef(true);
|
|
635
615
|
useEffect(() => {
|
|
636
|
-
if (
|
|
637
|
-
|
|
616
|
+
if (firstRndRef.current) {
|
|
617
|
+
firstRndRef.current = false;
|
|
638
618
|
scrollIntoView(true);
|
|
639
619
|
}
|
|
640
620
|
}, [scrollIntoView]);
|
|
641
621
|
useEffect(() => {
|
|
642
|
-
if (!
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
const
|
|
647
|
-
const
|
|
648
|
-
const
|
|
649
|
-
|
|
650
|
-
const
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
borderRadius: indicatorCornerRadius,
|
|
661
|
-
backgroundColor: indicatorColor,
|
|
662
|
-
width: indicatorWidth,
|
|
663
|
-
bottom: indicatorBottom,
|
|
664
|
-
transform: [{
|
|
665
|
-
translateX: indicatorX
|
|
666
|
-
}]
|
|
622
|
+
if (!firstRndRef.current) scrollIntoView();
|
|
623
|
+
}, [curName, scrollIntoView]);
|
|
624
|
+
const hasBorder = border ?? false;
|
|
625
|
+
const showInd = type === 'line';
|
|
626
|
+
const navH = type === 'jumbo' ? tokens.jumbo.height : type === 'card' ? tokens.card.height : tokens.tabList.height;
|
|
627
|
+
const navPB = Platform.OS === 'web' && type !== 'line' && type !== 'card' ? tokens.tabList.paddingBottom : 0;
|
|
628
|
+
const indBot = showInd ? type === 'line' ? 0 : tokens.indicator.offset : 0;
|
|
629
|
+
if (panes.length === 0) return null;
|
|
630
|
+
const indicatorNode = showInd ? /*#__PURE__*/React.createElement(Animated.View, {
|
|
631
|
+
testID: "rv-tabs-indicator",
|
|
632
|
+
style: [S.ind, {
|
|
633
|
+
height: resLineH,
|
|
634
|
+
borderRadius: indRad,
|
|
635
|
+
backgroundColor: indColor,
|
|
636
|
+
width: indicatorWidth,
|
|
637
|
+
bottom: indBot,
|
|
638
|
+
transform: [{
|
|
639
|
+
translateX: indicatorX
|
|
667
640
|
}]
|
|
668
|
-
}
|
|
669
|
-
}
|
|
641
|
+
}]
|
|
642
|
+
}) : null;
|
|
670
643
|
const navItems = useMemo(() => panes.map(pane => /*#__PURE__*/React.createElement(TabBarItem, {
|
|
671
644
|
key: pane.key,
|
|
672
645
|
pane: pane,
|
|
673
|
-
isActive: pane.name ===
|
|
646
|
+
isActive: pane.name === curName,
|
|
674
647
|
align: align,
|
|
675
648
|
scrollable: scrollable,
|
|
676
649
|
type: type,
|
|
@@ -682,21 +655,21 @@ const TabsBaseInner = (props, ref) => {
|
|
|
682
655
|
tabStyle: tabStyle,
|
|
683
656
|
titleStyle: titleStyle,
|
|
684
657
|
descriptionStyle: descriptionStyle,
|
|
685
|
-
onSelect:
|
|
686
|
-
onLayout:
|
|
658
|
+
onSelect: onSel,
|
|
659
|
+
onLayout: onTabLayout,
|
|
687
660
|
isLast: pane.index === panes.length - 1
|
|
688
|
-
})), [align, color,
|
|
689
|
-
const
|
|
690
|
-
const prev =
|
|
691
|
-
|
|
692
|
-
if (prev === 0 ||
|
|
661
|
+
})), [align, color, curName, descriptionStyle, ellipsis, onSel, onTabLayout, panes, scrollable, tabStyle, titleActiveColor, titleInactiveColor, titleStyle, tokens, type]);
|
|
662
|
+
const onNavCntSizeChg = useCallback(w => {
|
|
663
|
+
const prev = navCntWRef.current;
|
|
664
|
+
navCntWRef.current = w;
|
|
665
|
+
if (prev === 0 || firstRndRef.current) {
|
|
693
666
|
scrollIntoView(true);
|
|
694
667
|
return;
|
|
695
668
|
}
|
|
696
669
|
if (Math.abs(w - prev) > 1) {
|
|
697
|
-
cancelFrame(
|
|
698
|
-
|
|
699
|
-
|
|
670
|
+
cancelFrame(navCntSyncRef.current);
|
|
671
|
+
navCntSyncRef.current = requestFrame(() => {
|
|
672
|
+
navCntSyncRef.current = null;
|
|
700
673
|
scrollIntoView();
|
|
701
674
|
});
|
|
702
675
|
}
|
|
@@ -709,50 +682,56 @@ const TabsBaseInner = (props, ref) => {
|
|
|
709
682
|
scrollEventThrottle: 16,
|
|
710
683
|
onScrollBeginDrag: handleNavScrollBeginDrag,
|
|
711
684
|
onScroll: handleNavScroll,
|
|
712
|
-
onContentSizeChange:
|
|
713
|
-
contentContainerStyle:
|
|
685
|
+
onContentSizeChange: onNavCntSizeChg,
|
|
686
|
+
contentContainerStyle: S.navC
|
|
714
687
|
}, navItems, indicatorNode) : /*#__PURE__*/React.createElement(View, {
|
|
715
688
|
accessibilityRole: "tablist",
|
|
716
|
-
style: [
|
|
689
|
+
style: [S.navC, S.navCSta]
|
|
717
690
|
}, navItems, indicatorNode);
|
|
718
691
|
const navContent = /*#__PURE__*/React.createElement(View, {
|
|
719
|
-
style: [
|
|
720
|
-
borderBottomWidth: StyleSheet.hairlineWidth,
|
|
721
|
-
borderBottomColor: tokens.colors.border
|
|
722
|
-
} : null, {
|
|
692
|
+
style: [S.wrap, {
|
|
723
693
|
backgroundColor: background
|
|
724
694
|
}, tabBarStyle]
|
|
725
695
|
}, navLeft && /*#__PURE__*/React.createElement(View, {
|
|
726
|
-
style:
|
|
696
|
+
style: {
|
|
727
697
|
paddingHorizontal: tokens.spacing.navSidePaddingHorizontal
|
|
728
|
-
}
|
|
698
|
+
}
|
|
729
699
|
}, navLeft), /*#__PURE__*/React.createElement(View, {
|
|
730
|
-
style: [
|
|
731
|
-
minHeight:
|
|
732
|
-
paddingBottom:
|
|
700
|
+
style: [S.nav, {
|
|
701
|
+
minHeight: navH + navPB,
|
|
702
|
+
paddingBottom: navPB
|
|
733
703
|
}, type === 'card' ? {
|
|
734
|
-
borderWidth: StyleSheet.hairlineWidth,
|
|
735
704
|
borderRadius: tokens.card.radius,
|
|
736
|
-
borderColor: color ?? tokens.colors.cardBorder,
|
|
737
705
|
marginHorizontal: tokens.card.marginHorizontal,
|
|
738
706
|
overflow: 'hidden'
|
|
739
707
|
} : null],
|
|
740
|
-
onLayout:
|
|
741
|
-
}, navBody
|
|
742
|
-
style:
|
|
708
|
+
onLayout: onNavCtrLayout
|
|
709
|
+
}, navBody, type === 'card' && /*#__PURE__*/React.createElement(View, {
|
|
710
|
+
style: createHairlineView({
|
|
711
|
+
position: 'all',
|
|
712
|
+
color: color ?? tokens.colors.cardBorder,
|
|
713
|
+
borderRadius: tokens.card.radius
|
|
714
|
+
})
|
|
715
|
+
})), navRight && /*#__PURE__*/React.createElement(View, {
|
|
716
|
+
style: {
|
|
743
717
|
paddingHorizontal: tokens.spacing.navSidePaddingHorizontal
|
|
744
|
-
}]
|
|
745
|
-
}, navRight));
|
|
746
|
-
const paneNodes = useMemo(() => panes.map(pane => {
|
|
747
|
-
const isActive = pane.name === currentName;
|
|
748
|
-
const shouldRender = !lazyRender || isActive || visitedRef.current.has(pane.name);
|
|
749
|
-
if (!shouldRender && !isSwipeable) {
|
|
750
|
-
return null;
|
|
751
718
|
}
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
719
|
+
}, navRight), hasBorder && type === 'line' && /*#__PURE__*/React.createElement(View, {
|
|
720
|
+
style: createHairlineView({
|
|
721
|
+
position: 'bottom',
|
|
722
|
+
color: tokens.colors.border,
|
|
723
|
+
left: 0,
|
|
724
|
+
right: 0
|
|
725
|
+
})
|
|
726
|
+
}));
|
|
727
|
+
const paneNodes = useMemo(() => panes.map(pane => {
|
|
728
|
+
const isActive = pane.name === curName;
|
|
729
|
+
const shouldRender = !lazyRender || isActive || visRef.current.has(pane.name);
|
|
730
|
+
if (!shouldRender && !isSwipe) return null;
|
|
731
|
+
const layoutHandler = isSwipe && swipeCfg?.autoHeight ? event => onPaneLayout(pane.name, event) : undefined;
|
|
732
|
+
const paneStyles = [S.pane, isSwipe ? S.swipePane : null, isSwipe && ctrW > 0 && {
|
|
733
|
+
width: ctrW
|
|
734
|
+
}, !isSwipe && !isActive ? S.hidPane : null];
|
|
756
735
|
const paneContent = shouldRender ? pane.children : lazyRenderPlaceholder || null;
|
|
757
736
|
return /*#__PURE__*/React.createElement(View, {
|
|
758
737
|
key: pane.key,
|
|
@@ -760,37 +739,37 @@ const TabsBaseInner = (props, ref) => {
|
|
|
760
739
|
onLayout: layoutHandler,
|
|
761
740
|
style: paneStyles
|
|
762
741
|
}, paneContent);
|
|
763
|
-
}), [
|
|
764
|
-
const baseContentStyle =
|
|
765
|
-
const
|
|
766
|
-
height:
|
|
767
|
-
}]
|
|
768
|
-
const contentNode =
|
|
769
|
-
style:
|
|
742
|
+
}), [ctrW, curName, onPaneLayout, isSwipe, lazyRender, lazyRenderPlaceholder, panes, swipeCfg?.autoHeight]);
|
|
743
|
+
const baseContentStyle = [S.content, contentStyle];
|
|
744
|
+
const swipeContentStyle = [S.content, contentStyle, swipeCfg?.autoHeight && swipeH !== undefined && {
|
|
745
|
+
height: swipeH
|
|
746
|
+
}];
|
|
747
|
+
const contentNode = isSwipe ? /*#__PURE__*/React.createElement(View, {
|
|
748
|
+
style: swipeContentStyle
|
|
770
749
|
}, /*#__PURE__*/React.createElement(Animated.ScrollView, {
|
|
771
|
-
ref:
|
|
750
|
+
ref: swipeScrRef,
|
|
772
751
|
horizontal: true,
|
|
773
752
|
pagingEnabled: true,
|
|
774
753
|
scrollEventThrottle: 16,
|
|
775
754
|
showsHorizontalScrollIndicator: false,
|
|
776
|
-
onMomentumScrollEnd:
|
|
777
|
-
onScrollEndDrag:
|
|
778
|
-
nestedScrollEnabled:
|
|
779
|
-
directionalLockEnabled:
|
|
755
|
+
onMomentumScrollEnd: onSwipeMomentumScrollEnd,
|
|
756
|
+
onScrollEndDrag: onSwipeScrollEndDrag,
|
|
757
|
+
nestedScrollEnabled: swipeCfg?.preventScroll === false,
|
|
758
|
+
directionalLockEnabled: swipeCfg?.preventScroll !== false
|
|
780
759
|
}, paneNodes)) : /*#__PURE__*/React.createElement(View, {
|
|
781
760
|
style: baseContentStyle
|
|
782
761
|
}, paneNodes);
|
|
783
762
|
return /*#__PURE__*/React.createElement(View, _extends({}, rest, {
|
|
784
|
-
style: [
|
|
785
|
-
onLayout:
|
|
763
|
+
style: [S.ctr, style],
|
|
764
|
+
onLayout: onCtrLayout
|
|
786
765
|
}), navContent, navBottom && /*#__PURE__*/React.createElement(View, {
|
|
787
|
-
style:
|
|
766
|
+
style: {
|
|
788
767
|
marginTop: tokens.spacing.navBottomMarginTop
|
|
789
|
-
}
|
|
768
|
+
}
|
|
790
769
|
}, navBottom), contentNode);
|
|
791
770
|
};
|
|
792
|
-
const
|
|
793
|
-
|
|
771
|
+
const S = StyleSheet.create({
|
|
772
|
+
ctr: {
|
|
794
773
|
width: '100%'
|
|
795
774
|
},
|
|
796
775
|
wrap: {
|
|
@@ -803,31 +782,29 @@ const styles = StyleSheet.create({
|
|
|
803
782
|
position: 'relative',
|
|
804
783
|
alignSelf: 'stretch'
|
|
805
784
|
},
|
|
806
|
-
|
|
785
|
+
navC: {
|
|
807
786
|
flexDirection: 'row',
|
|
808
787
|
alignItems: 'center',
|
|
809
788
|
height: '100%',
|
|
810
789
|
position: 'relative'
|
|
811
790
|
},
|
|
812
|
-
|
|
791
|
+
navCSta: {
|
|
813
792
|
flex: 1
|
|
814
793
|
},
|
|
815
|
-
|
|
816
|
-
navBottom: {},
|
|
817
|
-
labelWrapper: {
|
|
794
|
+
lblW: {
|
|
818
795
|
justifyContent: 'center',
|
|
819
796
|
alignItems: 'center',
|
|
820
797
|
flexDirection: 'column'
|
|
821
798
|
},
|
|
822
|
-
|
|
799
|
+
lblWJ: {
|
|
823
800
|
alignItems: 'center'
|
|
824
801
|
},
|
|
825
|
-
|
|
802
|
+
cardLbl: {
|
|
826
803
|
flexDirection: 'row',
|
|
827
804
|
justifyContent: 'center',
|
|
828
805
|
alignItems: 'center'
|
|
829
806
|
},
|
|
830
|
-
|
|
807
|
+
tabI: {
|
|
831
808
|
flexShrink: 0,
|
|
832
809
|
height: '100%',
|
|
833
810
|
alignSelf: 'stretch',
|
|
@@ -835,23 +812,20 @@ const styles = StyleSheet.create({
|
|
|
835
812
|
justifyContent: 'center',
|
|
836
813
|
flexDirection: 'row'
|
|
837
814
|
},
|
|
838
|
-
|
|
815
|
+
flexI: {
|
|
839
816
|
flexGrow: 1
|
|
840
817
|
},
|
|
841
818
|
title: {
|
|
842
819
|
includeFontPadding: false
|
|
843
820
|
},
|
|
844
|
-
|
|
821
|
+
descTxt: {
|
|
845
822
|
includeFontPadding: false
|
|
846
823
|
},
|
|
847
|
-
descriptionView: {},
|
|
848
824
|
ellipsis: {
|
|
849
825
|
maxWidth: '100%',
|
|
850
826
|
flexShrink: 1
|
|
851
827
|
},
|
|
852
|
-
|
|
853
|
-
badgeText: {},
|
|
854
|
-
indicator: {
|
|
828
|
+
ind: {
|
|
855
829
|
position: 'absolute',
|
|
856
830
|
bottom: 0,
|
|
857
831
|
left: 0
|
|
@@ -862,16 +836,15 @@ const styles = StyleSheet.create({
|
|
|
862
836
|
pane: {
|
|
863
837
|
width: '100%'
|
|
864
838
|
},
|
|
865
|
-
|
|
839
|
+
swipePane: {
|
|
866
840
|
flexShrink: 0
|
|
867
841
|
},
|
|
868
|
-
|
|
842
|
+
hidPane: {
|
|
869
843
|
display: 'none'
|
|
870
844
|
}
|
|
871
845
|
});
|
|
872
|
-
const
|
|
873
|
-
|
|
874
|
-
const TabsWithPane = Object.assign(TabsBase, {
|
|
846
|
+
const TabsBaseRef = /*#__PURE__*/React.forwardRef(TabsBaseInner);
|
|
847
|
+
const TabsWithPane = Object.assign(/*#__PURE__*/React.memo(TabsBaseRef), {
|
|
875
848
|
TabPane
|
|
876
849
|
});
|
|
877
850
|
export { TabPane };
|