Removed fontSize prop from Emoji (#1399)
This commit is contained in:
parent
48b18fa5fb
commit
62f7358807
2 changed files with 9 additions and 18 deletions
|
|
@ -3,7 +3,12 @@
|
|||
|
||||
import React from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import {Image, Platform, Text} from 'react-native';
|
||||
import {
|
||||
Image,
|
||||
Platform,
|
||||
StyleSheet,
|
||||
Text
|
||||
} from 'react-native';
|
||||
import FastImage from 'react-native-fast-image';
|
||||
|
||||
import CustomPropTypes from 'app/constants/custom_prop_types';
|
||||
|
|
@ -15,7 +20,6 @@ export default class Emoji extends React.PureComponent {
|
|||
static propTypes = {
|
||||
customEmojis: PropTypes.object,
|
||||
emojiName: PropTypes.string.isRequired,
|
||||
fontSize: PropTypes.number,
|
||||
literal: PropTypes.string,
|
||||
size: PropTypes.number.isRequired,
|
||||
textStyle: CustomPropTypes.Style,
|
||||
|
|
@ -99,7 +103,6 @@ export default class Emoji extends React.PureComponent {
|
|||
|
||||
render() {
|
||||
const {
|
||||
fontSize,
|
||||
literal,
|
||||
size,
|
||||
textStyle,
|
||||
|
|
@ -136,7 +139,9 @@ export default class Emoji extends React.PureComponent {
|
|||
}
|
||||
|
||||
let marginTop = 0;
|
||||
if (fontSize) {
|
||||
if (textStyle) {
|
||||
const fontSize = StyleSheet.flatten(textStyle).fontSize;
|
||||
|
||||
// Center the image vertically on iOS (does nothing on Android)
|
||||
marginTop = (height - 16) / 2;
|
||||
|
||||
|
|
|
|||
|
|
@ -31,7 +31,6 @@ export default class Markdown extends PureComponent {
|
|||
baseTextStyle: CustomPropTypes.Style,
|
||||
blockStyles: PropTypes.object,
|
||||
emojiSizes: PropTypes.object,
|
||||
fontSizes: PropTypes.object,
|
||||
isEdited: PropTypes.bool,
|
||||
isSearchResult: PropTypes.bool,
|
||||
navigator: PropTypes.object.isRequired,
|
||||
|
|
@ -67,15 +66,6 @@ export default class Markdown extends PureComponent {
|
|||
}
|
||||
})
|
||||
},
|
||||
fontSizes: {
|
||||
heading1: 17,
|
||||
heading2: 17,
|
||||
heading3: 17,
|
||||
heading4: 17,
|
||||
heading5: 17,
|
||||
heading6: 17,
|
||||
text: 15
|
||||
},
|
||||
onLongPress: () => true
|
||||
};
|
||||
|
||||
|
|
@ -194,14 +184,11 @@ export default class Markdown extends PureComponent {
|
|||
|
||||
renderEmoji = ({context, emojiName, literal}) => {
|
||||
let size;
|
||||
let fontSize;
|
||||
const headingType = context.find((type) => type.startsWith('heading'));
|
||||
if (headingType) {
|
||||
size = this.props.emojiSizes[headingType];
|
||||
fontSize = this.props.fontSizes[headingType];
|
||||
} else {
|
||||
size = this.props.emojiSizes.text;
|
||||
fontSize = this.props.fontSizes.text;
|
||||
}
|
||||
|
||||
return (
|
||||
|
|
@ -209,7 +196,6 @@ export default class Markdown extends PureComponent {
|
|||
emojiName={emojiName}
|
||||
literal={literal}
|
||||
size={size}
|
||||
fontSize={fontSize}
|
||||
textStyle={this.computeTextStyle(this.props.baseTextStyle, context)}
|
||||
/>
|
||||
);
|
||||
|
|
|
|||
Loading…
Reference in a new issue