非常教程

React native参考手册

Components: SegmentedControlIOS

SegmentedControlIOS

使用SegmentedControlIOS渲染一个UISegmentedControl的iOS。

以编程方式更改所选索引

通过将selectIndex prop分配给状态变量,然后更改该变量,即可更改所选索引。请注意,状态变量需要在用户选择一个值并更改索引时进行更新,如下例所示。

<SegmentedControlIOS
  values={['One', 'Two']}
  selectedIndex={this.state.selectedIndex}
  onChange={(event) => {
    this.setState({selectedIndex: event.nativeEvent.selectedSegmentIndex});
  }}
/>

道具

ViewPropTypes道具...

enabled?: bool

如果为false,用户将无法与控件进行交互。默认值为true。

momentary?: bool

如果为true,那么选择一个段将不会在视觉上持续。在onValueChange如预期回调仍然可以工作。

onChange?: function

用户点击某个细分时调用的回调; 作为参数传递事件

onValueChange?: function

用户点击某个细分时调用的回调; 将段的值作为参数传递

selectedIndex?: number

props.values要预先选择的段的索引。

tintColor?: string

控制的强调颜色。

values?: [string]

按顺序控制分段按钮的标签。

Components: SegmentedControlIOS相关

React native

React Native 是一个 JavaScript 的框架,用来撰写实时的、可原生呈现 iOS 和 Android 的应用。

主页 https://facebook.github.io/react-native/
源码 https://github.com/facebook/react-native
发布版本 0.49

React native目录

1.开始 | Getting Started
2.指南 | Guides
3.APIs
4.组件:ActivityIndicator | Components: ActivityIndicator
5.组件:按钮 | Components: Button
6.组件:CheckBox | Components: CheckBox
7.组件:DatePickerIOS | Components: DatePickerIOS
8.组件:DrawerLayoutAndroid | Components: DrawerLayoutAndroid
9.组件:FlatList | Components: FlatList
10.组件:图像 | Components: Image
11.组件:KeyboardAvoidingView | Components: KeyboardAvoidingView
12.Components: ListView
13.Components: MaskedViewIOS
14.Components: Modal
15.Components: NavigatorIOS
16.Components: Picker
17.Components: PickerIOS
18.Components: ProgressBarAndroid
19.Components: ProgressViewIOS
20.Components: RefreshControl
21.Components: ScrollView
22.Components: SectionList
23.Components: SegmentedControlIOS
24.Components: Slider
25.Components: SnapshotViewIOS
26.Components: StatusBar
27.Components: Switch
28.Components: TabBarIOS
29.Components: TabBarIOS.Item
30.Components: Text
31.Components: TextInput
32.Components: ToolbarAndroid
33.Components: TouchableHighlight
34.Components: TouchableNativeFeedback
35.Components: TouchableOpacity
36.Components: TouchableWithoutFeedback
37.Components: View
38.Components: ViewPagerAndroid
39.Components: VirtualizedList
40.Components: WebView
41.创建 | Contributing
42.指南(Android) | Guides (Android)
43.指南(IOS) | Guides (iOS)
44.其他 | Miscellaneous