Lessons From Building Android Widgets
Shopify built its Android analytics widgets natively rather than in React Native, because widgets must be built from RemoteViews, which React Native does not support. Widget onUpdate() fires several times per cycle, so a one-minute cache keyed by widget ID removes redundant network calls and incorrect analytics. RemoteViews also append to existing views on each update, which they fixed by calling removeAllViews() before addView(). Charts are drawn from MPAndroidChart as ARGB_8888 bitmaps, relative timestamps were dropped over battery cost, and update flicker is reduced by suppressing updates for 60 seconds after placement and rendering early from cached shared preferences.
Related posts
- Lessons From Building iOS Widgets
Shopify Engineering mediumAdeptShopify rebuilt its iOS analytics widgets natively in SwiftUI rather than React Native, because app extensions have tight memory limits, WidgetKit serializes SwiftUI view hierarchies, and React Native had no official widget support. Each widget fetches data independently through Reportify/ShopifyQL while sharing session tokens with the app. iOS calls getTimeline and getSnapshot several times per update cycle, which caused redundant network calls and a token-refresh race that logged users out. A one-minute per-widget cache keyed on configuration fixed both problems. The post also covers a flexible metric decoder, a size-agnostic SwiftUI layout built on LazyVGrid and an OptionSet of layout options, and why relative timestamps were rejected for lack of customization.
- Five years of React Native at Shopify
Shopify Engineering easyNoviceAfter five years, Shopify has migrated all its mobile apps to React Native, with each team choosing its own migration timing, and reports sub-500ms P75 screen loads, over 99.9% crash-free sessions, and an end to iOS/Android feature-parity work. Hot reloading and TypeScript let engineers move between web and mobile, but native developers and native code remain essential for hardware features, widgets, watch apps and long-running background sync such as Point of Sale offline data. The downsides are flaky debugging, labor-intensive framework upgrades (handled by a rotating group) and heavier reliance on third-party libraries, mitigated with Dependabot and code scanning. Shopify is now extracting shared libraries for identity, monitoring and performance measurement after initially trading consistency for migration speed.
- Migrating our Largest Mobile App to React Native
Shopify Engineering mediumAdeptShopify is moving its largest native app, Shopify Mobile (300 screens per platform), to React Native through "Iterative Porting" rather than a rewrite. All new features are built in RN while existing screens are ported in parallel. Ports are prioritized with RICE scoring, shipped behind feature flags and monitored for two weeks before the native code is deleted. The team started with the four root screens, which took about four months and needed infrastructure along the way: "Native Routes" so RN can navigate to native screens, deeplinks that open as modals on iOS to avoid mixed RN/native navigation stacks, and safe-area handling inside cells. The porting also exposed and removed business-logic differences between the iOS and Android versions.
- Management of Native Code and React Native at Shopify
Shopify Engineering mediumAdeptShopify's Point of Sale team kept complex UI such as a draggable, reorderable grid of hundreds of buttons in React Native, fixing performance with fewer re-renders, lazy rendering, memoization and Reanimated 2. Background offline sync jobs were a different story: they froze the app because work in single-threaded JavaScript plus bridge traffic blocked interaction. The team moved that sync engine to a Kotlin Multiplatform library using SQLDelight, Apollo and coroutines, reaching about 95% shared code and cutting initial sync for a medium store from 30+ seconds to 2-3 seconds. The post recommends packaging KMM as a separate library with sandbox apps, sketches the Gradle and Xcode build setup, and notes the steeper learning curve for Swift developers.
- Migrating to React Native's New Architecture
Shopify Engineering mediumAdeptShopify moved Shopify Mobile and POS to React Native's New Architecture (Fabric) without pausing weekly releases. The team kept both architectures buildable on every PR, made only minimal code changes, deferred TurboModule conversion of 40+ native modules, and upgraded to the latest React Native first. Common breakages included state batching exposing timing-dependent components, blank screens caused by UIManager-dependent modules, view flattening nulling refs (fixed with collapsable={false} and a Babel plugin), and main-thread module setup deadlocks. A staged Android-first rollout with stability-based rollback tiers yielded 10% faster Android launch, though crash-free sessions and ANRs regressed for weeks after release.