|
1 | | -import { Platform, processColor } from 'react-native'; |
| 1 | +import { Platform } from 'react-native'; |
2 | 2 | import type { MarkdownStyle } from './types/MarkdownStyle'; |
3 | 3 | import type { |
4 | 4 | BlockTextAlign, |
5 | 5 | EmphasisFontStyle, |
6 | 6 | MarkdownStyleInternal, |
7 | 7 | } from './types/MarkdownStyleInternal'; |
8 | | -import { mergeSpoilerDefaults, isStyleEqual } from './styleUtils'; |
9 | | - |
10 | | -// On native, processColor converts hex strings to ARGB integers the renderer |
11 | | -// expects. On web, CSS accepts hex strings natively — no conversion needed. |
12 | | -// MarkdownStyleInternal types colors as `string`; native consumers |
13 | | -// (EnrichedMarkdownTextNativeComponent) accept `ColorValue` (string | number) |
14 | | -// at runtime, so the ARGB integers processColor produces are handled correctly. |
15 | | -export const normalizeColor = ( |
16 | | - color: string | undefined |
17 | | -): string | undefined => |
18 | | - color |
19 | | - ? Platform.OS === 'web' |
20 | | - ? color |
21 | | - : ((processColor(color) ?? undefined) as string | undefined) |
22 | | - : undefined; |
| 8 | +import { |
| 9 | + mergeSpoilerDefaults, |
| 10 | + isStyleEqual, |
| 11 | + normalizeColor, |
| 12 | +} from './styleUtils'; |
23 | 13 |
|
24 | 14 | const getSystemFont = (): string => |
25 | 15 | Platform.select({ |
@@ -75,7 +65,7 @@ const baseHeader: { |
75 | 65 | textAlign: 'auto', |
76 | 66 | }; |
77 | 67 |
|
78 | | -const DEFAULT_NORMALIZED_STYLE: MarkdownStyleInternal = Object.freeze({ |
| 68 | +const DEFAULT_NORMALIZED_STYLE = Object.freeze({ |
79 | 69 | paragraph: { |
80 | 70 | fontSize: 16, |
81 | 71 | fontFamily: getSystemFont(), |
@@ -237,7 +227,7 @@ const DEFAULT_NORMALIZED_STYLE: MarkdownStyleInternal = Object.freeze({ |
237 | 227 | particles: { density: 8, speed: 20 }, |
238 | 228 | solid: { borderRadius: 4 }, |
239 | 229 | }, |
240 | | -}); |
| 230 | +} as MarkdownStyleInternal); |
241 | 231 |
|
242 | 232 | const refCache = new WeakMap<MarkdownStyle, MarkdownStyleInternal>(); |
243 | 233 | const structuralCache: { |
|
0 commit comments