Skip to content

Commit 013785e

Browse files
authored
chore: remove onChangeStateDeprecated (#438)
# Summary Removes `onChangeStateDeprecated` callback. ## Test Plan n/a ## Screenshots / Videos n/a ## Compatibility | OS | Implemented | | ------- | :---------: | | iOS | ✅ | | Android | ✅ |
1 parent 7a6880a commit 013785e

File tree

4 files changed

+1
-100
lines changed

4 files changed

+1
-100
lines changed

docs/API_REFERENCE.md

Lines changed: 0 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -302,43 +302,6 @@ interface OnChangeStateEvent {
302302
|-------------------------------------------------------------|----------|
303303
| `(event: NativeSyntheticEvent<OnChangeStateEvent>) => void` | Both |
304304

305-
### `onChangeStateDeprecated`
306-
307-
> [!WARNING]
308-
> Callback is here just to provide easier migration to newest enriched versions and will be removed in future releases.
309-
310-
Callback that gets called when any of the styles within the selection changes.
311-
312-
Payload has a bool flag for each style:
313-
314-
```ts
315-
interface OnChangeStateDeprecatedEvent {
316-
isBold: boolean;
317-
isItalic: boolean;
318-
isUnderline: boolean;
319-
isStrikeThrough: boolean;
320-
isInlineCode: boolean;
321-
isH1: boolean;
322-
isH2: boolean;
323-
isH3: boolean;
324-
isH4: boolean;
325-
isH5: boolean;
326-
isH6: boolean;
327-
isCodeBlock: boolean;
328-
isBlockQuote: boolean;
329-
isOrderedList: boolean;
330-
isUnorderedList: boolean;
331-
isCheckboxList: boolean;
332-
isLink: boolean;
333-
isImage: boolean;
334-
isMention: boolean;
335-
}
336-
```
337-
338-
| Type | Platform |
339-
|-----------------------------------------------------------------------|----------|
340-
| `(event: NativeSyntheticEvent<OnChangeStateDeprecatedEvent>) => void` | Both |
341-
342305
### `onChangeText`
343306

344307
Callback called when any text changes occur in the input.

src/EnrichedTextInput.tsx

Lines changed: 1 addition & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ import EnrichedTextInputNativeComponent, {
2020
type OnMentionDetected,
2121
type OnMentionDetectedInternal,
2222
type OnRequestHtmlResultEvent,
23-
type OnChangeStateDeprecatedEvent,
2423
type OnKeyPressEvent,
2524
type OnPasteImagesEvent,
2625
} from './spec/EnrichedTextInputNativeComponent';
@@ -119,12 +118,6 @@ export interface EnrichedTextInputProps extends Omit<ViewProps, 'children'> {
119118
onChangeText?: (e: NativeSyntheticEvent<OnChangeTextEvent>) => void;
120119
onChangeHtml?: (e: NativeSyntheticEvent<OnChangeHtmlEvent>) => void;
121120
onChangeState?: (e: NativeSyntheticEvent<OnChangeStateEvent>) => void;
122-
/**
123-
* @deprecated Use onChangeState prop instead.
124-
*/
125-
onChangeStateDeprecated?: (
126-
e: NativeSyntheticEvent<OnChangeStateDeprecatedEvent>
127-
) => void;
128121
onLinkDetected?: (e: OnLinkDetected) => void;
129122
onMentionDetected?: (e: OnMentionDetected) => void;
130123
onStartMention?: (indicator: string) => void;
@@ -184,7 +177,6 @@ export const EnrichedTextInput = ({
184177
onChangeText,
185178
onChangeHtml,
186179
onChangeState,
187-
onChangeStateDeprecated,
188180
onLinkDetected,
189181
onMentionDetected,
190182
onStartMention,
@@ -429,37 +421,6 @@ export const EnrichedTextInput = ({
429421
pendingHtmlRequests.current.delete(requestId);
430422
};
431423

432-
const onChangeStateWithDeprecated = (
433-
e: NativeSyntheticEvent<OnChangeStateEvent>
434-
) => {
435-
onChangeState?.(e);
436-
// TODO: remove in 0.5.0 release
437-
onChangeStateDeprecated?.({
438-
...e,
439-
nativeEvent: {
440-
isBold: e.nativeEvent.bold.isActive,
441-
isItalic: e.nativeEvent.italic.isActive,
442-
isUnderline: e.nativeEvent.underline.isActive,
443-
isStrikeThrough: e.nativeEvent.strikeThrough.isActive,
444-
isInlineCode: e.nativeEvent.inlineCode.isActive,
445-
isH1: e.nativeEvent.h1.isActive,
446-
isH2: e.nativeEvent.h2.isActive,
447-
isH3: e.nativeEvent.h3.isActive,
448-
isH4: e.nativeEvent.h4.isActive,
449-
isH5: e.nativeEvent.h5.isActive,
450-
isH6: e.nativeEvent.h6.isActive,
451-
isCodeBlock: e.nativeEvent.codeBlock.isActive,
452-
isBlockQuote: e.nativeEvent.blockQuote.isActive,
453-
isOrderedList: e.nativeEvent.orderedList.isActive,
454-
isUnorderedList: e.nativeEvent.unorderedList.isActive,
455-
isCheckboxList: e.nativeEvent.checkboxList.isActive,
456-
isLink: e.nativeEvent.link.isActive,
457-
isImage: e.nativeEvent.image.isActive,
458-
isMention: e.nativeEvent.mention.isActive,
459-
},
460-
});
461-
};
462-
463424
return (
464425
<EnrichedTextInputNativeComponent
465426
ref={nativeRef}
@@ -481,7 +442,7 @@ export const EnrichedTextInput = ({
481442
onChangeHtml={onChangeHtml}
482443
isOnChangeHtmlSet={onChangeHtml !== undefined}
483444
isOnChangeTextSet={onChangeText !== undefined}
484-
onChangeState={onChangeStateWithDeprecated}
445+
onChangeState={onChangeState}
485446
onLinkDetected={handleLinkDetected}
486447
onMentionDetected={handleMentionDetected}
487448
onMention={handleMentionEvent}

src/index.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ export type {
33
OnChangeTextEvent,
44
OnChangeHtmlEvent,
55
OnChangeStateEvent,
6-
OnChangeStateDeprecatedEvent,
76
OnLinkDetected,
87
OnMentionDetected,
98
OnChangeSelectionEvent,

src/spec/EnrichedTextInputNativeComponent.ts

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -124,28 +124,6 @@ export interface OnChangeStateEvent {
124124
};
125125
}
126126

127-
export interface OnChangeStateDeprecatedEvent {
128-
isBold: boolean;
129-
isItalic: boolean;
130-
isUnderline: boolean;
131-
isStrikeThrough: boolean;
132-
isInlineCode: boolean;
133-
isH1: boolean;
134-
isH2: boolean;
135-
isH3: boolean;
136-
isH4: boolean;
137-
isH5: boolean;
138-
isH6: boolean;
139-
isCodeBlock: boolean;
140-
isBlockQuote: boolean;
141-
isOrderedList: boolean;
142-
isUnorderedList: boolean;
143-
isCheckboxList: boolean;
144-
isLink: boolean;
145-
isImage: boolean;
146-
isMention: boolean;
147-
}
148-
149127
export interface OnLinkDetected {
150128
text: string;
151129
url: string;

0 commit comments

Comments
 (0)