Skip to content

Commit 47d489a

Browse files
authored
refactor: Replace react-native-render-html with @native-html/render (#421)
1 parent f0355ed commit 47d489a

7 files changed

Lines changed: 104 additions & 129 deletions

File tree

app/screens/ActDetail/ActDetailScreen.styles.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,6 @@ export default StyleSheet.create({
99
linkStyle: {
1010
color: Colors.primary,
1111
textDecorationLine: "underline",
12+
textDecorationColor: Colors.primary,
1213
},
1314
});

app/screens/ActDetail/ActDetailScreen.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import React from "react";
22
import { ScrollView, useWindowDimensions } from "react-native";
33
import { useRoute } from "@react-navigation/native";
4-
import HTML from "react-native-render-html";
4+
import { RenderHTML } from "@native-html/render";
55

66
import { HTMLImage } from "components";
77
import { ui } from "utils";
@@ -30,7 +30,7 @@ const ActDetailScreen: NavStatelessComponent = () => {
3030
contentInsetAdjustmentBehavior="automatic"
3131
contentContainerStyle={{ paddingBottom: paddingBottom }}
3232
>
33-
<HTML
33+
<RenderHTML
3434
source={{ html: body }}
3535
contentWidth={contentWidth}
3636
baseStyle={baseFontStyle}

app/screens/InfoModal/InfoModalScreen.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import React from "react";
22
import { ScrollView, StyleSheet } from "react-native";
33
import { useRoute } from "@react-navigation/native";
4-
import HTML from "react-native-render-html";
4+
import { RenderHTML } from "@native-html/render";
55

66
import { ui } from "utils";
77
import { NavStatelessComponent } from "interfaces";
@@ -18,6 +18,7 @@ const InfoModalScreen: NavStatelessComponent = () => {
1818
a: {
1919
color: Colors.primary,
2020
textDecorationLine: "underline",
21+
textDecorationColor: Colors.primary,
2122
},
2223
});
2324
const route = useRoute();
@@ -40,7 +41,7 @@ const InfoModalScreen: NavStatelessComponent = () => {
4041
style={styles.container}
4142
contentInsetAdjustmentBehavior="automatic"
4243
>
43-
<HTML
44+
<RenderHTML
4445
source={{ html }}
4546
contentWidth={Layout.screen.width}
4647
baseStyle={styles.text}

app/screens/InfoModal/__test__/__snapshots__/InfoModalScreen.test.tsx.snap

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ exports[`InfoModalScreen renders correctly 1`] = `
1212
}
1313
}
1414
>
15-
<HTML
15+
<RenderHTML
1616
baseStyle={
1717
{
1818
"fontSize": 18,
@@ -56,6 +56,7 @@ exports[`InfoModalScreen renders correctly 1`] = `
5656
{
5757
"a": {
5858
"color": "#0F853B",
59+
"textDecorationColor": "#0F853B",
5960
"textDecorationLine": "underline",
6061
},
6162
}

jest/mock/node-modules/index.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,12 @@ jest.mock("react-redux", () => {
2929
};
3030
});
3131

32-
jest.mock("react-native-render-html", () => {
32+
jest.mock("@native-html/render", () => {
3333
const createMock = require("../../utils").createMock;
3434

35-
return createMock("HTML");
35+
return {
36+
RenderHTML: createMock("RenderHTML"),
37+
};
3638
});
3739

3840
jest.mock("react-native-keyboard-aware-scroll-view", () => {

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
},
2828
"dependencies": {
2929
"@expo/vector-icons": "^15.0.3",
30+
"@native-html/render": "^1.0.0-alpha.0",
3031
"@react-native-async-storage/async-storage": "2.2.0",
3132
"@react-native-community/datetimepicker": "8.4.4",
3233
"@react-native-community/slider": "5.0.1",
@@ -72,9 +73,8 @@
7273
"react-native-pager-view": "6.9.1",
7374
"react-native-progress": "5.0.1",
7475
"react-native-reanimated": "~4.1.1",
75-
"react-native-render-html": "^6.3.4",
7676
"react-native-safe-area-context": "~5.6.0",
77-
"react-native-screens": "^4.19.0",
77+
"react-native-screens": "4.19.0",
7878
"react-native-svg": "15.12.1",
7979
"react-native-worklets": "0.5.1",
8080
"react-redux": "8.0.4",
@@ -126,4 +126,4 @@
126126
},
127127
"name": "nmf-app",
128128
"version": "1.0.0"
129-
}
129+
}

0 commit comments

Comments
 (0)