DEV Community

Tyler Smith
Tyler Smith

Posted on • Edited on

Getting the Community SegmentedControl to Work on iOS in Expo SDK 37

I'm a new React Native developer, and it's been challenging understanding the relationship between React.js, React Native, Expo, the native platforms, and community components.

I wanted to use the React Native Community SegmentedControl in the app I'm building, but I got a mean looking error when I tested on iOS:

Invariant Violation: requireNativeComponent: "RNCSegmentedControl" was not found in the UI Manager.

Yikes.

I'm brand new to mobile development, so the GitHub issue on the SegmentedControl component in Expo was gibberish to me.

The community SegmentedControl component works fine on Android and Web because it's just a copy of the component built with standard React Native parts. As a quick and dirty solution, we can just import this component directly by its full file path.

import SegmentedControl from "@react-native-community/segmented-control/js/SegmentedControl.js";
Enter fullscreen mode Exit fullscreen mode

It's not as smooth as its native counterpart, but it'll get the job done.

I hope this helps. Leave a comment if you know a better way to do this!

Hostinger image

Get n8n VPS hosting 3x cheaper than a cloud solution

Get fast, easy, secure n8n VPS hosting from $4.99/mo at Hostinger. Automate any workflow using a pre-installed n8n application and no-code customization.

Start now

Top comments (1)

Collapse
 
smpetrey profile image
Stephen Petrey

You are a lifesaver. I was pulling my hair out trying to debug that error. Thanks so much!

Sentry mobile image

App store rankings love fast apps - mobile vitals can help you get there

Slow startup times, UI hangs, and frozen frames frustrate users—but they’re also fixable. Mobile Vitals help you measure and understand these performance issues so you can optimize your app’s speed and responsiveness. Learn how to use them to reduce friction and improve user experience.

Read full post →

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay