react-native-markdown-renderer
react-native-markdown-renderer copied to clipboard
Blockquote text style
trafficstars
Is it possible to style Text inside the blockquote?
👍 Need that too
This is really quick and dirty but I used this rule:
let styleChildren = function(child, style){
let grandChildren = []
let childStyle = {}
if(_.isNil(child)){
return child
}
if('props' in child && 'children' in child.props){
if(typeof(child.props.children) != 'object'){
grandChildren = child.props.children
}else{
grandChildren = _.map(child.props.children, (grandChild) => {
return this.styleChildren(grandChild, style)
})
}
if(child.props.style){
childStyle = child.props.style
}
}
return React.cloneElement(child, {
key: getUniqueID(),
style: {...childStyle, ...style},
children: grandChildren
})
}
Then apply that like so
<Markdown rules={rules}>
{myMarkDown}
</Markdown>
Probably has a tonne of knock on effects by overriding all the style of all the child objects, but it's working for me so far!
_ is of course lodash so you'll need import _ 'lodash'; or to replace the map function.