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

Button

就是一个Button

Basic Example:

import React from 'react'
import { View,ScrollView } from 'react-native'
import { Button } from 'mcloud-mobile'

const ViewTop = () => (
    <View style={{ marginTop: 10 }} />
)

const margin = { marginHorizontal: 15 }

export default () => (
    <ScrollView style={{ flex: 1 }}>
        <ViewTop />
        <Button
            layout="radius"
            type="primary"
            style={margin}
        >
            primary
        </Button>
        <ViewTop />
        <Button
            layout="radius"
            type="primary"
            style={margin}
            disabled
        >
            disabled primary
        </Button>
        <ViewTop />
        <Button
            type="ghost"
            style={margin}
            layout="radius"
        >
            ghost
        </Button>
        <ViewTop />
        <Button
            type="ghost"
            style={margin}
            layout="radius"
            disabled
        >
            disabled ghost
        </Button>
        <ViewTop />
        <Button
            layout="radius"
            type="primary"
            style={margin}
            styles={{
                primaryRaw:{
                    backgroundColor: '#00C482',
                    borderColor:'#00C482',
                },
                primaryHighlight: {
                    backgroundColor: '#0BA15C',
                    borderColor: '#0BA15C',
                },
            }}
        >
            primary custom color
        </Button>
        <ViewTop />
        <Button
            type="warning"
            style={margin}
            layout="radius"
        >
            warning
        </Button>
        <ViewTop />
        <Button
            type="warning"
            style={margin}
            layout="radius"
            disabled
        >
            disabled warning
        </Button>
        <ViewTop />
        <Button disabled>default disabled</Button>
        <ViewTop />
        <Button type="primary">primary</Button>
        <ViewTop />
        <Button type="primary" disabled>
            primary disabled
        </Button>
        <ViewTop />
        <Button type="warning" disabled>
            warning disabled
        </Button>
        <ViewTop />
        <View style={{ flexDirection:'row',paddingHorizontal:15 }}>
            <Button
                type="ghost"
                size="small"
                style={{ marginRight:15 }}
            >
                small ghost
            </Button>
            <Button
                type="primary"
                size="small"
                style={{ marginRight: 15 }}
            >
                small primary
            </Button>
            <Button
                type="warning"
                size="small"
            >
                small warning
            </Button>
        </View>
    </ScrollView>
)

Props:

属性说明类型默认值
type按钮类型,可选值为primary/ghost/warning或者不设string-
size按钮大小,可选值为large、smallstringlarge
layout布局类型,可选值位default、radiusstring
activeStyle点击反馈的自定义样式 (设为 false 时表示禁止点击反馈){}/false{}
disabled设置禁用booleanfalse
onPress点击按钮的点击回调函数(e: Object): void无
style自定义样式Object无
SegmentedControl →
  • 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