import type { LayoutChangeEvent } from 'react-native' import { LinearGradient } from 'expo-linear-gradient' import React, { useRef, useState } from 'react' import { ScrollView, Text, View } from 'react-native' import { useSafeAreaInsets } from 'react-native-safe-area-context' import { LucideIcon } from '@/components/common/ao' import { IconJiaotong } from '@/components/iconfont' import { Fab, FabIcon } from '@/components/ui/fab' import { Grid, GridItem } from '@/components/ui/grid' import { AddIcon } from '@/components/ui/icon' import { Progress, ProgressFilledTrack } from '@/components/ui/progress' import AddMoneyDrawer from './components/AddDrawer' import TransactionsList from './components/TransactionsList' export default function Money() { const [showDrawer, setShowDrawer] = useState(false) const insets = useSafeAreaInsets() const [gradientHeight, setGradientHeight] = useState(200) const gridLayout = useRef<{ y: number, height: number } | null>(null) const onGridLayout = (e: LayoutChangeEvent) => { // 仅首次布局计算高度 if (!gridLayout.current) { const { y, height } = e.nativeEvent.layout gridLayout.current = { y, height } setGradientHeight(y + height / 2 + 16 + insets.top) } } return ( 2025/11/10 {/* 余额区域 */} 余额 ↓20% 22,313.00 {/* 收入/支出/结余 */} 收入 ↑20% 11.0 支出 ↑20% 11.0 结余 ↑20% 11.0 {/* 预算进度 */} 预算 点击设置 {[...Array.from({ length: 5 })].map((_, i) => ( 账单 ))} { setShowDrawer(true) }} > { setShowDrawer(false) }} /> ) }