forked from Ivasoft/mattermost-mobile
* Migrate attachment_image * Migrate action_menu * Migrate action_button * migrate message_attachments * Remove unintended commited file * Fix tsc * Fix tsc * Fix lint * Update references * Make emoji functional component and fix imports * Use ReactNode instead of JSXElement * Convert action menu to FC * Remove unneeded fragments * Remove unneded undefined check * Use undefined instead of nil in calculateDimensions * Make sure height is always defined * Use is valid URL * Add missing types * Lint fixes and remove lodash * Revert package.json changes * Put back fragments since they are actually needed * Fix test * Fix lint * Address feedback
58 lines
1.5 KiB
TypeScript
58 lines
1.5 KiB
TypeScript
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
|
// See LICENSE.txt for license information.
|
|
|
|
import React from 'react';
|
|
import {StyleProp, TextStyle, View, ViewStyle} from 'react-native';
|
|
|
|
import EmbeddedBinding from './embedded_binding';
|
|
import {Theme} from '@mm-redux/types/preferences';
|
|
import {AppBinding} from '@mm-redux/types/apps';
|
|
|
|
type Props = {
|
|
embeds: AppBinding[],
|
|
baseTextStyle?: StyleProp<TextStyle>,
|
|
blockStyles?: StyleProp<ViewStyle>[],
|
|
deviceHeight: number,
|
|
deviceWidth: number,
|
|
postId: string,
|
|
onPermalinkPress?: () => void,
|
|
theme: Theme,
|
|
textStyles?: StyleProp<TextStyle>[],
|
|
}
|
|
|
|
export default function EmbeddedBindings(props: Props) {
|
|
const {
|
|
embeds,
|
|
baseTextStyle,
|
|
blockStyles,
|
|
deviceHeight,
|
|
onPermalinkPress,
|
|
postId,
|
|
theme,
|
|
textStyles,
|
|
} = props;
|
|
const content = [] as React.ReactNode[];
|
|
|
|
embeds.forEach((embed, i) => {
|
|
content.push(
|
|
<EmbeddedBinding
|
|
embed={embed}
|
|
baseTextStyle={baseTextStyle}
|
|
blockStyles={blockStyles}
|
|
deviceHeight={deviceHeight}
|
|
key={'att_' + i}
|
|
onPermalinkPress={onPermalinkPress}
|
|
postId={postId}
|
|
theme={theme}
|
|
textStyles={textStyles}
|
|
/>,
|
|
);
|
|
});
|
|
|
|
return (
|
|
<View style={{flex: 1, flexDirection: 'column'}}>
|
|
{content}
|
|
</View>
|
|
);
|
|
}
|