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

Use simple styles for code blocks in Native platforms #56924

Merged
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
137 changes: 0 additions & 137 deletions src/components/InlineCodeBlock/WrappedText.tsx

This file was deleted.

11 changes: 2 additions & 9 deletions src/components/InlineCodeBlock/index.native.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import React from 'react';
import type {TDefaultRendererProps} from 'react-native-render-html';
import useThemeStyles from '@hooks/useThemeStyles';
import Text from '@components/Text';
import type InlineCodeBlockProps from './types';
import type {TTextOrTPhrasing} from './types';
import WrappedText from './WrappedText';

/**
* Retrieves the text content from a Text or Phrasing node.
Expand All @@ -21,20 +20,14 @@ function getCurrentData(defaultRendererProps: TDefaultRendererProps<TTextOrTPhra
}

function InlineCodeBlock<TComponent extends TTextOrTPhrasing>({TDefaultRenderer, defaultRendererProps, textStyle, boxModelStyle}: InlineCodeBlockProps<TComponent>) {
const styles = useThemeStyles();
const data = getCurrentData(defaultRendererProps);

return (
<TDefaultRenderer
// eslint-disable-next-line react/jsx-props-no-spreading
{...defaultRendererProps}
>
<WrappedText
textStyles={textStyle}
wordStyles={[boxModelStyle, styles.codeWordStyle]}
>
{data}
</WrappedText>
<Text style={[boxModelStyle, textStyle]}>{data}</Text>
</TDefaultRenderer>
);
}
Expand Down
11 changes: 0 additions & 11 deletions src/styles/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import type {ThemeColors} from './theme/types';
import addOutlineWidth from './utils/addOutlineWidth';
import borders from './utils/borders';
import chatContentScrollViewPlatformStyles from './utils/chatContentScrollViewPlatformStyles';
import codeStyles from './utils/codeStyles';
import cursor from './utils/cursor';
import display from './utils/display';
import editedLabelStyles from './utils/editedLabelStyles';
Expand Down Expand Up @@ -201,7 +200,6 @@ const webViewStyles = (theme: ThemeColors) =>

code: {
...baseCodeTagStyles(theme),
...(codeStyles.codeTextStyle as MixedStyleDeclaration),
paddingLeft: 5,
paddingRight: 5,
fontFamily: FontUtils.fontFamily.platform.MONOSPACE.fontFamily,
Expand Down Expand Up @@ -3354,10 +3352,6 @@ const styles = (theme: ThemeColors) =>
alignSelf: 'center',
},

codeWordWrapper: {
...codeStyles.codeWordWrapper,
},

codeWordStyle: {
borderLeftWidth: 0,
borderRightWidth: 0,
Expand All @@ -3368,7 +3362,6 @@ const styles = (theme: ThemeColors) =>
paddingLeft: 0,
paddingRight: 0,
justifyContent: 'center',
...codeStyles.codeWordStyle,
},

codeFirstWordStyle: {
Expand All @@ -3385,10 +3378,6 @@ const styles = (theme: ThemeColors) =>
paddingRight: 5,
},

codePlainTextStyle: {
...codeStyles.codePlainTextStyle,
},

fullScreenLoading: {
backgroundColor: theme.componentBG,
opacity: 0.8,
Expand Down
20 changes: 0 additions & 20 deletions src/styles/utils/codeStyles/index.android.ts

This file was deleted.

21 changes: 0 additions & 21 deletions src/styles/utils/codeStyles/index.ios.ts

This file was deleted.

8 changes: 0 additions & 8 deletions src/styles/utils/codeStyles/index.ts

This file was deleted.

7 changes: 0 additions & 7 deletions src/styles/utils/codeStyles/types.ts

This file was deleted.

47 changes: 0 additions & 47 deletions tests/unit/splitLongWordTest.ts

This file was deleted.