Skip to content

Commit 5e36aa7

Browse files
raphaelporemilianoeloi
authored andcommitted
Add a basic documentation for custom styles (#14)
1 parent 0b49488 commit 5e36aa7

File tree

2 files changed

+92
-1
lines changed

2 files changed

+92
-1
lines changed

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@ const MyApp = () => (
4040
AppRegistry.registerComponent('MyApp', () => MyApp);
4141
```
4242

43+
See our [`sample`](https://github.com/globocom/react-native-draftjs-render/tree/master/sample) folder for more details.
44+
4345
### Adding custom styles
4446
RNDraftJSRender comes with default styles, but you can use your own:
4547

@@ -74,7 +76,7 @@ const MyApp = () => (
7476
AppRegistry.registerComponent('MyApp', () => MyApp);
7577
```
7678

77-
See our [`sample`](https://github.com/globocom/react-native-draftjs-render/tree/master/sample) folder for more details.
79+
See more at **[Custom Styles](https://github.com/globocom/react-native-draftjs-render/blob/master/docs/CustomStyles.md)** documentation.
7880

7981
## Developing
8082

docs/CustomStyles.md

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
# Custom Styles
2+
RNDraftJSRender comes with default styles, but you can use your own with the `customStyles` property:
3+
4+
```js
5+
import React from 'react';
6+
import {
7+
AppRegistry,
8+
StyleSheet,
9+
} from 'react-native';
10+
11+
import RNDraftJSRender from 'react-native-draftjs-render';
12+
import contentState from 'DraftJs/contentState';
13+
14+
const styles = StyleSheet.create({
15+
'header-one': {
16+
fontSize: 20,
17+
},
18+
paragraph: {
19+
color: 'pink',
20+
fontSize: 14,
21+
},
22+
link: {
23+
color: 'blue',
24+
fontWeight: 'bold',
25+
},
26+
});
27+
28+
const MyApp = () => (
29+
<RNDraftJSRender
30+
contentState={contentState}
31+
customStyles={styles}
32+
/>
33+
);
34+
35+
AppRegistry.registerComponent('MyApp', () => MyApp);
36+
```
37+
38+
## List of styles available
39+
40+
### Text styles
41+
42+
All the elements (except `'code-block'`) can have inner styles and been customized with:
43+
44+
- `bold`
45+
46+
- `italic`
47+
48+
- `link`
49+
50+
- `underline`
51+
52+
- `strikethrough`
53+
54+
### Elements
55+
56+
Each element have your own style and helper styles to use:
57+
58+
- `blockquote`
59+
- `blockquoteContainer`
60+
- `blockquoteIconBefore`
61+
- `blockquoteIconAfter`
62+
63+
- `'code-block'`
64+
65+
- `'header-one'`
66+
67+
- `'header-two'`
68+
69+
- `'header-three'`
70+
71+
- `'header-four'`
72+
73+
- `'header-five'`
74+
75+
- `'header-six'`
76+
77+
- `'ordered-list-item'`
78+
- `orderedListItemContainer`
79+
- `orderedListItemNumber`
80+
81+
- `paragraph`
82+
83+
- `'unordered-list-item'`
84+
- `unorderedListItemContainer`
85+
- `unorderedListItemBullet`
86+
87+
- `unstyled`
88+
89+
- `viewAfterList` (View placed after a list to handle styles at the end of each one)

0 commit comments

Comments
 (0)