Skip to content

Commit

Permalink
feat: transparentHeader prop added
Browse files Browse the repository at this point in the history
  • Loading branch information
IdaszakDaniel committed Apr 30, 2020
1 parent ed9b783 commit aa8b1d0
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 9 deletions.
11 changes: 7 additions & 4 deletions src/StickyParallaxHeader.js
Expand Up @@ -175,7 +175,7 @@ class StickyParallaxHeader extends Component {
}

renderHeader = () => {
const { header, headerHeight, backgroundColor } = this.props
const { header, headerHeight, backgroundColor, transparentHeader } = this.props

const headerStyle = header.props.style
const isArray = Array.isArray(headerStyle)
Expand All @@ -192,7 +192,8 @@ class StickyParallaxHeader extends Component {
height: headerHeight,
backgroundColor: isArray
? arrayHeaderStyle.backgroundColor
: backgroundColor || headerStyle?.backgroundColor
: backgroundColor || headerStyle?.backgroundColor,
...( transparentHeader && styles.transparentHeader )
})
}
>
Expand Down Expand Up @@ -413,7 +414,8 @@ StickyParallaxHeader.propTypes = {
tabsContainerStyle: ViewPropTypes.style,
snapStartTreshold: number,
snapStopTreshold: number,
snapValue: number
snapValue: number,
transparentHeader: bool
}

StickyParallaxHeader.defaultProps = {
Expand All @@ -427,7 +429,8 @@ StickyParallaxHeader.defaultProps = {
tabTextContainerActiveStyle: {},
tabTextContainerStyle: {},
tabTextStyle: {},
tabWrapperStyle: {}
tabWrapperStyle: {},
transparentHeader: false
}

export default StickyParallaxHeader
11 changes: 7 additions & 4 deletions src/predefinedComponents/AvatarHeader/AvatarHeader.js
Expand Up @@ -184,7 +184,7 @@ class AvatarHeader extends React.Component {
bounces,
scrollEvent,
parallaxHeight,
foreground
transparentHeader
} = this.props

return (
Expand All @@ -205,6 +205,7 @@ class AvatarHeader extends React.Component {
bounces={bounces}
snapToEdge={snapToEdge}
parallaxHeight={parallaxHeight}
transparentHeader={transparentHeader}
>
{renderBody(Brandon)}
</StickyParallaxHeader>
Expand All @@ -229,9 +230,10 @@ AvatarHeader.propTypes = {
image: number,
renderBody: func,
scrollEvent: func,
parralaxHeight: number,
parallaxHeight: number,
foreground: func,
header: func
header: func,
transparentHeader: bool
}
AvatarHeader.defaultProps = {
leftTopIconOnPress: () => {},
Expand All @@ -248,7 +250,8 @@ AvatarHeader.defaultProps = {
bounces: true,
snapToEdge: true,
hasBorderRadius: true,
parallaxHeight: sizes.userScreenParallaxHeader
parallaxHeight: sizes.userScreenParallaxHeader,
transparentHeader: false
}

export default AvatarHeader
11 changes: 10 additions & 1 deletion src/styles.js
Expand Up @@ -30,11 +30,20 @@ const styles = StyleSheet.create({
right: 0,
overflow: 'scroll'
},
transparentBackground : {
transparentBackground: {
position: 'absolute',
left: 0,
bottom: 0,
backgroundColor: 'transparent'
},
transparentHeader: {
backgroundColor: 'transparent',
position: 'absolute',
top: 0,
left: 0,
right: 0,
overflow: 'hidden',
zIndex: 3
}
})

Expand Down

0 comments on commit aa8b1d0

Please sign in to comment.