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,975 @@
|
|
|
1
|
+
# expo-liquid-glass-ui
|
|
2
|
+
|
|
3
|
+
Liquid Glass for React Native, in one package: the **glass view** — Apple's `UIGlassEffect` on
|
|
4
|
+
iOS 26+, a custom Metal renderer below it, and an AGSL port on Android 13+ with graceful tiers
|
|
5
|
+
down to API 29 — and the **controls** built on it: a tab bar, buttons that merge into their neighbours when
|
|
6
|
+
pressed, icon buttons, chips, a switch, slider, stepper, text input, segmented control, card,
|
|
7
|
+
toolbar, toast, bottom sheet, a stretch-merge morph group and a scroll-edge scrim — all in the
|
|
8
|
+
iOS 26 style, running on Android and on iOS versions that never got them.
|
|
9
|
+
|
|
10
|
+
The view began as a fork of [rit3zh/expo-liquid-glass-view](https://github.com/rit3zh/expo-liquid-glass-view)
|
|
11
|
+
(see `NOTICE`); it no longer tracks upstream. Everything native — Swift, Metal, Kotlin, AGSL — ships
|
|
12
|
+
here, and there is no config plugin: autolinking is the whole install.
|
|
13
|
+
|
|
14
|
+
The designs are ported from the
|
|
15
|
+
[AndroidLiquidGlass](https://github.com/Kyant0/AndroidLiquidGlass) catalog — `LiquidButton`,
|
|
16
|
+
`LiquidToggle`, `LiquidSlider` and `LiquidBottomTabs` — with the text field styled to match. Not
|
|
17
|
+
just the look: the catalog's `DampedDragAnimation` physics rig is ported whole, so the controls
|
|
18
|
+
share its springs, its velocity-driven jelly and its convergence-gated release. The two shader
|
|
19
|
+
renderers — Android's and the Metal one for iOS below 26 — run **the same algorithm**: everything
|
|
20
|
+
measured against real iOS 26 glass lands on both, and on top of it the goodies the catalog
|
|
21
|
+
demonstrates: adaptive glass that reads the backdrop and dresses for it, a whole-surface
|
|
22
|
+
magnification, an inner shadow, and a highlight that can follow gravity.
|
|
23
|
+
|
|
24
|
+
## Install
|
|
25
|
+
|
|
26
|
+
Not on npm yet — install from git, with the two peers the controls animate through:
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
npm install github:capthndsme/expo-liquid-glass-ui react-native-reanimated react-native-gesture-handler
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
If a project still has `expo-liquid-glass-view` installed, remove it: this package registers the
|
|
33
|
+
same native view names, and two copies fail at startup with "Tried to register two views with the
|
|
34
|
+
same name".
|
|
35
|
+
|
|
36
|
+
Gestures and springs are Reanimated worklets driven by `react-native-gesture-handler` — drag
|
|
37
|
+
tracking, the springs, and even the switch's track-color interpolation run on the UI thread with
|
|
38
|
+
**no JS work per frame**, which is what keeps the controls smooth on 120 Hz displays and under a
|
|
39
|
+
busy JS thread. Both peers are the Expo defaults; wrap the app in `GestureHandlerRootView` as
|
|
40
|
+
usual.
|
|
41
|
+
|
|
42
|
+
## Usage
|
|
43
|
+
|
|
44
|
+
```tsx
|
|
45
|
+
import { LiquidGlassView } from "expo-liquid-glass-ui";
|
|
46
|
+
|
|
47
|
+
<LiquidGlassView
|
|
48
|
+
variant="regular"
|
|
49
|
+
cornerRadius={32}
|
|
50
|
+
tint="#4da3ff33"
|
|
51
|
+
interactive
|
|
52
|
+
style={{ width: 260, height: 120 }}
|
|
53
|
+
containerStyle={{ alignItems: "center", justifyContent: "center" }}
|
|
54
|
+
>
|
|
55
|
+
<Text style={{ color: "#fff" }}>Liquid Glass</Text>
|
|
56
|
+
</LiquidGlassView>;
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
Corners take one number for all four, or an object for per-corner control.
|
|
60
|
+
|
|
61
|
+
```tsx
|
|
62
|
+
<LiquidGlassView cornerRadius={32} />
|
|
63
|
+
<LiquidGlassView cornerRadius={{ topLeft: 32, topRight: 32 }} />
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
### Backends
|
|
67
|
+
|
|
68
|
+
`renderer` defaults to `"auto"` — `UIGlassEffect` on iOS 26+, the Metal renderer below it. Force one with `renderer="native"` or `renderer="metal"`, and read back what a device actually chose:
|
|
69
|
+
|
|
70
|
+
```tsx
|
|
71
|
+
import { supportsGlass, supportsNativeGlass } from "expo-liquid-glass-ui";
|
|
72
|
+
|
|
73
|
+
<LiquidGlassView onRendererChange={(renderer) => console.log(renderer)} />;
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
Two booleans, both resolved once at import, answering different questions:
|
|
77
|
+
|
|
78
|
+
- `supportsGlass` — will `LiquidGlassView` render glass at all? iOS: always. Android: API 29+.
|
|
79
|
+
This is the flag the component itself mounts on.
|
|
80
|
+
- `supportsNativeGlass` — is Apple's `UIGlassEffect` here (iOS 26+)? Switch *layout* strategies
|
|
81
|
+
on this one (system tabs vs a floating pill), never visibility — below 26 glass still renders,
|
|
82
|
+
via Metal.
|
|
83
|
+
|
|
84
|
+
On Android `renderer` has no effect — there is no Apple material to ask for, so both `"native"` and
|
|
85
|
+
`"metal"` resolve to the shader path exactly as `"native"` does on iOS below 26. An existing iOS
|
|
86
|
+
screen needs no branching on it.
|
|
87
|
+
|
|
88
|
+
### Liquid morphing
|
|
89
|
+
|
|
90
|
+
<p align="center">
|
|
91
|
+
<img src="./docs/screenshots/morph-neck.png" alt="A puck necking out of a glass bar over a striped stage" width="330" />
|
|
92
|
+
</p>
|
|
93
|
+
|
|
94
|
+
On the shader renderers (`agsl` on Android, Metal on iOS), `metal.morph` folds a second rounded
|
|
95
|
+
rect into the view's shape with a smooth-min — refraction, dispersion and the border light all
|
|
96
|
+
follow the merged silhouette, so the two shapes neck together and separate like iOS 26's
|
|
97
|
+
`UIGlassContainerEffect` merge. Pair it with `metal.shape`, which insets the primary shape and
|
|
98
|
+
turns the view into a canvas the partner can move inside; both are `dp`, layout-style, and
|
|
99
|
+
animatable per-frame via Reanimated `useAnimatedProps`. The example's **morph** tab is the
|
|
100
|
+
playground (shot above: Galaxy S23, `agsl`, `smoothing: 48`).
|
|
101
|
+
|
|
102
|
+
### Adaptive glass
|
|
103
|
+
|
|
104
|
+
iOS 26's material reads what is behind it and dresses for it: over dark content the glass goes
|
|
105
|
+
dark with light text, over light content the reverse. The shader renderers do the same with
|
|
106
|
+
`adaptive`: the view samples the mean luminance of the backdrop under it — Android renders the
|
|
107
|
+
provider content into an 8×8 probe off the RenderThread, iOS reads the capture it already holds —
|
|
108
|
+
at most four times a second and only when something moved, settles on a polarity with hysteresis
|
|
109
|
+
(0.45 / 0.55), crossfades its frost over 350 ms, and reports through `onBackdropLuminance`.
|
|
110
|
+
`useAdaptiveGlass` turns the report into a scheme for the content on the glass, with a UI-thread
|
|
111
|
+
`progress` for crossfading colours; the tab bar and button take an `adaptive` prop that wires all
|
|
112
|
+
of it:
|
|
113
|
+
|
|
114
|
+
```tsx
|
|
115
|
+
const adaptive = useAdaptiveGlass();
|
|
116
|
+
const { colors } = useGlassUITheme(adaptive.scheme);
|
|
117
|
+
const labelStyle = useAnimatedStyle(() => ({
|
|
118
|
+
color: interpolateColor(adaptive.progress.value, [0, 1], ["#111", "#f4f4f4"]),
|
|
119
|
+
}));
|
|
120
|
+
|
|
121
|
+
<LiquidGlassView {...adaptive.glassProps} tint={colors.tabBarSurface}>
|
|
122
|
+
<Animated.Text style={labelStyle}>Adaptive</Animated.Text>
|
|
123
|
+
</LiquidGlassView>
|
|
124
|
+
|
|
125
|
+
<LiquidGlassTabBar adaptive … />
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
The native iOS 26 glass adapts on its own and ignores the prop. The example's **goodies** tab has
|
|
129
|
+
a draggable adaptive card over light/dark bands, with the reading on screen.
|
|
130
|
+
|
|
131
|
+
### Inner shadow, magnification, a gravity-lit rim
|
|
132
|
+
|
|
133
|
+
Three more `metal` dials, on both shader renderers:
|
|
134
|
+
|
|
135
|
+
- `innerShadow: { radius, offsetX, offsetY, opacity }` — the soft dark band along the inside of
|
|
136
|
+
the silhouette that gives a lifted control its thickness (Kyant's `InnerShadow`, iOS 26's
|
|
137
|
+
grabbed pill). The kit ramps it in with press progress on the tab pill (8 dp) and the thumbs
|
|
138
|
+
(4 dp).
|
|
139
|
+
- `magnification` — a whole-surface lens: the backdrop reads enlarged through the pane, the way
|
|
140
|
+
iOS 26's slider thumb enlarges the track. `1` is off; the example's goodies tab has a draggable
|
|
141
|
+
magnifier at `1.5`.
|
|
142
|
+
- `useGravityHighlight` — feed it accelerometer samples (`expo-sensors`, which the kit does not
|
|
143
|
+
depend on) and write its `angle` into `highlight.angle` from `useAnimatedProps`; every glass
|
|
144
|
+
edge then lights as if under one fixed lamp while the phone tilts. The catalog's control-centre
|
|
145
|
+
demo, without the sensor dependency.
|
|
146
|
+
|
|
147
|
+
## Android needs a provider
|
|
148
|
+
|
|
149
|
+
On Android the base library captures the backdrop explicitly. Wrap the content that should show
|
|
150
|
+
*through* the glass in a `LiquidGlassProvider`, and put these controls **after it as siblings —
|
|
151
|
+
never inside it** (a nested glass view would refract its own output). The provider is a plain
|
|
152
|
+
`View` on iOS and web, so one tree ships everywhere:
|
|
153
|
+
|
|
154
|
+
```tsx
|
|
155
|
+
import { LiquidGlassProvider } from "expo-liquid-glass-ui";
|
|
156
|
+
|
|
157
|
+
<View style={{ flex: 1 }}>
|
|
158
|
+
<LiquidGlassProvider style={StyleSheet.absoluteFill}>
|
|
159
|
+
{/* screen content */}
|
|
160
|
+
</LiquidGlassProvider>
|
|
161
|
+
|
|
162
|
+
{/* glass controls go here, after the provider */}
|
|
163
|
+
</View>;
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
Give the provider exactly **one** direct child (a wrapper `View` around your background and
|
|
167
|
+
scroller). Measured on device: with two direct children the native provider view lays out only the
|
|
168
|
+
first — the second never appears.
|
|
169
|
+
|
|
170
|
+
## Components
|
|
171
|
+
|
|
172
|
+
### LiquidGlassTabBar
|
|
173
|
+
|
|
174
|
+
A capsule glass bar with a glass pill that springs between tabs — tap a tab, or grab the pill and
|
|
175
|
+
drag it. It balloons to `78/56` while held, **stretches like jelly** with the drag, and snaps to
|
|
176
|
+
the nearest tab on release.
|
|
177
|
+
|
|
178
|
+
Six things from the reference are ported in full:
|
|
179
|
+
|
|
180
|
+
- **The jelly is velocity-driven counter-scaling**, not a lag or trail term. X divides and Y
|
|
181
|
+
multiplies by a clamped ±20% of the follower's velocity, so the deformation is
|
|
182
|
+
volume-preserving and inverts on reverse motion. The two axes use deliberately mismatched
|
|
183
|
+
springs (`ζ 0.6` on X, `0.7` on Y) — that 0.1 asymmetry *is* the wobble. The tab bar runs
|
|
184
|
+
it past the reference (`jelly: { gain: 2, limit: 0.45 }`, and a follower that overshoots):
|
|
185
|
+
iOS 26's pill overruns its tab and a fast flick pulls it into a hotdog. The slider and the
|
|
186
|
+
switch keep the reference's numbers.
|
|
187
|
+
- **The grab outlives the finger.** Release is gated on convergence: the pill stays inflated and
|
|
188
|
+
refractive until it is within 2.5% of its target, then deflates. Deflating on finger-up instead
|
|
189
|
+
is the usual way this gets lost.
|
|
190
|
+
- **The pill shows the bar, not the screen.** The bar runs `vibrancy → blur(8dp) → lens(24,24)`
|
|
191
|
+
permanently, and the accent copy the pill reads through wears that same recipe at the bar's
|
|
192
|
+
size — so the bar's lens runs on under the resting pill instead of stopping at its edge, and a
|
|
193
|
+
strong `barMetal` refracts just as strongly through the pill. The pill's own recipe adds
|
|
194
|
+
nothing at rest; the grab lays its lens and colour split on top.
|
|
195
|
+
- **The accent row lives under the glass.** A screen-invisible copy of the row, tinted to the
|
|
196
|
+
accent, is composited into the pill's backdrop — so it reaches the eye only through the pill's
|
|
197
|
+
lens and dispersion, cut exactly at the capsule edge. The copy is the row's size, always: the
|
|
198
|
+
grab scales the whole bar, icons included, and shrinks nothing — iOS 26's motion, checked
|
|
199
|
+
against an iPhone 14 Pro Max.
|
|
200
|
+
- **The bar looks smaller through the held pill.** The accent copy is the bar's full size at
|
|
201
|
+
rest — so the bar's lens runs on under the resting pill instead of stopping at its edge, which
|
|
202
|
+
Kyant's 56dp `tabsBackdrop` never did — and shrinks to that 56dp as the pill lifts. Through the
|
|
203
|
+
held pill the bar reads smaller while the icons keep their size, which is what iOS 26 shows
|
|
204
|
+
(and the illusion that once made the active glyph look shrunk). The pill's lens bends the inset
|
|
205
|
+
rim into view. None of it costs extra: the copy already blurred the same pixels.
|
|
206
|
+
- **The bar barely lights up under the grabbed pill.** The reference's `InteractiveHighlight` (a
|
|
207
|
+
flat additive wash plus a soft lobe centred on the pill, on its own bouncier spring,
|
|
208
|
+
`ζ 0.5 / k 300`, released the instant the finger lifts) is scaled by `pressLight`, default 0.1:
|
|
209
|
+
iOS 26 lightens the bar only faintly, and the full wash pushed a light bar toward white, leaving
|
|
210
|
+
the chip and the lifted pill nowhere lighter to go. `pressLight={1}` is the reference, `0` none.
|
|
211
|
+
|
|
212
|
+
```tsx
|
|
213
|
+
import { LiquidGlassTabBar } from "expo-liquid-glass-ui";
|
|
214
|
+
import { Ionicons } from "@expo/vector-icons";
|
|
215
|
+
|
|
216
|
+
const [index, setIndex] = useState(0);
|
|
217
|
+
|
|
218
|
+
<LiquidGlassTabBar
|
|
219
|
+
selectedIndex={index}
|
|
220
|
+
onTabSelected={setIndex}
|
|
221
|
+
tabs={[
|
|
222
|
+
{ key: "home", title: "Home", icon: ({ color, size }) => <Ionicons name="home" color={color} size={size} /> },
|
|
223
|
+
{ key: "search", title: "Search", icon: ({ color, size }) => <Ionicons name="search" color={color} size={size} /> },
|
|
224
|
+
{ key: "profile", title: "You", icon: ({ color, size }) => <Ionicons name="person" color={color} size={size} /> },
|
|
225
|
+
]}
|
|
226
|
+
style={{ position: "absolute", left: 16, right: 16, bottom: 32 }}
|
|
227
|
+
/>;
|
|
228
|
+
```
|
|
229
|
+
|
|
230
|
+
`variant` (`"regular"` | `"clear"`), `accentColor`, `inactiveColor`, `tint`,
|
|
231
|
+
`blurRadius` (the bar's blur, default 8 — the accent copy the pill reads through wears the bar's
|
|
232
|
+
whole recipe, so the resting pill stays the bar's frost), `height` (default 64), `pillHeight` (56),
|
|
233
|
+
`pillPressedScale`, `pressLight` (0.1), `barMetal`, `pillMetal`, `pillDraggedMetal`, `pillTint`, `labelStyle` and
|
|
234
|
+
`providerId` are all overridable; the defaults follow the scheme (light/dark) with the iOS system
|
|
235
|
+
palette. `adaptive` hands that choice to the backdrop instead: the bar reads the content under it
|
|
236
|
+
and switches its whole dress — wash, accent, inactive colour, the pill's lift — with the frost
|
|
237
|
+
crossfading natively and the labels with it (see [Adaptive glass](#adaptive-glass)). The grabbed
|
|
238
|
+
pill also carries the reference's inner shadow (8 dp × progress) and drop shadow.
|
|
239
|
+
|
|
240
|
+
`variant="clear"` swaps the whole dress at once — the bar's material, its surface wash, and the
|
|
241
|
+
accent strip behind the pill — pulling the 42% container fill back to a hint and letting the glass
|
|
242
|
+
carry the look. The lens is unchanged; clear means less scrim, not a different lens. (Borrowing the
|
|
243
|
+
base library's `CLEAR_DEFAULTS` lens verbatim was a mistake worth recording: its 30dp pull over a
|
|
244
|
+
10dp band is tuned for a small control, and on a 64dp bar it drags the gap above the bar into a
|
|
245
|
+
hard stripe across the top edge.)
|
|
246
|
+
|
|
247
|
+
Measured over a mid-tone card it costs nothing: label contrast 1.28:1 against `regular`'s 1.31:1,
|
|
248
|
+
and the pill actually reads *better* (+9.0 against +5.8). But that fill is what bounds the worst
|
|
249
|
+
case over arbitrary content, which is why `regular` stays the default — reach for `clear` over
|
|
250
|
+
photos and video, where a scrim reads as a grey slab.
|
|
251
|
+
|
|
252
|
+
### LiquidGlassButton
|
|
253
|
+
|
|
254
|
+
A 48pt glass capsule with the reference's full jelly: a grow-on-press spring on every renderer,
|
|
255
|
+
plus rubber-band follow toward the finger and stretch along the drag axis — all Reanimated
|
|
256
|
+
worklets observing the touch without ever stealing a scroll.
|
|
257
|
+
|
|
258
|
+
```tsx
|
|
259
|
+
import { LiquidGlassButton } from "expo-liquid-glass-ui";
|
|
260
|
+
|
|
261
|
+
<LiquidGlassButton onPress={submit}>Continue</LiquidGlassButton>
|
|
262
|
+
<LiquidGlassButton onPress={buy} tint="#0088FFCC" icon={({ color, size }) => <Ionicons name="cart" color={color} size={size} />}>
|
|
263
|
+
Buy now
|
|
264
|
+
</LiquidGlassButton>
|
|
265
|
+
<LiquidGlassButton size="small">Small</LiquidGlassButton>
|
|
266
|
+
<LiquidGlassButton size="large" loading={saving}>Save</LiquidGlassButton>
|
|
267
|
+
```
|
|
268
|
+
|
|
269
|
+
String children are wrapped in a styled `Text` (white when tinted, label color otherwise);
|
|
270
|
+
anything else renders as-is in a centered row. `icon` goes before the label and, as a function,
|
|
271
|
+
receives the resolved label colour and the glyph size for the button's `size` — `small` (36),
|
|
272
|
+
`regular` (48, the reference's) or `large` (56); `height` still overrides. `shape="circle"`
|
|
273
|
+
makes it exactly as wide as it is tall (see `LiquidGlassIconButton`). `loading` swaps the content
|
|
274
|
+
for a spinner without changing the width and ignores presses. `adaptive` makes the button read
|
|
275
|
+
the backdrop and dress for it — dark frost with a light label over dark content, the reverse over
|
|
276
|
+
light — with the label crossfading in step with the native frost.
|
|
277
|
+
|
|
278
|
+
**The press** is the shader's own: the finger dents the glass and boosts the lens under it
|
|
279
|
+
(`glow` with `lens`), and a light — the reference's `InteractiveHighlight`, a flat additive
|
|
280
|
+
`0.08` wash plus a `0.15` lobe under the finger — comes up with it, scaled by `pressLight`
|
|
281
|
+
(default 0.35). That lobe is sized for a bar; at full strength on a 48pt capsule it covers the
|
|
282
|
+
whole pane and reads as a Material pressed-state wash, which is what it used to look like — first
|
|
283
|
+
as a flat white view over the capsule, then at the shader's full strength. `pressLight={0}`
|
|
284
|
+
leaves only the inflation, the rubber band and the dent; `1` is Kyant's bar highlight. Only iOS
|
|
285
|
+
26's native glass and the no-glass degrade still use a flat wash, the reference's own declared
|
|
286
|
+
fallback, scaled the same way.
|
|
287
|
+
|
|
288
|
+
Put buttons in a `LiquidGlassGroup` and a press merges into the neighbour — see below.
|
|
289
|
+
|
|
290
|
+
### LiquidGlassGroup
|
|
291
|
+
|
|
292
|
+
iOS 26's `GlassEffectContainer` for the kit's controls: lay buttons, icon buttons or chips out
|
|
293
|
+
together, and pressing one **fuses it into its nearest neighbour like liquid** — the pressed
|
|
294
|
+
capsule inflates and rubber-bands exactly as it always did, and wherever it comes within
|
|
295
|
+
`spacing` of the next one the two silhouettes neck together into one pane, separating again as
|
|
296
|
+
the press lets go.
|
|
297
|
+
|
|
298
|
+
```tsx
|
|
299
|
+
import { LiquidGlassGroup, LiquidGlassButton, LiquidGlassIconButton } from "expo-liquid-glass-ui";
|
|
300
|
+
|
|
301
|
+
<LiquidGlassGroup>
|
|
302
|
+
<LiquidGlassButton onPress={cancel}>Cancel</LiquidGlassButton>
|
|
303
|
+
<LiquidGlassButton onPress={save} tint="#0088FFCC">Save</LiquidGlassButton>
|
|
304
|
+
</LiquidGlassGroup>
|
|
305
|
+
|
|
306
|
+
<LiquidGlassGroup gap={8}>
|
|
307
|
+
<LiquidGlassIconButton icon={heart} accessibilityLabel="Like" />
|
|
308
|
+
<LiquidGlassIconButton icon={share} accessibilityLabel="Share" />
|
|
309
|
+
<LiquidGlassIconButton icon={bookmark} accessibilityLabel="Save" />
|
|
310
|
+
</LiquidGlassGroup>
|
|
311
|
+
```
|
|
312
|
+
|
|
313
|
+
On the shader renderers (Android, iOS below 26 or `renderer="metal"`) a canvas glass view under
|
|
314
|
+
the row draws the merged silhouette from the base package's `metal.shape` + `metal.morph`: while
|
|
315
|
+
a member is pressed, its own pane and its partner's crossfade out and the canvas takes over both
|
|
316
|
+
— the pressed one redrawn from the very same press channels its pane is transformed by, so the
|
|
317
|
+
two never part company — and the press light rides along. A tinted member keeps its colour
|
|
318
|
+
through the merge. On iOS 26 the row is wrapped in `LiquidGlassContainer` and the system merges;
|
|
319
|
+
with no glass at all it is a plain row.
|
|
320
|
+
|
|
321
|
+
`spacing` (28, the smooth-min reach — a neighbour further away is left alone), `gap` (12),
|
|
322
|
+
`direction` (`"row"` | `"column"`), `metal` and `tint` for the canvas, `providerId`. Members join
|
|
323
|
+
through context, so a control of your own can too: `useGlassGroupMember` takes the control's
|
|
324
|
+
press channels and hands back the opacity its pane should wear, and `buttonPressTransform` is
|
|
325
|
+
the button's press geometry as a worklet.
|
|
326
|
+
|
|
327
|
+
### LiquidGlassIconButton
|
|
328
|
+
|
|
329
|
+
A circle of glass around one glyph — the iOS 26 toolbar button. It is `LiquidGlassButton` with
|
|
330
|
+
`shape="circle"`: the same jelly, the same press light, the same merge inside a group, and an
|
|
331
|
+
`accessibilityLabel` that is required because a circle has no label to read out.
|
|
332
|
+
|
|
333
|
+
```tsx
|
|
334
|
+
<LiquidGlassIconButton
|
|
335
|
+
icon={({ color, size }) => <Ionicons name="share-outline" color={color} size={size} />}
|
|
336
|
+
accessibilityLabel="Share"
|
|
337
|
+
onPress={share}
|
|
338
|
+
/>
|
|
339
|
+
```
|
|
340
|
+
|
|
341
|
+
### LiquidGlassChip
|
|
342
|
+
|
|
343
|
+
A small selectable capsule — a filter, a tag, a choice: the `small` button with a `selected`
|
|
344
|
+
state that wears the accent as its wash and a white label. Chips in a `LiquidGlassGroup` merge
|
|
345
|
+
into their neighbours when pressed like every other member.
|
|
346
|
+
|
|
347
|
+
```tsx
|
|
348
|
+
<LiquidGlassGroup gap={8} style={{ flexWrap: "wrap" }}>
|
|
349
|
+
{FILTERS.map((f) => (
|
|
350
|
+
<LiquidGlassChip key={f} label={f} selected={active.has(f)} onPress={() => toggle(f)} />
|
|
351
|
+
))}
|
|
352
|
+
</LiquidGlassGroup>
|
|
353
|
+
```
|
|
354
|
+
|
|
355
|
+
### LiquidGlassToolbar
|
|
356
|
+
|
|
357
|
+
iOS 26's floating navigation row: controls at either end that merge when pressed, and a title
|
|
358
|
+
between them in a capsule of its own. Nothing spans the width — each end is a `LiquidGlassGroup`
|
|
359
|
+
and the title floats, so the content behind shows between them.
|
|
360
|
+
|
|
361
|
+
```tsx
|
|
362
|
+
<LiquidGlassToolbar
|
|
363
|
+
title="Library"
|
|
364
|
+
leading={<LiquidGlassIconButton icon={back} accessibilityLabel="Back" onPress={goBack} />}
|
|
365
|
+
trailing={
|
|
366
|
+
<>
|
|
367
|
+
<LiquidGlassIconButton icon={search} accessibilityLabel="Search" />
|
|
368
|
+
<LiquidGlassIconButton icon={more} accessibilityLabel="More" />
|
|
369
|
+
</>
|
|
370
|
+
}
|
|
371
|
+
/>
|
|
372
|
+
```
|
|
373
|
+
|
|
374
|
+
### LiquidGlassStepper
|
|
375
|
+
|
|
376
|
+
The system stepper in glass: a capsule track with `−` and `+` ends around the value. Pressing an
|
|
377
|
+
end blooms a glass thumb over it — the segmented control's canvas thumb, lit by the press — and
|
|
378
|
+
the value pops as it changes. Hold an end and it keeps stepping (every 110 ms after 400 ms), the
|
|
379
|
+
way the system's does.
|
|
380
|
+
|
|
381
|
+
```tsx
|
|
382
|
+
<LiquidGlassStepper value={count} onValueChange={setCount} minimumValue={0} maximumValue={12} />
|
|
383
|
+
```
|
|
384
|
+
|
|
385
|
+
`step`, `autoRepeat`, `formatValue`, `height` (40), `tint`, `thumbTint`, `thumbMetal`.
|
|
386
|
+
|
|
387
|
+
### LiquidGlassCard
|
|
388
|
+
|
|
389
|
+
A pane of glass to put things on: the bar's material under the scheme wash, a continuous 24dp
|
|
390
|
+
corner, 16dp of padding. Give it an `onPress` and it becomes a control that presses to 98%;
|
|
391
|
+
otherwise it is a surface and touches pass to its children. `adaptive` flips the frost with the
|
|
392
|
+
backdrop — pair with `useAdaptiveGlass` for content that follows.
|
|
393
|
+
|
|
394
|
+
```tsx
|
|
395
|
+
<LiquidGlassCard onPress={open}>
|
|
396
|
+
<Text style={styles.title}>Now playing</Text>
|
|
397
|
+
<Text style={styles.body}>…</Text>
|
|
398
|
+
</LiquidGlassCard>
|
|
399
|
+
```
|
|
400
|
+
|
|
401
|
+
### LiquidGlassToast
|
|
402
|
+
|
|
403
|
+
A glass capsule that drops in from an edge with a message, waits, and leaves — on the button's
|
|
404
|
+
bouncy spring in and the critically damped one out. Controlled: the app owns `visible` and hears
|
|
405
|
+
`onDismiss` when the toast has waited `duration` (2.6 s) or been tapped; it stays mounted through
|
|
406
|
+
its exit so the spring finishes.
|
|
407
|
+
|
|
408
|
+
```tsx
|
|
409
|
+
<LiquidGlassToast
|
|
410
|
+
visible={saved}
|
|
411
|
+
message="Saved to your library"
|
|
412
|
+
icon={({ color, size }) => <Ionicons name="checkmark-circle" color={color} size={size} />}
|
|
413
|
+
onDismiss={() => setSaved(false)}
|
|
414
|
+
/>
|
|
415
|
+
```
|
|
416
|
+
|
|
417
|
+
`edge` (`"top"` | `"bottom"`), `offset` from it (60), `tint`, `metal`. Positioned absolutely
|
|
418
|
+
against its parent — render it last, above everything, as a sibling of the provider on Android.
|
|
419
|
+
|
|
420
|
+
### LiquidGlassSheet
|
|
421
|
+
|
|
422
|
+
A bottom sheet in glass: the bar's material with only its top corners rounded, a grab handle, a
|
|
423
|
+
dim behind it, and a drag that follows the finger — with resistance past the top — and decides on
|
|
424
|
+
release: dropped past 30 % of its height or flung down, the sheet asks to go; anywhere else it
|
|
425
|
+
springs back up. Controlled like the toast; the dim fades with the sheet's own travel.
|
|
426
|
+
|
|
427
|
+
```tsx
|
|
428
|
+
<LiquidGlassSheet visible={open} onDismiss={() => setOpen(false)} height={380}>
|
|
429
|
+
<Text style={styles.sheetTitle}>Share to</Text>
|
|
430
|
+
<LiquidGlassGroup>…</LiquidGlassGroup>
|
|
431
|
+
</LiquidGlassSheet>
|
|
432
|
+
```
|
|
433
|
+
|
|
434
|
+
`height` (420), `cornerRadius` (28), `handle`, `dim` (0.25), `dismissOnTap`, `tint`, `metal`.
|
|
435
|
+
Positioned absolutely at the bottom of its parent — render it last, as a sibling of the provider
|
|
436
|
+
on Android.
|
|
437
|
+
|
|
438
|
+
### LiquidGlassSwitch
|
|
439
|
+
|
|
440
|
+
The 64×28 toggle: a colored capsule track under a 40×24 glass thumb. At rest the thumb wears an
|
|
441
|
+
opaque white fill over an 8dp frost; pressing melts the fill away, drops the blur to **zero** and
|
|
442
|
+
balloons the bare glass to 1.5× — a full lens ball with chromatic dispersion over a combined
|
|
443
|
+
`[screen, track]` backdrop, so the green body and the world behind the switch both bend through
|
|
444
|
+
it. Drag it across or tap to toggle. Both routes play the same press → fly → release
|
|
445
|
+
choreography, and both carry the jelly (at the reference's gentler `÷50` setting).
|
|
446
|
+
|
|
447
|
+
```tsx
|
|
448
|
+
import { LiquidGlassSwitch } from "expo-liquid-glass-ui";
|
|
449
|
+
|
|
450
|
+
<LiquidGlassSwitch value={enabled} onValueChange={setEnabled} />;
|
|
451
|
+
```
|
|
452
|
+
|
|
453
|
+
`accentColor` (on-state, defaults to system green) and `trackColor` take parseable color strings —
|
|
454
|
+
they feed `Animated` color interpolation.
|
|
455
|
+
|
|
456
|
+
### LiquidGlassSlider
|
|
457
|
+
|
|
458
|
+
A 6dp track under the same 40×24 glass thumb the switch uses — but on the reference's
|
|
459
|
+
full-strength jelly setting (`÷10` rather than `÷50`), which is the control the effect was
|
|
460
|
+
originally tuned on. A tap on the track seeks without jumping: it plays the whole grab, so
|
|
461
|
+
seeking looks exactly like dragging.
|
|
462
|
+
|
|
463
|
+
```tsx
|
|
464
|
+
import { LiquidGlassSlider } from "expo-liquid-glass-ui";
|
|
465
|
+
|
|
466
|
+
const [volume, setVolume] = useState(0.5);
|
|
467
|
+
|
|
468
|
+
<LiquidGlassSlider value={volume} onValueChange={setVolume} />;
|
|
469
|
+
```
|
|
470
|
+
|
|
471
|
+
`minimumValue`/`maximumValue` (0–1 by default), `accentColor`, `trackColor`, `onSlidingComplete`,
|
|
472
|
+
`thumbMetal`, `thumbPressedMetal` and `providerId` are all overridable. Past either end the thumb
|
|
473
|
+
rubber-bands (10 dp through a tanh) and `onEdgeReached` fires once per arrival — the moment the
|
|
474
|
+
system slider clicks; wire `expo-haptics` there, the kit takes no dependency on it. Held, the thumb
|
|
475
|
+
wears a 4 dp inner shadow and a resting 4 dp drop shadow, both from the reference.
|
|
476
|
+
|
|
477
|
+
### LiquidGlassTextInput
|
|
478
|
+
|
|
479
|
+
A glass capsule field with `leading`/`trailing` slots and an accent focus ring that springs in.
|
|
480
|
+
Accepts every `TextInput` prop.
|
|
481
|
+
|
|
482
|
+
```tsx
|
|
483
|
+
import { LiquidGlassTextInput } from "expo-liquid-glass-ui";
|
|
484
|
+
|
|
485
|
+
<LiquidGlassTextInput
|
|
486
|
+
placeholder="Search"
|
|
487
|
+
value={query}
|
|
488
|
+
onChangeText={setQuery}
|
|
489
|
+
leading={<Ionicons name="search" size={18} color="#8E8E93" />}
|
|
490
|
+
/>;
|
|
491
|
+
```
|
|
492
|
+
|
|
493
|
+
### LiquidGlassMorphGroup
|
|
494
|
+
|
|
495
|
+
The iOS 26 stretch-merge: drag a capsule toward its neighbour and the two fuse like liquid;
|
|
496
|
+
release over it and `onMerge` fires — what merging *means* is yours. On the shader renderers
|
|
497
|
+
(Android 13+, iOS below 26 or `renderer="metal"`) a canvas glass view under the row draws the
|
|
498
|
+
merged silhouette via the base package's `metal.shape` + `metal.morph`; on iOS 26 the row is
|
|
499
|
+
wrapped in `LiquidGlassContainer` and the system's own merge takes over; with no glass at all the
|
|
500
|
+
capsules are plain washed views and the gesture still works.
|
|
501
|
+
|
|
502
|
+
```tsx
|
|
503
|
+
import { LiquidGlassMorphGroup } from "expo-liquid-glass-ui";
|
|
504
|
+
|
|
505
|
+
<LiquidGlassMorphGroup
|
|
506
|
+
items={[
|
|
507
|
+
{ key: "copy", label: "Copy" },
|
|
508
|
+
{ key: "share", label: "Share" },
|
|
509
|
+
]}
|
|
510
|
+
onMerge={(from, to) => combine(from, to)}
|
|
511
|
+
/>;
|
|
512
|
+
```
|
|
513
|
+
|
|
514
|
+
### LiquidGlassScrim
|
|
515
|
+
|
|
516
|
+
The scroll-edge melt: content slides under it sharp and dissolves into blur toward the screen
|
|
517
|
+
edge (`metal.progressiveBlur`, a true variable-radius Gaussian on Android 13+ and the iOS Metal
|
|
518
|
+
renderer). Hugs an edge; children — typically a tab bar or toolbar — render inside, untouched.
|
|
519
|
+
|
|
520
|
+
```tsx
|
|
521
|
+
import { LiquidGlassScrim } from "expo-liquid-glass-ui";
|
|
522
|
+
|
|
523
|
+
<LiquidGlassScrim edge="bottom" size={220} radius={26}>
|
|
524
|
+
<MyToolbar />
|
|
525
|
+
</LiquidGlassScrim>;
|
|
526
|
+
```
|
|
527
|
+
|
|
528
|
+
### LiquidGlassSegmentedControl
|
|
529
|
+
|
|
530
|
+
A segmented control whose thumb travels like liquid: on selection it detaches, stretches along
|
|
531
|
+
its flight, and a shrinking droplet stays necked to it for a beat before being absorbed.
|
|
532
|
+
|
|
533
|
+
```tsx
|
|
534
|
+
import { LiquidGlassSegmentedControl } from "expo-liquid-glass-ui";
|
|
535
|
+
|
|
536
|
+
<LiquidGlassSegmentedControl
|
|
537
|
+
segments={["Day", "Week", "Month"]}
|
|
538
|
+
selectedIndex={range}
|
|
539
|
+
onChange={setRange}
|
|
540
|
+
/>;
|
|
541
|
+
```
|
|
542
|
+
|
|
543
|
+
## Theme
|
|
544
|
+
|
|
545
|
+
`useGlassUITheme()` returns the resolved scheme and the palette the controls use
|
|
546
|
+
(system blue/green, label/inactive/placeholder, surface washes), and `GLASS_UI_PALETTE` exposes
|
|
547
|
+
both schemes statically.
|
|
548
|
+
|
|
549
|
+
## Android
|
|
550
|
+
|
|
551
|
+
<p align="center">
|
|
552
|
+
<img src="./docs/screenshots/playground-glass.png" alt="The AGSL glass over the playground stage" width="330" />
|
|
553
|
+
<img src="./docs/screenshots/playground-controls.png" alt="The playground's control sheet" width="330" />
|
|
554
|
+
</p>
|
|
555
|
+
|
|
556
|
+
<p align="center">
|
|
557
|
+
<sub>The example app's <b>playground</b> tab — every <code>metal</code> dial on a slider, a draggable
|
|
558
|
+
glass panel, and a JSON readout of the current configuration ready to paste into your
|
|
559
|
+
<code><LiquidGlassView /></code>. Shot on a Galaxy S23 on the <code>agsl</code> tier.</sub>
|
|
560
|
+
</p>
|
|
561
|
+
|
|
562
|
+
Android has **no equivalent of `UIGlassEffect`**. No Android primitive lets an in-app view sample the
|
|
563
|
+
pixels of its siblings: `View.setRenderEffect` applies to a view's *own* content, and
|
|
564
|
+
`Window.setBackgroundBlurRadius` is cross-*window* only and disabled on many OEM builds. So Android
|
|
565
|
+
gets a port of the **Metal renderer** — the path iOS uses as a *fallback* — and never Apple's
|
|
566
|
+
material.
|
|
567
|
+
|
|
568
|
+
That has one consequence you have to design around: the backdrop must be captured explicitly, so you
|
|
569
|
+
mark it with a `LiquidGlassProvider`.
|
|
570
|
+
|
|
571
|
+
```tsx
|
|
572
|
+
import { LiquidGlassProvider, LiquidGlassView } from "expo-liquid-glass-ui";
|
|
573
|
+
|
|
574
|
+
<View style={{ flex: 1 }}>
|
|
575
|
+
<LiquidGlassProvider style={StyleSheet.absoluteFill}>
|
|
576
|
+
<ScrollView>{/* everything that should show THROUGH the glass */}</ScrollView>
|
|
577
|
+
</LiquidGlassProvider>
|
|
578
|
+
|
|
579
|
+
<LiquidGlassView style={styles.panel} cornerRadius={32} />
|
|
580
|
+
</View>;
|
|
581
|
+
```
|
|
582
|
+
|
|
583
|
+
**Glass views must be siblings of the provider, drawn after it — never children of it.** That is
|
|
584
|
+
what keeps a glass view out of its own backdrop, and it is structural rather than filtered. A glass
|
|
585
|
+
view nested inside a provider refracts its own output; dev builds warn when you do it.
|
|
586
|
+
|
|
587
|
+
The provider renders as a plain `View` on iOS, web, and pre-API-29 Android, so you can wrap
|
|
588
|
+
unconditionally and ship one component tree.
|
|
589
|
+
|
|
590
|
+
Pair a view with a provider by `providerId` when you have more than one; both default to `"default"`.
|
|
591
|
+
Ids are namespaced **per window**, which matters for `Modal` below.
|
|
592
|
+
|
|
593
|
+
### Continuous corners (the Apple squircle)
|
|
594
|
+
|
|
595
|
+
`cornerStyle: "continuous"` — the default — renders Apple's continuous corner curve on both
|
|
596
|
+
shader renderers: the SDF, the clip path and the border all draw one calibrated superellipse
|
|
597
|
+
family (max deviation from the real iOS curve: 0.8 px at a 110 px radius, sub-pixel at every
|
|
598
|
+
radius UI actually uses). Capsules stay exact capsules — the family degrades continuously to
|
|
599
|
+
circular ends as the radius reaches half the short side. `cornerStyle: "circular"` opts back into
|
|
600
|
+
plain arcs. The iOS Metal renderer was circular-only in its SDF until the parity pass, with a
|
|
601
|
+
circular border under Apple's continuous content clip — a visible double edge at every corner
|
|
602
|
+
apex; it now shares Android's `ContinuousCorners` resolver, and the iOS 26 native material draws
|
|
603
|
+
Apple's own curve. Calibration method and error tables:
|
|
604
|
+
`docs/android-port/research/05-continuous-corner-calibration.md`.
|
|
605
|
+
|
|
606
|
+
### HDR glints (Android 14+, opt-in)
|
|
607
|
+
|
|
608
|
+
On an HDR panel, the glass border light — and the `interactive` press bloom — can exceed SDR
|
|
609
|
+
white, so the rim glints like real glass instead of saturating at white:
|
|
610
|
+
|
|
611
|
+
```ts
|
|
612
|
+
import { setGlassHdrEnabled, getGlassHdrStatus } from "expo-liquid-glass-ui";
|
|
613
|
+
|
|
614
|
+
const status = await setGlassHdrEnabled(true);
|
|
615
|
+
// { supported: true, enabled: true, headroom: 4.23 } on a capable panel
|
|
616
|
+
```
|
|
617
|
+
|
|
618
|
+
Facts to know before enabling:
|
|
619
|
+
|
|
620
|
+
- **It is window-level and never automatic.** `COLOR_MODE_HDR` switches the whole window to FP16
|
|
621
|
+
buffers — roughly double the compositing bandwidth — which is why this is an explicit call.
|
|
622
|
+
Some panels also cap their refresh rate while an HDR layer is present (a Nothing Phone (2)
|
|
623
|
+
drops 120 → 90 Hz).
|
|
624
|
+
- Only the glass highlights use the headroom. The backdrop seen *through* the glass stays SDR —
|
|
625
|
+
glass does not amplify what is behind it — and SDR content elsewhere in your UI is unaffected
|
|
626
|
+
by design of Android's mixed HDR/SDR composition.
|
|
627
|
+
- `headroom` is live: it breathes with screen brightness (bigger in dim rooms, smaller at full
|
|
628
|
+
blast) and the glass tracks it per frame. `1.0` means SDR output, bit-identical to the
|
|
629
|
+
pre-HDR renderer.
|
|
630
|
+
- The opt-in survives activity recreation (the module re-applies it on foreground), and it is a
|
|
631
|
+
no-op that reports `supported: false` on iOS, web, Android < 14, and SDR panels.
|
|
632
|
+
|
|
633
|
+
### API levels and degradation
|
|
634
|
+
|
|
635
|
+
| API | `onRendererChange` reports | What you get |
|
|
636
|
+
| --- | --- | --- |
|
|
637
|
+
| 33+ | `"agsl"` | The full shader: refraction, chromatic dispersion, angular highlight, frost, tint, film grain |
|
|
638
|
+
| 31–32 | `"fallback-blur"` | Blur, saturation, frost and tint, clipped to the outline. No refraction |
|
|
639
|
+
| 29–30 | `"scrim"` | The live backdrop drawn straight through under a translucent scrim. No blur |
|
|
640
|
+
| < 29 | — | A plain `View`; the native view is never mounted |
|
|
641
|
+
|
|
642
|
+
Degradation is automatic. It also drops a tier if the shader fails to compile *or* silently renders
|
|
643
|
+
nothing — a real failure mode on some drivers, caught by an off-screen render probe at startup rather
|
|
644
|
+
than left for a user to discover.
|
|
645
|
+
|
|
646
|
+
### `metal.android`
|
|
647
|
+
|
|
648
|
+
Android-only; iOS drops the key.
|
|
649
|
+
|
|
650
|
+
| Field | Type | Description |
|
|
651
|
+
| --- | --- | --- |
|
|
652
|
+
| `quality` | `"low" \| "medium" \| "high"` | How much of the shader to run. `medium` (8 dispersion taps) is the iOS-parity default; `high` is 16; `low` drops dispersion and grain for roughly a fifth of the cost. Leave it unset to let coverage decide |
|
|
653
|
+
| `maxTier` | `"agsl" \| "fallback-blur" \| "scrim" \| "none"` | A **ceiling** on the table above. It can only lower a device, never raise one. Useful for capping very large glass surfaces, and for exercising the fallbacks on hardware that would never take them |
|
|
654
|
+
|
|
655
|
+
### Performance
|
|
656
|
+
|
|
657
|
+
Glass is fill-rate bound, and the honest guidance is **don't cover the screen in it**. Measured on an
|
|
658
|
+
Adreno 740 at 120 Hz with one animating glass view, janky frames by screen coverage:
|
|
659
|
+
|
|
660
|
+
| coverage | 5 % | 10 % | 25 % | 50 % | 75 % | 100 % |
|
|
661
|
+
| --- | --- | --- | --- | --- | --- | --- |
|
|
662
|
+
| jank | 0.6 % | 2 % | 2 % | 18 % | 78 % | 80 % |
|
|
663
|
+
|
|
664
|
+
Above **25 % coverage** an unset `quality` drops to `low` automatically. Be aware that this is worth
|
|
665
|
+
about 1 ms — no quality setting makes a full-screen glass panel hold 120 Hz.
|
|
666
|
+
|
|
667
|
+
`metal.progressiveBlur` is the one feature where `quality` buys a lot: the ramp is a pyramid of
|
|
668
|
+
platform blurs cross-faded per pixel, and `low` / `medium` / `high` run 2 / 3 / up to 6 levels. Each
|
|
669
|
+
level is a full-node blur, weight and blend — about 10 ms per level on an Adreno 610 for two
|
|
670
|
+
full-width scrims covering 440 dp of the screen, on top of a 23 ms floor for the glass pass alone
|
|
671
|
+
over the same area. A single tab-bar scrim of a quarter that area lands around 2–3 ms per level.
|
|
672
|
+
Keep scroll-edge scrims as short as the design allows; the height is the cost.
|
|
673
|
+
|
|
674
|
+
How that budget feels across GPU generations — janky frames on a release build by scenario
|
|
675
|
+
(`dumpsys gfxinfo` deadline accounting; p50 frame latency in parentheses where it tells the real
|
|
676
|
+
story):
|
|
677
|
+
|
|
678
|
+
| scenario | Adreno 512 · 2019 budget | Adreno 610 · current budget | Adreno 740 · flagship |
|
|
679
|
+
| --- | --- | --- | --- |
|
|
680
|
+
| pinned glass bars over a scrolling feed | 1.7 % | 0.8 % | 2.5 % at 120 Hz |
|
|
681
|
+
| `interactive` press, drag and release | 7.5 % | 2.6 % (13 ms) | — |
|
|
682
|
+
| one small glass view animating continuously | 33 % at 45 fps (61 ms) | 65 % at 60 fps (20 ms) | 0.14 % (5 ms) |
|
|
683
|
+
| flinging a list of 24 glass rows | 88 % (89 ms) | 44 % (26 ms) | 0.75 % at 102 fps |
|
|
684
|
+
|
|
685
|
+
Devices: Redmi Note 7 (Snapdragon 660, API 34), Redmi Note 13 4G (Snapdragon 685, API 35), Galaxy
|
|
686
|
+
S23 Ultra (Snapdragon 8 Gen 2, API 36) — all on the `agsl` tier, all rendering correctly with zero
|
|
687
|
+
warnings.
|
|
688
|
+
|
|
689
|
+
The two patterns real UIs actually ship — pinned bars and press feedback — are fine on
|
|
690
|
+
**everything**, including a six-year-old budget phone. The two that are not — continuous animation
|
|
691
|
+
and scrolling many glass rows at once — degrade with GPU generation and nothing else: 88 → 44 →
|
|
692
|
+
0.75 % down the list row is a pure fill-rate ladder. On budget targets, give those screens
|
|
693
|
+
`metal.android.maxTier: "fallback-blur"` (HWUI's blur is far cheaper than the shader); no `quality`
|
|
694
|
+
setting rescues them.
|
|
695
|
+
|
|
696
|
+
### Things that do not work, and why
|
|
697
|
+
|
|
698
|
+
- **Video behind glass needs `TextureView`.** `SurfaceView` composites out of process and punches a
|
|
699
|
+
transparent hole through the app's window, so no `Canvas` or `RenderNode` path can capture it — it
|
|
700
|
+
is a hole in the backdrop. `expo-video` accepts `surfaceType="textureView"`. Dev builds warn if a
|
|
701
|
+
`SurfaceView` turns up inside a provider.
|
|
702
|
+
- **Turn off stretch overscroll on any scroller containing glass** (`overScrollMode="never"`).
|
|
703
|
+
Android 12+ draws overscroll as a pixel-space `RenderEffect` on the scroller's own `RenderNode`, so
|
|
704
|
+
the glass and the backdrop baked into it are warped together while the provider behind stays flat.
|
|
705
|
+
Nothing inside the container can compensate: the stretch is invisible to `getLocationInWindow`,
|
|
706
|
+
`View.getMatrix()`, and every public API — `EdgeEffect.getDistance()` exists but `ScrollView` and
|
|
707
|
+
`RecyclerView` keep their `EdgeEffect` instances private.
|
|
708
|
+
- **A `Modal` is its own window.** It needs its own provider; one in the activity will be refused
|
|
709
|
+
rather than silently drawn in the wrong coordinate space. A modal also cannot refract the activity
|
|
710
|
+
behind it — a provider records a view tree, and the activity is not in the modal's tree.
|
|
711
|
+
- **Glass does not refract other glass by default.** A glass view is never inside its own
|
|
712
|
+
provider's recording, so sibling panels do not see each other — the same property that gives
|
|
713
|
+
Android free self-exclusion. Stacking is opt-in via `LiquidGlassStack`: see
|
|
714
|
+
[Stacked glass](#stacked-glass).
|
|
715
|
+
|
|
716
|
+
### Stacked glass
|
|
717
|
+
|
|
718
|
+
Glass *can* refract glass below it — a slider under a bottom sheet, a tab bar over glass rows.
|
|
719
|
+
`LiquidGlassStack` is the way to ask for it: layers go bottom to top, and glass in a layer
|
|
720
|
+
automatically refracts everything below, **including lower layers' finished glass** — frost, rim
|
|
721
|
+
and refraction, bent again by the upper lens, live while the lower glass animates or drags:
|
|
722
|
+
|
|
723
|
+
```tsx
|
|
724
|
+
<LiquidGlassStack style={{ flex: 1 }}>
|
|
725
|
+
<LiquidGlassStack.Layer>
|
|
726
|
+
<ScrollView>{content}</ScrollView>
|
|
727
|
+
</LiquidGlassStack.Layer>
|
|
728
|
+
<LiquidGlassStack.Layer>
|
|
729
|
+
<GlassSlider /> {/* any component with a LiquidGlassView inside — */}
|
|
730
|
+
</LiquidGlassStack.Layer> {/* no providerId props anywhere */}
|
|
731
|
+
<LiquidGlassStack.Layer>
|
|
732
|
+
{sheetOpen && <GlassSheet />} {/* toggle content INSIDE a layer, never the layer */}
|
|
733
|
+
</LiquidGlassStack.Layer>
|
|
734
|
+
</LiquidGlassStack>
|
|
735
|
+
```
|
|
736
|
+
|
|
737
|
+
Each layer boundary is a nested `LiquidGlassProvider` with an auto-generated id, delivered to
|
|
738
|
+
descendant glass views through context — which is what lets a reusable glass component drop into
|
|
739
|
+
any layer without a `providerId` prop. An explicit `providerId` still wins where set, and
|
|
740
|
+
`useGlassStackProviderId()` reads the injected id for the rare component that must forward it
|
|
741
|
+
somewhere context cannot follow. The `stack` tab in the example app is a stack with a
|
|
742
|
+
stacked/flat toggle; dev builds log a one-time **info** line (not a warning) for the topology.
|
|
743
|
+
|
|
744
|
+
Two rules:
|
|
745
|
+
|
|
746
|
+
- **Keep the layer list static.** Adding or removing a `Layer` changes the provider nesting and
|
|
747
|
+
remounts every layer below it; toggling content inside a static layer is free, and an empty
|
|
748
|
+
layer slot costs nothing — a consumer-less provider skips recording entirely.
|
|
749
|
+
- **Budget for the overlap.** Where the layers overlap, the lower view's shader runs a second time
|
|
750
|
+
inside the upper view's backdrop (clipped to the overlap). Bars and sheets over widgets are
|
|
751
|
+
fine; stacking two huge surfaces is not. Every extra layer is another recording pass over
|
|
752
|
+
everything below it — two or three layers is the sane budget.
|
|
753
|
+
|
|
754
|
+
The stack is only convenience — the same topology can be wired by hand by nesting a provider
|
|
755
|
+
around (the lower provider + its glass) and pointing the upper glass at the outer one. If you do,
|
|
756
|
+
give every provider **exactly one normal-flow child** and position everything inside it;
|
|
757
|
+
absolutely-positioned children at index ≥ 1 directly under a provider currently get broken
|
|
758
|
+
frames.
|
|
759
|
+
|
|
760
|
+
Set `setGlassDebugLogging(true)` to log provider-recording and glass-draw rates under the
|
|
761
|
+
`ExpoLiquidGlass` tag. Both counters stop moving when the screen is at rest.
|
|
762
|
+
|
|
763
|
+
## Props
|
|
764
|
+
|
|
765
|
+
| Prop | Type | Default | Platforms | Description |
|
|
766
|
+
| --- | --- | --- | --- | --- |
|
|
767
|
+
| `variant` | `"regular" \| "clear"` | `"regular"` | iOS · Android | Material character. `clear` is thinner and less frosted. |
|
|
768
|
+
| `renderer` | `"auto" \| "native" \| "metal"` | `"auto"` | iOS | Which backend draws the glass. Accepted and ignored on Android — there is no native material to ask for. |
|
|
769
|
+
| `cornerRadius` | `number \| { topLeft?, topRight?, bottomRight?, bottomLeft? }` | `0` | iOS · Android | One radius for every corner, or one per corner. |
|
|
770
|
+
| `cornerStyle` | `"continuous" \| "circular"` | `"continuous"` | iOS · Android | Corner curvature. Apple's curve on iOS 26; the calibrated superellipse family on both shader renderers — SDF, clip and border on one curve. |
|
|
771
|
+
| `tint` | `ColorValue` | — | iOS · Android | Colour washed through the glass; alpha controls strength. |
|
|
772
|
+
| `interactive` | `boolean` | `false` | iOS · Android | Touch response. iOS 26: the system's own. Android and the iOS Metal renderer: the same native port — the specular blooms under the finger, the refraction dents and deepens around it, and the glass inflates, follows the drag and stretches along it, rubber-band style; native springs, no JS per frame. Android's lower tiers keep the feedback as an additive wash, and a press held ~150 ms owns the gesture so dragging glass doesn't scroll it away. |
|
|
773
|
+
| `glow` | `{ progress, x?, y?, lens? }` | — | iOS (Metal) · Android | A press reported from elsewhere — the bar under a dragged pill. Takes over the press uniforms; never touches the transform. Animate it per frame with `useAnimatedProps`. |
|
|
774
|
+
| `adaptive` | `boolean` | `false` | iOS (Metal) · Android | Adaptive glass: the frost's polarity follows the backdrop's luminance, and `onBackdropLuminance` reports it. See [Adaptive glass](#adaptive-glass). |
|
|
775
|
+
| `onBackdropLuminance` | `({ luminance, dark }) => void` | — | iOS (Metal) · Android | The adaptive sensor's reading, `0`–`1`, and the polarity the glass settled on. Needs `adaptive`. |
|
|
776
|
+
| `providerId` | `string` | `"default"` | Android | Which `LiquidGlassProvider` supplies the backdrop. iOS captures what lies beneath each glass in the window and ignores it. |
|
|
777
|
+
| `metal` | `GlassMetalOptions` | — | iOS · Android | Custom-renderer tuning. Ignored whenever `renderer` resolves to `"native"`. |
|
|
778
|
+
| `style` | `StyleProp<ViewStyle>` | — | iOS · Android | Style for the native glass view. |
|
|
779
|
+
| `containerStyle` | `StyleProp<ViewStyle>` | — | iOS · Android | Style for the wrapper around `children`. |
|
|
780
|
+
| `children` | `React.ReactNode` | — | iOS · Android | Content rendered inside the glass. |
|
|
781
|
+
| `onRendererChange` | `(renderer) => void` | — | iOS · Android | Fires with `"native"`, `"metal"`, `"agsl"`, `"fallback-blur"`, `"scrim"` or `"none"`. |
|
|
782
|
+
|
|
783
|
+
### `metal`
|
|
784
|
+
|
|
785
|
+
`metal.tint` is the view's `tint` carried by the recipe — it wins over the prop, any colour
|
|
786
|
+
string works on both platforms, and `lerpMetal` crossfades it between two recipes on the UI
|
|
787
|
+
thread. The kit's recipes are exported (`GLASS_BUTTON_METAL`, `GLASS_PILL_DRAGGED_METAL`, …), so
|
|
788
|
+
`{ ...GLASS_PILL_DRAGGED_METAL, tint: "#0088FFAA" }` as `pillDraggedMetal` is a tab pill that goes
|
|
789
|
+
blue as it lifts, and `{ ...GLASS_BUTTON_METAL, tint: "#0088FFCC" }` is a blue button. Nothing in
|
|
790
|
+
the kit is tinted by default. One control routes the wash for you: the tab bar paints a pill
|
|
791
|
+
recipe's `tint` *beneath* the active glyph rather than on the pill's glass, because the glyph
|
|
792
|
+
reaches the eye through that glass and a wash on it would dim the very icon it shows. The
|
|
793
|
+
example's **tint** tab is the tour.
|
|
794
|
+
|
|
795
|
+
Shapes the custom renderer only — Apple owns the equivalents internally, so it is ignored whenever `renderer` resolves to `"native"`. Leave a field unset to follow `variant`.
|
|
796
|
+
|
|
797
|
+
```tsx
|
|
798
|
+
<LiquidGlassView
|
|
799
|
+
renderer="metal"
|
|
800
|
+
metal={{
|
|
801
|
+
blurRadius: 4,
|
|
802
|
+
frost: 0.4,
|
|
803
|
+
saturation: 1.8,
|
|
804
|
+
refraction: { amount: 80, width: 24, height: 24, depth: 1 },
|
|
805
|
+
dispersion: { amount: 8 },
|
|
806
|
+
highlight: { intensity: 0.3, angle: 135 },
|
|
807
|
+
border: { width: 1, opacity: 0.3 },
|
|
808
|
+
}}
|
|
809
|
+
/>
|
|
810
|
+
```
|
|
811
|
+
|
|
812
|
+
| Field | Type | Platforms | Description |
|
|
813
|
+
| --- | --- | --- | --- |
|
|
814
|
+
| `blurRadius` | `number` | iOS · Android | Backdrop blur radius, in points. |
|
|
815
|
+
| `captureQuality` | `number` | iOS | Backdrop capture resolution, as a multiplier on screen scale. Floor `0.25`, default `1`. Accepted and ignored on Android, which records a display list rather than pixels, so there is nothing to scale. |
|
|
816
|
+
| `opacity` | `number` | iOS · Android | Opacity of the glass layer, `0`–`1`. Default `1`. |
|
|
817
|
+
| `frost` | `number` | iOS · Android | How far the backdrop is pulled toward the interface background colour. The main dial for reading as a material rather than a plain blur. |
|
|
818
|
+
| `saturation` | `number` | iOS · Android | Backdrop saturation multiplier. System materials sit well above `1`. Deliberately unclamped — a negative value reflects each channel through the luma and inverts hue rather than draining it. |
|
|
819
|
+
| `noise` | `number` | iOS · Android | Film grain, hiding banding in the blurred backdrop. Dropped by `quality: "low"`. |
|
|
820
|
+
| `light` | `number` | iOS · Android | Flat brightness added before the rim sheen. Small values, `0`–`0.1`. |
|
|
821
|
+
| `refraction.amount` | `number` | iOS · Android | How far the rim drags the backdrop, in points — the biggest dial on how strong the glass reads. |
|
|
822
|
+
| `refraction.width` / `.height` | `number` | iOS · Android | How far in from the left/right and top/bottom edges the stretch reaches. |
|
|
823
|
+
| `refraction.depth` | `number` | iOS · Android | Direction blend, edge normal (`0`) to radial (`1`). Radial makes corners sweep. |
|
|
824
|
+
| `refraction.swirl` | `number` | iOS · Android | How far the edge refraction leans toward `highlight.angle`'s light axis, unitless like `depth`. Default `0` — pixel measurement of real iOS 26 found no lean; the twist the eye reads is `depth`'s radial term sweeping the corners. A stylisation knob: positive leans toward the light, negative away, clamped to `[-1, 1]`. |
|
|
825
|
+
| `refraction.curve` | `{ power?, bias? }` | iOS · Android | Falloff shaping across the band. Reach for it last. All-or-nothing: supplying `power` alone takes `bias: 0` rather than the variant's. |
|
|
826
|
+
| `dispersion.amount` | `number` | iOS · Android | Chromatic split along the edge, in points. Dropped by `quality: "low"`. |
|
|
827
|
+
| `dispersion.reach` | `number` | iOS · Android | How far in from the edge the split reaches. Falls back to the *refraction height default*, not to your `refraction.height`. |
|
|
828
|
+
| `highlight.intensity` | `number` | iOS · Android | Specular rim strength, `0`–`1`. Set `0` to remove the glass border light entirely. |
|
|
829
|
+
| `highlight.angle` | `number` | iOS · Android | Light direction in degrees. Default `180` — a vertical light axis: top and bottom edges lit, side rims dying at the midpoints, which is what real iOS 26 bars measure. The rim lights **both** lobes on that axis, so the highlight is 180°-periodic, and the same angle steers the border gradient and the `refraction.swirl` lean. |
|
|
830
|
+
| `highlight.width` | `number` | iOS · Android | Depth of the crisp border-light line, in dp. Default `0.75` — Apple's line measures 2–3 px on a 238 px icon. A separate faint ~7 dp sheen under the lit edges rides the same lobes; there is deliberately no drawn dark line — the dark edge seen on real icons is the refraction fold imaging dark content, which the lens produces by itself. This replaced the old Metal wash, `refraction.height` wide, which multiplied (so it vanished over dark backdrops), lit one lobe only, and faked an inset shadow real glass does not have. |
|
|
831
|
+
| `highlight.falloff` | `number` | iOS · Android | Angular falloff exponent of the rim's two lobes. Default `1`; higher concentrates the light at the lobes. |
|
|
832
|
+
| `border.width` | `number` | iOS · Android | Edge stroke width. `0` disables. Default `1`. |
|
|
833
|
+
| `border.opacity` | `number` | iOS · Android | Edge stroke opacity. The stroke is **pure white light** fading out at the ends of the `highlight.angle` axis on both renderers — real iOS 26 glass has no dark edge component, so the black tails the Metal stroke used to carry are gone. |
|
|
834
|
+
| `innerShadow.radius` | `number` | iOS · Android | Blur radius of the inner shadow, in dp — the soft dark band along the inside of the silhouette, the shape minus itself translated by the offset. `0` (the default) is off. Evaluated on the merged field, so a `morph` partner shades as one piece. |
|
|
835
|
+
| `innerShadow.offsetX` / `.offsetY` | `number` | iOS · Android | Where the shadow is cast, dp. Defaults `0` and `radius`: lit from above, the pane's top lip shades the top inner edge. |
|
|
836
|
+
| `innerShadow.opacity` | `number` | iOS · Android | Strength of the (black) shadow, `0`–`1`. Default `0.15`. |
|
|
837
|
+
| `magnification` | `number` | iOS · Android | A whole-surface lens: the backdrop reads enlarged through the pane, contracting toward the shape's centre. `1` is none; clamped to `[1, 4]`. Geometry is untouched, and ≥ 1 only samples inward, so it costs no extra backdrop. |
|
|
838
|
+
| `android` | `{ quality?, maxTier? }` | Android | See [`metal.android`](#metalandroid). iOS drops the key. |
|
|
839
|
+
|
|
840
|
+
### `LiquidGlassContainer`
|
|
841
|
+
|
|
842
|
+
Wraps sibling glass views so they merge into one another as they get close, the way system controls do. iOS 26+; elsewhere a plain `View`.
|
|
843
|
+
|
|
844
|
+
```tsx
|
|
845
|
+
import { LiquidGlassContainer, LiquidGlassView } from "expo-liquid-glass-ui";
|
|
846
|
+
|
|
847
|
+
<LiquidGlassContainer spacing={40} style={{ flexDirection: "row", gap: 12 }}>
|
|
848
|
+
<LiquidGlassView cornerRadius={24} style={{ width: 64, height: 64 }} />
|
|
849
|
+
<LiquidGlassView cornerRadius={24} style={{ width: 64, height: 64 }} />
|
|
850
|
+
</LiquidGlassContainer>;
|
|
851
|
+
```
|
|
852
|
+
|
|
853
|
+
| Prop | Type | Default | Description |
|
|
854
|
+
| --- | --- | --- | --- |
|
|
855
|
+
| `spacing` | `number` | system | Distance, in points, at which nested glass elements begin to merge. |
|
|
856
|
+
|
|
857
|
+
## How the Metal path works
|
|
858
|
+
|
|
859
|
+
Below iOS 26 there is no system Liquid Glass, so the effect is rebuilt in three steps.
|
|
860
|
+
|
|
861
|
+
**Capture.** The window is rasterised into an `MTLTexture` at reduced scale, clipped to the union of the on-screen glass views and padded for blur reach. `CGContext` draws straight into the texture's `MTLBuffer`, so there is no upload step, and two buffers alternate so the CPU never writes memory the GPU is still reading. A Metal-backed view's own content is excluded, otherwise it refracts its own output and smears; views on the native path stay in, so a Metal glass moving over a native one still refracts it. SwiftUI content is composited by the render server and comes out of `CALayer.render(in:)` blank, so hosting views — `@expo/ui`'s `<Host>` included — are drawn in a second `drawHierarchy(in:)` pass that lands on top of the window pass.
|
|
862
|
+
|
|
863
|
+
**Blur.** Separable gaussian, horizontal then vertical, in capture space. Each view reads its own sub-rect of the shared texture through a UV offset, so N views cost the same as one.
|
|
864
|
+
|
|
865
|
+
**Glass.** One pass into the drawable, and the same algorithm as the Android shader line for line: the continuous-corner SDF (with a morph partner folded in by smooth-min), refraction along its gradient with the optional swirl, chromatic dispersion walked along the displacement axis, the optional magnification, saturation, frost (whose polarity follows the backdrop when `adaptive`), tint, grain, the additive two-lobe border light with its sheen, the inner shadow, the press glow and dent, and an antialiased shape mask. Refraction is a pure coordinate remap, so it needs no render target of its own. `interactive` runs the same spring choreography as Android (`GlassPressAnimator`) on a display link that only exists while a spring is unsettled, applied to the surface and content subviews so React Native's own `transform` is never touched; the adaptive sensor reads the capture buffer the CPU already holds, so it costs no readback.
|
|
866
|
+
|
|
867
|
+
Every glass view encodes into a single command buffer per frame, driven by one shared display link, and presents asynchronously — nothing waits on the GPU from the main thread. The remaining per-frame cost is `CALayer.render(in:)` over the window, inherent to sampling outside the compositor. Its measured cost feeds a rate limiter that holds capture to a fixed share of the frame budget, so a dense screen settles to a lower refresh rate instead of dropping frames. On iOS 26 none of this applies — `UIGlassEffect` samples in the compositor directly.
|
|
868
|
+
|
|
869
|
+
## How the Android path works
|
|
870
|
+
|
|
871
|
+
Same three steps, different primitives, and one structural difference that removes a whole class of
|
|
872
|
+
bugs.
|
|
873
|
+
|
|
874
|
+
**Capture.** `LiquidGlassProvider` records its subtree into a `RenderNode` — a *display list*, not a
|
|
875
|
+
rasterisation, so re-recording costs nothing like a screenshot. A recorded display list holds live
|
|
876
|
+
references to its child nodes, so content that has not changed is re-rasterised by the GPU for free.
|
|
877
|
+
Each glass view then draws that node into its own padded node, transformed by a provider-to-local
|
|
878
|
+
matrix, and applies the effect chain there — never on the provider's node, and never via
|
|
879
|
+
`View.setRenderEffect`, which cannot be cropped and clips to the view bounds.
|
|
880
|
+
|
|
881
|
+
Because a glass view is a **sibling** of the provider rather than a descendant, self-exclusion is
|
|
882
|
+
structural. iOS has to filter its own views out of the capture; Android cannot include them in the
|
|
883
|
+
first place.
|
|
884
|
+
|
|
885
|
+
**Blur and glass.** `RenderEffect.createChainEffect` runs `createBlurEffect` and then the AGSL shader
|
|
886
|
+
in one pass: refraction (leaning toward the highlight's light axis — the iOS 26 "swirl"), chromatic
|
|
887
|
+
dispersion along the edge tangent, saturation, frost, tint, grain, the glass border light and an
|
|
888
|
+
antialiased rounded-rect SDF mask. HWUI propagates the device clip into the
|
|
889
|
+
filter's requested output rect, so clipping to the view before drawing genuinely shrinks the shaded
|
|
890
|
+
region — a 90× padded node costs +2 ms, not 90×.
|
|
891
|
+
|
|
892
|
+
**Scheduling.** Nothing is on a timer. The provider re-records only when its content actually
|
|
893
|
+
changes, and glass views redraw only when the provider's content generation moves *or* when their own
|
|
894
|
+
position in the window changes — the latter watched by an `OnPreDrawListener`, because a `FlatList`
|
|
895
|
+
scrolling glass rows re-records the *list's* display list, not each row's, so a row's own
|
|
896
|
+
`dispatchDraw` never runs while it moves. At rest both counters read zero.
|
|
897
|
+
|
|
898
|
+
## Fidelity notes
|
|
899
|
+
|
|
900
|
+
Honest deltas against the Compose originals:
|
|
901
|
+
|
|
902
|
+
- **Dispersion is a magnitude here, not a boolean.** The reference flips `chromaticAberration` on
|
|
903
|
+
and takes 7 fixed spectral taps; the base view walks N taps along the displacement axis and
|
|
904
|
+
masks them into channels. The *shape* of the effect now matches — `dispersion.quadrant: 1` was
|
|
905
|
+
added to the base view's shader for this, and it reproduces Kyant's `(cx·cy)/(hx·hy)` weighting
|
|
906
|
+
including the sign flip, so a capsule fringes at its two ends, hue order reversing between them,
|
|
907
|
+
and stays clean along the flanks. The exact per-channel weights are still not tap-for-tap equal.
|
|
908
|
+
- **Dispersion has a usable range, and it is narrow.** Under ~2dp of spread the shader skips it
|
|
909
|
+
entirely; over the tap budget it steps into discrete bands. `quality: "medium"` spaces its 8 taps
|
|
910
|
+
one *point* apart and `"high"` its 16 one *pixel* apart, so the wider the fringe the more the
|
|
911
|
+
expensive tier earns its cost. The pill runs 12dp on `"high"`; everything else is narrow enough
|
|
912
|
+
for `"medium"`.
|
|
913
|
+
- **Shadows, both kinds.** The reference's pill carries `Shadow(alpha = p)` and
|
|
914
|
+
`InnerShadow(8dp × p)`. The inner shadow is the base view's `metal.innerShadow` now — an SDF
|
|
915
|
+
band on the merged field, ramped in with press progress on the pill (8 dp) and the thumbs
|
|
916
|
+
(4 dp) — and the drop shadow is a `boxShadow` sibling under the glass, opacity-animated on the
|
|
917
|
+
pill and resting on the thumbs, drawn outside the capsule so the lens keeps a clean backdrop.
|
|
918
|
+
The reference's slider dead-stops at its ends; this one rubber-bands past them and fires
|
|
919
|
+
`onEdgeReached`, which is the system slider's behaviour rather than the catalog's.
|
|
920
|
+
- **Nothing here.** The one deviation that used to live in this list — a plain capsule in place of
|
|
921
|
+
the reference's second glass bar — turned out to be a mistake in both directions. It came from
|
|
922
|
+
measuring the strip while the pill was still sampling a *three*-layer backdrop; drop the visible
|
|
923
|
+
bar from that stack, as the reference does, and the faithful version is both correct and
|
|
924
|
+
**faster** (POCO F1: 61 fps at 0.8% jank, against 45 fps at 28% for the three-layer stack).
|
|
925
|
+
- **The button's press glow is the reference's own fallback.** Its buttons light up with a flat
|
|
926
|
+
additive white plus a finger-centred radial, both `BlendMode.Plus`. React Native has neither, so
|
|
927
|
+
the button uses the flat `White α0.25 × p` the reference itself declares for devices without
|
|
928
|
+
runtime shaders. The *tab bar* is exact — it drives the base view's `glow` prop, which is that
|
|
929
|
+
same highlight living in the AGSL where it belongs.
|
|
930
|
+
- **The pill's cutout is hard on Android, soft on iOS.** Android composites explicit provider
|
|
931
|
+
layers, so the pill covers the inactive row and the accent copy replaces it — the reference's
|
|
932
|
+
exact behaviour, icons sliced in two at the capsule edge. iOS has no provider layers to stack,
|
|
933
|
+
so there the inactive item fades under the pill and the cutout draws the accent copy over it.
|
|
934
|
+
|
|
935
|
+
Everything gesture-driven animates its `metal` per frame through `lerpMetal` and
|
|
936
|
+
`useAnimatedProps`, the way the reference recomposes its effect chain — no React state is in the
|
|
937
|
+
path of a material change. That is exported, so app code can do the same:
|
|
938
|
+
|
|
939
|
+
```tsx
|
|
940
|
+
const props = useAnimatedProps(() => ({
|
|
941
|
+
metal: lerpMetal(REST, HELD, pressProgress.value),
|
|
942
|
+
}));
|
|
943
|
+
```
|
|
944
|
+
|
|
945
|
+
## Working on this
|
|
946
|
+
|
|
947
|
+
One repository: `src/core` is the glass view (the former `expo-liquid-glass-view`), the rest of
|
|
948
|
+
`src` is the control kit, `android/` and `ios/` are the native module, and `example/` is the
|
|
949
|
+
harness — a bare Expo app whose Metro config resolves `expo-liquid-glass-ui` from `../src`, so
|
|
950
|
+
nothing needs publishing or building to try a change. `npm install` at the root, `npm install`
|
|
951
|
+
in `example/`, then `npx expo run:android` (or build `example/android` with Gradle).
|
|
952
|
+
|
|
953
|
+
The example's **blur** tab drifts a marker under two scroll-edge scrims so `dumpsys gfxinfo`
|
|
954
|
+
prices the progressive blur per frame; its **ui tune** screen drives the tab bar off live sliders —
|
|
955
|
+
every `metal` knob for both pill states, both scheme pairs, and a `log` button that prints the
|
|
956
|
+
tuned JSON to the Metro console. The shipped defaults came from it. The Android port's research
|
|
957
|
+
and plan live in `docs/android-port/`.
|
|
958
|
+
|
|
959
|
+
## Support
|
|
960
|
+
|
|
961
|
+
| Platform | Backend | `onRendererChange` |
|
|
962
|
+
| --- | --- | --- |
|
|
963
|
+
| iOS 26+ | `UIGlassEffect` | `"native"` |
|
|
964
|
+
| iOS 16.4–25 | Metal renderer | `"metal"` / `"fallback-blur"` |
|
|
965
|
+
| Android 13+ (API 33) | AGSL renderer — a port of the Metal one | `"agsl"` |
|
|
966
|
+
| Android 12–12L (API 31–32) | `RenderEffect` blur, no refraction | `"fallback-blur"` |
|
|
967
|
+
| Android 10–11 (API 29–30) | Live backdrop under a scrim | `"scrim"` |
|
|
968
|
+
| Android < 10, web | Not supported — plain `View` | — |
|
|
969
|
+
|
|
970
|
+
Verified on a Galaxy S23 (Adreno 740, API 36) and a Galaxy Note 4 (Mali-T760, API 32). The API 29–30
|
|
971
|
+
tier has not been run on period hardware.
|
|
972
|
+
|
|
973
|
+
## License
|
|
974
|
+
|
|
975
|
+
MIT. The glass view descends from rit3zh's `expo-liquid-glass-view` (MIT) — see `NOTICE`.
|