77// @flow
88
99import React from 'react' ;
10- import {
11- View ,
12- } from 'react-native' ;
10+ import { View } from 'react-native' ;
1311
1412import BlockQuote from './components/BlockQuote' ;
1513import DraftJsText from './components/DraftJsText' ;
@@ -23,16 +21,22 @@ type ParamsType = {
2321 atomicHandler : Function ,
2422 navigate ?: Function ,
2523 orderedListSeparator ?: string ,
26- customBlockHandler ?: ( Object , ParamsType ) => any
24+ customBlockHandler ?: ( Object , ParamsType ) => any ,
25+ depthMargin ?: number ,
2726} ;
2827
28+ export const ViewAfterList = ( props : Object ) : React$Element < * > => (
29+ < View { ...props } />
30+ ) ;
31+
2932const getBlocks = ( params : ParamsType ) : ?Array < * > => {
3033 const {
3134 contentState,
3235 customStyles,
3336 navigate,
3437 orderedListSeparator,
3538 customBlockHandler,
39+ depthMargin,
3640 } = params ;
3741 let { atomicHandler } = params ;
3842
@@ -55,19 +59,19 @@ const getBlocks = (params: ParamsType): ?Array<*> => {
5559 } ,
5660 } ;
5761
58- function ViewAfterList ( ) : any {
59- return < View style = { customStyles . viewAfterList } /> ;
60- }
61-
62- function checkCounter ( counter : Object ) : any {
62+ const checkCounter = ( counter : Object ) : any => {
6363 const myCounter = counter ;
6464
65-
6665 // list types
6766 if ( myCounter . count >= 0 ) {
6867 if ( myCounter . count > 0 ) {
6968 myCounter . count = 0 ;
70- return < ViewAfterList key = { generateKey ( ) } /> ;
69+ return (
70+ < ViewAfterList
71+ style = { customStyles && customStyles . viewAfterList }
72+ key = { generateKey ( ) }
73+ />
74+ ) ;
7175 }
7276 return null ;
7377 }
@@ -76,11 +80,16 @@ const getBlocks = (params: ParamsType): ?Array<*> => {
7680 if ( myCounter [ 'unordered-list-item' ] . count > 0 || myCounter [ 'ordered-list-item' ] . count > 0 ) {
7781 myCounter [ 'unordered-list-item' ] . count = 0 ;
7882 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+ ) ;
8089 }
8190
8291 return null ;
83- }
92+ } ;
8493
8594 return contentState . blocks
8695 . map ( ( item : Object ) : any => {
@@ -158,6 +167,7 @@ const getBlocks = (params: ParamsType): ?Array<*> => {
158167 entityMap = { contentState . entityMap }
159168 customStyles = { customStyles }
160169 navigate = { navigate }
170+ defaultMarginLeft = { depthMargin }
161171 />
162172 </ View >
163173 ) ;
@@ -195,6 +205,7 @@ const getBlocks = (params: ParamsType): ?Array<*> => {
195205 entityMap = { contentState . entityMap }
196206 customStyles = { customStyles }
197207 navigate = { navigate }
208+ defaultMarginLeft = { depthMargin }
198209 />
199210 </ View >
200211 ) ;
@@ -212,4 +223,4 @@ const getBlocks = (params: ParamsType): ?Array<*> => {
212223 } ) ;
213224} ;
214225
215- module . exports = getBlocks ;
226+ export default getBlocks ;
0 commit comments