Dealing with monetary values in a React Native app

If you’ve been following along with the previous few posts, you’ll know that I recently shipped a React Native app that deals with financial data. Financial data values are very often represented by decimal numbers. Computers are good at many things, but representing decimal numbers (known technically as “floating point” numbers) is not one of them - and JavaScript is no exception. Need proof? Just copy and paste 0.3-0.2 into your nearest browser’s console. If JS can’t be trusted with basic math that you can do in your head, how can it be trusted with real data?

Sync your React Native SQLite database between devices with Dropbox

In the previous two posts we have bootstrapped a React Native project with TypeScript and CocoaPods, and then integrated an SQLite plugin to enable storing relational data on-device. Next, let’s take a look at using the Dropbox HTTP API to backup our database and enable synchronization between devices. We’ll begin by walking through support for the Dropbox v2 authorization flow in a React Native app, and then use the token we are granted to enable synchronization of our database file via the Dropbox files HTTP endpoints.

Building an offline first app with React Native and SQLite

This article walks through how I built an offline first React Native app using a device-local SQLite database, and details the patterns that I would recommend following when building your own. As I mentioned in the intro of my last post, I recently worked on a side project which required the secure storage of financial data in a relational manner. Due to the sensitive nature of the data, we did not want to store it on a server. The solution we came up with was one where the data would be stored locally on-device, which we found to have a number of benefits:

Get started with React Native, TypeScript, and CocoaPods

This article gives an introduction to my preferred development setup of 2018 for building mobile applications: React Native with TypeScript and CocoaPods, coded in the awesome Visual Studio Code editor.