Skip to content

Commit 284db7b

Browse files
committed
refactor(ios): simplify heading style definitions in RichTextView and RichTextViewNativeComponent
1 parent 170dfbb commit 284db7b

2 files changed

Lines changed: 22 additions & 48 deletions

File tree

src/RichTextView.tsx

Lines changed: 11 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -5,31 +5,18 @@ import RichTextViewNativeComponent, {
55
import { normalizeRichTextStyle } from './normalizeRichTextStyle';
66
import type { ViewStyle, TextStyle } from 'react-native';
77

8+
export interface HeadingStyle {
9+
fontSize?: number;
10+
fontFamily?: string;
11+
}
12+
813
export interface RichTextStyle {
9-
h1?: {
10-
fontSize?: number;
11-
fontFamily?: string;
12-
};
13-
h2?: {
14-
fontSize?: number;
15-
fontFamily?: string;
16-
};
17-
h3?: {
18-
fontSize?: number;
19-
fontFamily?: string;
20-
};
21-
h4?: {
22-
fontSize?: number;
23-
fontFamily?: string;
24-
};
25-
h5?: {
26-
fontSize?: number;
27-
fontFamily?: string;
28-
};
29-
h6?: {
30-
fontSize?: number;
31-
fontFamily?: string;
32-
};
14+
h1?: HeadingStyle;
15+
h2?: HeadingStyle;
16+
h3?: HeadingStyle;
17+
h4?: HeadingStyle;
18+
h5?: HeadingStyle;
19+
h6?: HeadingStyle;
3320
}
3421

3522
export interface RichTextViewProps

src/RichTextViewNativeComponent.ts

Lines changed: 11 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -5,31 +5,18 @@ import {
55
type ColorValue,
66
} from 'react-native';
77

8+
export interface HeadingStyleInternal {
9+
fontSize?: CodegenTypes.Float;
10+
fontFamily?: string;
11+
}
12+
813
export interface RichTextStyleInternal {
9-
h1?: {
10-
fontSize?: CodegenTypes.Float;
11-
fontFamily?: string;
12-
};
13-
h2?: {
14-
fontSize?: CodegenTypes.Float;
15-
fontFamily?: string;
16-
};
17-
h3?: {
18-
fontSize?: CodegenTypes.Float;
19-
fontFamily?: string;
20-
};
21-
h4?: {
22-
fontSize?: CodegenTypes.Float;
23-
fontFamily?: string;
24-
};
25-
h5?: {
26-
fontSize?: CodegenTypes.Float;
27-
fontFamily?: string;
28-
};
29-
h6?: {
30-
fontSize?: CodegenTypes.Float;
31-
fontFamily?: string;
32-
};
14+
h1?: HeadingStyleInternal;
15+
h2?: HeadingStyleInternal;
16+
h3?: HeadingStyleInternal;
17+
h4?: HeadingStyleInternal;
18+
h5?: HeadingStyleInternal;
19+
h6?: HeadingStyleInternal;
3320
}
3421

3522
export interface NativeProps extends ViewProps {

0 commit comments

Comments
 (0)