@@ -36,25 +36,24 @@ const styles = StyleSheet.flatten({
36
36
subscript : {
37
37
// WIP
38
38
} ,
39
- "fontsize-14" : {
40
- fontSize : 20 ,
41
- fontFamily : 'Georgia'
42
- } ,
43
- "fontsize-12" : {
44
- fontSize : 18
45
- } ,
46
- "fontsize-11" : {
47
- fontSize : 16
48
- } ,
49
- "fontsize-10" : {
50
- fontSize : 14
51
- } ,
52
- "fontsize-9" : {
53
- fontSize : 12
54
- } ,
55
- "fontsize-8" : {
56
- fontSize : 10
57
- } ,
39
+ // "fontsize-14": {
40
+ // fontSize: 20
41
+ // },
42
+ // "fontsize-12": {
43
+ // fontSize: 18
44
+ // },
45
+ // "fontsize-11": {
46
+ // fontSize: 16
47
+ // },
48
+ // "fontsize-10": {
49
+ // fontSize: 14
50
+ // },
51
+ // "fontsize-9": {
52
+ // fontSize: 12
53
+ // },
54
+ // "fontsize-8": {
55
+ // fontSize: 10
56
+ // },
58
57
"fontfamily-georgia" : {
59
58
fontFamily : Platform . OS === 'ios' ? 'Georgia' : 'sans-serif'
60
59
} ,
@@ -73,19 +72,19 @@ const styles = StyleSheet.flatten({
73
72
} ) ;
74
73
75
74
const getStyles = ( itemType : any , customStyles : Object ) : any => {
76
- console . log ( itemType )
77
- console . log ( itemType . includes ( 'bgcolor' ) )
78
- if ( itemType . includes ( 'bgcolor' ) ) {
79
- return [ StyleSheet . flatten ( {
80
- backgroundColor : itemType . split ( '-' ) [ 1 ]
81
- } ) , customStyles [ itemType ] ]
82
- }
83
- if ( typeof itemType === 'string' ) return [ styles [ itemType ] , customStyles [ itemType ] ] ;
75
+ console . log ( "ITEM TYPE" , itemType )
76
+ // if (itemType.includes('bgcolor')) {
77
+ // return [StyleSheet.flatten({
78
+ // backgroundColor: itemType.split('-')[1]
79
+ // }), customStyles[itemType]]
80
+ // }
81
+ // if (typeof itemType === 'string') return [styles[itemType], customStyles[itemType]];
84
82
85
83
let defaultTextStyles = { } ;
86
84
let customTextStyles = { } ;
87
85
let bgcolorStyle = { }
88
86
let colorStyle = { }
87
+ let fontsizeStyle = { }
89
88
itemType . forEach ( ( i : string ) => {
90
89
if ( i . includes ( 'bgcolor' ) ) {
91
90
bgcolorStyle = StyleSheet . flatten ( {
@@ -97,10 +96,17 @@ const getStyles = (itemType: any, customStyles: Object): any => {
97
96
color : i . split ( '-' ) [ 1 ]
98
97
} )
99
98
}
99
+ if ( i . split ( '-' ) [ 0 ] === 'fontsize' ) {
100
+ let fontSize = Number ( i . split ( '-' ) [ 1 ] )
101
+ fontsizeStyle = StyleSheet . flatten ( {
102
+ lineHeight : fontSize + 10 ,
103
+ fontSize : fontSize
104
+ } )
105
+ }
100
106
Object . assign ( defaultTextStyles , styles [ i ] ) ;
101
107
Object . assign ( customTextStyles , customStyles [ i ] ) ;
102
108
} ) ;
103
- const newStyles = [ defaultTextStyles , customTextStyles , colorStyle , bgcolorStyle ] ;
109
+ const newStyles = [ defaultTextStyles , customTextStyles , colorStyle , bgcolorStyle , fontsizeStyle ] ;
104
110
return newStyles ;
105
111
} ;
106
112
0 commit comments