Skip to content

Commit 286b074

Browse files
committed
fixing example issues referring to old 1.3.6 code.
updating description
1 parent a53f4a4 commit 286b074

File tree

4 files changed

+14
-9
lines changed

4 files changed

+14
-9
lines changed

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,9 @@ To give a summary of the supported syntax react-native-markdown-renderer support
3737
| ---- | ---- | ------- |
3838
| v | 16.0.0-alpha.12 | 0.45.1 |
3939
| v | 16.0.0-alpha.6 | 0.44.0 |
40-
| v | ^15.6.1 | ^0.46.4 |
41-
| v | ^15.6.1 | ^0.48.3 |
40+
| x | 15.x | ^0.46.4 |
41+
42+
``` // react 15 seems to break with expo.```
4243

4344
### Todo
4445
- ~~add styleSheet support~~

example/App.js

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import React from 'react';
22
import { StyleSheet, Text, View, ScrollView } from 'react-native';
33
import 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
*/
178178
const 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

193193
export 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',

example/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@
1515
},
1616
"dependencies": {
1717
"expo": "^18.0.3",
18-
"react": "^15.6.1",
19-
"react-native": "^0.48.3",
18+
"react": "16.0.0-alpha.12",
19+
"react-native": "^0.45.1",
2020
"react-native-markdown-renderer": "git+https://github.com/mientjan/react-native-markdown-renderer.git"
2121
},
2222
"devDependencies": {

index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ export {
3232
MarkdownIt,
3333
PluginContainer,
3434
blockPlugin,
35+
styles
3536
};
3637

3738
export default class Markdown extends Component {

0 commit comments

Comments
 (0)