RN

React Native 画一条漂亮的分割线

2019-06-24  本文已影响0人  KooHead

背景

如何解决?

简单的封装一下_

import React, { PureComponent } from 'react'
import {
  View,
  StyleSheet
} from 'react-native'

class SpliteLine extends PureComponent {
  render () {
    let { lineHeight, color, style, contentStyle } = this.props
    return (
      <View style={{ backgroundColor: 'white', ...contentStyle }}>
        <View style={[{ height: 0, borderTopWidth: lineHeight, borderColor: color, opacity: 0.7, margin: StyleSheet.hairlineWidth }, style]} />
      </View>
    )
  }
}

SpliteLine.defaultProps = {
  lineHeight: StyleSheet.hairlineWidth,
  color: '#bdbdbd',
  contentStyle: {}
}

export default SpliteLine
上一篇下一篇

猜你喜欢

热点阅读