Skip to content

Commit 251271f

Browse files
author
Raphael Freitas
committed
Update docs
Add GetStarded.md and update README.md and CustomStyles.md
1 parent 8a4738f commit 251271f

File tree

3 files changed

+61
-4
lines changed

3 files changed

+61
-4
lines changed

README.md

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,19 @@ A React Native render for [Draft.js](http://draftjs.org/) model.
1616

1717
Join the [#react-native-render](https://draftjs.slack.com/messages/react_native_render) channel on DraftJS Slack team.
1818

19+
## Documentation
20+
21+
* [Get Started](https://github.com/globocom/react-native-draftjs-render/blob/master/docs/GetStarted.md)
22+
* [Custom Styles](https://github.com/globocom/react-native-draftjs-render/blob/master/docs/CustomStyles.md)
23+
* Atomic Types (to do).
24+
1925
## Getting Started
2026
Install **React Native Draft.js Render** on your React Native project, using NPM or Yarn:
2127

2228
```sh
23-
npm i -S react-native-draftjs-render
24-
# or...
2529
yarn add react-native-draftjs-render
30+
# or...
31+
npm i -S react-native-draftjs-render
2632
```
2733

2834
### Using
@@ -31,6 +37,7 @@ Just import and insert your Draft.js model on getRNDraftJSBlocks:
3137
```js
3238
import React from 'react';
3339
import {
40+
ScrollView,
3441
AppRegistry,
3542
} from 'react-native';
3643

@@ -40,7 +47,7 @@ import contentState from 'DraftJs/contentState';
4047
const MyApp = () => {
4148
const blocks = getRNDraftJSBlocks({ contentState });
4249
return (
43-
<View style={{ flex: 1 }}>{blocks}</View>
50+
<ScrollView style={{ flex: 1 }}>{blocks}</ScrollView>
4451
);
4552
};
4653

docs/CustomStyles.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ RNDraftJSRender comes with default styles, but you can use your own with the `cu
44
```js
55
import React from 'react';
66
import {
7+
ScrollView,
78
AppRegistry,
89
StyleSheet,
910
} from 'react-native';
@@ -28,7 +29,7 @@ const styles = StyleSheet.flatten({ // Use .flatten over .create
2829
const MyApp = () => {
2930
const blocks = getRNDraftJSBlocks({ contentState, customStyles: styles });
3031
return (
31-
<View style={{ flex: 1 }}>{blocks}</View>
32+
<ScrollView style={{ flex: 1 }}>{blocks}</ScrollView>
3233
);
3334
};
3435

docs/GetStarted.md

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
# Get Started
2+
3+
First, install **React Native Draft.js Render** on your React Native project, using NPM or Yarn:
4+
5+
```sh
6+
yarn add react-native-draftjs-render
7+
# or...
8+
npm i -S react-native-draftjs-render
9+
```
10+
11+
## How to Use
12+
13+
Just import and insert your Draft.js model on RNDraftJSRender:
14+
15+
```js
16+
import React from 'react';
17+
import {
18+
ScrollView,
19+
AppRegistry,
20+
} from 'react-native';
21+
22+
import getRNDraftJSBlocks from 'react-native-draftjs-render';
23+
import contentState from 'DraftJs/contentState';
24+
25+
const MyApp = () => {
26+
const blocks = getRNDraftJSBlocks({ contentState });
27+
return (
28+
<ScrollView style={{ flex: 1 }}>{blocks}</ScrollView>
29+
);
30+
};
31+
32+
AppRegistry.registerComponent('MyApp', () => MyApp);
33+
```
34+
35+
* `contentState`: the Draft.js model with `blocks` and `entityMap` nodes.
36+
```js
37+
// Flow type for contentState
38+
type contentState: {
39+
blocks: Array<Object>,
40+
entityMap: Object,
41+
};
42+
```
43+
44+
See our [`sample`](https://github.com/globocom/react-native-draftjs-render/tree/master/sample) folder for more details.
45+
46+
## Next
47+
48+
1. **[Custom Styles](https://github.com/globocom/react-native-draftjs-render/blob/master/docs/CustomStyles.md)**.
49+
2. Atomic Types (To do).

0 commit comments

Comments
 (0)