11import * as Haptics from "expo-haptics" ;
22import { SymbolView } from "../../components/AppSymbol" ;
33import { useCallback , useEffect , useRef } from "react" ;
4- import { ActivityIndicator , Pressable , View } from "react-native" ;
5- import Animated , { FadeIn , FadeOut } from "react-native-reanimated" ;
4+ import { ActivityIndicator , Platform , Pressable , View } from "react-native" ;
5+ import Animated , { FadeIn , FadeOut , LinearTransition } from "react-native-reanimated" ;
66import { useSafeAreaInsets } from "react-native-safe-area-context" ;
7+ import { isGlassEffectAPIAvailable } from "expo-glass-effect" ;
78
89import { AppText as Text } from "../../components/AppText" ;
10+ import { GlassSurface } from "../../components/GlassSurface" ;
911import { tryOpenExternalUrl } from "../../lib/openExternalUrl" ;
1012import { useThemeColor } from "../../lib/useThemeColor" ;
1113import type { GitActionProgress } from "../../state/use-vcs-action-state" ;
1214
15+ const OVERLAY_LAYOUT_TRANSITION = LinearTransition . duration ( 220 ) ;
16+ const AnimatedGlassSurface = Animated . createAnimatedComponent ( GlassSurface ) ;
17+
1318export function GitActionProgressOverlay ( props : {
1419 readonly progress : GitActionProgress ;
1520 readonly onDismiss : ( ) => void ;
@@ -61,16 +66,9 @@ export function GitActionProgressOverlay(props: {
6166function OverlayContent ( props : { readonly progress : GitActionProgress } ) {
6267 const { progress } = props ;
6368 const iconColor = useThemeColor ( "--color-icon" ) ;
64-
65- const bgClass =
66- progress . phase === "error"
67- ? "bg-red-50 dark:bg-red-950/80 border-red-200 dark:border-red-800"
68- : "bg-card border-border" ;
69-
70- return (
71- < View
72- className = { `flex-row items-center gap-2.5 rounded-2xl border px-3.5 py-3 shadow-lg shadow-black/10 ${ bgClass } ` }
73- >
69+ const supportsGlass = Platform . OS === "ios" && isGlassEffectAPIAvailable ( ) ;
70+ const content = (
71+ < >
7472 < OverlayIcon phase = { progress . phase } iconColor = { iconColor } />
7573
7674 < View className = "flex-1 gap-0.5" >
@@ -89,7 +87,37 @@ function OverlayContent(props: { readonly progress: GitActionProgress }) {
8987 { progress . prUrl ? (
9088 < SymbolView name = "arrow.up.right" size = { 13 } tintColor = { iconColor } type = "monochrome" />
9189 ) : null }
92- </ View >
90+ </ >
91+ ) ;
92+
93+ if ( supportsGlass ) {
94+ return (
95+ < AnimatedGlassSurface
96+ chrome = "none"
97+ glassEffectStyle = "regular"
98+ layout = { OVERLAY_LAYOUT_TRANSITION }
99+ style = { {
100+ borderCurve : "continuous" ,
101+ borderRadius : 26 ,
102+ } }
103+ >
104+ < View className = "flex-row items-center gap-2.5 px-3.5 py-3" > { content } </ View >
105+ </ AnimatedGlassSurface >
106+ ) ;
107+ }
108+
109+ const bgClass =
110+ progress . phase === "error"
111+ ? "bg-red-50 dark:bg-red-950/80 border-red-200 dark:border-red-800"
112+ : "bg-card border-border" ;
113+
114+ return (
115+ < Animated . View
116+ layout = { OVERLAY_LAYOUT_TRANSITION }
117+ className = { `flex-row items-center gap-2.5 rounded-[26px] border border-continuous px-3.5 py-3 shadow-lg shadow-black/10 ${ bgClass } ` }
118+ >
119+ { content }
120+ </ Animated . View >
93121 ) ;
94122}
95123
0 commit comments