Flock Cover

Pay-as-you-fly drone insurance

Could you introduce your app in a few sentences?

Drones are everywhere. They are used for a variety of purposes, both commercial and recreational, and their presence is only expanding. Flock Cover provides an on-demand insurance solution for this exciting space. We use big data analytics on weather data, location data, population data, and other sources in order to quantify the risk of any drone flight within a matter of seconds. This quantification subsequently unlocks hyper-localized, short-term insurance policies that are priced proportionally to the risk of the flight. As such, Flock Cover is a flexible alternative to annual insurance policies, and also ensures that insurance companies are only exposed to the risk that they have been directly paid for. We also provide a risk reduction service to our customers. With just one tap, pilots can receive a breakdown of their real-time hazards, such as the wind speed, building density and much more, and can easily adjust the flight location or time in order to minimize their exposure to risk.

What made you decide to use/switch to React Native?

Initially we had a prototype that had been written in Angular 4 + Ionic. Unfortunately I have a few problems with how Angular does things. First of all, the Typescript type interface drives a very Object Oriented approach. Secondly the shared mutable state inherent to two way data binding is, in my opinion, an anti pattern. Finally, Angular is quite clearly a framework that predates ES6 native import/export, as evidenced by the existence of its own Dependency Injection mechanism. On top of all of that, Typescript is deliberately unsound.
On the other hand, React with Redux has an (almost) functional interface, allows for easy immutability at the reducer level, and plays nicely with Flow, which is sound, has a vibrant ecosystem and strong community buy in.

The argument in favor of either of them versus native Swift + Java, is that we can write a single codebase, and run it (almost verbatim) on both platforms. We are also empowered to do Continuous Delivery, and, given that the backend is NodeJS, all of our engineers are able to work across the full stack. Whilst we obviously sacrifice some performance, for the most part it isn't really a major concern as our app doesn’t do too much heavy lifting. There are a few exceptions - individual components which we will eventually write natively.

How did you transition to React Native?

I had quit my job and was looking for a new challenge. However, Flock was a greenfield project, and there wasn’t really much of a transition. We threw away the existing prototype and rewrote it in React Native. I have years of exposure to the JavaScript ecosystem, and have worked for years with both Angular and React. Additionally I know NodeJS very well. I had never before built a mobile application.

Have your tried other cross platform technologies before using React Native?

As mentioned above, we briefly flirted with Angular 4 + Ionic.

What has your experience been working with React Native in terms of app performance, have you noticed any impacts?

The app generally handles fine in terms of performance. One exception is a MapBox GL rendered in a WebView due to fairly specific custom styling/behavior requirements. That screen will most likely be rewritten natively.

How has adopting React Native affected developer productivity?

Developer productivity has been consistently strong. Developer happiness is generally ok, and most of the time React is a pleasure to use.
There are pain points inherent to native development that don’t exist in the web world. Real 100% continuous delivery is limited by the Apple app review process. Opening XCode feels like entering a hell dimension where up is down and down is up. Every operation feels like performing poorly documented Arcane Magic, and things fail for completely no reason.
Additionally, the React Native ecosystem is shockingly immature. Things routinely break between versions. Entire versions of React Native have been skipped for update as we point blank could not get our app to compile. react-native link creates duplicates as a matter of course. My most horrifying example is probably fbsimctl, which point blank refuses to compile depending on the SHA, is not versioned, and demands to be installed from HEAD (spoiler, we ditched it).

Which tools, libraries and frameworks are part of your development process with React Native?

As a company we do not enforce IDEs. Most of the team is running Atom. Personally, I am on Emacs.
Our stack is a collection of NodeJS services sitting atop a Postgres database, with a React Native app on the front end. All systems use FlowJS for types (we default to a fairly strict interpretation - closed immutable types by default).
We use Mocha with Sinon and Supertest for backend testing, Jest and Enzyme for frontend testing, Detox for E2E testing and Postman for backend integration tests.On both the frontend and backend we use nock. We flirted briefly with moxios, but found its assertions to be to loose for our liking.
Our flux state engine is redux. We use react-navigation for screen management. We use MapboxGL for the mapping solution and POSTGIS for handling geodata on the backend.
Our apps run in Heroku, and we use CircleCI, Codeship, and Fastlane for Continuous Delivery.
We use Sentry for error logging, Pagerduty for developer notifications, and Intercom for customer interaction.
We render PDFs with react-native-pdf, manage payment details with tipsi-stripe, use turf for geojson calculations, moment for date/time management, and Auth0 for authentication.

We do also maintain native integrations with a handful of tools that are poorly supported in the React Native community and aim to eventually open source these. In particular we are currently building out a custom integration with Segment IO, and have added full native crash detection for our Sentry.

What resources have you used to learn React Native? Books, tutorials, courses etc. Anything you can recommend?

Egghead.io is full of fantastic resources,and we pay for a company subscription. Other than that it’s been mostly experimenting with solutions, and Stack Overflow.

What are some things that you don’t like about React Native or that need to be improved?

As mentioned above, there are many things about native development that are substandard. My biggest gripe with React Native proper is the frequent instability inherent in the ecosystem. Additionally, Jest is kind of awful. We have abandoned Snapshot tests wholesale as we found they inflate code coverage statistics and provide few actual guarantees. Additionally, Jest's mocking is inferior to something like Sinon in nearly every way. Given time (so probably never), I would love to see us ditch Jest entirely and migrate over to Mocha.
The fact that React Native styling is subtly different from raw CSS is also incredibly frustrating and requires a constant relearning of a skill to solve a completely solved problem.
In particular the lack of a span tag or equivalent functionality occasionally makes styling challenging.

Anything else you would like to mention?

You can find out more about Flock and download the Flock Cover app for free by visiting our website. We’re also on GitHub.
I can be found here on LinkedIn and here on GitHub.

Want to download the app from outside the UK? Click here to find out more.

I am hiring!