Frostless
Frostless

Reputation: 848

SegmentedControlIOS is not supported on this platform error React Native

So I upgraded my react-native to 0.57.3 and then launch the app in android. But the previous SegmentedControlIOS is replace with this error message. Does it mean my android sdk version is too high and I can no longer use this component?

enter image description here

Upvotes: 0

Views: 405

Answers (1)

Sateesh Yemireddi
Sateesh Yemireddi

Reputation: 4409

SegmentedControlIOS in react-native is only developed for iOS platform by Facebook.

So this component will not available for Android.

You can differentiate the platform specific components by Platform in react-native.

import {Platform, StyleSheet} from 'react-native';

const Component = Platform.select({
  ios: () => require('ComponentIOS'),
  android: () => require('ComponentAndroid'),
})();

<Component />;

If you want use SegmentControl for both iOS and android please go for react-native-segmented-control-tab

npm install react-native-segmented-control-tab --save

Please visit https://github.com/kirankalyan5/react-native-segmented-control-tab

Android

enter image description here

iOS:

enter image description here

Upvotes: 1

Related Questions