Shift is a workout app that uses a timer to alternate music during work periods with podcasts during rest periods. Users can listen to Spotify or curated mixtapes, and the app also supports podcast queues and imports. Its workout screen includes timed beeps, spoken alerts, playback controls, and a notification showing the time left and current audio.
React Native going Native
Speaker
Truls Skeie of Kvarn explains how his team moved parts of the Shift workout app from React Native to native code at React Native EU 2021, hosted by Callstack.
Skeie explains that React Native sends information between JavaScript and native code over a bridge. In Shift, changing audio sources involved several back-and-forth calls to pause one player, start another, and update the interface. Headphone controls, beeps, and notifications also relied on bridge communication.
Shift’s background workout timer checked its state every second, sent updates to JavaScript for the interface, and switched audio when the countdown reached zero. It also processed data every 15 seconds, including saving podcast position. The team moved the countdown and timer loop to native code, where a main counter and a Shift Master handled display events, notifications, alerts, automatic switching, and audio players.
Skeie says the native rewrite made the freeze and unfreeze logic simpler to read and easier to debug. The team made the change after three years of maintaining the app, when it understood where the code was hard to reason about. He cautions that native code means maintaining platform-specific features, and says Shift had performed well before the rewrite.
Skeie suggests moving a small problem to native code first, then learning from the experience before expanding the approach. He also recommends reading how React Native packages structure their bridge code and using available resources to learn native interfaces and platform development. He says that understanding native platforms improved his React Native skills.
Takeaways
- Consider moving a feature to native code when bridge traffic makes it hard to reason about, and weigh the ongoing platform-specific maintenance.
- Measure the actual app experience before assuming frequent bridge calls are causing poor performance.
- For background timers, keeping countdown logic native can reduce the need for per-second updates to JavaScript.
- Start learning native development with a small, well-understood problem and inspect how existing React Native packages work.
- Revisit architecture after gaining years of experience with the code and its recurring sources of bugs.
Mentioned in this talk
Search inside this talk
What was claimed 10
- works atTruls Skeie works at Kvarn
“I work for a company called Kvarn here in Norway”
YouTube Unverified1 source· Talk
- featureShift: Switches between music and podcasts according to a workout timer.
“it's a workout app that lets you shift between podcasts and music”
YouTube Unverified1 source· Talk
- foundedTruls Skeie founded Shift
“my friend and I wanted to carve out more time for podcasts”
YouTube Unverified1 source· Talk
- builtTruls Skeie built Shift
“What I'm presenting today is a team effort that we've done together”
YouTube Unverified1 source· Talk
- uses
“We use a package called React Native Track Player on the native side to play podcasts”
YouTube Unverified1 source· Talk
- uses
“For music, we use a package called React Native Spotify to play Spotify”
YouTube Unverified1 source· Talk
- uses
“José ... tried to use a package called React Native Background Timer, which we also tried”
YouTube Unverified1 source· Talk
- featureShift: After moving the timer and countdown to the native side, the app no longer sends the timer’s per-second calls over the bridge.
“we took the duration and the countdown timer and moved them to the native side”
YouTube Unverified1 source· Talk
- featureShift: The native-side countdown handles timer events, notifications, beeps, speech, automatic switching, and audio playback control.
“the Shift Master ... handles the notification ... plays a beep ... and plays speech”
YouTube Unverified1 source· Talk
- usesShift uses
Sentry MCP
“some sort of reporting here that reports to Sentry for us”
YouTube Unverified1 source· Talk







