Skip to content

Commit 9ed2d09

Browse files
committed
upd patch
1 parent e1cb29d commit 9ed2d09

File tree

1 file changed

+8
-27
lines changed

1 file changed

+8
-27
lines changed

patch-rn.js

Lines changed: 8 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -4,36 +4,17 @@ const fs = require('fs');
44
const { promisify } = require('util');
55
const glob = require('glob');
66

7-
const patterns = [
8-
new RegExp(
9-
'type === "AndroidTextInput" \\\|\\| // Android[\\s\\S]+' +
10-
'type === "RCTMultilineTextInputView" \\|\\| // iOS[\\s\\S]+' +
11-
'type === "RCTSinglelineTextInputView" \\|\\| // iOS[\\s\\S]+' +
12-
'type === "RCTText" \\|\\|[\\s\\S]+' +
13-
'type === "RCTVirtualText"'
14-
),
15-
16-
new RegExp(
17-
'"AndroidTextInput" === props \\|\\|[\\s\\S]+' +
18-
'"RCTMultilineTextInputView" === props \\|\\|[\\s\\S]+' +
19-
'"RCTSinglelineTextInputView" === props \\|\\|[\\s\\S]+' +
20-
'"RCTText" === props \\|\\|[\\s\\S]+' +
21-
'"RCTVirtualText" === props'
22-
)
23-
];
24-
25-
const patches = [
26-
'type.includes("Text")',
27-
28-
'props.includes("Text")'
29-
]
7+
const pattern = new RegExp(
8+
'invariant\\([\\s\\S]' +
9+
'hostContext\\.isInAParentText,[\\s\\S]' +
10+
'"Text strings must be rendered within a <Text> component\\."[\\s\\S]' +
11+
'\\);'
12+
);
3013

3114
const patchFile = async (file) => {
3215
const content = (await promisify(fs.readFile)(file)).toString();
33-
const patched = content
34-
.replace(patterns[0], patches[0])
35-
.replace(patterns[1], patches[1])
36-
16+
const patched = content.replace(patterns, '');
17+
3718
await promisify(fs.writeFile)(file, patched);
3819
};
3920

0 commit comments

Comments
 (0)