-
Notifications
You must be signed in to change notification settings - Fork 3.3k
Polish iOS git progress overlay with glass effects #4387
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,15 +1,19 @@ | ||
| import * as Haptics from "expo-haptics"; | ||
| import { isLiquidGlassSupported, LiquidGlassView } from "@callstack/liquid-glass"; | ||
| import { SymbolView } from "../../components/AppSymbol"; | ||
| import { useCallback, useEffect, useRef } from "react"; | ||
| import { ActivityIndicator, Pressable, View } from "react-native"; | ||
| import Animated, { FadeIn, FadeOut } from "react-native-reanimated"; | ||
| import { ActivityIndicator, Pressable, StyleSheet, useColorScheme, View } from "react-native"; | ||
| import Animated, { FadeIn, FadeOut, LinearTransition } from "react-native-reanimated"; | ||
| import { useSafeAreaInsets } from "react-native-safe-area-context"; | ||
|
|
||
| import { AppText as Text } from "../../components/AppText"; | ||
| import { tryOpenExternalUrl } from "../../lib/openExternalUrl"; | ||
| import { useThemeColor } from "../../lib/useThemeColor"; | ||
| import type { GitActionProgress } from "../../state/use-vcs-action-state"; | ||
|
|
||
| const OVERLAY_LAYOUT_TRANSITION = LinearTransition.duration(220); | ||
| const AnimatedLiquidGlassView = Animated.createAnimatedComponent(LiquidGlassView); | ||
|
|
||
| export function GitActionProgressOverlay(props: { | ||
| readonly progress: GitActionProgress; | ||
| readonly onDismiss: () => void; | ||
|
|
@@ -45,7 +49,7 @@ export function GitActionProgressOverlay(props: { | |
|
|
||
| return ( | ||
| <Animated.View | ||
| entering={FadeIn.duration(200)} | ||
| entering={isLiquidGlassSupported ? undefined : FadeIn.duration(200)} | ||
| exiting={FadeOut.duration(150)} | ||
| className="absolute inset-x-3 z-[100]" | ||
| style={{ top: insets.top + 48 }} | ||
|
|
@@ -61,16 +65,11 @@ export function GitActionProgressOverlay(props: { | |
| function OverlayContent(props: { readonly progress: GitActionProgress }) { | ||
| const { progress } = props; | ||
| const iconColor = useThemeColor("--color-icon"); | ||
|
|
||
| const bgClass = | ||
| progress.phase === "error" | ||
| ? "bg-red-50 dark:bg-red-950/80 border-red-200 dark:border-red-800" | ||
| : "bg-card border-border"; | ||
|
|
||
| return ( | ||
| <View | ||
| className={`flex-row items-center gap-2.5 rounded-2xl border px-3.5 py-3 shadow-lg shadow-black/10 ${bgClass}`} | ||
| > | ||
| const glassBorder = useThemeColor("--color-header-border"); | ||
| const glassTint = useThemeColor("--color-glass-tint"); | ||
| const isDarkMode = useColorScheme() === "dark"; | ||
| const content = ( | ||
| <> | ||
| <OverlayIcon phase={progress.phase} iconColor={iconColor} /> | ||
|
|
||
| <View className="flex-1 gap-0.5"> | ||
|
|
@@ -89,7 +88,56 @@ function OverlayContent(props: { readonly progress: GitActionProgress }) { | |
| {progress.prUrl ? ( | ||
| <SymbolView name="arrow.up.right" size={13} tintColor={iconColor} type="monochrome" /> | ||
| ) : null} | ||
| </View> | ||
| </> | ||
| ); | ||
|
|
||
| if (isLiquidGlassSupported) { | ||
| return ( | ||
| <Animated.View | ||
| layout={OVERLAY_LAYOUT_TRANSITION} | ||
| style={{ | ||
| backgroundColor: glassTint, | ||
| borderColor: glassBorder, | ||
| borderCurve: "continuous", | ||
| borderRadius: 26, | ||
| borderWidth: StyleSheet.hairlineWidth, | ||
| overflow: "hidden", | ||
| }} | ||
| > | ||
| <AnimatedLiquidGlassView | ||
| colorScheme={isDarkMode ? "dark" : "light"} | ||
| effect="regular" | ||
| interactive | ||
| layout={OVERLAY_LAYOUT_TRANSITION} | ||
| style={{ | ||
| borderCurve: "continuous", | ||
| borderRadius: 26, | ||
| overflow: "hidden", | ||
| }} | ||
| > | ||
| <Animated.View | ||
| entering={FadeIn.delay(60).duration(140)} | ||
| className="flex-row items-center gap-2.5 px-3.5 py-3" | ||
| > | ||
| {content} | ||
| </Animated.View> | ||
| </AnimatedLiquidGlassView> | ||
| </Animated.View> | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Expo glass fallback removedMedium Severity The overlay now branches only on Reviewed by Cursor Bugbot for commit cb8041b. Configure here. |
||
| ); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Error chrome missing on glass pathMedium Severity After the glass branch was added, Reviewed by Cursor Bugbot for commit faf65cb. Configure here. |
||
| } | ||
|
|
||
| const bgClass = | ||
| progress.phase === "error" | ||
| ? "bg-red-50 dark:bg-red-950/80 border-red-200 dark:border-red-800" | ||
| : "bg-card border-border"; | ||
|
|
||
| return ( | ||
| <Animated.View | ||
| layout={OVERLAY_LAYOUT_TRANSITION} | ||
| className={`flex-row items-center gap-2.5 rounded-[26px] border border-continuous px-3.5 py-3 shadow-lg shadow-black/10 ${bgClass}`} | ||
| > | ||
| {content} | ||
| </Animated.View> | ||
| ); | ||
| } | ||
|
|
||
|
|
||


There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Duplicate layout on liquid glass
Medium Severity
This overlay is the only callsite that wraps
LiquidGlassViewinAnimated.createAnimatedComponentand applieslayout={OVERLAY_LAYOUT_TRANSITION}on both the outerAnimated.ViewandAnimatedLiquidGlassView.ComposerSurfaceanimates only the wrapper and keepsLiquidGlassViewnon-animated.Additional Locations (1)
apps/mobile/src/features/threads/GitActionProgressOverlay.tsx#L95-L97Reviewed by Cursor Bugbot for commit cb8041b. Configure here.