diff --git a/MarkdownView.js b/MarkdownView.js
index 973a484..1172050 100644
--- a/MarkdownView.js
+++ b/MarkdownView.js
@@ -7,6 +7,7 @@ import React, {
} from 'react'
import {
+ Text,
View,
} from 'react-native'
@@ -81,10 +82,11 @@ class MarkdownView extends Component {
onLinkPress?: (string) => void,
styles?: Styles,
children: string,
+ textProps?: Object,
}
render() {
- const {rules = {}, styles = {}, onLinkPress} = this.props
+ const {rules = {}, styles = {}, onLinkPress, textProps = {}} = this.props
const mergedStyles = mergeStyles(DefaultStyles, styles)
const mergedRules = mergeRules(SimpleMarkdown.defaultRules, simpleMarkdownRules(mergeRules(DefaultRules, rules), mergedStyles))
@@ -93,7 +95,7 @@ class MarkdownView extends Component {
const ast = SimpleMarkdown.parserFor(mergedRules)(markdown, {inline: false})
const render = SimpleMarkdown.reactFor(SimpleMarkdown.ruleOutput(mergedRules, 'react'))
- const initialRenderState = {onLinkPress: onLinkPress}
+ const initialRenderState = {onLinkPress: onLinkPress, textProps: textProps}
return (
@@ -163,6 +165,11 @@ MarkdownView.propTypes = {
* string (first and only argument).
*/
onLinkPress: PropTypes.func,
+
+ /**
+ * Props passed to all components. See https://facebook.github.io/react-native/docs/text#props
+ */
+ textProps: PropTypes.object,
}
export default MarkdownView
diff --git a/README.md b/README.md
index 65882d5..f5099e4 100644
--- a/README.md
+++ b/README.md
@@ -135,7 +135,11 @@ e.g.
}
```
-## onLinkPress
+### onLinkPress
Callback function for when a link is pressed. The callback receives the URL of the link as a
string (first and only argument).
+
+### textProps
+
+Props passed to all `` components. See https://facebook.github.io/react-native/docs/text#props
diff --git a/renders.js b/renders.js
index 93d986f..f872ae5 100644
--- a/renders.js
+++ b/renders.js
@@ -70,7 +70,7 @@ function renderTableCell(cell, row, column, rowCount, columnCount, output, state
}
return |
-
+
{output(cell, state)}
|
@@ -91,7 +91,7 @@ function paragraphRenderer() {
function textContentRenderer(styleName, styleName2) {
return (node: InlineContentNode, output: OutputFunction, state: RenderState, styles: RenderStyles) => (
-
+
{typeof node.content === 'string' ? node.content : output(node.content, state)}
)
@@ -119,7 +119,7 @@ function paddedSize(size, style) {
export default Object.freeze({
blockQuote: textContentRenderer('blockQuote'),
br: (node: EmptyNode, output: OutputFunction, state: RenderState, styles: RenderStyles) => (
-
+
{'\n\n'}
),
@@ -136,7 +136,7 @@ export default Object.freeze({
inlineCode: textContentRenderer('inlineCode'),
link: (node: LinkNode, output: OutputFunction, state: RenderState, styles: RenderStyles) => {
const onPress = state.onLinkPress
- return onPress(node.target) : null}>
+ return onPress(node.target) : null}>
{typeof node.content === 'string' ? node.content : output(node.content, state)}
},
@@ -146,13 +146,13 @@ export default Object.freeze({
{
node.ordered ?
- {`${i + 1}.`}
+ {`${i + 1}.`}
:
-
+
{styles.listItemBullet && styles.listItemBullet.content ? styles.listItemBullet.content : '\u2022'}
}
-
+
{output(item, state)}
@@ -160,7 +160,7 @@ export default Object.freeze({
),
newline: (node: EmptyNode, output: OutputFunction, state: RenderState, styles: RenderStyles) => (
-
+
{'\n'}
),
diff --git a/types.js b/types.js
index c3f9399..4dfc1a6 100644
--- a/types.js
+++ b/types.js
@@ -75,7 +75,8 @@ export type NodeKey = string
export type OutputFunction = (Node, Object) => ?any
export type RenderState = {
key: string,
- onLinkPress: ?(string) => void
+ onLinkPress: ?(string) => void,
+ textProps: Object,
}
export type RenderStyle = Object
export type RenderStyles = {[key: NodeKey]: RenderStyle}