@@ -4,36 +4,17 @@ const fs = require('fs');
4
4
const { promisify } = require ( 'util' ) ;
5
5
const glob = require ( 'glob' ) ;
6
6
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
+ ) ;
30
13
31
14
const patchFile = async ( file ) => {
32
15
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
+
37
18
await promisify ( fs . writeFile ) ( file , patched ) ;
38
19
} ;
39
20
0 commit comments