7
7
// @flow
8
8
9
9
import React from 'react' ;
10
- import {
11
- View ,
12
- } from 'react-native' ;
10
+ import { View } from 'react-native' ;
13
11
14
12
import BlockQuote from './components/BlockQuote' ;
15
13
import DraftJsText from './components/DraftJsText' ;
@@ -23,16 +21,22 @@ type ParamsType = {
23
21
atomicHandler : Function ,
24
22
navigate ?: Function ,
25
23
orderedListSeparator ?: string ,
26
- customBlockHandler ?: ( Object , ParamsType ) => any
24
+ customBlockHandler ?: ( Object , ParamsType ) => any ,
25
+ depthMargin ?: number ,
27
26
} ;
28
27
28
+ export const ViewAfterList = ( props : Object ) : React$Element < * > => (
29
+ < View { ...props } />
30
+ ) ;
31
+
29
32
const getBlocks = ( params : ParamsType ) : ?Array < * > => {
30
33
const {
31
34
contentState,
32
35
customStyles,
33
36
navigate,
34
37
orderedListSeparator,
35
38
customBlockHandler,
39
+ depthMargin,
36
40
} = params ;
37
41
let { atomicHandler } = params ;
38
42
@@ -55,19 +59,19 @@ const getBlocks = (params: ParamsType): ?Array<*> => {
55
59
} ,
56
60
} ;
57
61
58
- function ViewAfterList ( ) : any {
59
- return < View style = { customStyles . viewAfterList } /> ;
60
- }
61
-
62
- function checkCounter ( counter : Object ) : any {
62
+ const checkCounter = ( counter : Object ) : any => {
63
63
const myCounter = counter ;
64
64
65
-
66
65
// list types
67
66
if ( myCounter . count >= 0 ) {
68
67
if ( myCounter . count > 0 ) {
69
68
myCounter . count = 0 ;
70
- return < ViewAfterList key = { generateKey ( ) } /> ;
69
+ return (
70
+ < ViewAfterList
71
+ style = { customStyles && customStyles . viewAfterList }
72
+ key = { generateKey ( ) }
73
+ />
74
+ ) ;
71
75
}
72
76
return null ;
73
77
}
@@ -76,11 +80,16 @@ const getBlocks = (params: ParamsType): ?Array<*> => {
76
80
if ( myCounter [ 'unordered-list-item' ] . count > 0 || myCounter [ 'ordered-list-item' ] . count > 0 ) {
77
81
myCounter [ 'unordered-list-item' ] . count = 0 ;
78
82
myCounter [ 'ordered-list-item' ] . count = 0 ;
79
- return < ViewAfterList key = { generateKey ( ) } /> ;
83
+ return (
84
+ < ViewAfterList
85
+ style = { customStyles && customStyles . viewAfterList }
86
+ key = { generateKey ( ) }
87
+ />
88
+ ) ;
80
89
}
81
90
82
91
return null ;
83
- }
92
+ } ;
84
93
85
94
return contentState . blocks
86
95
. map ( ( item : Object ) : any => {
@@ -158,6 +167,7 @@ const getBlocks = (params: ParamsType): ?Array<*> => {
158
167
entityMap = { contentState . entityMap }
159
168
customStyles = { customStyles }
160
169
navigate = { navigate }
170
+ defaultMarginLeft = { depthMargin }
161
171
/>
162
172
</ View >
163
173
) ;
@@ -195,6 +205,7 @@ const getBlocks = (params: ParamsType): ?Array<*> => {
195
205
entityMap = { contentState . entityMap }
196
206
customStyles = { customStyles }
197
207
navigate = { navigate }
208
+ defaultMarginLeft = { depthMargin }
198
209
/>
199
210
</ View >
200
211
) ;
@@ -212,4 +223,4 @@ const getBlocks = (params: ParamsType): ?Array<*> => {
212
223
} ) ;
213
224
} ;
214
225
215
- module . exports = getBlocks ;
226
+ export default getBlocks ;
0 commit comments