Consider it done. The open-source AI agent that works out of the box · 想到,就能做到。开源、开箱即用的 AI Agent。
TypeScript agentai-agentai-assistantandroidclaude-codecodexelectroniosllmmacosreact-nativetypescriptwindows
/**
* 首页下拉菜单面板。
* iOS 26+:GlassView 包住内容(和顶栏圆钮同一用法),写死宽度,圆角走系统玻璃。
* 不要把玻璃绝对铺满,也不要对玻璃做透明度动画——会掏空底板。
* 无系统玻璃时回退 BlurBackdrop + sheet 色卡片。
*/
import { GlassView } from 'expo-glass-effect';
import { useAdaptiveWindow } from '@/platform/AdaptiveWindowContext';
import { controlRegion } from '@/platform/windowGeometry';
import type { ReactNode } from 'react';
import { Animated, Modal, Pressable, ScrollView, StyleSheet, View, type StyleProp, type ViewStyle } from 'react-native';
import { BlurBackdrop } from '@/session/BlurBackdrop';
import { useLiquidGlassAvailable } from '@/session/useLiquidGlassAvailable';
import { useTheme, useThemedStyles, type ThemeColors } from '@/theme';
import { radius, spacing } from '@/theme/tokens';
const MENU_WIDTH = 280;
export function HomeGlassMenuPanel({
children,
style,
testID,
}: {
children: ReactNode;
style?: StyleProp<ViewStyle>;
testID: string;
}) {
const { colors, mode } = useTheme();
const styles = useThemedStyles(makeStyles);
const liquidGlass = useLiquidGlassAvailable();
return (
<Pressable
onPress={() => undefined}
style={[styles.shell, liquidGlass ? styles.shellGlass : styles.shellSolid, style, { maxWidth: '100%' }]}
testID={testID}
>
{liquidGlass ? (
<GlassView
colorScheme={mode}
glassEffectStyle="regular"
isInteractive
style={styles.glass}
>
<View style={styles.body}>{children}</View>
</GlassView>
) : (
<>
<BlurBackdrop intensity={40} overlayColor={colors.sheetSurface} />
<View style={styles.body}>{children}</View>
</>
)}
</Pressable>
);
}
/** 背板自己淡入淡出;玻璃面板不参与 opacity,避免 UIGlassEffect 被打成全透明。 */
export function HomeMenuScrim({
backdropTestID,
children,
onClose,
onShow,
progress,
topOffset,
visible,
}: {
backdropTestID: string;
children: ReactNode;
onClose(): void;
onShow(): void;
progress: Animated.Value;
topOffset: number;
visible: boolean;
}) {
const styles = useThemedStyles(makeStyles);
const geometry = useAdaptiveWindow();
const region = controlRegion(geometry);
return (
<Modal supportedOrientations={["portrait", "portrait-upside-down", "landscape-left", "landscape-right"]} animationType="none" onShow={onShow} transparent visible={visible} onRequestClose={onClose}>
<View style={styles.layer}>
<Animated.View pointerEvents="none" style={[styles.dim, { opacity: progress }]} />
<Pressable
onPress={onClose}
style={[styles.hit, { paddingTop: Math.max(region.y, Math.min(topOffset, region.y + region.height - 100)),
paddingLeft: region.x + spacing.lg, paddingRight: geometry.width - region.x - region.width + spacing.lg,
paddingBottom: geometry.height - region.y - region.height }]}
testID={backdropTestID}
>
<ScrollView keyboardShouldPersistTaps="handled" showsVerticalScrollIndicator={false}>{children}</ScrollView>
</Pressable>
</View>
</Modal>
);
}
const makeStyles = (colors: ThemeColors) =>
StyleSheet.create({
shell: {
overflow: 'hidden',
width: MENU_WIDTH,
},
shellGlass: {
borderRadius: radius.container,
},
shellSolid: {
borderColor: colors.border,
borderRadius: radius.container,
borderWidth: StyleSheet.hairlineWidth,
},
glass: {
maxWidth: '100%',
borderRadius: radius.container,
overflow: 'hidden',
width: MENU_WIDTH,
},
body: {
padding: spacing.sm,
zIndex: 1,
},
layer: {
flex: 1,
},
dim: {
backgroundColor: colors.overlay,
bottom: 0,
left: 0,
position: 'absolute',
right: 0,
top: 0,
},
hit: {
flex: 1,
paddingHorizontal: spacing.lg,
},
});