11import React from 'react' ;
22import { StyleSheet , Text , View , ScrollView } from 'react-native' ;
33import Markdown , {
4- AstRenderer , style , defaultRenderFunctions , PluginContainer , blockPlugin ,
4+ AstRenderer , styles , renderRules ,
55 getUniqueID
66} from 'react-native-markdown-renderer' ;
77
@@ -176,7 +176,7 @@ This is a text. Click [here](https://google.com) to open a link. Let's add some
176176 * i'm overriding the default h1 render function.
177177 */
178178const renderer = new AstRenderer ( {
179- ...defaultRenderFunctions ,
179+ ...renderRules ,
180180 h1 : ( node , children , parents ) => {
181181 return (
182182 < Text key = { getUniqueID ( ) } style = { { backgroundColor : 'red' } } > { children } </ Text >
@@ -188,23 +188,26 @@ const renderer = new AstRenderer({
188188 < Text key = { getUniqueID ( ) } style = { { backgroundColor : 'green' } } > { children } </ Text >
189189 ) ;
190190 } ,
191- } ) ;
191+ } , styles ) ;
192192
193193export default class App extends React . Component {
194194 render ( ) {
195+
196+
195197 return (
196198 < View style = { styles . container } >
199+
197200 < ScrollView >
198201 < Text > Markdown</ Text >
199202 < Text > --------</ Text >
200- < Markdown plugins = { [ ] } children = { markdownText } />
203+ < Markdown plugins = { [ ] } renderer = { renderer } children = { markdownText } />
201204 </ ScrollView >
202205 </ View >
203206 ) ;
204207 }
205208}
206209
207- const styles = StyleSheet . create ( {
210+ const styleSheet = StyleSheet . create ( {
208211 container : {
209212 flex : 1 ,
210213 backgroundColor : '#ffcc00' ,
0 commit comments