// Copyright (c) 2016 Mattermost, Inc. All Rights Reserved. // See License.txt for license information. import React from 'react'; import {StyleSheet, View} from 'react-native'; import FormattedText from 'app/components/formatted_text'; const Styles = StyleSheet.create({ dividerLine: { flex: 1, height: 1, backgroundColor: '#b3b3b3' }, dividerContainer: { height: 20, marginLeft: 15, marginRight: 15 }, dividerText: { flex: 1, textAlign: 'center' } }); export default class LineDivider extends React.Component { static propTypes = { color: React.PropTypes.string.isRequired, translationId: React.PropTypes.string, translationText: React.PropTypes.string, side: React.PropTypes.oneOf(['left', 'right', 'center']) }; static defaultProps = { side: 'right' }; renderLine() { return ( ); } render() { let renderText; if (this.props.translationId && this.props.translationText) { renderText = ( ); } let content = ( {this.renderLine()} {renderText} ); if (this.props.side === 'left') { content = ( {renderText} {this.renderLine()} ); } else if (this.props.side === 'center') { content = ( {this.renderLine()} {renderText} {this.renderLine()} ); } return content; } }