DEV Community πŸ‘©β€πŸ’»πŸ‘¨β€πŸ’»

DEV Community πŸ‘©β€πŸ’»πŸ‘¨β€πŸ’» is a community of 963,274 amazing developers

We're a place where coders share, stay up-to-date and grow their careers.

Create account Log in
Tyler Smith
Tyler Smith

Posted on • Updated 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!

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!

🌚 Friends don't let friends browse without dark mode.

Sorry, it's true.