Skip to content

Commit

Permalink
Merge pull request #56924 from callstack-internal/bugfix/53458-code-b…
Browse files Browse the repository at this point in the history
…locks-native

Use simple styles for code blocks in Native platforms
  • Loading branch information
grgia authored Feb 27, 2025
2 parents 0856182 + 4b24788 commit 7d0bcb4
Show file tree
Hide file tree
Showing 8 changed files with 2 additions and 260 deletions.
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 @@ -3355,10 +3353,6 @@ const styles = (theme: ThemeColors) =>
alignSelf: 'center',
},

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

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

codeFirstWordStyle: {
Expand All @@ -3386,10 +3379,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.

0 comments on commit 7d0bcb4

Please sign in to comment.