glacia-native 0.5.2 → 0.6.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 +84 -17
- package/lib/module/Accordion.js +58 -0
- package/lib/module/ActionSheet.js +38 -0
- package/lib/module/Alert.js +23 -0
- package/lib/module/AlertDialog.js +47 -0
- package/lib/module/Avatar.js +48 -0
- package/lib/module/Badge.js +36 -0
- package/lib/module/Bars.js +13 -268
- package/lib/module/Button.js +57 -39
- package/lib/module/Card.js +31 -19
- package/lib/module/Checkbox.js +42 -0
- package/lib/module/Chip.js +80 -0
- package/lib/module/Collapsible.js +26 -0
- package/lib/module/ContextMenu.js +33 -0
- package/lib/module/Dialog.js +39 -123
- package/lib/module/DropdownMenu.js +33 -0
- package/lib/module/Field.js +22 -0
- package/lib/module/Glass.js +10 -3
- package/lib/module/Group.js +36 -0
- package/lib/module/IconButton.js +40 -0
- package/lib/module/Input.js +43 -38
- package/lib/module/Label.js +17 -0
- package/lib/module/MorphGroup.js +47 -0
- package/lib/module/Popover.js +29 -0
- package/lib/module/Progress.js +32 -0
- package/lib/module/RadioGroup.js +51 -0
- package/lib/module/Scrim.js +44 -0
- package/lib/module/SegmentedControl.js +70 -63
- package/lib/module/Select.js +51 -0
- package/lib/module/Separator.js +25 -0
- package/lib/module/Sheet.js +51 -0
- package/lib/module/Skeleton.js +48 -0
- package/lib/module/Slider.js +45 -34
- package/lib/module/Stepper.js +167 -0
- package/lib/module/Switch.js +45 -55
- package/lib/module/TabBar.js +50 -44
- package/lib/module/Textarea.js +18 -0
- package/lib/module/Toast.js +55 -0
- package/lib/module/Toggle.js +47 -0
- package/lib/module/ToggleGroup.js +56 -0
- package/lib/module/Toolbar.js +37 -0
- package/lib/module/Tooltip.js +31 -0
- package/lib/module/glass-provider.js +28 -0
- package/lib/module/glass-stack.js +61 -0
- package/lib/module/index.js +78 -109
- package/lib/module/internal/GlassBackdrop.js +36 -0
- package/lib/module/internal/GlassView.js +43 -11
- package/lib/module/internal/blur-community.js +20 -0
- package/lib/module/internal/blur-community.web.js +9 -0
- package/lib/module/internal/blur.js +6 -9
- package/lib/module/internal/glass-routing.js +156 -30
- package/lib/module/internal/initials.js +12 -0
- package/lib/module/internal/overlay.js +147 -0
- package/lib/module/internal/primitives.js +16 -0
- package/lib/typescript/Accordion.d.ts +22 -0
- package/lib/typescript/ActionSheet.d.ts +24 -0
- package/lib/typescript/Alert.d.ts +15 -0
- package/lib/typescript/AlertDialog.d.ts +17 -0
- package/lib/typescript/Avatar.d.ts +22 -0
- package/lib/typescript/Badge.d.ts +12 -0
- package/lib/typescript/Bars.d.ts +3 -188
- package/lib/typescript/Button.d.ts +44 -10
- package/lib/typescript/Card.d.ts +30 -3
- package/lib/typescript/Checkbox.d.ts +14 -0
- package/lib/typescript/Chip.d.ts +19 -0
- package/lib/typescript/Collapsible.d.ts +17 -0
- package/lib/typescript/ContextMenu.d.ts +23 -0
- package/lib/typescript/Dialog.d.ts +8 -68
- package/lib/typescript/DropdownMenu.d.ts +23 -0
- package/lib/typescript/Field.d.ts +19 -0
- package/lib/typescript/Glass.d.ts +11 -2
- package/lib/typescript/Group.d.ts +35 -0
- package/lib/typescript/IconButton.d.ts +21 -0
- package/lib/typescript/Input.d.ts +17 -18
- package/lib/typescript/Label.d.ts +14 -0
- package/lib/typescript/MorphGroup.d.ts +46 -0
- package/lib/typescript/Popover.d.ts +17 -0
- package/lib/typescript/Progress.d.ts +13 -0
- package/lib/typescript/RadioGroup.d.ts +21 -0
- package/lib/typescript/Scrim.d.ts +33 -0
- package/lib/typescript/SegmentedControl.d.ts +24 -13
- package/lib/typescript/Select.d.ts +19 -0
- package/lib/typescript/Separator.d.ts +10 -0
- package/lib/typescript/Sheet.d.ts +45 -0
- package/lib/typescript/Skeleton.d.ts +10 -0
- package/lib/typescript/Slider.d.ts +15 -7
- package/lib/typescript/Stepper.d.ts +49 -0
- package/lib/typescript/Switch.d.ts +19 -12
- package/lib/typescript/TabBar.d.ts +18 -6
- package/lib/typescript/Textarea.d.ts +6 -0
- package/lib/typescript/Toast.d.ts +40 -0
- package/lib/typescript/Toggle.d.ts +21 -0
- package/lib/typescript/ToggleGroup.d.ts +22 -0
- package/lib/typescript/Toolbar.d.ts +35 -0
- package/lib/typescript/Tooltip.d.ts +16 -0
- package/lib/typescript/glass-provider.d.ts +34 -0
- package/lib/typescript/glass-stack.d.ts +54 -0
- package/lib/typescript/index.d.ts +38 -17
- package/lib/typescript/internal/GlassBackdrop.d.ts +33 -0
- package/lib/typescript/internal/GlassView.d.ts +18 -2
- package/lib/typescript/internal/blur-community.d.ts +2 -0
- package/lib/typescript/internal/blur-community.web.d.ts +2 -0
- package/lib/typescript/internal/glass-routing.d.ts +83 -15
- package/lib/typescript/internal/initials.d.ts +2 -0
- package/lib/typescript/internal/overlay.d.ts +74 -0
- package/lib/typescript/internal/primitives.d.ts +11 -0
- package/package.json +12 -10
- package/src/Accordion.tsx +165 -0
- package/src/ActionSheet.tsx +149 -0
- package/src/Alert.tsx +85 -0
- package/src/AlertDialog.tsx +124 -0
- package/src/Avatar.tsx +102 -0
- package/src/Badge.tsx +80 -0
- package/src/Bars.tsx +10 -807
- package/src/Button.tsx +196 -67
- package/src/Card.tsx +105 -32
- package/src/Checkbox.tsx +98 -0
- package/src/Chip.tsx +149 -0
- package/src/Collapsible.tsx +66 -0
- package/src/ContextMenu.tsx +103 -0
- package/src/Dialog.tsx +85 -335
- package/src/DropdownMenu.tsx +103 -0
- package/src/Field.tsx +65 -0
- package/src/Glass.tsx +15 -5
- package/src/Group.tsx +98 -0
- package/src/IconButton.tsx +110 -0
- package/src/Input.tsx +139 -87
- package/src/Label.tsx +56 -0
- package/src/MorphGroup.tsx +134 -0
- package/src/Popover.tsx +81 -0
- package/src/Progress.tsx +83 -0
- package/src/RadioGroup.tsx +122 -0
- package/src/Scrim.tsx +94 -0
- package/src/SegmentedControl.tsx +132 -99
- package/src/Select.tsx +136 -0
- package/src/Separator.tsx +52 -0
- package/src/Sheet.tsx +139 -0
- package/src/Skeleton.tsx +77 -0
- package/src/Slider.tsx +84 -47
- package/src/Stepper.tsx +315 -0
- package/src/Switch.tsx +81 -73
- package/src/TabBar.tsx +106 -93
- package/src/Textarea.tsx +34 -0
- package/src/Toast.tsx +131 -0
- package/src/Toggle.tsx +113 -0
- package/src/ToggleGroup.tsx +129 -0
- package/src/Toolbar.tsx +111 -0
- package/src/Tooltip.tsx +79 -0
- package/src/engine/CHANGELOG.md +430 -0
- package/src/engine/NOTICE +54 -0
- package/src/engine/README.md +975 -0
- package/src/engine/android/build.gradle +18 -0
- package/src/engine/android/src/main/AndroidManifest.xml +2 -0
- package/src/engine/android/src/main/java/expo/modules/liquidglass/ExpoLiquidGlassModule.kt +174 -0
- package/src/engine/android/src/main/java/expo/modules/liquidglass/GlassConstants.kt +7 -0
- package/src/engine/android/src/main/java/expo/modules/liquidglass/LiquidGlassContainerView.kt +16 -0
- package/src/engine/android/src/main/java/expo/modules/liquidglass/LiquidGlassProviderView.kt +165 -0
- package/src/engine/android/src/main/java/expo/modules/liquidglass/LiquidGlassView.kt +1731 -0
- package/src/engine/android/src/main/java/expo/modules/liquidglass/enums/GlassEnums.kt +171 -0
- package/src/engine/android/src/main/java/expo/modules/liquidglass/glass/BackdropGraph.kt +146 -0
- package/src/engine/android/src/main/java/expo/modules/liquidglass/glass/BackdropSource.kt +53 -0
- package/src/engine/android/src/main/java/expo/modules/liquidglass/glass/ContinuousCorners.kt +188 -0
- package/src/engine/android/src/main/java/expo/modules/liquidglass/glass/CornerRadii.kt +62 -0
- package/src/engine/android/src/main/java/expo/modules/liquidglass/glass/GlassAppearance.kt +352 -0
- package/src/engine/android/src/main/java/expo/modules/liquidglass/glass/GlassDebug.kt +109 -0
- package/src/engine/android/src/main/java/expo/modules/liquidglass/glass/GlassEnvironment.kt +139 -0
- package/src/engine/android/src/main/java/expo/modules/liquidglass/glass/GlassHdr.kt +85 -0
- package/src/engine/android/src/main/java/expo/modules/liquidglass/glass/GlassLuminanceProbe.kt +189 -0
- package/src/engine/android/src/main/java/expo/modules/liquidglass/glass/GlassPressAnimator.kt +264 -0
- package/src/engine/android/src/main/java/expo/modules/liquidglass/glass/GlassProgressiveBlur.kt +249 -0
- package/src/engine/android/src/main/java/expo/modules/liquidglass/glass/GlassShaderCache.kt +256 -0
- package/src/engine/android/src/main/java/expo/modules/liquidglass/glass/GlassShaderSource.kt +845 -0
- package/src/engine/android/src/main/java/expo/modules/liquidglass/glass/GlassTier.kt +63 -0
- package/src/engine/android/src/main/java/expo/modules/liquidglass/glass/ProviderRegistry.kt +71 -0
- package/src/engine/android/src/main/java/expo/modules/liquidglass/records/GlassRecords.kt +288 -0
- package/src/engine/index.ts +24 -0
- package/src/engine/ios/Enums/GlassBlurDirection.swift +21 -0
- package/src/engine/ios/Enums/GlassVariant.swift +86 -0
- package/src/engine/ios/ExpoLiquidGlass.podspec +93 -0
- package/src/engine/ios/ExpoLiquidGlassModule.swift +77 -0
- package/src/engine/ios/Glass/BackdropCapturer.swift +811 -0
- package/src/engine/ios/Glass/ContinuousCorners.swift +165 -0
- package/src/engine/ios/Glass/GlassBackdrop.swift +176 -0
- package/src/engine/ios/Glass/GlassFramePhase.swift +126 -0
- package/src/engine/ios/Glass/GlassFrameScheduler.swift +261 -0
- package/src/engine/ios/Glass/GlassPressAnimator.swift +250 -0
- package/src/engine/ios/Glass/GlassRenderContext.swift +168 -0
- package/src/engine/ios/Glass/GlassRenderer.swift +186 -0
- package/src/engine/ios/Glass/GlassSurfaceView.swift +452 -0
- package/src/engine/ios/Glass/NonRenderableView.swift +54 -0
- package/src/engine/ios/Glass/StripCache.swift +545 -0
- package/src/engine/ios/Records/GlassCornerRadii.swift +79 -0
- package/src/engine/ios/Records/GlassMetalOptions.swift +180 -0
- package/src/engine/ios/Records/GlassRefractionCurve.swift +14 -0
- package/src/engine/ios/Shaders/LiquidGlass.metal +480 -0
- package/src/engine/ios/Shaders/bundle-marker.txt +6 -0
- package/src/engine/ios/Views/LiquidGlassContainerView.swift +99 -0
- package/src/engine/ios/Views/LiquidGlassView.swift +859 -0
- package/src/engine/package.json +70 -0
- package/src/engine/src/components/LiquidGlassButton/LiquidGlassButton.tsx +424 -0
- package/src/engine/src/components/LiquidGlassCard/LiquidGlassCard.tsx +98 -0
- package/src/engine/src/components/LiquidGlassChip/LiquidGlassChip.tsx +65 -0
- package/src/engine/src/components/LiquidGlassGroup/LiquidGlassGroup.tsx +350 -0
- package/src/engine/src/components/LiquidGlassIconButton/LiquidGlassIconButton.tsx +24 -0
- package/src/engine/src/components/LiquidGlassMorphGroup/LiquidGlassMorphGroup.tsx +434 -0
- package/src/engine/src/components/LiquidGlassScrim/LiquidGlassScrim.tsx +100 -0
- package/src/engine/src/components/LiquidGlassSegmentedControl/LiquidGlassSegmentedControl.tsx +213 -0
- package/src/engine/src/components/LiquidGlassSheet/LiquidGlassSheet.tsx +218 -0
- package/src/engine/src/components/LiquidGlassSlider/LiquidGlassSlider.tsx +327 -0
- package/src/engine/src/components/LiquidGlassStepper/LiquidGlassStepper.tsx +321 -0
- package/src/engine/src/components/LiquidGlassSwitch/LiquidGlassSwitch.tsx +296 -0
- package/src/engine/src/components/LiquidGlassTabBar/LiquidGlassTabBar.tsx +952 -0
- package/src/engine/src/components/LiquidGlassTextInput/LiquidGlassTextInput.tsx +151 -0
- package/src/engine/src/components/LiquidGlassToast/LiquidGlassToast.tsx +169 -0
- package/src/engine/src/components/LiquidGlassToolbar/LiquidGlassToolbar.tsx +124 -0
- package/src/engine/src/components/index.ts +16 -0
- package/src/engine/src/constants/index.ts +4 -0
- package/src/engine/src/constants/metal.constants.ts +327 -0
- package/src/engine/src/constants/metrics.constants.ts +325 -0
- package/src/engine/src/constants/springs.constants.ts +107 -0
- package/src/engine/src/constants/styles.constants.ts +12 -0
- package/src/engine/src/context/glass-group.context.ts +65 -0
- package/src/engine/src/context/index.ts +6 -0
- package/src/engine/src/core/components/LiquidGlassContainer/LiquidGlassContainer.tsx +32 -0
- package/src/engine/src/core/components/LiquidGlassContainer/index.ts +1 -0
- package/src/engine/src/core/components/LiquidGlassProvider/LiquidGlassProvider.tsx +66 -0
- package/src/engine/src/core/components/LiquidGlassProvider/index.ts +1 -0
- package/src/engine/src/core/components/LiquidGlassStack/LiquidGlassStack.tsx +184 -0
- package/src/engine/src/core/components/LiquidGlassStack/index.ts +1 -0
- package/src/engine/src/core/components/LiquidGlassView/LiquidGlassView.tsx +126 -0
- package/src/engine/src/core/components/LiquidGlassView/index.ts +1 -0
- package/src/engine/src/core/components/index.ts +4 -0
- package/src/engine/src/core/constants/glass.constants.ts +57 -0
- package/src/engine/src/core/constants/index.ts +20 -0
- package/src/engine/src/core/constants/native.constants.ts +16 -0
- package/src/engine/src/core/context/glass-stack.context.ts +30 -0
- package/src/engine/src/core/context/index.ts +4 -0
- package/src/engine/src/core/enum/index.ts +12 -0
- package/src/engine/src/core/index.ts +1 -0
- package/src/engine/src/core/interfaces/glass-hdr.interface.ts +15 -0
- package/src/engine/src/core/interfaces/glass-metal.interface.ts +248 -0
- package/src/engine/src/core/interfaces/glass-surface.interface.ts +9 -0
- package/src/engine/src/core/interfaces/index.ts +31 -0
- package/src/engine/src/core/interfaces/liquid-glass-container.interface.ts +6 -0
- package/src/engine/src/core/interfaces/liquid-glass-provider.interface.ts +14 -0
- package/src/engine/src/core/interfaces/liquid-glass-stack.interface.ts +21 -0
- package/src/engine/src/core/interfaces/liquid-glass-view.interface.ts +129 -0
- package/src/engine/src/core/interfaces/native-liquid-glass-view.interface.ts +19 -0
- package/src/engine/src/core/modules/ExpoLiquidGlassModule.ts +26 -0
- package/src/engine/src/core/modules/index.ts +2 -0
- package/src/engine/src/core/root/index.ts +51 -0
- package/src/engine/src/core/types/glass.types.ts +25 -0
- package/src/engine/src/core/types/index.ts +8 -0
- package/src/engine/src/core/utils/debug.utils.ts +17 -0
- package/src/engine/src/core/utils/dev-warn.utils.ts +17 -0
- package/src/engine/src/core/utils/hdr.utils.ts +37 -0
- package/src/engine/src/core/utils/index.ts +5 -0
- package/src/engine/src/core/utils/native-view.utils.ts +33 -0
- package/src/engine/src/core/utils/platform.utils.ts +34 -0
- package/src/engine/src/core/views/NativeGlassBackdropView.ts +24 -0
- package/src/engine/src/core/views/NativeLiquidGlassContainerView.ts +13 -0
- package/src/engine/src/core/views/NativeLiquidGlassContainerView.web.ts +10 -0
- package/src/engine/src/core/views/NativeLiquidGlassProviderView.ts +13 -0
- package/src/engine/src/core/views/NativeLiquidGlassProviderView.web.ts +10 -0
- package/src/engine/src/core/views/NativeLiquidGlassView.ts +19 -0
- package/src/engine/src/core/views/NativeLiquidGlassView.web.ts +14 -0
- package/src/engine/src/core/views/index.ts +4 -0
- package/src/engine/src/hooks/index.ts +18 -0
- package/src/engine/src/hooks/use-adaptive-glass.ts +91 -0
- package/src/engine/src/hooks/use-damped-drag.ts +332 -0
- package/src/engine/src/hooks/use-echo-filter.ts +55 -0
- package/src/engine/src/hooks/use-glass-group-member.ts +169 -0
- package/src/engine/src/hooks/use-gravity-highlight.ts +79 -0
- package/src/engine/src/hooks/use-press-progress.ts +44 -0
- package/src/engine/src/index.ts +120 -0
- package/src/engine/src/interfaces/index.ts +28 -0
- package/src/engine/src/interfaces/liquid-glass-button.interface.ts +94 -0
- package/src/engine/src/interfaces/liquid-glass-card.interface.ts +40 -0
- package/src/engine/src/interfaces/liquid-glass-chip.interface.ts +29 -0
- package/src/engine/src/interfaces/liquid-glass-group.interface.ts +32 -0
- package/src/engine/src/interfaces/liquid-glass-icon-button.interface.ts +19 -0
- package/src/engine/src/interfaces/liquid-glass-morph-group.interface.ts +59 -0
- package/src/engine/src/interfaces/liquid-glass-scrim.interface.ts +36 -0
- package/src/engine/src/interfaces/liquid-glass-segmented-control.interface.ts +32 -0
- package/src/engine/src/interfaces/liquid-glass-sheet.interface.ts +38 -0
- package/src/engine/src/interfaces/liquid-glass-slider.interface.ts +37 -0
- package/src/engine/src/interfaces/liquid-glass-stepper.interface.ts +35 -0
- package/src/engine/src/interfaces/liquid-glass-switch.interface.ts +27 -0
- package/src/engine/src/interfaces/liquid-glass-tab-bar.interface.ts +116 -0
- package/src/engine/src/interfaces/liquid-glass-text-input.interface.ts +42 -0
- package/src/engine/src/interfaces/liquid-glass-toast.interface.ts +36 -0
- package/src/engine/src/interfaces/liquid-glass-toolbar.interface.ts +33 -0
- package/src/engine/src/theme/glass-ui-theme.ts +100 -0
- package/src/engine/src/theme/index.ts +2 -0
- package/src/engine/src/utils/button-press.utils.ts +63 -0
- package/src/engine/src/utils/index.ts +3 -0
- package/src/engine/src/utils/metal.utils.ts +164 -0
- package/src/glass-provider.tsx +60 -0
- package/src/glass-stack.tsx +115 -0
- package/src/index.ts +47 -190
- package/src/internal/GlassBackdrop.tsx +60 -0
- package/src/internal/GlassView.tsx +53 -18
- package/src/internal/blur-community.ts +19 -0
- package/src/internal/blur-community.web.ts +7 -0
- package/src/internal/blur.ts +7 -8
- package/src/internal/glass-routing.ts +212 -34
- package/src/internal/initials.ts +7 -0
- package/src/internal/overlay.tsx +258 -0
- package/src/internal/primitives.ts +23 -0
- package/lib/module/Carousel.js +0 -103
- package/lib/module/Display.js +0 -318
- package/lib/module/Feedback.js +0 -395
- package/lib/module/Form.js +0 -160
- package/lib/module/Forms2.js +0 -471
- package/lib/module/Message.js +0 -84
- package/lib/module/Overlays.js +0 -344
- package/lib/module/Pickers.js +0 -243
- package/lib/module/Table.js +0 -100
- package/lib/module/ai.js +0 -283
- package/lib/module/charts/AreaChart.js +0 -32
- package/lib/module/charts/BarChart.js +0 -75
- package/lib/module/charts/FunnelChart.js +0 -50
- package/lib/module/charts/HeatmapChart.js +0 -71
- package/lib/module/charts/LineChart.js +0 -81
- package/lib/module/charts/PlotChart.js +0 -52
- package/lib/module/charts/RadarChart.js +0 -78
- package/lib/module/charts/RingChart.js +0 -52
- package/lib/module/charts/ScatterChart.js +0 -95
- package/lib/module/charts/WaterfallChart.js +0 -85
- package/lib/module/charts/advanced.js +0 -313
- package/lib/module/charts/extra.js +0 -108
- package/lib/module/charts/index.js +0 -50
- package/lib/module/charts/scales.js +0 -140
- package/lib/typescript/Carousel.d.ts +0 -47
- package/lib/typescript/Display.d.ts +0 -178
- package/lib/typescript/Feedback.d.ts +0 -196
- package/lib/typescript/Form.d.ts +0 -97
- package/lib/typescript/Forms2.d.ts +0 -209
- package/lib/typescript/Message.d.ts +0 -67
- package/lib/typescript/Overlays.d.ts +0 -146
- package/lib/typescript/Pickers.d.ts +0 -105
- package/lib/typescript/Table.d.ts +0 -64
- package/lib/typescript/ai.d.ts +0 -166
- package/lib/typescript/charts/AreaChart.d.ts +0 -44
- package/lib/typescript/charts/BarChart.d.ts +0 -19
- package/lib/typescript/charts/FunnelChart.d.ts +0 -25
- package/lib/typescript/charts/HeatmapChart.d.ts +0 -23
- package/lib/typescript/charts/LineChart.d.ts +0 -30
- package/lib/typescript/charts/PlotChart.d.ts +0 -31
- package/lib/typescript/charts/RadarChart.d.ts +0 -27
- package/lib/typescript/charts/RingChart.d.ts +0 -28
- package/lib/typescript/charts/ScatterChart.d.ts +0 -34
- package/lib/typescript/charts/WaterfallChart.d.ts +0 -22
- package/lib/typescript/charts/advanced.d.ts +0 -107
- package/lib/typescript/charts/extra.d.ts +0 -63
- package/lib/typescript/charts/index.d.ts +0 -13
- package/lib/typescript/charts/scales.d.ts +0 -35
- package/src/Carousel.tsx +0 -233
- package/src/Display.tsx +0 -781
- package/src/Feedback.tsx +0 -992
- package/src/Form.tsx +0 -445
- package/src/Forms2.tsx +0 -1055
- package/src/Message.tsx +0 -218
- package/src/Overlays.tsx +0 -704
- package/src/Pickers.tsx +0 -595
- package/src/Table.tsx +0 -232
- package/src/ai.tsx +0 -715
- package/src/charts/AreaChart.tsx +0 -73
- package/src/charts/BarChart.tsx +0 -221
- package/src/charts/FunnelChart.tsx +0 -125
- package/src/charts/HeatmapChart.tsx +0 -155
- package/src/charts/LineChart.tsx +0 -247
- package/src/charts/PlotChart.tsx +0 -168
- package/src/charts/RadarChart.tsx +0 -208
- package/src/charts/RingChart.tsx +0 -133
- package/src/charts/ScatterChart.tsx +0 -223
- package/src/charts/WaterfallChart.tsx +0 -201
- package/src/charts/advanced.tsx +0 -676
- package/src/charts/extra.tsx +0 -242
- package/src/charts/index.ts +0 -86
- package/src/charts/scales.ts +0 -163
|
@@ -0,0 +1,952 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import {
|
|
3
|
+
memo,
|
|
4
|
+
useCallback,
|
|
5
|
+
useEffect,
|
|
6
|
+
useId,
|
|
7
|
+
useMemo,
|
|
8
|
+
useRef,
|
|
9
|
+
useState,
|
|
10
|
+
} from "react";
|
|
11
|
+
import type { ColorValue, LayoutChangeEvent } from "react-native";
|
|
12
|
+
import {
|
|
13
|
+
I18nManager,
|
|
14
|
+
Platform,
|
|
15
|
+
Pressable,
|
|
16
|
+
StyleSheet,
|
|
17
|
+
Text,
|
|
18
|
+
View,
|
|
19
|
+
} from "react-native";
|
|
20
|
+
import { Gesture, GestureDetector } from "react-native-gesture-handler";
|
|
21
|
+
import Animated, {
|
|
22
|
+
Easing,
|
|
23
|
+
interpolateColor,
|
|
24
|
+
processColor,
|
|
25
|
+
runOnJS,
|
|
26
|
+
useAnimatedProps,
|
|
27
|
+
useAnimatedStyle,
|
|
28
|
+
useDerivedValue,
|
|
29
|
+
useSharedValue,
|
|
30
|
+
withSpring,
|
|
31
|
+
type SharedValue,
|
|
32
|
+
} from "react-native-reanimated";
|
|
33
|
+
|
|
34
|
+
import {
|
|
35
|
+
ABSOLUTE_FILL,
|
|
36
|
+
GLASS_BAR_CLEAR_METAL,
|
|
37
|
+
GLASS_BAR_METAL,
|
|
38
|
+
GLASS_PILL_DRAGGED_METAL,
|
|
39
|
+
GLASS_PILL_METAL,
|
|
40
|
+
PANEL_SPRING,
|
|
41
|
+
TAB_ACCENT_STRIP_HEIGHT,
|
|
42
|
+
TAB_FOLLOWER_SPEC,
|
|
43
|
+
TAB_JELLY_GAIN,
|
|
44
|
+
TAB_JELLY_LIMIT,
|
|
45
|
+
TAB_BAR_HEIGHT,
|
|
46
|
+
TAB_BAR_PADDING,
|
|
47
|
+
TAB_BAR_PRESS_GROWTH,
|
|
48
|
+
TAB_CONTENT_GAP,
|
|
49
|
+
TAB_ICON_SIZE,
|
|
50
|
+
TAB_ICON_SLOT,
|
|
51
|
+
TAB_LABEL_SIZE,
|
|
52
|
+
TAB_PANEL_MAX_OFFSET,
|
|
53
|
+
TAB_PILL_BLOOM_WIDTH,
|
|
54
|
+
TAB_PILL_HEIGHT,
|
|
55
|
+
TAB_PILL_PRESSED_SCALE,
|
|
56
|
+
TAB_PILL_SHADOW,
|
|
57
|
+
TAB_PILL_WASH_BLEED,
|
|
58
|
+
TAB_PRESS_LIGHT,
|
|
59
|
+
TAB_VELOCITY_DIVISOR,
|
|
60
|
+
} from "../../constants";
|
|
61
|
+
import type { GlassMetalOptions } from "../../core";
|
|
62
|
+
import { LiquidGlassProvider, LiquidGlassView } from "../../core";
|
|
63
|
+
import {
|
|
64
|
+
useAdaptiveGlass,
|
|
65
|
+
useDampedDrag,
|
|
66
|
+
useEchoFilter,
|
|
67
|
+
usePressProgress,
|
|
68
|
+
} from "../../hooks";
|
|
69
|
+
import type {
|
|
70
|
+
ILiquidGlassTabBarProps,
|
|
71
|
+
ILiquidGlassTabItem,
|
|
72
|
+
} from "../../interfaces";
|
|
73
|
+
import { GLASS_UI_PALETTE, useGlassUITheme } from "../../theme";
|
|
74
|
+
import { lerpMetal } from "../../utils";
|
|
75
|
+
|
|
76
|
+
/** The reference's rubber-band curve — Compose `EaseOut`, i.e. CSS `ease-out`. */
|
|
77
|
+
const EASE_OUT = Easing.bezier(0, 0, 0.58, 1).factory();
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* The adaptive wash at `progress`, as the ARGB number both natives take for `tint`. Inside a
|
|
81
|
+
* worklet `interpolateColor` hands back that number already; on the JS thread it hands back an
|
|
82
|
+
* `rgba()` string, which `processColor` converts. Never process the number again — that rotates
|
|
83
|
+
* its channels.
|
|
84
|
+
*/
|
|
85
|
+
const adaptiveTintValue = (
|
|
86
|
+
progress: number,
|
|
87
|
+
light: string,
|
|
88
|
+
dark: string
|
|
89
|
+
): ColorValue => {
|
|
90
|
+
"worklet";
|
|
91
|
+
const color = interpolateColor(progress, [0, 1], [light, dark]);
|
|
92
|
+
const processed = typeof color === "number" ? color : processColor(color);
|
|
93
|
+
return processed as unknown as ColorValue;
|
|
94
|
+
};
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* Every glass surface here changes under the finger, so all three are animated components. The
|
|
98
|
+
* props they take from the UI thread — `metal` and `glow` — are re-uploaded as shader uniforms and
|
|
99
|
+
* redrawn; no geometry rebuild, no backdrop re-record, no JS.
|
|
100
|
+
*/
|
|
101
|
+
const AnimatedGlassView = Animated.createAnimatedComponent(LiquidGlassView);
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* On Android the pill's backdrop is an explicit stack of provider layers, so the pill paints over
|
|
105
|
+
* the inactive row and the accent copy underneath replaces it — the reference's hard cutout, which
|
|
106
|
+
* slices icons in two at the capsule edge.
|
|
107
|
+
*
|
|
108
|
+
* Everywhere else that machinery does not exist: iOS declares no provider props (its Metal path
|
|
109
|
+
* captures the window beneath each glass) and web has no native module at all — so before this
|
|
110
|
+
* split the accent copy only ever reached the eye through a backdrop nothing else could sample,
|
|
111
|
+
* and the active item faded to nothing. QA's "tap home, home button disappears". The soft
|
|
112
|
+
* cutout is the same slice built from plain views: the active item still fades out under the
|
|
113
|
+
* pill, and a clipped capsule window riding the pill shows the wash and the accent copy instead
|
|
114
|
+
* — no backdrop required, so it also survives every renderer downgrade below glass.
|
|
115
|
+
*/
|
|
116
|
+
const CUTOUT_IS_HARD = Platform.OS === "android";
|
|
117
|
+
|
|
118
|
+
/**
|
|
119
|
+
* The reference's second `onDrawSurface` rect: a 3% black wash that fades *in* under the grab, as
|
|
120
|
+
* the resting fill fades out. Black in both themes — the resting fill is the one that flips.
|
|
121
|
+
*/
|
|
122
|
+
const PILL_WASH_ALPHA = 0.03;
|
|
123
|
+
|
|
124
|
+
/** The recipe with its `tint` removed — the tab bar paints that beneath the glyphs itself. */
|
|
125
|
+
const withoutTint = (metal: GlassMetalOptions): GlassMetalOptions => {
|
|
126
|
+
if (metal.tint == null) return metal;
|
|
127
|
+
const rest = { ...metal };
|
|
128
|
+
delete rest.tint;
|
|
129
|
+
return rest;
|
|
130
|
+
};
|
|
131
|
+
|
|
132
|
+
interface IBaseTabProps {
|
|
133
|
+
tab: ILiquidGlassTabItem;
|
|
134
|
+
index: number;
|
|
135
|
+
selected: boolean;
|
|
136
|
+
position: SharedValue<number>;
|
|
137
|
+
color: string;
|
|
138
|
+
/** Adaptive: the label crossfades between the two palettes' inactive colours. */
|
|
139
|
+
adaptiveProgress: SharedValue<number> | null;
|
|
140
|
+
labelStyle: ILiquidGlassTabBarProps["labelStyle"];
|
|
141
|
+
onPress: (index: number) => void;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
/** One inactive tab. The pill covers it; see {@link CUTOUT_IS_HARD}. */
|
|
145
|
+
const BaseTab: React.FC<IBaseTabProps> = ({
|
|
146
|
+
tab,
|
|
147
|
+
index,
|
|
148
|
+
selected,
|
|
149
|
+
position,
|
|
150
|
+
color,
|
|
151
|
+
adaptiveProgress,
|
|
152
|
+
labelStyle,
|
|
153
|
+
onPress,
|
|
154
|
+
}: IBaseTabProps): React.ReactElement => {
|
|
155
|
+
const fadeStyle = useAnimatedStyle(() =>
|
|
156
|
+
CUTOUT_IS_HARD
|
|
157
|
+
? { opacity: 1 }
|
|
158
|
+
: { opacity: Math.min(1, Math.abs(position.value - index)) }
|
|
159
|
+
);
|
|
160
|
+
const colorStyle = useAnimatedStyle(() => ({
|
|
161
|
+
color:
|
|
162
|
+
adaptiveProgress == null
|
|
163
|
+
? color
|
|
164
|
+
: interpolateColor(
|
|
165
|
+
adaptiveProgress.value,
|
|
166
|
+
[0, 1],
|
|
167
|
+
[GLASS_UI_PALETTE.light.inactive, GLASS_UI_PALETTE.dark.inactive]
|
|
168
|
+
),
|
|
169
|
+
}));
|
|
170
|
+
return (
|
|
171
|
+
<Pressable
|
|
172
|
+
accessibilityRole="tab"
|
|
173
|
+
accessibilityState={{ selected }}
|
|
174
|
+
accessibilityLabel={tab.title ?? tab.key}
|
|
175
|
+
onPress={() => onPress(index)}
|
|
176
|
+
style={styles.tab}
|
|
177
|
+
>
|
|
178
|
+
<Animated.View style={[styles.tabContent, fadeStyle]}>
|
|
179
|
+
<View style={styles.iconSlot}>
|
|
180
|
+
{tab.icon?.({ focused: false, color, size: TAB_ICON_SIZE })}
|
|
181
|
+
</View>
|
|
182
|
+
{tab.title != null ? (
|
|
183
|
+
<Animated.Text style={[styles.label, colorStyle, labelStyle]}>
|
|
184
|
+
{tab.title}
|
|
185
|
+
</Animated.Text>
|
|
186
|
+
) : null}
|
|
187
|
+
</Animated.View>
|
|
188
|
+
</Pressable>
|
|
189
|
+
);
|
|
190
|
+
};
|
|
191
|
+
|
|
192
|
+
interface IAccentRowProps {
|
|
193
|
+
tabs: ILiquidGlassTabItem[];
|
|
194
|
+
accent: string;
|
|
195
|
+
labelStyle: ILiquidGlassTabBarProps["labelStyle"];
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
/**
|
|
199
|
+
* The focused row, accent throughout. One copy feeds Android's provider layer, the other fills the
|
|
200
|
+
* soft cutout's window — shared so the two cutouts cannot drift apart. It is the inactive row's
|
|
201
|
+
* size, always: the grab scales the whole bar around it and shrinks nothing (see `panelStyle`).
|
|
202
|
+
*/
|
|
203
|
+
const AccentRow: React.FC<IAccentRowProps> = ({
|
|
204
|
+
tabs,
|
|
205
|
+
accent,
|
|
206
|
+
labelStyle,
|
|
207
|
+
}: IAccentRowProps): React.ReactElement => {
|
|
208
|
+
return (
|
|
209
|
+
<View style={styles.row}>
|
|
210
|
+
{tabs.map((tab) => (
|
|
211
|
+
<View key={tab.key} style={styles.tab}>
|
|
212
|
+
<View style={styles.tabContent}>
|
|
213
|
+
<View style={styles.iconSlot}>
|
|
214
|
+
{tab.icon?.({
|
|
215
|
+
focused: true,
|
|
216
|
+
color: accent,
|
|
217
|
+
size: TAB_ICON_SIZE,
|
|
218
|
+
})}
|
|
219
|
+
</View>
|
|
220
|
+
{tab.title != null ? (
|
|
221
|
+
<Text style={[styles.label, { color: accent }, labelStyle]}>
|
|
222
|
+
{tab.title}
|
|
223
|
+
</Text>
|
|
224
|
+
) : null}
|
|
225
|
+
</View>
|
|
226
|
+
</View>
|
|
227
|
+
))}
|
|
228
|
+
</View>
|
|
229
|
+
);
|
|
230
|
+
};
|
|
231
|
+
|
|
232
|
+
/**
|
|
233
|
+
* The catalog's `LiquidBottomTabs`.
|
|
234
|
+
*
|
|
235
|
+
* Three stacked siblings, in the reference's own z-order:
|
|
236
|
+
*
|
|
237
|
+
* 1. **The visible bar** — glass with the always-on material, carrying the real, tappable tab row.
|
|
238
|
+
* 2. **A screen-invisible accent clone**, recorded into its own provider. Not just tinted icons: a
|
|
239
|
+
* second, complete glass bar — the visible bar's exact recipe and shape — with the accent row
|
|
240
|
+
* and the pill's wash over it. Through the pill it *is* the bar: same lens, same rim, same
|
|
241
|
+
* frost, so the bar's refraction runs on under the pill instead of stopping at its edge.
|
|
242
|
+
* 3. **The pill**, last and therefore on top, reading `[screen, accent]` as one combined backdrop.
|
|
243
|
+
* Whatever it covers appears accent-blue; everything outside stays inactive. There is no
|
|
244
|
+
* cross-fade and no per-tab colour lerp — the transition follows the capsule edge exactly.
|
|
245
|
+
*
|
|
246
|
+
* The visible bar is deliberately **absent** from that stack, exactly as the reference's
|
|
247
|
+
* `rememberCombinedBackdrop(backdrop, tabsBackdrop)` leaves it out. Including it scrims everything
|
|
248
|
+
* the pill shows a second time — the bar's container fill on top of the clone's — and the pill goes
|
|
249
|
+
* darker and flatter than the bar around it. It is also *slower*: on a POCO F1 the three-layer
|
|
250
|
+
* stack measured 45 fps at 28% jank against 61 fps at 0.8% for this one.
|
|
251
|
+
*
|
|
252
|
+
* The clone departs from the reference in one respect. Kyant's `tabsBackdrop` is a 56dp capsule
|
|
253
|
+
* inside the 64dp bar wearing `lens(24dp * progress)` — no lens at rest — so a resting pill showed
|
|
254
|
+
* the backdrop *unbent* while the bar around it bent it: a flat hole in the refraction, glaring the
|
|
255
|
+
* moment an app put a stronger lens on `barMetal` (the user's call, 2026-09-07). Here the clone
|
|
256
|
+
* wears the bar's recipe permanently and is the bar's full size *at rest*, so the refraction is
|
|
257
|
+
* continuous across the resting pill; it shrinks to the reference's 56dp only as the pill lifts.
|
|
258
|
+
* That inset is what iOS 26 shows through the held pill — the bar reads smaller through it while
|
|
259
|
+
* the icons keep their size (iPhone 14 Pro Max, 2026-09-07; it is the illusion that had the
|
|
260
|
+
* active glyph read as "shrunk" that morning) — and the pill's lens bends that inner rim into
|
|
261
|
+
* view. None of it is the double computation it sounds like: the clone already blurred exactly
|
|
262
|
+
* these pixels, and the lens is a handful of uniforms on a shader that ran regardless.
|
|
263
|
+
*
|
|
264
|
+
* All of the above is the Android build. Where the provider stack does not exist — iOS, web — the
|
|
265
|
+
* accent clone is not rendered at all; a clipped capsule window rides *on* the pill instead,
|
|
266
|
+
* holding the wash and the accent row (the soft cutout, {@link CUTOUT_IS_HARD}). The backdrop
|
|
267
|
+
* trick and the JS trick draw the same picture; only the mechanism is per-platform.
|
|
268
|
+
*
|
|
269
|
+
* Nothing above swaps on a React state change. The pill's lens, the pill's wash and the light the
|
|
270
|
+
* bar throws under the pill are all continuous functions of one shared value, written to the native
|
|
271
|
+
* views from the UI thread — the reference recomposes its effect chain every frame of a press, and
|
|
272
|
+
* anything less lands a frame late and at the wrong moment.
|
|
273
|
+
*
|
|
274
|
+
* The motion is `DampedDragAnimation`: a critically-damped follower chased by an underdamped
|
|
275
|
+
* velocity channel, with the grab held through the whole snap and released only on arrival.
|
|
276
|
+
*/
|
|
277
|
+
const LiquidGlassTabBarBase: React.FC<ILiquidGlassTabBarProps> = ({
|
|
278
|
+
tabs,
|
|
279
|
+
selectedIndex,
|
|
280
|
+
onTabSelected,
|
|
281
|
+
accentColor,
|
|
282
|
+
inactiveColor,
|
|
283
|
+
tint,
|
|
284
|
+
adaptive = false,
|
|
285
|
+
variant = "regular",
|
|
286
|
+
height = TAB_BAR_HEIGHT,
|
|
287
|
+
barMetal,
|
|
288
|
+
blurRadius,
|
|
289
|
+
pillMetal,
|
|
290
|
+
pillDraggedMetal,
|
|
291
|
+
pillTint,
|
|
292
|
+
pillHeight = TAB_PILL_HEIGHT,
|
|
293
|
+
pillPressedScale = TAB_PILL_PRESSED_SCALE,
|
|
294
|
+
pressLight = TAB_PRESS_LIGHT,
|
|
295
|
+
providerId,
|
|
296
|
+
style,
|
|
297
|
+
labelStyle,
|
|
298
|
+
}: ILiquidGlassTabBarProps): React.ReactElement => {
|
|
299
|
+
// Adaptive: the whole dress follows the polarity the glass settled on rather than the OS
|
|
300
|
+
// scheme — the contrast pairing (dark surface, light control) driven by the backdrop. The
|
|
301
|
+
// hook is always mounted; its sensor only runs when `adaptive` spreads its props.
|
|
302
|
+
const adaptiveGlass = useAdaptiveGlass();
|
|
303
|
+
const { colors } = useGlassUITheme(
|
|
304
|
+
adaptive ? adaptiveGlass.scheme : undefined
|
|
305
|
+
);
|
|
306
|
+
const accent = accentColor ?? colors.accent;
|
|
307
|
+
const inactive = inactiveColor ?? colors.inactive;
|
|
308
|
+
const count = Math.max(tabs.length, 1);
|
|
309
|
+
const direction = I18nManager.isRTL ? -1 : 1;
|
|
310
|
+
const accentLayerId = `glass-ui-tabs-${useId()}-accent`;
|
|
311
|
+
|
|
312
|
+
const [width, setWidth] = useState(0);
|
|
313
|
+
const tabWidth = width > 0 ? (width - TAB_BAR_PADDING * 2) / count : 0;
|
|
314
|
+
const pillTop = (height - pillHeight) / 2;
|
|
315
|
+
const stripHeight = Math.min(TAB_ACCENT_STRIP_HEIGHT, height);
|
|
316
|
+
|
|
317
|
+
const restMetal = pillMetal ?? GLASS_PILL_METAL;
|
|
318
|
+
const grabbedMetal = pillDraggedMetal ?? GLASS_PILL_DRAGGED_METAL;
|
|
319
|
+
// A pill recipe's `tint` never reaches the pill's glass. On Android the pill is a window onto
|
|
320
|
+
// the accent layer — the active glyph reaches the eye *through* it — so a wash on the glass
|
|
321
|
+
// sits over the very icon the lens is displaying and dims it (the theme's #0088FF → #38A0FD;
|
|
322
|
+
// a blue pill swallowed its own glyph). Both washes are painted beneath the glyphs instead,
|
|
323
|
+
// where the resting chip already lives: the resting one *is* the chip, the held one follows
|
|
324
|
+
// the pill's bloom and fades in with the grab — the crossfade `lerpMetal` would have run on
|
|
325
|
+
// the glass, one layer down. The soft cutout draws its glyphs over the pill, so there the held
|
|
326
|
+
// wash sits on the glass, under the window. A recipe's tint wins over `pillTint`, as
|
|
327
|
+
// `barMetal`'s does over `tint`.
|
|
328
|
+
const restGlass = useMemo(() => withoutTint(restMetal), [restMetal]);
|
|
329
|
+
const heldGlass = useMemo(() => withoutTint(grabbedMetal), [grabbedMetal]);
|
|
330
|
+
const restWash = restMetal.tint ?? pillTint ?? colors.tabIndicatorSurface;
|
|
331
|
+
const heldWash = grabbedMetal.tint;
|
|
332
|
+
// The whole dress switches together: a clear bar needs its fill pulled back *and* its material
|
|
333
|
+
// re-leaned. The accent clone wears this same recipe, so it follows for free — anything else
|
|
334
|
+
// and the pill shows a scrim, a frost or a lens the bar does not have. `barMetal`/`tint` still
|
|
335
|
+
// override either.
|
|
336
|
+
const isClear = variant === "clear";
|
|
337
|
+
const surfaceTint =
|
|
338
|
+
tint ?? (isClear ? colors.tabBarSurfaceClear : colors.tabBarSurface);
|
|
339
|
+
const resolvedBarMetal = useMemo<GlassMetalOptions>(() => {
|
|
340
|
+
if (barMetal != null) return barMetal;
|
|
341
|
+
const base = isClear ? GLASS_BAR_CLEAR_METAL : GLASS_BAR_METAL;
|
|
342
|
+
return blurRadius == null ? base : { ...base, blurRadius };
|
|
343
|
+
}, [barMetal, blurRadius, isClear]);
|
|
344
|
+
// The two washes the adaptive crossfade runs between; an explicit `tint` pins it.
|
|
345
|
+
const adaptiveTint = adaptive && tint == null;
|
|
346
|
+
const lightSurface = isClear
|
|
347
|
+
? GLASS_UI_PALETTE.light.tabBarSurfaceClear
|
|
348
|
+
: GLASS_UI_PALETTE.light.tabBarSurface;
|
|
349
|
+
const darkSurface = isClear
|
|
350
|
+
? GLASS_UI_PALETTE.dark.tabBarSurfaceClear
|
|
351
|
+
: GLASS_UI_PALETTE.dark.tabBarSurface;
|
|
352
|
+
|
|
353
|
+
// Wilder than the reference on purpose — iOS 26's pill overruns its tab and settles back,
|
|
354
|
+
// and a fast flick pulls it into a hotdog (iPhone 14 Pro Max, 2026-09-07). See
|
|
355
|
+
// TAB_FOLLOWER_SPEC and TAB_JELLY_GAIN.
|
|
356
|
+
const drag = useDampedDrag({
|
|
357
|
+
range: [0, count - 1],
|
|
358
|
+
initialValue: selectedIndex,
|
|
359
|
+
pressedScale: pillPressedScale,
|
|
360
|
+
velocityDivisor: TAB_VELOCITY_DIVISOR,
|
|
361
|
+
valueSpring: TAB_FOLLOWER_SPEC,
|
|
362
|
+
jelly: { gain: TAB_JELLY_GAIN, limit: TAB_JELLY_LIMIT },
|
|
363
|
+
});
|
|
364
|
+
|
|
365
|
+
/**
|
|
366
|
+
* The bar's light runs on its own clock. `InteractiveHighlight` presses with `spring(0.5f, 300f)`
|
|
367
|
+
* and lets go the moment the finger does, while the pill's `spring(1f, 1000f)` press stays pinned
|
|
368
|
+
* at 1 until the follower has arrived. Driving both from one value — which is what a single
|
|
369
|
+
* `pressProgress` would do — makes the bar hold its glow through the whole flight home, and the
|
|
370
|
+
* grab stops reading as a grab.
|
|
371
|
+
*
|
|
372
|
+
* Faint by default (`pressLight`, 0.1): iOS 26 barely lightens the bar under the grab, and the
|
|
373
|
+
* reference's full wash spent the bar's headroom. The clock is the same; its output is scaled.
|
|
374
|
+
*/
|
|
375
|
+
const glow = usePressProgress();
|
|
376
|
+
|
|
377
|
+
/** Raw accumulated drag in px, unclamped — feeds the whole-panel rubber band. */
|
|
378
|
+
const panelDrag = useSharedValue(0);
|
|
379
|
+
const panelOffset = useSharedValue(0);
|
|
380
|
+
const barWidth = useSharedValue(0);
|
|
381
|
+
const slotWidth = useSharedValue(0);
|
|
382
|
+
/** Mirrors `selectedIndex` on the UI thread so the drag can tell when the landing changed. */
|
|
383
|
+
const committedIndex = useSharedValue(selectedIndex);
|
|
384
|
+
|
|
385
|
+
const echo = useEchoFilter<number>();
|
|
386
|
+
const mounted = useRef(false);
|
|
387
|
+
|
|
388
|
+
useEffect(() => {
|
|
389
|
+
barWidth.value = width;
|
|
390
|
+
slotWidth.value = tabWidth;
|
|
391
|
+
}, [barWidth, slotWidth, width, tabWidth]);
|
|
392
|
+
|
|
393
|
+
// An external change plays the full grab choreography, exactly as a tap does — the reference's
|
|
394
|
+
// `animateToValue` presses, flies and releases rather than tweening the position.
|
|
395
|
+
useEffect(() => {
|
|
396
|
+
if (!mounted.current) {
|
|
397
|
+
mounted.current = true;
|
|
398
|
+
return;
|
|
399
|
+
}
|
|
400
|
+
// The bar's own commits come back through this prop — see `useEchoFilter`.
|
|
401
|
+
if (echo.isEcho(selectedIndex)) return;
|
|
402
|
+
committedIndex.value = selectedIndex;
|
|
403
|
+
drag.animateTo(selectedIndex);
|
|
404
|
+
}, [committedIndex, drag, echo, selectedIndex]);
|
|
405
|
+
|
|
406
|
+
const commit = useCallback(
|
|
407
|
+
(index: number): void => {
|
|
408
|
+
echo.emitted(index);
|
|
409
|
+
onTabSelected(index);
|
|
410
|
+
},
|
|
411
|
+
[echo, onTabSelected]
|
|
412
|
+
);
|
|
413
|
+
|
|
414
|
+
// The gesture lives on the pill alone — the reference puts its drag inspector on the pill and
|
|
415
|
+
// leaves the tabs to their own click handling.
|
|
416
|
+
//
|
|
417
|
+
// The reference presses on touch-down (`awaitFirstDown`, no slop) and this did too, which is
|
|
418
|
+
// wrong the moment a bar floats over a scroll view: a finger landing on the pill to *scroll*
|
|
419
|
+
// inflated it and lit the whole bar, and since the press spring is `spring(1f, 1000f)` the
|
|
420
|
+
// apology took ~130 ms to play out. Requiring horizontal intent costs 6dp of travel nobody can
|
|
421
|
+
// see and removes the flash entirely; `failOffsetY` hands a vertical drag straight to the
|
|
422
|
+
// scroller. The reference never had to solve this — its tab bars sit in a static column.
|
|
423
|
+
const pan = Gesture.Pan()
|
|
424
|
+
.enabled(count > 1)
|
|
425
|
+
.activeOffsetX([-6, 6])
|
|
426
|
+
.failOffsetY([-12, 12])
|
|
427
|
+
.shouldCancelWhenOutside(false)
|
|
428
|
+
.onBegin(() => {
|
|
429
|
+
panelDrag.value = 0;
|
|
430
|
+
})
|
|
431
|
+
// Not `onBegin`: the grab starts when the gesture *activates*, which is the first moment the
|
|
432
|
+
// drag is unambiguously horizontal.
|
|
433
|
+
.onStart(() => {
|
|
434
|
+
drag.press();
|
|
435
|
+
glow.pressIn();
|
|
436
|
+
})
|
|
437
|
+
// `onChange` gives the incremental delta; `onUpdate` would give the cumulative translation,
|
|
438
|
+
// and the reference accumulates onto the spring's *target*, one drag amount at a time.
|
|
439
|
+
.onChange((event) => {
|
|
440
|
+
if (slotWidth.value <= 0) return;
|
|
441
|
+
drag.dragBy((direction * event.changeX) / slotWidth.value);
|
|
442
|
+
|
|
443
|
+
// The rubber band tracks total signed drag, not overscroll, so it engages from the first
|
|
444
|
+
// pixel anywhere on the strip — and it nudges the whole widget, never the pill alone.
|
|
445
|
+
panelDrag.value += event.changeX;
|
|
446
|
+
const f = Math.min(
|
|
447
|
+
1,
|
|
448
|
+
Math.max(-1, panelDrag.value / Math.max(barWidth.value, 1))
|
|
449
|
+
);
|
|
450
|
+
panelOffset.value =
|
|
451
|
+
TAB_PANEL_MAX_OFFSET * Math.sign(f) * EASE_OUT(Math.abs(f));
|
|
452
|
+
})
|
|
453
|
+
.onEnd(() => {
|
|
454
|
+
// Plain round(), no fling: velocity feeds the jelly and nothing else, so a fast flick that
|
|
455
|
+
// only crossed 0.4 of a cell snaps back.
|
|
456
|
+
const target = Math.min(
|
|
457
|
+
count - 1,
|
|
458
|
+
Math.max(0, Math.round(drag.targetValue.value))
|
|
459
|
+
);
|
|
460
|
+
drag.animateTo(target);
|
|
461
|
+
if (target !== committedIndex.value) {
|
|
462
|
+
committedIndex.value = target;
|
|
463
|
+
runOnJS(commit)(target);
|
|
464
|
+
}
|
|
465
|
+
})
|
|
466
|
+
.onFinalize(() => {
|
|
467
|
+
drag.release();
|
|
468
|
+
glow.pressOut();
|
|
469
|
+
panelOffset.value = withSpring(0, PANEL_SPRING);
|
|
470
|
+
});
|
|
471
|
+
|
|
472
|
+
// The grab scales the *whole* bar — glass, both rows, the pill riding in it — by 16dp of
|
|
473
|
+
// width, both axes, about its centre, on top of the rubber band. iOS 26 does exactly this and
|
|
474
|
+
// shrinks nothing: the icons, active and inactive alike, grow with the bar and stay the same
|
|
475
|
+
// size as each other (checked against an iPhone 14 Pro Max, 2026-09-07). An earlier build
|
|
476
|
+
// scaled only the bar's glass and minified the active glyph to 56/64 under the lifted pill,
|
|
477
|
+
// which read as the icon shrinking while the bar stood still; both are gone. Everything the
|
|
478
|
+
// pill reads — the accent layer, its strip, the washes — sits inside this transform with it,
|
|
479
|
+
// so the pill and its backdrop scale as one.
|
|
480
|
+
const panelStyle = useAnimatedStyle(() => ({
|
|
481
|
+
transform: [
|
|
482
|
+
{ translateX: panelOffset.value },
|
|
483
|
+
{
|
|
484
|
+
scale:
|
|
485
|
+
1 +
|
|
486
|
+
(TAB_BAR_PRESS_GROWTH / Math.max(barWidth.value, 1)) *
|
|
487
|
+
drag.pressProgress.value,
|
|
488
|
+
},
|
|
489
|
+
],
|
|
490
|
+
}));
|
|
491
|
+
const pillGeometry = useDerivedValue(() => {
|
|
492
|
+
const { scaleX, scaleY } = drag.jelly();
|
|
493
|
+
// The grab scale is a *height* ratio (56 -> 78dp). Applied to width it overshoots badly on a
|
|
494
|
+
// wide pill — held still, a 4-tab cell would hang ~17dp past its slot on each side, which is
|
|
495
|
+
// the "overhanging" the flick fix could not touch because the jelly is at zero when the finger
|
|
496
|
+
// stops. So the spring's own 0..1 progress is re-mapped onto a fixed 22dp of width instead,
|
|
497
|
+
// preserving its overshoot and settle exactly. `scaleX / drag.scaleX.value` isolates the jelly
|
|
498
|
+
// factor, which still rides on top.
|
|
499
|
+
const bloom = pillPressedScale - 1;
|
|
500
|
+
const grabbed = bloom > 1e-6 ? (drag.scaleX.value - 1) / bloom : 0;
|
|
501
|
+
const widthGrab =
|
|
502
|
+
slotWidth.value > 0
|
|
503
|
+
? 1 + (TAB_PILL_BLOOM_WIDTH / slotWidth.value) * grabbed
|
|
504
|
+
: 1;
|
|
505
|
+
const jellyX = drag.scaleX.value !== 0 ? scaleX / drag.scaleX.value : 1;
|
|
506
|
+
return {
|
|
507
|
+
translateX: direction * drag.value.value * slotWidth.value,
|
|
508
|
+
scaleX: widthGrab * jellyX,
|
|
509
|
+
scaleY,
|
|
510
|
+
};
|
|
511
|
+
});
|
|
512
|
+
const pillStyle = useAnimatedStyle(() => {
|
|
513
|
+
const { translateX, scaleX, scaleY } = pillGeometry.value;
|
|
514
|
+
return { transform: [{ translateX }, { scaleX }, { scaleY }] };
|
|
515
|
+
});
|
|
516
|
+
/**
|
|
517
|
+
* The held wash under the Android glyphs — `pillDraggedMetal.tint` — riding the pill's own
|
|
518
|
+
* geometry, since it has to sit exactly where the lens looks, and fading in with the grab as
|
|
519
|
+
* the resting chip fades out.
|
|
520
|
+
*/
|
|
521
|
+
const heldWashStyle = useAnimatedStyle(() => {
|
|
522
|
+
const { translateX, scaleX, scaleY } = pillGeometry.value;
|
|
523
|
+
return {
|
|
524
|
+
opacity: drag.pressProgress.value,
|
|
525
|
+
transform: [{ translateX }, { scaleX }, { scaleY }],
|
|
526
|
+
};
|
|
527
|
+
});
|
|
528
|
+
/** The same wash on the soft cutout path: over the pill's glass, under the window's glyphs. */
|
|
529
|
+
const heldWashOverlayStyle = useAnimatedStyle(() => ({
|
|
530
|
+
opacity: drag.pressProgress.value,
|
|
531
|
+
}));
|
|
532
|
+
|
|
533
|
+
// `InteractiveHighlight`, ported: a flat white wash over the whole bar plus a soft lobe centred
|
|
534
|
+
// on the pill, both riding press progress, additive. It lives in the shader already — this is
|
|
535
|
+
// only telling it where the finger is, since the finger is on the pill and not on the bar. The
|
|
536
|
+
// reference hangs the same highlight on both rows, so the light shows through the pill too.
|
|
537
|
+
//
|
|
538
|
+
// `lens: false` is the point of the distinction: the bar lights up, it does not start refracting
|
|
539
|
+
// harder because something sitting on top of it was grabbed.
|
|
540
|
+
//
|
|
541
|
+
// Adaptive, the wash crossfades between the two schemes' surfaces on the same clock as the
|
|
542
|
+
// native frost. `tint` normally stays off the animated path because Android wants it
|
|
543
|
+
// `processColor`ed — so it is processed here, and both natives accept the resulting ARGB
|
|
544
|
+
// number (Android's `Int` prop, Expo's `UIColor` converter on iOS). On the UI thread
|
|
545
|
+
// `interpolateColor` already returns that number; on the JS thread (the initial props) it
|
|
546
|
+
// returns an `rgba()` string — processing the number a second time rotates its channels, which
|
|
547
|
+
// is how the pill once went cyan.
|
|
548
|
+
const barGlowProps = useAnimatedProps(() => ({
|
|
549
|
+
glow: {
|
|
550
|
+
progress: glow.progress.value * pressLight,
|
|
551
|
+
x: TAB_BAR_PADDING + (drag.value.value + 0.5) * slotWidth.value,
|
|
552
|
+
y: height / 2,
|
|
553
|
+
lens: false,
|
|
554
|
+
},
|
|
555
|
+
...(adaptiveTint
|
|
556
|
+
? {
|
|
557
|
+
// A processed ARGB number rides the `ColorValue` prop — see the comment above.
|
|
558
|
+
tint: adaptiveTintValue(
|
|
559
|
+
adaptiveGlass.progress.value,
|
|
560
|
+
lightSurface,
|
|
561
|
+
darkSurface
|
|
562
|
+
),
|
|
563
|
+
}
|
|
564
|
+
: null),
|
|
565
|
+
}));
|
|
566
|
+
const accentProps = useAnimatedProps(() => ({
|
|
567
|
+
glow: {
|
|
568
|
+
progress: glow.progress.value * pressLight,
|
|
569
|
+
x: TAB_BAR_PADDING + (drag.value.value + 0.5) * slotWidth.value,
|
|
570
|
+
y: height / 2,
|
|
571
|
+
lens: false,
|
|
572
|
+
},
|
|
573
|
+
...(adaptiveTint
|
|
574
|
+
? {
|
|
575
|
+
// A processed ARGB number rides the `ColorValue` prop — see the comment above.
|
|
576
|
+
tint: adaptiveTintValue(
|
|
577
|
+
adaptiveGlass.progress.value,
|
|
578
|
+
lightSurface,
|
|
579
|
+
darkSurface
|
|
580
|
+
),
|
|
581
|
+
}
|
|
582
|
+
: null),
|
|
583
|
+
}));
|
|
584
|
+
/**
|
|
585
|
+
* The clone's capsule: the bar's full height at rest, the reference's 56dp under the grab. iOS
|
|
586
|
+
* 26 shows the bar *smaller* through the held pill while the icons keep their size, and this
|
|
587
|
+
* inset — the reference's `tabsBackdrop` height — is exactly that. At rest it must be the bar's
|
|
588
|
+
* size, or the refraction stops at the pill's edge (see the component doc). The corner radius
|
|
589
|
+
* stays `height / 2`; the native side clamps it to the capsule's half-height.
|
|
590
|
+
*/
|
|
591
|
+
const cloneStyle = useAnimatedStyle(() => {
|
|
592
|
+
const inset = ((height - stripHeight) / 2) * drag.pressProgress.value;
|
|
593
|
+
return { top: inset, bottom: inset };
|
|
594
|
+
});
|
|
595
|
+
/** The reference's `Shadow(alpha = progress)` under the grabbed pill. */
|
|
596
|
+
const pillShadowStyle = useAnimatedStyle(() => ({
|
|
597
|
+
opacity: drag.pressProgress.value,
|
|
598
|
+
}));
|
|
599
|
+
const pillProps = useAnimatedProps(() => ({
|
|
600
|
+
metal: lerpMetal(restGlass, heldGlass, drag.pressProgress.value),
|
|
601
|
+
}));
|
|
602
|
+
|
|
603
|
+
/**
|
|
604
|
+
* The pill's own surface, and the reason a resting pill reads as a chip while a grabbed one reads
|
|
605
|
+
* as clear glass. Two stacked rects, exactly the reference's `onDrawSurface`: the tinted fill
|
|
606
|
+
* fades out under the grab and a 3% black wash fades in behind it.
|
|
607
|
+
*
|
|
608
|
+
* The fill is not the glass's `tint`, and not for want of a way to animate one — see
|
|
609
|
+
* `restWash` above: the pill's glass *shows* the glyph, so its wash has to go underneath. The 3%
|
|
610
|
+
* wash does sit over the glass, over the shader's rim light, and it costs nothing in practice,
|
|
611
|
+
* because the rim only exists at full press, which is exactly where the fill has reached zero.
|
|
612
|
+
*/
|
|
613
|
+
const pillFillStyle = useAnimatedStyle(() => ({
|
|
614
|
+
opacity: 1 - drag.pressProgress.value,
|
|
615
|
+
transform: [{ translateX: direction * drag.value.value * slotWidth.value }],
|
|
616
|
+
}));
|
|
617
|
+
const pillWashStyle = useAnimatedStyle(() => ({
|
|
618
|
+
opacity: PILL_WASH_ALPHA * drag.pressProgress.value,
|
|
619
|
+
}));
|
|
620
|
+
|
|
621
|
+
/**
|
|
622
|
+
* The soft cutout (see {@link CUTOUT_IS_HARD}): a capsule window riding the pill, with a
|
|
623
|
+
* bar-sized accent row counter-translated inside so the copy stays glued to the real row while
|
|
624
|
+
* the window's edge does the slicing. The wash sits inside the same window, under the icons —
|
|
625
|
+
* the very spot the Android chip occupies in the accent layer. The window deliberately skips
|
|
626
|
+
* the pill's bloom and jelly: the grabbed pill swells *around* a stable icon, which is also how
|
|
627
|
+
* the Android lens reads.
|
|
628
|
+
*/
|
|
629
|
+
const cutoutWindowStyle = useAnimatedStyle(() => ({
|
|
630
|
+
transform: [{ translateX: direction * drag.value.value * slotWidth.value }],
|
|
631
|
+
}));
|
|
632
|
+
const cutoutContentStyle = useAnimatedStyle(() => ({
|
|
633
|
+
transform: [
|
|
634
|
+
{ translateX: -direction * drag.value.value * slotWidth.value },
|
|
635
|
+
],
|
|
636
|
+
}));
|
|
637
|
+
const cutoutFillStyle = useAnimatedStyle(() => ({
|
|
638
|
+
opacity: 1 - drag.pressProgress.value,
|
|
639
|
+
}));
|
|
640
|
+
// The bar's wash inside the soft cutout: the window capture the pill reads there excludes
|
|
641
|
+
// every glass view, so without this the resting pill is a hole in the bar's wash. It fades with
|
|
642
|
+
// the lift, like the reference's container fill leaving the grabbed pill clear.
|
|
643
|
+
const cutoutWashStyle = useAnimatedStyle(() => ({
|
|
644
|
+
opacity: 1 - drag.pressProgress.value,
|
|
645
|
+
}));
|
|
646
|
+
|
|
647
|
+
const handleLayout = (event: LayoutChangeEvent): void => {
|
|
648
|
+
setWidth(event.nativeEvent.layout.width);
|
|
649
|
+
};
|
|
650
|
+
|
|
651
|
+
const handleTabPress = (index: number): void => {
|
|
652
|
+
// The tap carries the liquid too. `animateTo` is the reference's `animateToValue`: it
|
|
653
|
+
// presses, retargets the follower, and releases only once the value has essentially arrived —
|
|
654
|
+
// so a tapped pill wears the same bloom and the same lens as one under a finger, and settles
|
|
655
|
+
// back into the silent resting state on landing.
|
|
656
|
+
//
|
|
657
|
+
// This supersedes the hand-rolled version from main, which raised `pressProgress` with a
|
|
658
|
+
// `withSpring` callback and guarded an interrupted flight on `finished === false`. The
|
|
659
|
+
// convergence gate makes that guard structural: a second tap simply re-presses and re-arms it,
|
|
660
|
+
// so there is no completion flag to mis-handle.
|
|
661
|
+
committedIndex.value = index;
|
|
662
|
+
drag.animateTo(index);
|
|
663
|
+
if (index !== selectedIndex) commit(index);
|
|
664
|
+
};
|
|
665
|
+
|
|
666
|
+
return (
|
|
667
|
+
<Animated.View
|
|
668
|
+
onLayout={handleLayout}
|
|
669
|
+
style={[{ height }, panelStyle, style]}
|
|
670
|
+
>
|
|
671
|
+
{/* The visible bar. Nothing records it: the pill reads the screen and the accent clone, and
|
|
672
|
+
the reference is equally deliberate about that — a bar in the pill's stack would scrim
|
|
673
|
+
the pill's view a second time with its own container fill. */}
|
|
674
|
+
<AnimatedGlassView
|
|
675
|
+
providerId={providerId}
|
|
676
|
+
cornerRadius={height / 2}
|
|
677
|
+
cornerStyle="continuous"
|
|
678
|
+
tint={surfaceTint}
|
|
679
|
+
metal={resolvedBarMetal}
|
|
680
|
+
{...(adaptive ? adaptiveGlass.glassProps : null)}
|
|
681
|
+
animatedProps={barGlowProps}
|
|
682
|
+
style={StyleSheet.absoluteFill}
|
|
683
|
+
/>
|
|
684
|
+
|
|
685
|
+
<View style={styles.row} pointerEvents="box-none">
|
|
686
|
+
{tabs.map((tab, index) => (
|
|
687
|
+
<BaseTab
|
|
688
|
+
key={tab.key}
|
|
689
|
+
tab={tab}
|
|
690
|
+
index={index}
|
|
691
|
+
selected={index === selectedIndex}
|
|
692
|
+
position={drag.value}
|
|
693
|
+
color={inactive}
|
|
694
|
+
adaptiveProgress={
|
|
695
|
+
adaptive && inactiveColor == null ? adaptiveGlass.progress : null
|
|
696
|
+
}
|
|
697
|
+
labelStyle={labelStyle}
|
|
698
|
+
onPress={handleTabPress}
|
|
699
|
+
/>
|
|
700
|
+
))}
|
|
701
|
+
</View>
|
|
702
|
+
|
|
703
|
+
{/* The accent clone: screen-invisible, touch-inert, recorded at full strength, and stacked
|
|
704
|
+
on top of the pill's combined backdrop — so all of this reaches the eye only through the
|
|
705
|
+
pill's glass. The 2% wrapper opacity applies at composite time, after the provider has
|
|
706
|
+
recorded its children. Android only: nothing else can sample a provider, so anywhere
|
|
707
|
+
else this subtree is three mounted views nobody can ever see. */}
|
|
708
|
+
{CUTOUT_IS_HARD ? (
|
|
709
|
+
<View pointerEvents="none" style={styles.accentLayer}>
|
|
710
|
+
<LiquidGlassProvider providerId={accentLayerId} style={styles.fill}>
|
|
711
|
+
<View style={styles.fill}>
|
|
712
|
+
{/* The clone's glass: the visible bar over again — its recipe, its wash — because
|
|
713
|
+
it is the only glass the pill reads, the visible bar being deliberately *not* in
|
|
714
|
+
the pill's stack. The material is static (`metal` is a plain prop); what moves
|
|
715
|
+
is its capsule, full-height at rest and inset to the reference's 56dp as the
|
|
716
|
+
pill lifts (TAB_ACCENT_STRIP_HEIGHT), and the glow beneath the pill. */}
|
|
717
|
+
<AnimatedGlassView
|
|
718
|
+
providerId={providerId}
|
|
719
|
+
cornerRadius={height / 2}
|
|
720
|
+
cornerStyle="continuous"
|
|
721
|
+
tint={surfaceTint}
|
|
722
|
+
metal={resolvedBarMetal}
|
|
723
|
+
animatedProps={accentProps}
|
|
724
|
+
style={[styles.clone, cloneStyle]}
|
|
725
|
+
/>
|
|
726
|
+
{/* The resting pill's lift. It belongs *here*, under the accent icons, rather than
|
|
727
|
+
as a film over the pill's glass: the pill is showing this layer, so anything
|
|
728
|
+
painted on top of the lens washes the very icon the lens is displaying — a 20%
|
|
729
|
+
white film turned #0088FF into #38A0FD. Recorded beneath the icons it lifts the
|
|
730
|
+
strip and leaves the glyphs untouched. */}
|
|
731
|
+
{tabWidth > 0 ? (
|
|
732
|
+
<Animated.View
|
|
733
|
+
style={[
|
|
734
|
+
styles.pill,
|
|
735
|
+
{
|
|
736
|
+
start: TAB_BAR_PADDING,
|
|
737
|
+
top: pillTop,
|
|
738
|
+
width: tabWidth,
|
|
739
|
+
height: pillHeight,
|
|
740
|
+
borderRadius: pillHeight / 2,
|
|
741
|
+
backgroundColor: restWash,
|
|
742
|
+
},
|
|
743
|
+
pillFillStyle,
|
|
744
|
+
]}
|
|
745
|
+
/>
|
|
746
|
+
) : null}
|
|
747
|
+
{/* The held wash, same layer, same reason — and cut TAB_PILL_WASH_BLEED larger
|
|
748
|
+
than the pill, because the grabbed lens pulls the backdrop in from outside its
|
|
749
|
+
rim and would otherwise show a clear ring around the colour. */}
|
|
750
|
+
{tabWidth > 0 && heldWash != null ? (
|
|
751
|
+
<Animated.View
|
|
752
|
+
style={[
|
|
753
|
+
styles.pill,
|
|
754
|
+
{
|
|
755
|
+
start: TAB_BAR_PADDING - TAB_PILL_WASH_BLEED,
|
|
756
|
+
top: pillTop - TAB_PILL_WASH_BLEED,
|
|
757
|
+
width: tabWidth + TAB_PILL_WASH_BLEED * 2,
|
|
758
|
+
height: pillHeight + TAB_PILL_WASH_BLEED * 2,
|
|
759
|
+
borderRadius: pillHeight / 2 + TAB_PILL_WASH_BLEED,
|
|
760
|
+
backgroundColor: heldWash,
|
|
761
|
+
},
|
|
762
|
+
heldWashStyle,
|
|
763
|
+
]}
|
|
764
|
+
/>
|
|
765
|
+
) : null}
|
|
766
|
+
<AccentRow
|
|
767
|
+
tabs={tabs}
|
|
768
|
+
accent={accent}
|
|
769
|
+
labelStyle={labelStyle}
|
|
770
|
+
/>
|
|
771
|
+
</View>
|
|
772
|
+
</LiquidGlassProvider>
|
|
773
|
+
</View>
|
|
774
|
+
) : null}
|
|
775
|
+
|
|
776
|
+
{tabWidth > 0 ? (
|
|
777
|
+
<GestureDetector gesture={pan}>
|
|
778
|
+
<Animated.View
|
|
779
|
+
style={[
|
|
780
|
+
styles.pill,
|
|
781
|
+
{
|
|
782
|
+
start: TAB_BAR_PADDING,
|
|
783
|
+
top: pillTop,
|
|
784
|
+
width: tabWidth,
|
|
785
|
+
height: pillHeight,
|
|
786
|
+
},
|
|
787
|
+
pillStyle,
|
|
788
|
+
]}
|
|
789
|
+
>
|
|
790
|
+
{/* The drop shadow, under the glass and outside the capsule only, fading in with
|
|
791
|
+
the grab — `boxShadow` on a transparent view draws nothing inside its box, so the
|
|
792
|
+
pill keeps refracting a clean backdrop. */}
|
|
793
|
+
<Animated.View
|
|
794
|
+
pointerEvents="none"
|
|
795
|
+
style={[
|
|
796
|
+
StyleSheet.absoluteFill,
|
|
797
|
+
styles.pillShadow,
|
|
798
|
+
{ borderRadius: pillHeight / 2 },
|
|
799
|
+
pillShadowStyle,
|
|
800
|
+
]}
|
|
801
|
+
/>
|
|
802
|
+
<AnimatedGlassView
|
|
803
|
+
// The reference's `rememberCombinedBackdrop(backdrop, tabsBackdrop)` exactly: the
|
|
804
|
+
// screen, then the accent clone. The visible bar is deliberately absent — it carries
|
|
805
|
+
// its own container fill, so including it scrims everything the pill shows a second
|
|
806
|
+
// time and the pill reads darker and flatter than the bar around it.
|
|
807
|
+
providerId={[providerId ?? "default", accentLayerId]}
|
|
808
|
+
cornerRadius={pillHeight / 2}
|
|
809
|
+
cornerStyle="continuous"
|
|
810
|
+
animatedProps={pillProps}
|
|
811
|
+
style={StyleSheet.absoluteFill}
|
|
812
|
+
/>
|
|
813
|
+
{/* The held wash where the glyphs are drawn over the pill (the soft cutout): on the
|
|
814
|
+
glass, under the window. Android paints it in the accent layer instead. */}
|
|
815
|
+
{!CUTOUT_IS_HARD && heldWash != null ? (
|
|
816
|
+
<Animated.View
|
|
817
|
+
pointerEvents="none"
|
|
818
|
+
style={[
|
|
819
|
+
StyleSheet.absoluteFill,
|
|
820
|
+
{ borderRadius: pillHeight / 2, backgroundColor: heldWash },
|
|
821
|
+
heldWashOverlayStyle,
|
|
822
|
+
]}
|
|
823
|
+
/>
|
|
824
|
+
) : null}
|
|
825
|
+
<Animated.View
|
|
826
|
+
pointerEvents="none"
|
|
827
|
+
style={[
|
|
828
|
+
StyleSheet.absoluteFill,
|
|
829
|
+
styles.pillWash,
|
|
830
|
+
{ borderRadius: pillHeight / 2 },
|
|
831
|
+
pillWashStyle,
|
|
832
|
+
]}
|
|
833
|
+
/>
|
|
834
|
+
</Animated.View>
|
|
835
|
+
</GestureDetector>
|
|
836
|
+
) : null}
|
|
837
|
+
|
|
838
|
+
{/* The soft cutout. Drawn over the pill's glass rather than into any backdrop, so it works
|
|
839
|
+
on every renderer — UIGlassEffect, Metal, and the plain-View degrade alike. The Metal
|
|
840
|
+
path's capture keeps everything painted over a glass out of that glass's backdrop, so
|
|
841
|
+
neither the pill nor the bar ever refracts this overlay or the row beneath it. */}
|
|
842
|
+
{!CUTOUT_IS_HARD && tabWidth > 0 ? (
|
|
843
|
+
<Animated.View
|
|
844
|
+
pointerEvents="none"
|
|
845
|
+
style={[
|
|
846
|
+
styles.pill,
|
|
847
|
+
styles.cutoutWindow,
|
|
848
|
+
{
|
|
849
|
+
start: TAB_BAR_PADDING,
|
|
850
|
+
top: pillTop,
|
|
851
|
+
width: tabWidth,
|
|
852
|
+
height: pillHeight,
|
|
853
|
+
borderRadius: pillHeight / 2,
|
|
854
|
+
},
|
|
855
|
+
cutoutWindowStyle,
|
|
856
|
+
]}
|
|
857
|
+
>
|
|
858
|
+
<Animated.View
|
|
859
|
+
style={[
|
|
860
|
+
styles.cutoutFill,
|
|
861
|
+
{ backgroundColor: surfaceTint },
|
|
862
|
+
cutoutWashStyle,
|
|
863
|
+
]}
|
|
864
|
+
/>
|
|
865
|
+
<Animated.View
|
|
866
|
+
style={[
|
|
867
|
+
styles.cutoutFill,
|
|
868
|
+
{ backgroundColor: restWash },
|
|
869
|
+
cutoutFillStyle,
|
|
870
|
+
]}
|
|
871
|
+
/>
|
|
872
|
+
<Animated.View
|
|
873
|
+
style={[
|
|
874
|
+
styles.cutoutContent,
|
|
875
|
+
{ start: -TAB_BAR_PADDING, top: -pillTop, width, height },
|
|
876
|
+
cutoutContentStyle,
|
|
877
|
+
]}
|
|
878
|
+
>
|
|
879
|
+
<AccentRow
|
|
880
|
+
tabs={tabs}
|
|
881
|
+
accent={accent}
|
|
882
|
+
labelStyle={labelStyle}
|
|
883
|
+
/>
|
|
884
|
+
</Animated.View>
|
|
885
|
+
</Animated.View>
|
|
886
|
+
) : null}
|
|
887
|
+
</Animated.View>
|
|
888
|
+
);
|
|
889
|
+
};
|
|
890
|
+
|
|
891
|
+
const styles = StyleSheet.create({
|
|
892
|
+
fill: {
|
|
893
|
+
flex: 1,
|
|
894
|
+
},
|
|
895
|
+
pill: {
|
|
896
|
+
position: "absolute",
|
|
897
|
+
},
|
|
898
|
+
pillWash: {
|
|
899
|
+
backgroundColor: "#000",
|
|
900
|
+
},
|
|
901
|
+
clone: {
|
|
902
|
+
position: "absolute",
|
|
903
|
+
left: 0,
|
|
904
|
+
right: 0,
|
|
905
|
+
},
|
|
906
|
+
pillShadow: {
|
|
907
|
+
boxShadow: TAB_PILL_SHADOW,
|
|
908
|
+
},
|
|
909
|
+
accentLayer: {
|
|
910
|
+
...ABSOLUTE_FILL,
|
|
911
|
+
opacity: 0.02,
|
|
912
|
+
},
|
|
913
|
+
cutoutWindow: {
|
|
914
|
+
overflow: "hidden",
|
|
915
|
+
},
|
|
916
|
+
cutoutFill: {
|
|
917
|
+
...ABSOLUTE_FILL,
|
|
918
|
+
},
|
|
919
|
+
cutoutContent: {
|
|
920
|
+
position: "absolute",
|
|
921
|
+
},
|
|
922
|
+
row: {
|
|
923
|
+
...ABSOLUTE_FILL,
|
|
924
|
+
flexDirection: "row",
|
|
925
|
+
paddingHorizontal: TAB_BAR_PADDING,
|
|
926
|
+
},
|
|
927
|
+
tab: {
|
|
928
|
+
flex: 1,
|
|
929
|
+
alignItems: "center",
|
|
930
|
+
justifyContent: "center",
|
|
931
|
+
},
|
|
932
|
+
tabContent: {
|
|
933
|
+
alignItems: "center",
|
|
934
|
+
gap: TAB_CONTENT_GAP,
|
|
935
|
+
},
|
|
936
|
+
iconSlot: {
|
|
937
|
+
width: TAB_ICON_SLOT,
|
|
938
|
+
height: TAB_ICON_SLOT,
|
|
939
|
+
alignItems: "center",
|
|
940
|
+
justifyContent: "center",
|
|
941
|
+
},
|
|
942
|
+
label: {
|
|
943
|
+
fontSize: TAB_LABEL_SIZE,
|
|
944
|
+
fontWeight: "400",
|
|
945
|
+
},
|
|
946
|
+
});
|
|
947
|
+
|
|
948
|
+
const LiquidGlassTabBar: React.NamedExoticComponent<ILiquidGlassTabBarProps> =
|
|
949
|
+
memo<ILiquidGlassTabBarProps>(LiquidGlassTabBarBase);
|
|
950
|
+
LiquidGlassTabBar.displayName = "LiquidGlassTabBar";
|
|
951
|
+
|
|
952
|
+
export { LiquidGlassTabBar };
|