Skip to content
TypeScript

fix(mobile): replace Callstack glass with Expo glass (#8862)

Julius Marminge9b2d04317c68
diff --git a/apps/mobile/package.json b/apps/mobile/package.json
index b708661db9b..3fcb1f76f3d 100644
--- a/apps/mobile/package.json
+++ b/apps/mobile/package.json
@@ -45,7 +45,6 @@
"typecheck": "tsc --noEmit"
},
"dependencies": {
- "@callstack/liquid-glass": "^0.7.1",
"@clerk/expo": "catalog:",
"@effect/atom-react": "catalog:",
"@expo-google-fonts/dm-sans": "^0.4.2",
diff --git a/apps/mobile/src/features/threads/GitActionProgressOverlay.tsx b/apps/mobile/src/features/threads/GitActionProgressOverlay.tsx
index 086f41a1bc7..fb12a35d6c2 100644
--- a/apps/mobile/src/features/threads/GitActionProgressOverlay.tsx
+++ b/apps/mobile/src/features/threads/GitActionProgressOverlay.tsx
@@ -1,5 +1,5 @@
import * as Haptics from "expo-haptics";
-import { isLiquidGlassSupported, LiquidGlassView } from "@callstack/liquid-glass";
+import { GlassView } from "expo-glass-effect";
import { SymbolView } from "../../components/AppSymbol";
import { useCallback, useEffect, useRef } from "react";
import { ActivityIndicator, Pressable, StyleSheet, useColorScheme, View } from "react-native";
@@ -11,11 +11,12 @@ import { APP_BAR_HEIGHT } from "../../lib/layoutMetrics";
import { themeColorWithAlpha } from "../../lib/mobileTheme";
import { tryOpenExternalUrl } from "../../lib/openExternalUrl";
import { useUniwindTheme } from "../../lib/useUniwindTheme";
+import { NATIVE_LIQUID_GLASS_SUPPORTED } from "../../native/native-glass";
import type { GitActionProgress } from "../../state/use-vcs-action-state";
const OVERLAY_LAYOUT_TRANSITION = LinearTransition.duration(220);
const OVERLAY_TOP_GAP = 8;
-const AnimatedLiquidGlassView = Animated.createAnimatedComponent(LiquidGlassView);
+const AnimatedGlassView = Animated.createAnimatedComponent(GlassView);
export function GitActionProgressOverlay(props: {
readonly progress: GitActionProgress;
@@ -52,7 +53,7 @@ export function GitActionProgressOverlay(props: {
return (
<Animated.View
- entering={isLiquidGlassSupported ? undefined : FadeIn.duration(200)}
+ entering={NATIVE_LIQUID_GLASS_SUPPORTED ? undefined : FadeIn.duration(200)}
exiting={FadeOut.duration(150)}
className="absolute inset-x-3 z-[100]"
style={{ top: insets.top + APP_BAR_HEIGHT + OVERLAY_TOP_GAP }}
@@ -102,7 +103,7 @@ function OverlayContent(props: { readonly progress: GitActionProgress }) {
</>
);
- if (isLiquidGlassSupported) {
+ if (NATIVE_LIQUID_GLASS_SUPPORTED) {
return (
<Animated.View
layout={OVERLAY_LAYOUT_TRANSITION}
@@ -116,10 +117,10 @@ function OverlayContent(props: { readonly progress: GitActionProgress }) {
shadowRadius: 18,
}}
>
- <AnimatedLiquidGlassView
+ <AnimatedGlassView
colorScheme={isDarkMode ? "dark" : "light"}
- effect="regular"
- interactive
+ glassEffectStyle="regular"
+ isInteractive
layout={OVERLAY_LAYOUT_TRANSITION}
tintColor={glassTint}
style={{
@@ -136,7 +137,7 @@ function OverlayContent(props: { readonly progress: GitActionProgress }) {
>
{content}
</Animated.View>
- </AnimatedLiquidGlassView>
+ </AnimatedGlassView>
</Animated.View>
);
}
diff --git a/apps/mobile/src/features/threads/floating-working-control.tsx b/apps/mobile/src/features/threads/floating-working-control.tsx
index 1883947c048..bdfa19a9eea 100644
--- a/apps/mobile/src/features/threads/floating-working-control.tsx
+++ b/apps/mobile/src/features/threads/floating-working-control.tsx
@@ -1,8 +1,4 @@
-import {
- isLiquidGlassSupported,
- LiquidGlassContainerView,
- LiquidGlassView,
-} from "@callstack/liquid-glass";
+import { GlassContainer, GlassView } from "expo-glass-effect";
import { useEffect, useState } from "react";
import { Text as SystemText, View } from "react-native";
import Animated, {
@@ -18,6 +14,7 @@ import { withUniwind } from "uniwind";
import { AppText as Text } from "../../components/AppText";
import { ControlPill } from "../../components/ControlPill";
+import { NATIVE_LIQUID_GLASS_SUPPORTED } from "../../native/native-glass";
const CONTROL_HEIGHT = 44;
const CONTROL_COMPOSER_GAP = 8;
@@ -31,9 +28,15 @@ const CONTROL_TIMING = {
} as const;
const CONTROL_SEPARATION = (16 + CONTROL_HEIGHT) / 2;
-const UniwindLiquidGlassView = withUniwind(LiquidGlassView);
-const UniwindLiquidGlassContainerView = withUniwind(LiquidGlassContainerView);
-const AnimatedLiquidGlassView = Animated.createAnimatedComponent(UniwindLiquidGlassView);
+// Expo reapplies glass after native layout and window reattachment, when UIKit
+// can otherwise leave the label visible but lose the material behind it.
+const UniwindGlassView = withUniwind(GlassView, {
+ style: { fromClassName: "className" },
+});
+const UniwindGlassContainer = withUniwind(GlassContainer, {
+ style: { fromClassName: "className" },
+});
+const AnimatedGlassView = Animated.createAnimatedComponent(UniwindGlassView);
export const FLOATING_WORKING_CONTROL_COVERAGE = CONTROL_HEIGHT + CONTROL_COMPOSER_GAP;
@@ -68,29 +71,29 @@ export function FloatingWorkingControl(props: {
pointerEvents="box-none"
className="absolute left-0 right-0 z-20 items-center"
style={{ top: -FLOATING_WORKING_CONTROL_COVERAGE }}
- entering={isLiquidGlassSupported ? undefined : CONTROL_ENTERING}
- exiting={isLiquidGlassSupported ? undefined : CONTROL_EXITING}
+ entering={NATIVE_LIQUID_GLASS_SUPPORTED ? undefined : CONTROL_ENTERING}
+ exiting={NATIVE_LIQUID_GLASS_SUPPORTED ? undefined : CONTROL_EXITING}
>
- {props.startedAt !== null && isLiquidGlassSupported ? (
- <UniwindLiquidGlassContainerView
+ {props.startedAt !== null && NATIVE_LIQUID_GLASS_SUPPORTED ? (
+ <UniwindGlassContainer
spacing={GLASS_MERGE_SPACING}
pointerEvents="box-none"
className="flex-row items-center gap-4"
>
- <AnimatedLiquidGlassView
+ <AnimatedGlassView
colorScheme={props.colorScheme}
- effect="regular"
+ glassEffectStyle="regular"
pointerEvents="none"
className="h-11 justify-center overflow-hidden rounded-full"
style={timerStyle}
>
<WorkingDuration startedAt={props.startedAt} />
- </AnimatedLiquidGlassView>
+ </AnimatedGlassView>
- <AnimatedLiquidGlassView
+ <AnimatedGlassView
colorScheme={props.colorScheme}
- effect="regular"
- interactive
+ glassEffectStyle="regular"
+ isInteractive
pointerEvents={props.showScrollToEnd ? "auto" : "none"}
accessibilityElementsHidden={!props.showScrollToEnd}
importantForAccessibility={props.showScrollToEnd ? "auto" : "no-hide-descendants"}
@@ -100,8 +103,8 @@ export function FloatingWorkingControl(props: {
<Animated.View style={arrowContentStyle}>
<ScrollToEndButton disabled={!props.showScrollToEnd} onPress={props.onScrollToEnd} />
</Animated.View>
- </AnimatedLiquidGlassView>
- </UniwindLiquidGlassContainerView>
+ </AnimatedGlassView>
+ </UniwindGlassContainer>
) : props.startedAt !== null ? (
<View pointerEvents="box-none" className="flex-row items-center gap-4">
<Animated.View
@@ -128,15 +131,15 @@ export function FloatingWorkingControl(props: {
/>
</Animated.View>
</View>
- ) : isLiquidGlassSupported ? (
- <UniwindLiquidGlassView
+ ) : NATIVE_LIQUID_GLASS_SUPPORTED ? (
+ <UniwindGlassView
colorScheme={props.colorScheme}
- effect="regular"
- interactive
+ glassEffectStyle="regular"
+ isInteractive
className="h-11 w-11 items-center justify-center overflow-hidden rounded-full"
>
<ScrollToEndButton onPress={props.onScrollToEnd} />
- </UniwindLiquidGlassView>
+ </UniwindGlassView>
) : (
<ControlPill
accessibilityLabel="Scroll to end"
diff --git a/docs/user/mobile-appearance.md b/docs/user/mobile-appearance.md
index a57b98e553c..b7e4d57a6ad 100644
--- a/docs/user/mobile-appearance.md
+++ b/docs/user/mobile-appearance.md
@@ -4,8 +4,8 @@ T3 Code Mobile includes the T3 Code, T3 Chat, Grove, Ocean, Ember, and Iris them
light and dark colors that apply throughout the app, including code reviews, file previews, the
terminal, native headers, and sheets.
-On supported iOS versions, the new-task and thread composers use the system glass material.
-Other platforms use a themed background.
+On supported iOS versions, the new-task and thread composers, working timer, and scroll-to-end
+button use the system glass material. Other platforms use a themed background.
To change themes:
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index c310daa9ca1..29785097d23 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -211,9 +211,6 @@ importers:
apps/mobile:
dependencies:
- '@callstack/liquid-glass':
- specifier: ^0.7.1
'@clerk/expo':
specifier: 4.2.0
version: 4.2.0(patch_hash=72e426f44fc1cde16fc2cbba3d1e96cdca7c6d957faa73d0fe6b43948608a6c1)(1fcd0592788ddcf326eeeb90d875ed47)
@@ -1700,12 +1697,6 @@ packages:
cpu: [x64]
os: [win32]
- '@callstack/[email protected]':
- resolution: {integrity: sha512-N2rzs8g3kneI5G/98AZdVtjc6OUFBBFwPxVGVMoXUEI7QiioB4+aWwbImg5h8Z3Vb/T+fgLYWmmNhi27wHwE4g==}
- peerDependencies:
- react: '*'
- react-native: '*'
-
'@capsizecss/[email protected]':
resolution: {integrity: sha512-CuNiSqg7+e1cO/GjffyMOm5Tt2jUF9CWHHnvQ/UkqvtkGfHdgwEC0wpmq7fkN3gxwpRnrAN0WzO3vREKmNolMQ==}
engines: {node: '>=18'}
@@ -11398,11 +11389,6 @@ snapshots:
'@bruits/[email protected]':
optional: true
- dependencies:
- react: 19.2.3
-
'@capsizecss/[email protected]':
dependencies:
fontkitten: 1.0.3