UNPKG

npmchenwei111

Version:

test1111

73 lines (63 loc) 1.88 kB
/** * Created by ziyu on 2017/6/20. */ import React, { Component } from 'react' import { StyleSheet, Text, View } from 'react-native' import Button from '../../../common/views/Button' import { px2dp, sp } from '../../../utils/Px2dp' import LinearGradient from 'react-native-linear-gradient' class SubmitBtnRadius extends Component { constructor (props) { super(props) this.state = {} } componentDidMount () { } render () { let btnData = this.props.btnData return ( <View style={this.props.style}> { btnData.enable ? <Button onPress={() => { this.props.onPress() }} style={{alignItems: 'center'}}> <LinearGradient colors={['#FF4645', '#FF4645']} start={{x: 0, y: 1}} end={{x: 1, y: 1}} style={{borderRadius: 50}} > <View style={styles.submit}> <Text style={{fontSize: sp(16), color: '#fff'}}>{btnData.text}</Text> </View> </LinearGradient> </Button> : <View style={{alignItems: 'center'}}> <LinearGradient colors={['#CDCDCD', '#CDCDCD']} start={{x: 0, y: 1}} end={{x: 1, y: 1}} style={{borderRadius: 50}} > <View style={styles.submitDisabled}> <Text style={{fontSize: sp(16), color: '#fff'}}>{btnData.text}</Text> </View> </LinearGradient> </View> } </View> ) } } const styles = StyleSheet.create({ submit: { paddingVertical: px2dp(11.75), width: px2dp(240), backgroundColor: 'transparent', alignItems: 'center' }, submitDisabled: { paddingVertical: px2dp(11.75), width: px2dp(240), backgroundColor: 'transparent', alignItems: 'center' } }) export default SubmitBtnRadius