Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert "fix inline code blocks for native platforms" #2550

Merged
merged 1 commit into from
Apr 23, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions src/components/AnchorForCommentsOnly/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import {StyleSheet, Text} from 'react-native';
import {StyleSheet} from 'react-native';
import anchorForCommentsOnlyPropTypes from './anchorForCommentsOnlyPropTypes';

const defaultProps = {
Expand All @@ -18,17 +18,16 @@ const AnchorForCommentsOnly = ({
style,
...props
}) => (
<Text
<a
style={StyleSheet.flatten(style)}
accessibilityRole="link"
href={href}
rel={rel}
target={target}
// eslint-disable-next-line react/jsx-props-no-spreading
{...props}
>
{children}
</Text>
</a>
);

AnchorForCommentsOnly.propTypes = anchorForCommentsOnlyPropTypes;
Expand Down
19 changes: 19 additions & 0 deletions src/components/InlineCodeBlock/index.android.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
/* eslint-disable react/jsx-props-no-spreading */
import React from 'react';
import {View} from 'react-native';
import inlineCodeBlockPropTypes from './inlineCodeBlockPropTypes';

const InlineCodeBlock = ({
TDefaultRenderer,
defaultRendererProps,
boxModelStyle,
textStyle,
}) => (
<View style={boxModelStyle}>
<TDefaultRenderer style={textStyle} {...defaultRendererProps} />
</View>
);

InlineCodeBlock.propTypes = inlineCodeBlockPropTypes;
InlineCodeBlock.displayName = 'InlineCodeBlock';
export default InlineCodeBlock;
Original file line number Diff line number Diff line change
@@ -1,26 +1,23 @@
/* eslint-disable react/jsx-props-no-spreading */
import React from 'react';
import {View} from 'react-native';
import styles from '../../styles/styles';
import WrappedText from './wrappedText';
import inlineCodeBlockPropTypes from './inlineCodeBlockPropTypes';

const InlineCodeBlock = ({
TDefaultRenderer,
defaultRendererProps,
boxModelStyle,
textStyle,
}) => (
<WrappedText
textStyle={textStyle}
wordStyle={{
<View
style={{
...boxModelStyle,
...styles.codeWordStyle,
...styles.mbn1,
}}
firstWordStyle={styles.codeFirstWordStyle}
lastWordStyle={styles.codeLastWordStyle}
// eslint-disable-next-line react/jsx-props-no-spreading
{...defaultRendererProps}
>
{defaultRendererProps.tnode.data}
</WrappedText>
<TDefaultRenderer style={textStyle} {...defaultRendererProps} />
</View>
);

InlineCodeBlock.propTypes = inlineCodeBlockPropTypes;
Expand Down
87 changes: 0 additions & 87 deletions src/components/InlineCodeBlock/wrappedText.js

This file was deleted.

40 changes: 4 additions & 36 deletions src/styles/styles.js
Original file line number Diff line number Diff line change
Expand Up @@ -1312,39 +1312,6 @@ const styles = {
scrollbarWidth: 'none',
},

codeWordWrapper: {
height: 10,
},

codeWordStyle: {
borderLeftWidth: 0,
borderRightWidth: 0,
borderTopLeftRadius: 0,
borderBottomLeftRadius: 0,
borderTopRightRadius: 0,
borderBottomRightRadius: 0,
flexBasis: 'auto',
paddingLeft: 0,
paddingRight: 0,
justifyContent: 'center',
marginVertical: -2,
top: -1,
},

codeFirstWordStyle: {
borderLeftWidth: 1,
borderTopLeftRadius: 4,
borderBottomLeftRadius: 4,
paddingLeft: 5,
},

codeLastWordStyle: {
borderRightWidth: 1,
borderTopRightRadius: 4,
borderBottomRightRadius: 4,
paddingRight: 5,
},

fullScreenLoading: {
backgroundColor: themeColors.componentBG,
opacity: 0.8,
Expand All @@ -1365,6 +1332,8 @@ const styles = {
const baseCodeTagStyles = {
borderWidth: 1,
borderRadius: 5,
marginTop: 4,
marginBottom: 4,
borderColor: themeColors.border,
backgroundColor: themeColors.textBackground,
};
Expand Down Expand Up @@ -1421,9 +1390,9 @@ const webViewStyles = {
...baseCodeTagStyles,
paddingLeft: 5,
paddingRight: 5,
paddingBottom: 2,
alignSelf: 'flex-start',
fontFamily: fontFamily.MONOSPACE,
lineHeight: 18,
fontSize: 13,
},

img: {
Expand All @@ -1436,7 +1405,6 @@ const webViewStyles = {
baseFontStyle: {
color: themeColors.text,
fontSize: variables.fontSizeNormal,
lineHeight: variables.fontSizeNormalHeight,
fontFamily: fontFamily.GTA,
},
};
Expand Down
1 change: 0 additions & 1 deletion src/styles/variables.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ export default {
fontSizeExtraSmall: 9,
fontSizeLabel: 13,
fontSizeNormal: 15,
fontSizeNormalHeight: 20,
fontSizeLarge: 17,
fontSizeh1: 19,
iconSizeExtraSmall: 12,
Expand Down