# React Native budgeting app template (Pro)

> A complete React Native personal budgeting app for iOS, Android and the web: what is safe to spend today, activity by day with swipe to split, budgets you drag to reorder and resize, insights, savings goals, bills and subscriptions, and quick cash expenses.

# Budgeting: Penny Pro

Penny reads transactions and never moves money. Budgets turn amber from 80% and red when over; splitting a payment halves what counts against your budget.

See it live, on any device

## Use the whole app

```tsx
import { BudgetApp } from '@patine-ui/pro';

<BudgetApp />;
```

| Prop | Type | Default |
| --- | --- | --- |
| `initialRoute` | 'overview' \| 'activity' \| 'budgets' \| 'insights' \| 'goals' \| 'bills' \| 'add' \| 'settings' | 'overview' |
| `demo` | `'ready'` \| `'loading'` \| `'empty'` \| `'error'` | `'ready'` |
| `insets` | `{ top, bottom }` | None |
| `platform` | `'ios'` \| `'android'` \| `'web'` | `Platform.OS` |

Screens move the platform's way: on iOS a pushed screen slides in from the trailing edge, on Android they fade through, on the web and between tabs they fade in. Reduce motion turns it off.

## Screens

| Screen | What it does |
| --- | --- |
| `BudgetOverviewScreen` | Safe to spend today, StatsRow, cash flow on a ComboChart, budgets closest to their limit, bills coming up |
| `BudgetActivityScreen` | Transactions by day with totals, search and filters, SwipeableRow to split or hide, a BottomSheet to change the category |
| `BudgetsScreen` | RadialChart rings, budgets on SortableList with handles, an AlertDialog with a Slider to change a limit |
| `InsightsScreen` | Plain-language notes, stacked BarChart by category, a DonutChart and a spending HeatmapChart |
| `GoalsScreen` | The main goal on a GaugeChart, savings with a dashed plan, goals with progress and on-track badges |
| `BillsScreen` | Pro's Agenda of due dates, subscriptions with brand logos, bills to pay by hand |
| `AddExpenseScreen` | A big amount, category tiles, DatePickerField and a split with AvatarGroup |
| `BudgetSettingsScreen` | Linked accounts with brand logos, budgeting and notification switches |

Every screen is exported on its own, takes its data as props, and has sample data as defaults. `budgetsFor(txns, today)` gives each budget's spent, left and state; `monthSummary` the safe-to-spend figure; `goalStatus` whether a goal is on track.

## Built with

The free components, from `patine-ui`:

[AlertDialog](/docs/components/alert-dialog) · [Avatar](/docs/components/avatar) · [AvatarGroup](/docs/components/avatar-group) · [Badge](/docs/components/badge) · [BottomSheet](/docs/components/bottom-sheet) · [Button](/docs/components/button) · [Card](/docs/components/card) · [ChipGroup](/docs/components/chip-group) · [DatePickerField](/docs/components/date-picker) · [DescriptionList](/docs/components/description-list) · [Heading, Text](/docs/components/text) · [List, ListItem](/docs/components/list) · [Progress](/docs/components/progress) · [SearchField](/docs/components/search-field) · [Separator](/docs/components/separator) · [Slider](/docs/components/slider) · [SortableHandle, SortableList](/docs/components/sortable-list) · [Stat](/docs/components/stat) · [SwipeableRow](/docs/components/swipeable-row) · [Switch](/docs/components/switch) · [TextField](/docs/components/text-field)

And from Patine Pro:

- [Agenda](/docs/blocks/agenda) PRO
- [App shell and layout](/docs/pro/layout) PRO
- [Bar chart](/docs/components/bar-chart) PRO
- [Brand logos](/docs/components/brand-icons) PRO
- [Combo chart](/docs/components/combo-chart) PRO
- [Gauge chart](/docs/components/gauge-chart) PRO
- [Heatmap](/docs/components/heatmap-chart) PRO
- [Line chart](/docs/components/line-chart) PRO
- [Pie chart](/docs/components/pie-chart) PRO
- [Radial chart](/docs/components/radial-chart) PRO
- [Stats row](/docs/blocks/stats-row) PRO

## Files

```text
budget/
├── components/
│   ├── BudgetRow.tsx
│   └── TxnRow.tsx
├── hooks/
│   ├── useBudgetApp.ts
│   ├── useBudgetScreens.ts
│   └── useSpendDays.ts
├── AddExpenseScreen.tsx
├── BillsScreen.tsx
├── budget.constants.ts
├── budget.types.ts
├── budget.utils.ts
├── BudgetActivityScreen.tsx
├── BudgetApp.tsx
├── BudgetLimitsScreen.tsx
├── BudgetOverviewScreen.tsx
├── BudgetSettingsScreen.tsx
├── GoalsScreen.tsx
├── index.ts
└── InsightsScreen.tsx
```

It also uses `shared/`, the theme, money formatting and screen transitions every Pro app shares.

## A look at the code

Whether a savings goal is on track and what it needs each month, from `budget.utils.ts`:

```tsx
/** Where a goal stands: how far along, what's left, and whether what goes in each month gets there by the date. */
export const goalStatus = (goal: Goal, today: Date) => {
  const months = monthsUntil(goal.by, today);
  const left = Math.max(0, goal.target - goal.saved);
  const projected = goal.saved + goal.monthly * months;
  return {
    ratio: goal.target ? goal.saved / goal.target : 0,
    left,
    months,
    onTrack: projected >= goal.target,
    /** What it would take each month to get there in time */
    needed: months ? Math.ceil(left / months) : left,
  };
};
```

Get the source with Pro
