diff --git a/apps/mobile/app/(app)/(tabs)/budgets.tsx b/apps/mobile/app/(app)/(tabs)/budgets.tsx index 2c954c4f..839bb974 100644 --- a/apps/mobile/app/(app)/(tabs)/budgets.tsx +++ b/apps/mobile/app/(app)/(tabs)/budgets.tsx @@ -56,6 +56,21 @@ export default function BudgetsScreen() { } }) + const headerStyle = useAnimatedStyle(() => { + return { + transform: [ + { + translateY: interpolate( + headerAnimation.value, + [0, chartHeight * 1.5, chartHeight * 1.7], + [0, 0, -chartHeight], + Extrapolation.EXTEND, + ), + }, + ], + } + }) + const summaryStyle = useAnimatedStyle(() => { const extraSectionHeaderSpacing = spacing * 2 return { @@ -175,7 +190,7 @@ export default function BudgetsScreen() { const chartData = map( groupBy( transactions.filter((i) => !!i.budgetId), - (t) => t.date, + (transaction) => dayjsExtended(transaction.date).format('YYYY-MM-DD'), ), (transactions, key) => ({ day: new Date(key).getDate(), @@ -199,8 +214,9 @@ export default function BudgetsScreen() { return ( - { if (headerHeight.value === ev.nativeEvent.layout.height) { return @@ -226,7 +242,7 @@ export default function BudgetsScreen() { data={chartData} /> - + { + return { + transform: [ + { + translateY: interpolate( + headerAnimation.value, + [0, chartHeight * 1.5, chartHeight * 1.7], + [0, 0, -chartHeight], + Extrapolation.EXTEND, + ), + }, + ], + } + }) + const summaryStyle = useAnimatedStyle(() => { const extraSectionHeaderSpacing = spacing * 2 return { @@ -190,7 +205,9 @@ export default function BudgetDetailScreen() { } const chartData = map( - groupBy(transactions, (t) => t.date), + groupBy(transactions, (transaction) => + dayjsExtended(transaction.date).format('YYYY-MM-DD'), + ), (transactions, key) => ({ day: new Date(key).getDate(), amount: transactions.reduce((acc, t) => acc - t.amountInVnd, 0), @@ -204,8 +221,9 @@ export default function BudgetDetailScreen() { index={currentPeriodIndex} onChange={setCurrentPeriodIndex} /> - { if (headerHeight.value === ev.nativeEvent.layout.height) { return @@ -237,7 +255,7 @@ export default function BudgetDetailScreen() { } /> - + = ({ budget }) => { > - + {budget.name} @@ -90,7 +90,7 @@ export const BudgetItem: FC = ({ budget }) => { = ({ budget }) => { { - if (isFirstPressActive) { + if (firstTouch.x) { Haptics.selectionAsync().catch(() => null) } - }, [isFirstPressActive]) + }, [firstTouch.x]) return (