◉RORK LABJP
●EXPO — EAS Observe now records native crashes (Oct 7). On SDK 57, update to 57.0.21 or later●SDK 58 — SDK 58 Beta has been out since Sep 15. The stable date is still unconfirmed●RN 0.88 — React Native 0.88.x is scheduled for Oct 12, 3 days left●Q&A — People are asking why expo-widgets render blank only in production builds●RORK — GPT-6.1 Sol was added on Sep 29, available on Pro and Max plans●NEW — Building an app for a client? Decide who owns the publishing account first●EXPO — EAS Observe now records native crashes (Oct 7). On SDK 57, update to 57.0.21 or later●SDK 58 — SDK 58 Beta has been out since Sep 15. The stable date is still unconfirmed●RN 0.88 — React Native 0.88.x is scheduled for Oct 12, 3 days left●Q&A — People are asking why expo-widgets render blank only in production builds●RORK — GPT-6.1 Sol was added on Sep 29, available on Pro and Max plans●NEW — Building an app for a client? Decide who owns the publishing account first
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.

Rork577Expo213Reanimated10Animation8UI10

✦ 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 $15 for lifetime access
View Membership →

Related Articles

⬡ Dev Tools2026-10-07
Japanese Headings Won't Turn Bold on Android: How to Trace and Fix a fontWeight That Does Nothing
A troubleshooting note for Rork apps where headings look bold on iPhone but stay thin on Android. How to tell the symptoms apart, pick weights through fontFamily, and verify the fix.
⬡ Dev Tools2026-09-21
A build that stops with exit code 0 — the flag that silenced the log, and the check that let an empty file through
Two reports landed in the same week: eas build --local stopping with exit code 0 but produced no further output, and a zero-byte stub that never got embedded. Both came down to settings that reduce output. Here is how to audit your own scripts.
⬡ Dev Tools2026-09-07
Adding .easignore stops EAS from reading .gitignore — count what actually ships to the build
EAS Build decides what to upload from .gitignore, and the moment you add .easignore the two swap places. Here is how I count the bundled files before sending, plus a measured result: once a parent directory is excluded, an exclamation mark cannot bring a file back.
📚RECOMMENDED BOOKS
Build a Large Language Model (From Scratch)
Sebastian Raschka
LLM Dev
Prompt Engineering for LLMs
Berryman & Ziegler
Prompting
AI Engineering
Chip Huyen
AI Eng
* Contains affiliate links