UNPKG

rn-btn

Version:

react native, button

112 lines (100 loc) 2.87 kB
# rn-btn react native button ![](img/btn.png) ## 使用 ```javascript import RNBtn from 'rn-btn' export default class App extends Component { render () { return ( <View style={{flex: 1}}> <RNBtn text="小号文字按钮" type={'text'} size={'small'} /> <RNBtn text="小号按钮" size={'small'} /> <RNBtn text="默认文字大小按钮" type={'text'} size={'default'} /> <RNBtn text="默认大小按钮" size={'default'} /> <RNBtn text="偏大号文字按钮" type={'text'} size={'large'} /> <RNBtn text="偏大号按钮" size={'large'} /> <RNBtn text="巨大号文字" type={'text'} size={'huge'} /> <RNBtn text="巨大号å按钮" size={'huge'} /> <RNBtn text="默认" style={myStyle.loginOutBtn} callback={(that) => { LoginOut(this.props.navigation) }} /> <RNBtn text="主要" style={myStyle.loginOutBtn} theme={'main'} callback={(that) => { LoginOut(this.props.navigation) }} /> <RNBtn text="警告" style={myStyle.loginOutBtn} theme={'warn'} callback={(that) => { LoginOut(this.props.navigation) }} /> <RNBtn text="错误" style={myStyle.loginOutBtn} theme={'error'} callback={(that) => { LoginOut(this.props.navigation) }} /> </View> ) } } const myStyle = StyleSheet.create({ loginOutBtn: { margin: 5, borderRadius: 3 } }) ``` ## API | 参数 | 类型 | 说明 | | ------------- | ---------------------------------- | ------------------- | | text | String | 文字内容 | | size | ['small','default','large','huge'] | 大小, | | shadow | Boolean | 阴影效果或无 | | type | ['text'] | 文字效果或无 | | disabled | Boolean | 是否禁用 | | disabledStyle | Style | 自定义禁用样式 | | theme | ['main','warn','error'] | 按钮样式或无,与type的不同效果不同 | | style | Style | 自定义按钮样式 | | callback | Function | 回调函数 |