Skip to content

Commit 9f14362

Browse files
author
Igor Canedo
committed
updating readme
1 parent 60a55df commit 9f14362

File tree

2 files changed

+23
-22
lines changed

2 files changed

+23
-22
lines changed

README.md

+16-15
Original file line numberDiff line numberDiff line change
@@ -20,22 +20,23 @@ yarn add react-native-draftjs-render
2020
```
2121

2222
### Using
23-
Just import and insert your Draft.js model on RNDraftJSRender:
23+
Just import and insert your Draft.js model on getRNDraftJSBlocks:
2424

2525
```js
2626
import React from 'react';
2727
import {
2828
AppRegistry,
2929
} from 'react-native';
3030

31-
import RNDraftJSRender from 'react-native-draftjs-render';
31+
import getRNDraftJSBlocks from 'react-native-draftjs-render';
3232
import contentState from 'DraftJs/contentState';
3333

34-
const MyApp = () => (
35-
<RNDraftJSRender
36-
contentState={contentState}
37-
/>
38-
);
34+
const MyApp = () => {
35+
const blocks = getRNDraftJSBlocks({ contentState });
36+
return (
37+
<View style={{ flex: 1 }}>{blocks}</View>
38+
);
39+
};
3940

4041
AppRegistry.registerComponent('MyApp', () => MyApp);
4142
```
@@ -52,7 +53,7 @@ import {
5253
StyleSheet,
5354
} from 'react-native';
5455

55-
import RNDraftJSRender from 'react-native-draftjs-render';
56+
import getRNDraftJSBlocks from 'react-native-draftjs-render';
5657
import contentState from 'DraftJs/contentState';
5758

5859
const styles = StyleSheet.flatten({
@@ -66,19 +67,19 @@ const styles = StyleSheet.flatten({
6667
},
6768
});
6869

69-
const MyApp = () => (
70-
<RNDraftJSRender
71-
contentState={contentState}
72-
customStyles={styles}
73-
/>
74-
);
70+
const MyApp = () => {
71+
const blocks = getRNDraftJSBlocks({ contentState, customStyles: styles });
72+
return (
73+
<View style={{ flex: 1 }}>{blocks}</View>
74+
);
75+
};
7576

7677
AppRegistry.registerComponent('MyApp', () => MyApp);
7778
```
7879

7980
See more at **[Custom Styles](https://github.com/globocom/react-native-draftjs-render/blob/master/docs/CustomStyles.md)** documentation.
8081

81-
## Developing
82+
## Contributing
8283

8384
To develop using example react-native project:
8485

docs/CustomStyles.md

+7-7
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import {
88
StyleSheet,
99
} from 'react-native';
1010

11-
import RNDraftJSRender from 'react-native-draftjs-render';
11+
import getRNDraftJSBlocks from 'react-native-draftjs-render';
1212
import contentState from 'DraftJs/contentState';
1313

1414
const styles = StyleSheet.flatten({ // Use .flatten over .create
@@ -25,12 +25,12 @@ const styles = StyleSheet.flatten({ // Use .flatten over .create
2525
},
2626
});
2727

28-
const MyApp = () => (
29-
<RNDraftJSRender
30-
contentState={contentState}
31-
customStyles={styles}
32-
/>
33-
);
28+
const MyApp = () => {
29+
const blocks = getRNDraftJSBlocks({ contentState, customStyles: styles });
30+
return (
31+
<View style={{ flex: 1 }}>{blocks}</View>
32+
);
33+
};
3434

3535
AppRegistry.registerComponent('MyApp', () => MyApp);
3636
```

0 commit comments

Comments
 (0)