@@ -20,22 +20,23 @@ yarn add react-native-draftjs-render
20
20
```
21
21
22
22
### Using
23
- Just import and insert your Draft.js model on RNDraftJSRender :
23
+ Just import and insert your Draft.js model on getRNDraftJSBlocks :
24
24
25
25
``` js
26
26
import React from ' react' ;
27
27
import {
28
28
AppRegistry ,
29
29
} from ' react-native' ;
30
30
31
- import RNDraftJSRender from ' react-native-draftjs-render' ;
31
+ import getRNDraftJSBlocks from ' react-native-draftjs-render' ;
32
32
import contentState from ' DraftJs/contentState' ;
33
33
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
+ };
39
40
40
41
AppRegistry .registerComponent (' MyApp' , () => MyApp);
41
42
```
@@ -52,7 +53,7 @@ import {
52
53
StyleSheet ,
53
54
} from ' react-native' ;
54
55
55
- import RNDraftJSRender from ' react-native-draftjs-render' ;
56
+ import getRNDraftJSBlocks from ' react-native-draftjs-render' ;
56
57
import contentState from ' DraftJs/contentState' ;
57
58
58
59
const styles = StyleSheet .flatten ({
@@ -66,19 +67,19 @@ const styles = StyleSheet.flatten({
66
67
},
67
68
});
68
69
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
+ } ;
75
76
76
77
AppRegistry .registerComponent (' MyApp' , () => MyApp);
77
78
```
78
79
79
80
See more at ** [ Custom Styles] ( https://github.com/globocom/react-native-draftjs-render/blob/master/docs/CustomStyles.md ) ** documentation.
80
81
81
- ## Developing
82
+ ## Contributing
82
83
83
84
To develop using example react-native project:
84
85
0 commit comments