mattermost-mobile/app/components/markdown/markdown_list_item/index.tsx
Elias Nahum 784b05fe97
Upgrade Dependencies (#7299)
* upgrade reanimated

* update devDependencies

* upgrade react-intl

* update react-native and some dependencies

* update react-native-permissions

* update RN

* use Share sheet for Report a problem

* update Sentry

* remove step to downloadWebRTC

* update detox deps

* feedback review
2023-04-21 12:16:54 -04:00

63 lines
1.5 KiB
TypeScript

// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
import React, {type ReactNode} from 'react';
import {StyleSheet, Text, type TextStyle, View} from 'react-native';
type MarkdownListItemProps = {
bulletStyle: TextStyle;
bulletWidth: number;
children: ReactNode | ReactNode[];
continue: boolean;
index: number;
ordered: boolean;
level: number;
}
const style = StyleSheet.create({
container: {
flexDirection: 'row',
alignItems: 'flex-start',
},
bullet: {
alignItems: 'flex-end',
marginRight: 5,
},
contents: {
flex: 1,
},
});
const MarkdownListItem = ({index, level, bulletWidth, bulletStyle, children, continue: doContinue, ordered}: MarkdownListItemProps) => {
let bullet;
if (doContinue) {
bullet = '';
} else if (ordered) {
bullet = index + '.';
} else if (level % 2 === 0) {
bullet = '◦';
} else {
bullet = '•';
}
return (
<View
style={style.container}
testID='markdown_list_item'
>
<View style={[{width: bulletWidth}, style.bullet]}>
<Text
style={bulletStyle}
testID='markdown_list_item.bullet'
>
{bullet}
</Text>
</View>
<View style={style.contents}>
{children}
</View>
</View>
);
};
export default MarkdownListItem;