/** * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * * @format * @flow strict-local */ 'use strict'; import * as React from 'react'; import {SegmentedControlIOS, Text, View, StyleSheet} from 'react-native'; export function BasicSegmentedControlExample(): React.Node { return ( ); } export function PreSelectedSegmentedControlExample(): React.Node { return ( ); } export function MomentarySegmentedControlExample(): React.Node { return ( ); } export function DisabledSegmentedControlExample(): React.Node { return ( ); } export function ColorSegmentedControlExample(): React.Node { return ( ); } export function EventSegmentedControlExample(): React.Node { const [selectedIndex, setSelectedIndex] = React.useState(undefined); const [value, setValue] = React.useState('Not selected'); const values = ['One', 'Two', 'Three']; return ( Value: {value} Index: {selectedIndex} { setSelectedIndex(event.nativeEvent.selectedSegmentIndex); }} onValueChange={changedValue => { setValue(changedValue); }} /> ); } const styles = StyleSheet.create({ text: { fontSize: 14, textAlign: 'center', fontWeight: '500', margin: 10, }, });