11import * as Haptics from "expo-haptics" ;
2+ import { isLiquidGlassSupported , LiquidGlassView } from "@callstack/liquid-glass" ;
23import { SymbolView } from "../../components/AppSymbol" ;
34import { useCallback , useEffect , useRef } from "react" ;
4- import { ActivityIndicator , Platform , Pressable , View } from "react-native" ;
5+ import { ActivityIndicator , Pressable , StyleSheet , useColorScheme , View } from "react-native" ;
56import Animated , { FadeIn , FadeOut , LinearTransition } from "react-native-reanimated" ;
67import { useSafeAreaInsets } from "react-native-safe-area-context" ;
7- import { isGlassEffectAPIAvailable } from "expo-glass-effect" ;
88
99import { AppText as Text } from "../../components/AppText" ;
10- import { GlassSurface } from "../../components/GlassSurface" ;
1110import { tryOpenExternalUrl } from "../../lib/openExternalUrl" ;
1211import { useThemeColor } from "../../lib/useThemeColor" ;
1312import type { GitActionProgress } from "../../state/use-vcs-action-state" ;
1413
1514const OVERLAY_LAYOUT_TRANSITION = LinearTransition . duration ( 220 ) ;
16- const AnimatedGlassSurface = Animated . createAnimatedComponent ( GlassSurface ) ;
15+ const AnimatedLiquidGlassView = Animated . createAnimatedComponent ( LiquidGlassView ) ;
1716
1817export function GitActionProgressOverlay ( props : {
1918 readonly progress : GitActionProgress ;
@@ -50,7 +49,7 @@ export function GitActionProgressOverlay(props: {
5049
5150 return (
5251 < Animated . View
53- entering = { FadeIn . duration ( 200 ) }
52+ entering = { isLiquidGlassSupported ? undefined : FadeIn . duration ( 200 ) }
5453 exiting = { FadeOut . duration ( 150 ) }
5554 className = "absolute inset-x-3 z-[100]"
5655 style = { { top : insets . top + 48 } }
@@ -66,7 +65,9 @@ export function GitActionProgressOverlay(props: {
6665function OverlayContent ( props : { readonly progress : GitActionProgress } ) {
6766 const { progress } = props ;
6867 const iconColor = useThemeColor ( "--color-icon" ) ;
69- const supportsGlass = Platform . OS === "ios" && isGlassEffectAPIAvailable ( ) ;
68+ const glassBorder = useThemeColor ( "--color-header-border" ) ;
69+ const glassTint = useThemeColor ( "--color-glass-tint" ) ;
70+ const isDarkMode = useColorScheme ( ) === "dark" ;
7071 const content = (
7172 < >
7273 < OverlayIcon phase = { progress . phase } iconColor = { iconColor } />
@@ -90,19 +91,38 @@ function OverlayContent(props: { readonly progress: GitActionProgress }) {
9091 </ >
9192 ) ;
9293
93- if ( supportsGlass ) {
94+ if ( isLiquidGlassSupported ) {
9495 return (
95- < AnimatedGlassSurface
96- chrome = "none"
97- glassEffectStyle = "regular"
96+ < Animated . View
9897 layout = { OVERLAY_LAYOUT_TRANSITION }
9998 style = { {
99+ backgroundColor : glassTint ,
100+ borderColor : glassBorder ,
100101 borderCurve : "continuous" ,
101102 borderRadius : 26 ,
103+ borderWidth : StyleSheet . hairlineWidth ,
104+ overflow : "hidden" ,
102105 } }
103106 >
104- < View className = "flex-row items-center gap-2.5 px-3.5 py-3" > { content } </ View >
105- </ AnimatedGlassSurface >
107+ < AnimatedLiquidGlassView
108+ colorScheme = { isDarkMode ? "dark" : "light" }
109+ effect = "regular"
110+ interactive
111+ layout = { OVERLAY_LAYOUT_TRANSITION }
112+ style = { {
113+ borderCurve : "continuous" ,
114+ borderRadius : 26 ,
115+ overflow : "hidden" ,
116+ } }
117+ >
118+ < Animated . View
119+ entering = { FadeIn . delay ( 60 ) . duration ( 140 ) }
120+ className = "flex-row items-center gap-2.5 px-3.5 py-3"
121+ >
122+ { content }
123+ </ Animated . View >
124+ </ AnimatedLiquidGlassView >
125+ </ Animated . View >
106126 ) ;
107127 }
108128
0 commit comments