11import React , { Component , PropTypes } from 'react' ;
2- import { Linking , Text , View } from 'react-native' ;
2+ import { Text , View } from 'react-native' ;
33
44import FitImage from 'react-native-fit-image' ;
55import { markdownStyles } from './style' ;
66import AstRenderer from './AstRenderer' ;
77
8- const openUrl = url => {
9- Linking . openURL ( url ) ;
10- } ;
118
12- const hasParents = ( parents , type ) => {
13- return parents . findIndex ( el => el . type === type ) > - 1 ;
14- } ;
9+
10+
1511
1612const defaultRenderFunctions = {
1713 // when unknown elements are introduced, so it wont break
@@ -57,13 +53,13 @@ const defaultRenderFunctions = {
5753 } ,
5854 a : ( node , children ) => {
5955 return (
60- < Text style = { markdownStyles . a } onPress = { ( ) => openUrl ( node . attributes . href ) } >
56+ < Text style = { markdownStyles . a } onPress = { ( ) => AstRenderer . openUrl ( node . attributes . href ) } >
6157 { children }
6258 </ Text >
6359 ) ;
6460 } ,
6561 em : ( node , children , parents ) => {
66- if ( hasParents ( parents , 'ICONLIST' ) ) {
62+ if ( AstRenderer . hasParents ( parents , 'ICONLIST' ) ) {
6763 return (
6864 < Text style = { markdownStyles . icon } key = { AstRenderer . getUniqueID ( ) } >
6965 { children }
@@ -149,7 +145,7 @@ const defaultRenderFunctions = {
149145 ) ;
150146 } ,
151147 li : ( node , children , parents ) => {
152- if ( hasParents ( parents , 'ul' ) ) {
148+ if ( AstRenderer . hasParents ( parents , 'ul' ) ) {
153149 return (
154150 < View key = { AstRenderer . getUniqueID ( ) } style = { markdownStyles . listUnorderedItem } >
155151 < Text style = { { marginLeft : - 10 , marginRight : 10 , lineHeight : 40 } } >
@@ -162,7 +158,7 @@ const defaultRenderFunctions = {
162158 ) ;
163159 }
164160
165- if ( hasParents ( parents , 'ol' ) ) {
161+ if ( AstRenderer . hasParents ( parents , 'ol' ) ) {
166162 return (
167163 < View key = { AstRenderer . getUniqueID ( ) } style = { { flexDirection : 'row' } } >
168164 < Text style = { { width : 20 , lineHeight : 40 } } >
0 commit comments