RORK LABJP
MAX — Rork Max generates native Swift apps for iPhone, iPad, Apple Watch, Apple TV, Vision Pro, and iMessageNATIVE — Rork Max unlocks native features: AR/LiDAR, Metal 3D, widgets, Dynamic Island, Live Activities, HealthKit, and Core MLSTACK — Rork builds native iOS and Android apps with React Native (Expo) from a plain-English descriptionGROWTH — Rork now attracts over 743,000 monthly visits, growing at an 85% ratePRICE — Rork is free to start, with paid plans from $25/monthTREND — Gartner projects 75% of new apps will be built with low-code/no-code by the end of 2026MAX — Rork Max generates native Swift apps for iPhone, iPad, Apple Watch, Apple TV, Vision Pro, and iMessageNATIVE — Rork Max unlocks native features: AR/LiDAR, Metal 3D, widgets, Dynamic Island, Live Activities, HealthKit, and Core MLSTACK — Rork builds native iOS and Android apps with React Native (Expo) from a plain-English descriptionGROWTH — Rork now attracts over 743,000 monthly visits, growing at an 85% ratePRICE — Rork is free to start, with paid plans from $25/monthTREND — Gartner projects 75% of new apps will be built with low-code/no-code by the end of 2026
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.

Rork494Expo135Reanimated10Animation7UI10

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-04-29
Adding Bottom Sheets to a Rork App — A Practical Guide to @gorhom/bottom-sheet on iOS and Android
Rork's default Modal works for confirmations, but the moment you need multiple snap points or inertial scroll inside the sheet it falls short. This guide walks through dropping @gorhom/bottom-sheet into a Rork project, handling the keyboard, and smoothing out iOS/Android differences.
Dev Tools2026-04-04
React Native Skia in Rork: to Custom Graphics, Animations & Shader Effects
A complete guide to implementing high-quality custom graphics in your Rork app using React Native Skia. Covers Canvas-based custom charts, gradients, shader effects, and interactive animations with Reanimated — all with practical, production-ready code.
Dev Tools2026-03-30
Rork × React Native Reanimated & Gesture Handler — Building 60fps Animations and Advanced Gesture Interactions
Keeping Reanimated 3 and Gesture Handler at 60fps, told through the production pitfalls I hit running wallpaper and calming-tone apps: delayed runOnJS, useDerivedValue caching, FlashList pairing, and missing cancelAnimation — each with real measurements.
📚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
See all →