mattermost-mobile/app/components/markdown/markdown_list_item.js
Mattermost Build bb0e056fba
Update dependencies (#5266) (#5283)
* Update dependencies

* Fix lint, use npm@6

* Fix unit tests

* Dowgrade Fastlane

* Fix Fastlane script

* use android:api-29-node ci image

* Infer gradle json file from apk output folder

* Fastlane to Parse new version of gradle output-metadata.json

(cherry picked from commit f8a0f29237)

Co-authored-by: Elias Nahum <nahumhbl@gmail.com>
2021-04-06 11:27:26 -04:00

64 lines
1.7 KiB
JavaScript

// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
import React, {PureComponent} from 'react';
import PropTypes from 'prop-types';
import {
StyleSheet,
Text,
View,
} from 'react-native';
import CustomPropTypes from '@constants/custom_prop_types';
export default class MarkdownListItem extends PureComponent {
static propTypes = {
children: CustomPropTypes.Children,
ordered: PropTypes.bool.isRequired,
continue: PropTypes.bool,
index: PropTypes.number.isRequired,
bulletWidth: PropTypes.number,
bulletStyle: CustomPropTypes.Style,
level: PropTypes.number,
};
render() {
let bullet;
if (this.props.continue) {
bullet = '';
} else if (this.props.ordered) {
bullet = this.props.index + '.';
} else if (this.props.level % 2 === 0) {
bullet = '◦';
} else {
bullet = '•';
}
return (
<View style={style.container}>
<View style={[{width: this.props.bulletWidth}, style.bullet]}>
<Text style={this.props.bulletStyle}>
{bullet}
</Text>
</View>
<View style={style.contents}>
{this.props.children}
</View>
</View>
);
}
}
const style = StyleSheet.create({
container: {
flexDirection: 'row',
alignItems: 'flex-start',
},
bullet: {
alignItems: 'flex-end',
marginRight: 5,
},
contents: {
flex: 1,
},
});