1
- import _ from 'underscore' ;
2
1
import React from 'react' ;
3
2
import PropTypes from 'prop-types' ;
4
- import { ScrollView , View } from 'react-native' ;
5
- import Lottie from 'lottie-react-native' ;
3
+ import Lottie from './Lottie' ;
6
4
import headerWithBackButtonPropTypes from './HeaderWithBackButton/headerWithBackButtonPropTypes' ;
7
- import HeaderWithBackButton from './HeaderWithBackButton' ;
8
- import ScreenWrapper from './ScreenWrapper' ;
9
5
import styles from '../styles/styles' ;
10
6
import themeColors from '../styles/themes/default' ;
11
- import * as StyleUtils from '../styles/StyleUtils' ;
12
- import useWindowDimensions from '../hooks/useWindowDimensions' ;
13
- import FixedFooter from './FixedFooter' ;
14
- import useNetwork from '../hooks/useNetwork' ;
7
+ import HeaderPageLayout from './HeaderPageLayout' ;
15
8
16
9
const propTypes = {
17
10
...headerWithBackButtonPropTypes ,
@@ -30,59 +23,37 @@ const propTypes = {
30
23
31
24
/** Overlay content to display on top of animation */
32
25
overlayContent : PropTypes . func ,
33
-
34
- /** Whether to include padding top */
35
- includePaddingTop : PropTypes . bool ,
36
26
} ;
37
27
38
28
const defaultProps = {
39
29
backgroundColor : themeColors . appBG ,
40
30
footer : null ,
41
31
overlayContent : null ,
42
- includePaddingTop : true ,
43
32
} ;
44
33
45
- function IllustratedHeaderPageLayout ( { backgroundColor, children, illustration, footer, overlayContent, includePaddingTop, ...propsToPassToHeader } ) {
46
- const { windowHeight} = useWindowDimensions ( ) ;
47
- const { isOffline} = useNetwork ( ) ;
34
+ function IllustratedHeaderPageLayout ( { backgroundColor, children, illustration, footer, overlayContent, ...propsToPassToHeader } ) {
48
35
return (
49
- < ScreenWrapper
50
- style = { [ StyleUtils . getBackgroundColorStyle ( backgroundColor ) ] }
51
- shouldEnablePickerAvoiding = { false }
52
- includeSafeAreaPaddingBottom = { false }
53
- includePaddingTop = { includePaddingTop }
54
- offlineIndicatorStyle = { [ StyleUtils . getBackgroundColorStyle ( themeColors . appBG ) ] }
55
- >
56
- { ( { safeAreaPaddingBottomStyle} ) => (
36
+ < HeaderPageLayout
37
+ backgroundColor = { backgroundColor }
38
+ title = { propsToPassToHeader . title }
39
+ headerContent = {
57
40
< >
58
- < HeaderWithBackButton
59
- // eslint-disable-next-line react/jsx-props-no-spreading
60
- { ... propsToPassToHeader }
61
- titleColor = { backgroundColor === themeColors . appBG ? undefined : themeColors . textColorfulBackground }
62
- iconFill = { backgroundColor === themeColors . appBG ? undefined : themeColors . iconColorfulBackground }
41
+ < Lottie
42
+ source = { illustration }
43
+ style = { styles . w100 }
44
+ autoPlay
45
+ loop
63
46
/>
64
- < View style = { [ styles . flex1 , StyleUtils . getBackgroundColorStyle ( themeColors . appBG ) , ! isOffline ? safeAreaPaddingBottomStyle : { } ] } >
65
- < ScrollView
66
- contentContainerStyle = { safeAreaPaddingBottomStyle }
67
- showsVerticalScrollIndicator = { false }
68
- >
69
- < View style = { styles . overscrollSpacer ( backgroundColor , windowHeight ) } />
70
- < View style = { [ styles . alignItemsCenter , styles . justifyContentEnd , StyleUtils . getBackgroundColorStyle ( backgroundColor ) ] } >
71
- < Lottie
72
- source = { illustration }
73
- style = { styles . w100 }
74
- autoPlay
75
- loop
76
- />
77
- { overlayContent && overlayContent ( ) }
78
- </ View >
79
- < View style = { [ styles . pt5 ] } > { children } </ View >
80
- </ ScrollView >
81
- { ! _ . isNull ( footer ) && < FixedFooter > { footer } </ FixedFooter > }
82
- </ View >
47
+ { overlayContent && overlayContent ( ) }
83
48
</ >
84
- ) }
85
- </ ScreenWrapper >
49
+ }
50
+ headerContainerStyles = { [ styles . justifyContentCenter , styles . w100 ] }
51
+ footer = { footer }
52
+ // eslint-disable-next-line react/jsx-props-no-spreading
53
+ { ...propsToPassToHeader }
54
+ >
55
+ { children }
56
+ </ HeaderPageLayout >
86
57
) ;
87
58
}
88
59
0 commit comments