// @ts-nocheck import SegmentedControl, { NativeSegmentedControlIOSChangeEvent, } from '@react-native-segmented-control/segmented-control'; import React, { useState } from 'react'; import { ScrollView, StyleSheet, Text, View, NativeSyntheticEvent } from 'react-native'; // This example is a copy from https://github.com/react-native-community/segmented-control/blob/master/example const SegmentedControlScreen = () => { const [values] = useState(['One', 'Two', 'Three']); const [value, setValue] = useState('Unselected'); const [selectedIndex, setIndex] = useState(undefined); const _onChange = (event: NativeSyntheticEvent) => { setIndex(event.nativeEvent.selectedSegmentIndex); }; const _onValueChange = (value: string) => { setValue(value); }; return ( Note: Only the last control on this screen is expected to change state Segmented controls can have values and images Segmented controls can have pre-selected values Segmented controls can be momentary Segmented controls can be disabled Custom colors can be provided Selected value and index are available via callbacks Value: {value} Index: {selectedIndex} ); }; const styles = StyleSheet.create({ text: { fontSize: 14, textAlign: 'center', fontWeight: '500', margin: 10, }, segmentContainer: { marginBottom: 10, }, segmentSection: { marginBottom: 25, }, container: { paddingTop: 80, }, }); export default SegmentedControlScreen;