react-base-library
Version:
自定义一个button
25 lines (23 loc) • 715 B
JavaScript
import React, { Component } from 'react';
import {
Platform,
StyleSheet,
Text,
View,
TouchableOpacity
} from 'react-native';
export default class Button extends Component{
render(){
const {width,height,backgroundColor,children,borderRadius} = this.props
return(
<TouchableOpacity
onPress={this.props.onPress}
>
<View style={{...flextCenter,backgroundColor,width,height,borderRadius}}>
<Text style={{color:'white',fontSize:20}}>{children}</Text>
</View>
</TouchableOpacity>
)
}
}
export const flextCenter={justifyContent:'center',alignItems:'center'}