Skip to content

Commit 0e9478b

Browse files
chore: move EnrichedText into native directory (#591)
# Summary move `EnrichedText` into native directory ## Test Plan iOS/android builds properly ## Screenshots / Videos n/a ## Compatibility | OS | Implemented | | ------- | :---------: | | iOS | ✅ | | Android | ✅ | ## Checklist - [ ] E2E tests are passing - [ ] Required E2E tests have been added (if applicable)
1 parent 02ea6cf commit 0e9478b

3 files changed

Lines changed: 28 additions & 26 deletions

File tree

src/index.native.tsx

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1+
// EnrichedTextInput
12
export { EnrichedTextInput } from './native/EnrichedTextInput';
2-
export * from './EnrichedText';
33
export type {
44
EnrichedInputStyle,
55
EnrichedTextInputProps,
@@ -19,6 +19,13 @@ export type {
1919
EnrichedTextInputInstance,
2020
ContextMenuItem,
2121
OnChangeMentionEvent,
22+
} from './types';
23+
24+
// EnrichedText
25+
export { EnrichedText } from './native/EnrichedText';
26+
export type {
27+
EnrichedTextProps,
28+
EnrichedTextInstance,
2229
EnrichedTextHtmlStyle,
2330
OnMentionPressEvent,
2431
OnLinkPressEvent,
Lines changed: 4 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,48 +1,27 @@
11
import {
22
type Component,
3-
type RefObject,
43
useCallback,
54
useImperativeHandle,
65
useMemo,
76
useRef,
87
} from 'react';
98
import type {
10-
ColorValue,
119
HostInstance,
1210
MeasureInWindowOnSuccessCallback,
1311
MeasureLayoutOnSuccessCallback,
1412
MeasureOnSuccessCallback,
1513
NativeMethods,
16-
TextStyle,
17-
ViewProps,
1814
} from 'react-native';
1915
import EnrichedTextNativeComponent, {
2016
type NativeProps,
2117
type OnLinkPressEvent,
22-
type OnMentionPressEvent,
2318
type OnMentionPressEventInternal,
24-
} from './spec/EnrichedTextNativeComponent';
25-
import { nullthrows } from './utils/nullthrows';
26-
import { normalizeEnrichedTextHtmlStyle } from './utils/normalizeHtmlStyle';
27-
import type { EnrichedTextHtmlStyle } from './types';
19+
} from '../spec/EnrichedTextNativeComponent';
20+
import { nullthrows } from '../utils/nullthrows';
21+
import { normalizeEnrichedTextHtmlStyle } from '../utils/normalizeHtmlStyle';
22+
import type { EnrichedTextProps } from '../types';
2823
import type { DirectEventHandler } from 'react-native/Libraries/Types/CodegenTypes';
2924

30-
export interface EnrichedTextInstance extends NativeMethods {}
31-
32-
export interface EnrichedTextProps extends ViewProps {
33-
ref?: RefObject<EnrichedTextInstance | null>;
34-
children: string;
35-
style?: TextStyle;
36-
htmlStyle?: EnrichedTextHtmlStyle;
37-
useHtmlNormalizer?: boolean;
38-
ellipsizeMode?: 'head' | 'middle' | 'tail' | 'clip';
39-
numberOfLines?: number;
40-
selectable?: boolean;
41-
selectionColor?: ColorValue;
42-
onLinkPress?: (event: OnLinkPressEvent) => void;
43-
onMentionPress?: (event: OnMentionPressEvent) => void;
44-
}
45-
4625
type ComponentType = (Component<NativeProps, {}, any> & NativeMethods) | null;
4726

4827
export const EnrichedText = ({

src/types.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -496,6 +496,22 @@ export interface EnrichedTextInputProps extends Omit<ViewProps, 'children'> {
496496
useHtmlNormalizer?: boolean;
497497
}
498498

499+
export interface EnrichedTextInstance extends NativeMethods {}
500+
501+
export interface EnrichedTextProps extends ViewProps {
502+
ref?: RefObject<EnrichedTextInstance | null>;
503+
children: string;
504+
style?: TextStyle;
505+
htmlStyle?: EnrichedTextHtmlStyle;
506+
useHtmlNormalizer?: boolean;
507+
ellipsizeMode?: 'head' | 'middle' | 'tail' | 'clip';
508+
numberOfLines?: number;
509+
selectable?: boolean;
510+
selectionColor?: ColorValue;
511+
onLinkPress?: (event: OnLinkPressEvent) => void;
512+
onMentionPress?: (event: OnMentionPressEvent) => void;
513+
}
514+
499515
interface EnrichedTextMentionStyleProperties extends MentionStyleProperties {
500516
pressColor?: ColorValue;
501517
pressBackgroundColor?: ColorValue;

0 commit comments

Comments
 (0)