Tips.js 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. import React, { Component } from 'react'
  2. import { Text, View } from 'react-native'
  3. import PropTypes from 'prop-types'
  4. export default class Tips extends Component {
  5. static defaultProps = {
  6. bgColor: '#000',
  7. fColor: '#fff',
  8. borderColor: null,
  9. borderWidth:null
  10. };
  11. static propTypes = {
  12. //按钮宽度
  13. width: PropTypes.string.isRequired,
  14. //按钮高度
  15. height: PropTypes.string.isRequired,
  16. //按钮的圆度
  17. borderRadius: PropTypes.string.isRequired,
  18. //背景颜色
  19. bgColor: PropTypes.string,
  20. //字体颜色
  21. fColor: PropTypes.string,
  22. //文本
  23. text: PropTypes.string.isRequired,
  24. }
  25. render() {
  26. let { bgColor, fColor, text, width, height, borderRadius, borderColor, fSize } = this.props
  27. return (
  28. <View style={{
  29. width: width,
  30. height: height,
  31. backgroundColor: bgColor,
  32. justifyContent: "center",
  33. alignItems: "center",
  34. borderRadius: borderRadius,
  35. borderWidth: 1,
  36. borderColor: borderColor
  37. }}>
  38. <Text style={{
  39. color: fColor,
  40. fontSize:fSize
  41. }}
  42. >{text}</Text>
  43. </View>
  44. )
  45. }
  46. }