mCloud Design Mobile

mCloud Design Mobile

  • Docs
  • API
  • Help
  • Blog

›Component

Component

  • Button
  • SegmentedControl
  • SearchBar
  • Radio
  • Checkbox
  • Badge
  • Marquee
  • Switch
  • InputItem
  • NoticeBar
  • Textarea
  • List
  • Card
  • Picker
  • Label
  • EmptyView
  • Stepper
  • Tabs
  • DatePicker
  • Modal
  • Avatar
  • ActionSheet
  • ShareSheet

First Category

  • Button
  • Fifth Document

SegmentedControl

SegmentedControl

Basic Example:

import React from 'react';
import { SafeAreaView, View, FlatList, StyleSheet, Text } from 'react-native';
import Constants from 'expo-constants';
import { SegmentedControl } from "mcloud-mobile";


export default function App() {
  return (
    <SafeAreaView style={styles.container}>
           <SegmentedControl style={{ marginTop:20 }} />
                                        <SegmentedControl
                                            disabled
                                            titles={['申请','审批']}
                                            segments={2}
                                            onPressMethods={[() => {},() => {}]}
                                            style={{ marginTop:20 }}
                                        />
                                        <SegmentedControl
                                            titles={['left','right']}
                                            segments={2}
                                            onPressMethods={[() => {},() => {}]}
                                            type='special'
                                            style={{ marginTop:20 }}
                                        />
                                        <SegmentedControl
                                            titles={['left','center','right']}
                                            segments={3}
                                            onPressMethods={[() => {},() => {},() => {}]}
                                            type='special'
                                            style={{ marginTop:20,width:300 }}
                                        />
                   
    </SafeAreaView>
  );
}

const styles = StyleSheet.create({
  container: {
    flex: 1,
    marginTop: Constants.statusBarHeight,
        alignItems:'center'
  },
});

Props:

属性说明类型默认值
typeSegmentedControl类型,可选值为default/specialstringdefault
disabled设置禁用booleanfalse
segments按钮的个数number2
titles按钮的title元素为string类型的数组无
onPressMethods按钮点击的回调函数元素为函数类型的数组无
selectedIndex初始选中哪个按钮number0
style自定义样式Object无
← ButtonSearchBar →
  • Basic Example:
  • Props:
mCloud Design Mobile
Docs
Getting Started (or other categories)Guides (or other categories)API Reference (or other categories)
Community
User ShowcaseStack OverflowProject ChatTwitter
More
BlogGitHubStar
Facebook Open Source
Copyright © 2019 Your Name or Your Company Name