@@ -5,6 +5,8 @@ import FitImage from "react-native-fit-image";
55import getUniqueID from "./util/getUniqueID" ;
66import openUrl from "./util/openUrl" ;
77import hasParents from "./util/hasParents" ;
8+ import applyStyle from "./util/applyStyle" ;
9+ import ImageComponent from "./ImageComponent" ;
810
911const renderRules = {
1012 // when unknown elements are introduced, so it wont break
@@ -69,34 +71,45 @@ const renderRules = {
6971 ) ;
7072 } ,
7173
72- heading1 : ( node , children , parent , styles ) => (
73- < View key = { node . key } style = { [ styles . heading , styles . heading1 ] } >
74- { children }
75- </ View >
76- ) ,
77- heading2 : ( node , children , parent , styles ) => (
78- < View key = { node . key } style = { [ styles . heading , styles . heading2 ] } >
79- { children }
80- </ View >
81- ) ,
74+ heading1 : ( node , children , parent , styles ) => {
75+ return (
76+ < View key = { node . key } style = { styles . headingContainer } >
77+ { applyStyle ( children , [ styles . heading , styles . heading1 ] , "Text" ) }
78+ </ View >
79+ ) ;
80+ } ,
81+
82+ heading2 : ( node , children , parent , styles ) => {
83+
84+ children = applyStyle ( children , [ styles . heading , styles . heading2 ] , "Text" ) ;
85+
86+ console . log ( children ) ;
87+
88+
89+ return (
90+ < View key = { node . key } style = { styles . headingContainer } >
91+ { children }
92+ </ View >
93+ ) ;
94+ } ,
8295 heading3 : ( node , children , parent , styles ) => (
83- < View key = { node . key } style = { [ styles . heading , styles . heading3 ] } >
84- { children }
96+ < View key = { node . key } style = { styles . headingContainer } >
97+ { applyStyle ( children , [ styles . heading , styles . heading3 ] , "Text" ) }
8598 </ View >
8699 ) ,
87100 heading4 : ( node , children , parent , styles ) => (
88- < View key = { node . key } style = { [ styles . heading , styles . heading4 ] } >
89- { children }
101+ < View key = { node . key } style = { styles . headingContainer } >
102+ { applyStyle ( children , [ styles . heading , styles . heading4 ] , "Text" ) }
90103 </ View >
91104 ) ,
92105 heading5 : ( node , children , parent , styles ) => (
93- < View key = { node . key } style = { [ styles . heading , styles . heading5 ] } >
94- { children }
106+ < View key = { node . key } style = { styles . headingContainer } >
107+ { applyStyle ( children , [ styles . heading , styles . heading5 ] , "Text" ) }
95108 </ View >
96109 ) ,
97110 heading6 : ( node , children , parent , styles ) => (
98- < View key = { node . key } style = { [ styles . heading , styles . heading6 ] } >
99- { children }
111+ < View key = { node . key } style = { styles . headingContainer } >
112+ { applyStyle ( children , [ styles . heading , styles . heading6 ] , "Text" ) }
100113 </ View >
101114 ) ,
102115
@@ -222,10 +235,10 @@ const renderRules = {
222235 ) ,
223236 image : ( node , children , parent , styles ) => {
224237 return (
225- < FitImage
238+ < ImageComponent
226239 key = { node . key }
227- style = { { margin : 1 } }
228- source = { { uri : node . attributes . src } }
240+ style = { styles . image }
241+ uri = { node . attributes . src }
229242 />
230243 ) ;
231244 }
0 commit comments