* RN-173 Added support for Markdown images * RN-173 Added proper alt text when image fails to load * Changed (edited) indicator not add itself as a child of an image * RN-173 Removed space between an image and the following text * Made sure MarkdownImage is mounted when setState is called * Fixed images in links having their location overwritten * Made images work in links * Fixed uppercase links not working on Android * Added vertical margin around images * RN-173 Added styling for markdown image error text * RN-173 Added error when image exceeds max dimensions on Android
35 lines
911 B
JavaScript
35 lines
911 B
JavaScript
// Copyright (c) 2017-present Mattermost, Inc. All Rights Reserved.
|
|
// See License.txt for license information.
|
|
|
|
import React, {PureComponent} from 'react';
|
|
import PropTypes from 'prop-types';
|
|
import {StyleSheet, View} from 'react-native';
|
|
|
|
export default class MarkdownList extends PureComponent {
|
|
static propTypes = {
|
|
children: PropTypes.node.isRequired,
|
|
ordered: PropTypes.bool.isRequired,
|
|
tight: PropTypes.bool
|
|
};
|
|
|
|
render() {
|
|
const children = React.Children.map(this.props.children, (child) => {
|
|
return React.cloneElement(child, {
|
|
ordered: this.props.ordered,
|
|
tight: this.props.tight
|
|
});
|
|
});
|
|
|
|
return (
|
|
<View style={style.indent}>
|
|
{children}
|
|
</View>
|
|
);
|
|
}
|
|
}
|
|
|
|
const style = StyleSheet.create({
|
|
indent: {
|
|
marginRight: 20
|
|
}
|
|
});
|