mattermost-mobile/app/components/markdown/markdown_list/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

35 lines
834 B
TypeScript

// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
import React, {type ReactElement} from 'react';
type MarkdownList = {
children: ReactElement[];
ordered: boolean;
start: number;
tight: boolean;
};
const MarkdownList = ({start = 1, tight, ordered, children}: MarkdownList) => {
let bulletWidth = 15;
if (ordered) {
const lastNumber = (start + children.length) - 1;
bulletWidth = (9 * lastNumber.toString().length) + 7;
}
const childrenElements = React.Children.map(children, (child) => {
return React.cloneElement(child, {
bulletWidth,
ordered,
tight,
});
});
return (
<>
{childrenElements}
</>
);
};
export default MarkdownList;