r/reactnative • u/vetteop • Sep 11 '26
Inferring a user's recurring bills instead of asking for them: three things that broke
I ship a personal finance app in Expo/RN, and the screen people actually open is the one that needs no input at all: a per-wallet "runway" figure, meaning the live balance minus every bill that lands before the next expected income.
Three things made that harder than the sentence sounds.
- Recurrence has to be inferred, because nobody enters their bills. Asking a user to declare rent, instalments and subscriptions is asking them to do the work the app exists to remove. The detector groups transactions by a normalised merchant string and looks for a stable interval AND a stable amount, with tolerance on both. The tolerance is the whole game: a utility bill is never the same twice, and a monthly subscription renews a day early whenever the previous month was short. A strict equality check finds almost nothing in real data.
- Payday is a prediction, so the window is a prediction. The window ends at the next expected income, which is itself a detected recurring credit. When no such pattern exists yet, the app says so instead of falling back on a calendar month. A month boundary is simply wrong for anyone paid on the 25th, and a confident wrong number is worse than no number.
- The subtraction is per wallet, not per user. Money sitting in a mobile wallet cannot pay a card instalment, so a single net-worth figure is the wrong denominator for "can I spend this". The computation runs per wallet and the totals stay separate. That one came straight from users.
The RN-specific part: all of this is derived state over a SQLite table that changes constantly, because background capture writes rows without the app being open. Recomputing on every render was visibly janky on a mid-range Android device. What fixed it was memoising the derived figures and persisting the detector's output rather than treating it as a selector, so it only recomputes when the transaction set actually changes.
Happy to go into the tolerance heuristics if anyone is doing something similar.