From 909e1673d5099cfe1d5b31485b48271ca91f32af Mon Sep 17 00:00:00 2001 From: ManigandanRaamanathan Date: Wed, 5 Feb 2020 05:06:59 +0800 Subject: [PATCH 1/4] Added more props and feature Added more styling props, header contents, statusbar customisation props and more. --- index.js | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/index.js b/index.js index a7244cc..fac0d33 100644 --- a/index.js +++ b/index.js @@ -30,7 +30,7 @@ const DEFAULT_TITLE_COLOR = 'white'; const styles = StyleSheet.create({ container: { - backgroundColor: 'white', + // backgroundColor: 'white', flex: 1, }, scrollView: { @@ -240,14 +240,14 @@ class RNParallax extends Component { height: this.getHeaderHeight(), backgroundColor: navbarColor, opacity: navBarOpacity, - }, + }, this.props.headerStyle ]} /> ); } renderHeaderBackground() { - const { backgroundImage, backgroundColor } = this.props; + const { backgroundImage, backgroundColor, headerContent } = this.props; const imageOpacity = this.getImageOpacity(); return ( @@ -258,9 +258,10 @@ class RNParallax extends Component { height: this.getHeaderHeight(), opacity: imageOpacity, backgroundColor: backgroundImage ? 'transparent' : backgroundColor, - }, + }, this.props.headerStyle ]} > + {headerContent? headerContent() : null} {backgroundImage && this.renderBackgroundImage()} {!backgroundImage && this.renderPlainBackground()} @@ -340,11 +341,12 @@ class RNParallax extends Component { } render() { - const { navbarColor, statusBarColor, containerStyle } = this.props; + const { navbarColor, statusBarColor, containerStyle, statusBarStyle, statusBarTranslucent } = this.props; return ( {this.renderScrollView()} {this.renderNavbarBackground()} @@ -377,7 +379,11 @@ RNParallax.propTypes = { alwaysShowTitle: PropTypes.bool, alwaysShowNavBar: PropTypes.bool, statusBarColor: PropTypes.string, + statusBarTranslucent: PropTypes.bool, + statusBarStyle: PropTypes.string, scrollViewProps: PropTypes.object, + headerStyle: PropTypes.object, + headerContent: PropTypes.func }; RNParallax.defaultProps = { @@ -401,6 +407,8 @@ RNParallax.defaultProps = { alwaysShowNavBar: true, statusBarColor: null, scrollViewProps: {}, + headerStyle: {}, + headerContent: null }; export default RNParallax; From 78baf61fec1bbc3c794d17bdc2f20abaf852fa5b Mon Sep 17 00:00:00 2001 From: ManigandanRaamanathan Date: Sat, 30 Jan 2021 01:09:14 +0800 Subject: [PATCH 2/4] Update index.js Fixes hidden pull to refresh refresh indicator --- index.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/index.js b/index.js index fac0d33..a41f462 100644 --- a/index.js +++ b/index.js @@ -35,6 +35,13 @@ const styles = StyleSheet.create({ }, scrollView: { flex: 1, + + //Fixes missing pull to refresh refresh indicator + position: 'absolute', + bottom: 0, + left: 0, + right: 0, + height: '100%', }, header: { position: 'absolute', @@ -348,11 +355,13 @@ class RNParallax extends Component { backgroundColor={statusBarColor || navbarColor} translucent={statusBarTranslucent} barStyle={statusBarStyle? statusBarStyle : 'dark-content'} /> - {this.renderScrollView()} {this.renderNavbarBackground()} {this.renderHeaderBackground()} {this.renderHeaderTitle()} {this.renderHeaderForeground()} + + //Fixes missing pull to refresh refresh indicator + {this.renderScrollView()} ); } From 960c0e0d27ca85d52afface504495edcf43e8d76 Mon Sep 17 00:00:00 2001 From: ManigandanRaamanathan Date: Sat, 30 Jan 2021 01:51:47 +0800 Subject: [PATCH 3/4] Updated default props Updated default props on statusbar --- index.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/index.js b/index.js index a41f462..4b1ed94 100644 --- a/index.js +++ b/index.js @@ -415,6 +415,8 @@ RNParallax.defaultProps = { alwaysShowTitle: true, alwaysShowNavBar: true, statusBarColor: null, + statusBarTranslucent: false, + statusBarStyle: 'dark-content', scrollViewProps: {}, headerStyle: {}, headerContent: null From 88580f239893d79a175774227f76a9cd3e256f6d Mon Sep 17 00:00:00 2001 From: ManigandanRaamanathan Date: Mon, 8 Feb 2021 20:24:22 +0800 Subject: [PATCH 4/4] Update index.js --- index.js | 1 - 1 file changed, 1 deletion(-) diff --git a/index.js b/index.js index b08511f..5e93099 100644 --- a/index.js +++ b/index.js @@ -370,7 +370,6 @@ class RNParallax extends Component { {this.renderHeaderTitle()} {this.renderHeaderForeground()} - //Fixes missing pull to refresh refresh indicator {this.renderScrollView()} );