◉RORK LABJP
●ARCHIVE — Since 11/22 you can archive a Rork project instead of deleting it, and bring it back from Archived●PLAY FIX — Fixed: Expo apps built for Google Play losing their Rork AI key, which broke AI features●SONNET 4.5 — Sonnet 4.5 retires from the Claude API on 11/30, 7 days left. Check which model your app calls●SPLASH — Expo users report apps stuck on the splash screen after rolling back to an earlier update●NEW — New: Three clues to check before replying to a "stuck on the splash screen" review●2.5 ROUTE — From 12/1, Gemini 2.5 requests reroute to newer models at new rates. 8 days left●ARCHIVE — Since 11/22 you can archive a Rork project instead of deleting it, and bring it back from Archived●PLAY FIX — Fixed: Expo apps built for Google Play losing their Rork AI key, which broke AI features●SONNET 4.5 — Sonnet 4.5 retires from the Claude API on 11/30, 7 days left. Check which model your app calls●SPLASH — Expo users report apps stuck on the splash screen after rolling back to an earlier update●NEW — New: Three clues to check before replying to a "stuck on the splash screen" review●2.5 ROUTE — From 12/1, Gemini 2.5 requests reroute to newer models at new rates. 8 days left
Articles/Dev Tools
⬡ Dev Tools/2026-07-08Intermediate

Building a Segmented Control With a Sliding Indicator in Reanimated

The stock segmented control looks out of place on Android. Here is a custom Reanimated component that measures each segment and slides the indicator, with complete code plus UI-thread rendering, accessibility, and RTL handling from real shipping notes.

Rork621Expo237Reanimated10Animation8UI10

✦ Premium Article

I rebuilt the "Light / Dark / Auto" switch on a wallpaper app's settings screen not long ago. At first I dropped in @react-native-segmented-control as-is, but on Android the corners and colors looked foreign, and the switch just snapped from one state to the next. After lifting my finger, there was no easy way for my eyes to follow where the selection had landed. It felt oddly restless.

When the selected position glides across to its new spot, that single beat of motion makes the screen feel settled in the hand. In this article I want to walk through the custom "sliding indicator" I built with Reanimated, from measuring widths to the last details before shipping.

Why I didn't stop at the stock component

SegmentedControl leans native on iOS, but on Android it's hard to keep visually consistent, and there's almost no room for animation. I wanted the same expression on both platforms, and I wanted to tune the indicator's motion myself. Those two wishes are what pushed me toward building my own.

Here's a rough comparison to frame the decision.

ConcernStock SegmentedControlCustom Reanimated
Unified look across OSesHardFree
Indicator motionMostly fixedTunable
Implementation costLowMedium
AccessibilityLeft to the OSYour responsibility

If the stock control is enough, the stock control is best. I only lean custom where motion becomes part of the experience, like a settings screen or filter UI that should match a brand's color and movement.

The core idea: measure widths, then move

This is where people trip. Segment labels change width by language, whether Japanese or English. If you assume equal columns and compute position from screen width / count, the indicator drifts off the labels in languages with longer words.

So I measure each segment's real size with onLayout and use that array to drive the indicator's translateX and width. Measuring happens once. Every switch afterward just reads the measured values, so no re-render occurs.

✦

Thank you for reading this far.

Continue Reading

What follows includes implementation code, benchmarks, and practical content we hope you'll find useful. This site runs without ads — server and development costs are supported entirely by members like you. If it's been helpful, we'd be truly grateful for your support.

WHAT YOU'LL LEARN
✦Complete code that measures segment widths via onLayout and slides the indicator
✦A design that runs on the UI thread with no re-renders (feels like 60fps)
✦The finishing touches that ship: accessibilityRole and RTL support
Secure payment via Stripe · Cancel anytime
✦

Unlock This Article

Get full access to the rest of this article. Buy once, read anytime. This site is ad-free — your support goes directly toward keeping it running.

or
Unlock all articles with Membership →
Share

Thank You for Reading

Rork Lab is ad-free, supported entirely by members like you. We publish practical guides daily with implementation code, benchmarks, and production-ready patterns. If you've found it useful, we'd love to have you on board.

  • ✦Copy-paste ready implementation code
  • ✦New advanced guides published daily
  • ✦$5/mo or $10 for lifetime access
View Membership →

Related Articles

⬡ Dev Tools2026-11-19
New Wallpapers Showed Up Everywhere Except the Filters: Ship the Count and the Category Lists Together
I added 67 wallpapers in one batch. They appeared in the full list and in New, but not under a single category filter, because I had raised the ID limit and forgotten to ship the category lists. Here is a pre-bump check, a client-side way to spot silent fallbacks in an Expo app, and a post-release count against the origin.
⬡ Dev Tools2026-10-30
It runs in development but the iOS Release build dies on launch — checking whether a missing scheme is the cause
In an expo-router app, an app.json with no scheme can crash only the iOS Release build at launch. Why Debug and Android survive, the two ways to fix it, how to think about leaving the scheme out on purpose, and a pre-submission check.
⬡ Dev Tools2026-10-15
When EXPO_PUBLIC_ Values Read Fine in Dev but Come Back undefined in Production: Telling the Spellings Apart
The API URL reads fine while developing and turns undefined once the app is built. The cause was how process.env was written. I lined up babel-preset-expo's output for dev and production and tabulated which spellings get replaced and which are left behind.