Skip to content

Commit 2a91fac

Browse files
kacperzolkiewskihejsztynx
authored andcommitted
chore: upgrade library deps to RN 0.87
1 parent 0ce109a commit 2a91fac

12 files changed

Lines changed: 264 additions & 910 deletions

File tree

android/gradle.properties

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
ReactNativeEnrichedHtml_kotlinVersion=2.0.21
1+
ReactNativeEnrichedHtml_kotlinVersion=2.2.0
22
ReactNativeEnrichedHtml_minSdkVersion=24
3-
ReactNativeEnrichedHtml_targetSdkVersion=34
4-
ReactNativeEnrichedHtml_compileSdkVersion=35
3+
ReactNativeEnrichedHtml_targetSdkVersion=36
4+
ReactNativeEnrichedHtml_compileSdkVersion=37
55
ReactNativeEnrichedHtml_ndkVersion=27.1.12297006

apps/example-web/tsconfig.app.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
"compilerOptions": {
44
"tsBuildInfoFile": "./node_modules/.tmp/tsconfig.app.tsbuildinfo",
55
"types": ["vite/client"],
6-
"baseUrl": ".",
76
"paths": {
87
"react-native-enriched-html": ["../../src/index.tsx"]
98
}

apps/example/tsconfig.json

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,12 @@
22
"extends": "../../tsconfig.json",
33
"compilerOptions": {
44
"paths": {
5-
"react-native-enriched-html": ["../../src/index.native.tsx"]
5+
"react-native-enriched-html": ["../../src/index.native.tsx"],
6+
// Pin a single `@types/react` copy so the library source typechecked here
7+
// doesn't mix react types with the example's copy (which makes codegen
8+
// command ref types collapse to `never`).
9+
"react": ["../../node_modules/@types/react"],
10+
"react/*": ["../../node_modules/@types/react/*"]
611
}
712
}
813
}

package.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -119,9 +119,9 @@
119119
"@eslint/js": "^9.22.0",
120120
"@evilmartians/lefthook": "^1.5.0",
121121
"@playwright/test": "1.58.2",
122-
"@react-native-community/cli": "20.1.0",
123-
"@react-native/eslint-config": "^0.86.0",
124-
"@react-native/jest-preset": "^0.86.0",
122+
"@react-native-community/cli": "20.2.0",
123+
"@react-native/eslint-config": "^0.87.0",
124+
"@react-native/jest-preset": "^0.87.0",
125125
"@release-it/conventional-changelog": "^9.0.2",
126126
"@types/jest": "^29.5.5",
127127
"@types/react": "^19.2.0",
@@ -138,11 +138,11 @@
138138
"prettier": "^3.0.3",
139139
"react": "19.2.3",
140140
"react-dom": "19.2.3",
141-
"react-native": "0.86.0",
141+
"react-native": "0.87.0",
142142
"react-native-builder-bob": "^0.43.0",
143143
"release-it": "^17.10.0",
144144
"turbo": "^1.10.7",
145-
"typescript": "^5.8.3"
145+
"typescript": "^6.0.3"
146146
},
147147
"peerDependencies": {
148148
"react": "*",

src/css.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
declare module '*.css';

src/native/EnrichedText.tsx

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import {
66
type ComponentRef,
77
} from 'react';
88
import type {
9+
CodegenTypes,
910
HostComponent,
1011
HostInstance,
1112
MeasureInWindowOnSuccessCallback,
@@ -20,7 +21,6 @@ import EnrichedTextNativeComponent, {
2021
import { nullthrows } from '../utils/nullthrows';
2122
import { normalizeEnrichedTextHtmlStyle } from '../utils/normalizeHtmlStyle';
2223
import type { EnrichedTextProps } from '../types';
23-
import type { DirectEventHandler } from 'react-native/Libraries/Types/CodegenTypes';
2424

2525
type ComponentType = ComponentRef<HostComponent<NativeProps>>;
2626

@@ -46,14 +46,15 @@ export const EnrichedText = ({
4646
[_htmlStyle]
4747
);
4848

49-
const onLinkPress: DirectEventHandler<OnLinkPressEvent> = useCallback(
50-
(e) => {
51-
_onLinkPress?.(e.nativeEvent);
52-
},
53-
[_onLinkPress]
54-
);
49+
const onLinkPress: CodegenTypes.DirectEventHandler<OnLinkPressEvent> =
50+
useCallback(
51+
(e) => {
52+
_onLinkPress?.(e.nativeEvent);
53+
},
54+
[_onLinkPress]
55+
);
5556

56-
const onMentionPress: DirectEventHandler<OnMentionPressEventInternal> =
57+
const onMentionPress: CodegenTypes.DirectEventHandler<OnMentionPressEventInternal> =
5758
useCallback(
5859
(e) => {
5960
const { text, indicator, attributes } = e.nativeEvent;

src/spec/EnrichedTextInputNativeComponent.ts

Lines changed: 57 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
11
import { codegenNativeComponent, codegenNativeCommands } from 'react-native';
22
import type {
3-
BubblingEventHandler,
4-
DirectEventHandler,
5-
Float,
6-
Int32,
7-
UnsafeMixed,
8-
} from 'react-native/Libraries/Types/CodegenTypes';
9-
import type { ColorValue, HostComponent, ViewProps } from 'react-native';
3+
CodegenTypes,
4+
ColorValue,
5+
HostComponent,
6+
ViewProps,
7+
} from 'react-native';
108
import React from 'react';
119

1210
export interface LinkNativeRegex {
@@ -129,8 +127,8 @@ export interface OnChangeStateEvent {
129127
export interface OnLinkDetected {
130128
text: string;
131129
url: string;
132-
start: Int32;
133-
end: Int32;
130+
start: CodegenTypes.Int32;
131+
end: CodegenTypes.Int32;
134132
}
135133

136134
export interface OnMentionDetectedInternal {
@@ -147,18 +145,18 @@ export interface OnMentionDetected {
147145

148146
export interface OnMentionEvent {
149147
indicator: string;
150-
text: UnsafeMixed;
148+
text: CodegenTypes.UnsafeMixed;
151149
}
152150

153151
export interface OnChangeSelectionEvent {
154-
start: Int32;
155-
end: Int32;
152+
start: CodegenTypes.Int32;
153+
end: CodegenTypes.Int32;
156154
text: string;
157155
}
158156

159157
export interface OnRequestHtmlResultEvent {
160-
requestId: Int32;
161-
html: UnsafeMixed;
158+
requestId: CodegenTypes.Int32;
159+
html: CodegenTypes.UnsafeMixed;
162160
}
163161

164162
export interface OnSubmitEditing {
@@ -181,8 +179,8 @@ export interface TextShortcut {
181179
export interface OnContextMenuItemPressEvent {
182180
itemText: string;
183181
selectedText: string;
184-
selectionStart: Int32;
185-
selectionEnd: Int32;
182+
selectionStart: CodegenTypes.Int32;
183+
selectionEnd: CodegenTypes.Int32;
186184
styleState: {
187185
bold: {
188186
isActive: boolean;
@@ -284,27 +282,27 @@ export interface OnContextMenuItemPressEvent {
284282
}
285283

286284
interface TargetedEvent {
287-
target: Int32;
285+
target: CodegenTypes.Int32;
288286
}
289287

290288
export interface PastedImage {
291289
uri: string;
292290
type: string;
293-
width: Float;
294-
height: Float;
291+
width: CodegenTypes.Float;
292+
height: CodegenTypes.Float;
295293
}
296294

297295
export interface OnPasteImagesEvent {
298296
images: {
299297
uri: string;
300298
type: string;
301-
width: Float;
302-
height: Float;
299+
width: CodegenTypes.Float;
300+
height: CodegenTypes.Float;
303301
}[];
304302
}
305303

306304
type Heading = {
307-
fontSize?: Float;
305+
fontSize?: CodegenTypes.Float;
308306
bold?: boolean;
309307
};
310308

@@ -317,13 +315,13 @@ export interface HtmlStyleInternal {
317315
h6?: Heading;
318316
blockquote?: {
319317
borderColor?: ColorValue;
320-
borderWidth?: Float;
321-
gapWidth?: Float;
318+
borderWidth?: CodegenTypes.Float;
319+
gapWidth?: CodegenTypes.Float;
322320
color?: ColorValue;
323321
};
324322
codeblock?: {
325323
color?: ColorValue;
326-
borderRadius?: Float;
324+
borderRadius?: CodegenTypes.Float;
327325
backgroundColor?: ColorValue;
328326
};
329327
code?: {
@@ -336,23 +334,23 @@ export interface HtmlStyleInternal {
336334
};
337335
// This is a workaround for the fact that codegen does not support Records.
338336
// On native Android side this will become a ReadableMap, on native iOS we can work with a folly::dynamic object.
339-
mention?: UnsafeMixed;
337+
mention?: CodegenTypes.UnsafeMixed;
340338
ol?: {
341-
gapWidth?: Float;
342-
marginLeft?: Float;
339+
gapWidth?: CodegenTypes.Float;
340+
marginLeft?: CodegenTypes.Float;
343341
markerFontWeight?: string;
344342
markerColor?: ColorValue;
345343
};
346344
ul?: {
347345
bulletColor?: ColorValue;
348-
bulletSize?: Float;
349-
marginLeft?: Float;
350-
gapWidth?: Float;
346+
bulletSize?: CodegenTypes.Float;
347+
marginLeft?: CodegenTypes.Float;
348+
gapWidth?: CodegenTypes.Float;
351349
};
352350
ulCheckbox?: {
353-
gapWidth?: Float;
354-
boxSize?: Float;
355-
marginLeft?: Float;
351+
gapWidth?: CodegenTypes.Float;
352+
boxSize?: CodegenTypes.Float;
353+
marginLeft?: CodegenTypes.Float;
356354
boxColor?: ColorValue;
357355
};
358356
}
@@ -379,26 +377,26 @@ export interface NativeProps extends ViewProps {
379377
allowFontScaling?: boolean;
380378

381379
// event callbacks
382-
onInputFocus?: DirectEventHandler<TargetedEvent>;
383-
onInputBlur?: DirectEventHandler<TargetedEvent>;
384-
onChangeText?: DirectEventHandler<OnChangeTextEvent>;
385-
onChangeHtml?: DirectEventHandler<OnChangeHtmlEvent>;
386-
onChangeState?: DirectEventHandler<OnChangeStateEvent>;
387-
onLinkDetected?: DirectEventHandler<OnLinkDetected>;
388-
onMentionDetected?: DirectEventHandler<OnMentionDetectedInternal>;
389-
onMention?: DirectEventHandler<OnMentionEvent>;
390-
onChangeSelection?: DirectEventHandler<OnChangeSelectionEvent>;
391-
onRequestHtmlResult?: DirectEventHandler<OnRequestHtmlResultEvent>;
392-
onInputKeyPress?: DirectEventHandler<OnKeyPressEvent>;
393-
onPasteImages?: DirectEventHandler<OnPasteImagesEvent>;
394-
onContextMenuItemPress?: DirectEventHandler<OnContextMenuItemPressEvent>;
395-
onSubmitEditing?: BubblingEventHandler<OnSubmitEditing>;
380+
onInputFocus?: CodegenTypes.DirectEventHandler<TargetedEvent>;
381+
onInputBlur?: CodegenTypes.DirectEventHandler<TargetedEvent>;
382+
onChangeText?: CodegenTypes.DirectEventHandler<OnChangeTextEvent>;
383+
onChangeHtml?: CodegenTypes.DirectEventHandler<OnChangeHtmlEvent>;
384+
onChangeState?: CodegenTypes.DirectEventHandler<OnChangeStateEvent>;
385+
onLinkDetected?: CodegenTypes.DirectEventHandler<OnLinkDetected>;
386+
onMentionDetected?: CodegenTypes.DirectEventHandler<OnMentionDetectedInternal>;
387+
onMention?: CodegenTypes.DirectEventHandler<OnMentionEvent>;
388+
onChangeSelection?: CodegenTypes.DirectEventHandler<OnChangeSelectionEvent>;
389+
onRequestHtmlResult?: CodegenTypes.DirectEventHandler<OnRequestHtmlResultEvent>;
390+
onInputKeyPress?: CodegenTypes.DirectEventHandler<OnKeyPressEvent>;
391+
onPasteImages?: CodegenTypes.DirectEventHandler<OnPasteImagesEvent>;
392+
onContextMenuItemPress?: CodegenTypes.DirectEventHandler<OnContextMenuItemPressEvent>;
393+
onSubmitEditing?: CodegenTypes.BubblingEventHandler<OnSubmitEditing>;
396394

397395
// Style related props - used for generating proper setters in component's manager
398396
// These should not be passed as regular props
399397
color?: ColorValue;
400-
fontSize?: Float;
401-
lineHeight?: Float;
398+
fontSize?: CodegenTypes.Float;
399+
lineHeight?: CodegenTypes.Float;
402400
fontFamily?: string;
403401
fontWeight?: string;
404402
fontStyle?: string;
@@ -422,8 +420,8 @@ interface NativeCommands {
422420
setValue: (viewRef: React.ElementRef<ComponentType>, text: string) => void;
423421
setSelection: (
424422
viewRef: React.ElementRef<ComponentType>,
425-
start: Int32,
426-
end: Int32
423+
start: CodegenTypes.Int32,
424+
end: CodegenTypes.Int32
427425
) => void;
428426

429427
// Text formatting commands
@@ -448,21 +446,21 @@ interface NativeCommands {
448446
) => void;
449447
addLink: (
450448
viewRef: React.ElementRef<ComponentType>,
451-
start: Int32,
452-
end: Int32,
449+
start: CodegenTypes.Int32,
450+
end: CodegenTypes.Int32,
453451
text: string,
454452
url: string
455453
) => void;
456454
removeLink: (
457455
viewRef: React.ElementRef<ComponentType>,
458-
start: Int32,
459-
end: Int32
456+
start: CodegenTypes.Int32,
457+
end: CodegenTypes.Int32
460458
) => void;
461459
addImage: (
462460
viewRef: React.ElementRef<ComponentType>,
463461
uri: string,
464-
width: Float,
465-
height: Float
462+
width: CodegenTypes.Float,
463+
height: CodegenTypes.Float
466464
) => void;
467465
startMention: (
468466
viewRef: React.ElementRef<ComponentType>,
@@ -476,7 +474,7 @@ interface NativeCommands {
476474
) => void;
477475
requestHTML: (
478476
viewRef: React.ElementRef<ComponentType>,
479-
requestId: Int32
477+
requestId: CodegenTypes.Int32
480478
) => void;
481479
setTextAlignment: (
482480
viewRef: React.ElementRef<ComponentType>,

0 commit comments

Comments
 (0)