Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 29 additions & 8 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,18 @@ const DEFAULT_TITLE_COLOR = 'white';

const styles = StyleSheet.create({
container: {
backgroundColor: 'white',
// backgroundColor: 'white',
flex: 1,
},
scrollView: {
flex: 1,

//Fixes missing pull to refresh refresh indicator
position: 'absolute',
bottom: 0,
left: 0,
right: 0,
height: '100%',
},
header: {
position: 'absolute',
Expand Down Expand Up @@ -242,14 +249,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 (
Expand All @@ -260,8 +267,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()}
</Animated.View>
Expand Down Expand Up @@ -349,15 +358,19 @@ class RNParallax extends Component {
}

render() {
const {navbarColor, statusBarColor, containerStyle} = this.props;
const { navbarColor, statusBarColor, containerStyle, statusBarStyle, statusBarTranslucent } = this.props;
return (
<View style={[styles.container, containerStyle]}>
<StatusBar backgroundColor={statusBarColor || navbarColor} />
{this.renderScrollView()}
<StatusBar
backgroundColor={statusBarColor || navbarColor}
translucent={statusBarTranslucent} barStyle={statusBarStyle? statusBarStyle : 'dark-content'}
/>
{this.renderNavbarBackground()}
{this.renderHeaderBackground()}
{this.renderHeaderTitle()}
{this.renderHeaderForeground()}

{this.renderScrollView()}
</View>
);
}
Expand All @@ -384,7 +397,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 = {
Expand All @@ -407,7 +424,11 @@ RNParallax.defaultProps = {
alwaysShowTitle: true,
alwaysShowNavBar: true,
statusBarColor: null,
statusBarTranslucent: false,
statusBarStyle: 'dark-content',
scrollViewProps: {},
headerStyle: {},
headerContent: null
};

export default RNParallax;