1
1
import React , { ReactNode } from 'react' ;
2
- import { ScrollView , View , Text , TouchableHighlight } from 'react-native' ;
2
+ import {
3
+ ScrollView ,
4
+ View ,
5
+ Text ,
6
+ TouchableHighlight ,
7
+ TextStyle ,
8
+ ViewStyle ,
9
+ } from 'react-native' ;
3
10
import MarkedList from '@jsamr/react-native-li' ;
4
11
import Disc from '@jsamr/counter-style/presets/disc' ;
5
12
import Decimal from '@jsamr/counter-style/presets/decimal' ;
6
13
import MDImage from './../components/MDImage' ;
7
14
import { generateRandomString } from '../utils/string' ;
8
- import type { TextStyleProp , ViewStyleProp } from './types' ;
9
15
import { onLinkPress } from '../utils/handlers' ;
10
16
11
17
class Renderer {
12
- getTextNode = ( children : string | ReactNode [ ] , styles : TextStyleProp ) => {
18
+ getTextNode = ( children : string | ReactNode [ ] , styles ?: TextStyle ) => {
13
19
return (
14
20
< Text key = { generateRandomString ( ) } style = { styles } >
15
21
{ children }
@@ -20,7 +26,7 @@ class Renderer {
20
26
getTextLinkNode = (
21
27
children : string | ReactNode [ ] ,
22
28
href : string ,
23
- styles : TextStyleProp
29
+ styles ?: TextStyle
24
30
) => {
25
31
return (
26
32
< Text
@@ -49,7 +55,7 @@ class Renderer {
49
55
) ;
50
56
} ;
51
57
52
- getViewNode ( children : ReactNode [ ] | null , styles : ViewStyleProp ) {
58
+ getViewNode ( children : ReactNode [ ] | null , styles ?: ViewStyle ) {
53
59
return (
54
60
< View key = { generateRandomString ( ) } style = { styles } >
55
61
{ children }
@@ -59,8 +65,8 @@ class Renderer {
59
65
60
66
getCodeBlockNode (
61
67
text : string ,
62
- containerStyle : ViewStyleProp ,
63
- textStyle : TextStyleProp
68
+ containerStyle ?: ViewStyle ,
69
+ textStyle ?: TextStyle
64
70
) {
65
71
return (
66
72
< ScrollView
@@ -73,7 +79,7 @@ class Renderer {
73
79
) ;
74
80
}
75
81
76
- getBlockquoteNode ( children : ReactNode [ ] , styles : ViewStyleProp ) {
82
+ getBlockquoteNode ( children : ReactNode [ ] , styles ?: ViewStyle ) {
77
83
return (
78
84
< View key = { generateRandomString ( ) } style = { styles } >
79
85
{ children }
@@ -88,8 +94,8 @@ class Renderer {
88
94
getListNode (
89
95
ordered : boolean ,
90
96
li : ReactNode [ ] ,
91
- listStyle : ViewStyleProp ,
92
- textStyle : TextStyleProp
97
+ listStyle ?: ViewStyle ,
98
+ textStyle ?: TextStyle
93
99
) {
94
100
return (
95
101
< MarkedList
0 commit comments