Skip to content

Commit

Permalink
feat: adds parallax height props to predefined headers
Browse files Browse the repository at this point in the history
  • Loading branch information
IdaszakDaniel committed May 17, 2021
1 parent 1dbee6f commit 70b9344
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
3 changes: 1 addition & 2 deletions src/index.d.ts
Expand Up @@ -42,6 +42,7 @@ export interface SharedProps {
refreshControl?: ReactElement;
decelerationRate: number | string;
children?: ReactElement;
parallaxHeight?: number;
}

export interface IconProps {
Expand Down Expand Up @@ -98,7 +99,6 @@ export type AvatarHeaderProps = SharedProps &
hasBorderRadius?: boolean;
header?: () => ReactElement;
image?: number;
parallaxHeight?: number;
renderBody?: (title: string) => ReactElement;
scrollEvent?: (event: NativeSyntheticEvent<NativeScrollEvent>) => void;
snapStartThreshold?: number;
Expand All @@ -121,7 +121,6 @@ export type CustomHeaderProps = SharedProps &
initialPage?: number;
onChangeTab?: (changeTabArguments: OnChangeTabArguments) => void;
onEndReached?: () => void;
parallaxHeight?: number;
scrollEvent?: (event: NativeSyntheticEvent<NativeScrollEvent>) => void;
snapStartThreshold?: number;
snapStopThreshold?: number;
Expand Down
5 changes: 4 additions & 1 deletion src/predefinedComponents/DetailsHeader/DetailsHeader.js
Expand Up @@ -141,6 +141,7 @@ class DetailsHeader extends React.Component {
headerHeight,
snapToEdge,
bounces,
parallaxHeight
} = this.props;

if (renderBody) {
Expand All @@ -154,7 +155,7 @@ class DetailsHeader extends React.Component {
foreground={this.renderForeground(user)}
header={this.renderHeader(user)}
deviceWidth={constants.deviceWidth}
parallaxHeight={sizes.cardScreenParallaxHeader}
parallaxHeight={parallaxHeight}
scrollEvent={event([{ nativeEvent: { contentOffset: { y: this.scrollY.y } } }], {
useNativeDriver: false,
})}
Expand Down Expand Up @@ -188,6 +189,7 @@ DetailsHeader.propTypes = {
snapToEdge: bool,
hasBorderRadius: bool,
iconNumber: number,
parallaxHeight: number
};
DetailsHeader.defaultProps = {
leftTopIconOnPress: () => {},
Expand All @@ -205,6 +207,7 @@ DetailsHeader.defaultProps = {
snapToEdge: true,
hasBorderRadius: true,
iconNumber: Brandon.cardsAmount,
parallaxHeight: sizes.cardScreenParallaxHeader
};

export default DetailsHeader;
5 changes: 4 additions & 1 deletion src/predefinedComponents/TabbedHeader/TabbedHeader.js
Expand Up @@ -163,6 +163,7 @@ export default class TabbedHeader extends React.Component {
contentContainerStyles,
refreshControl,
rememberTabScrollPosition,
parallaxHeight
} = this.props;

if (renderBody) {
Expand All @@ -181,7 +182,7 @@ export default class TabbedHeader extends React.Component {
foreground={this.renderForeground(this.scrollY)}
header={this.renderHeader()}
deviceWidth={constants.deviceWidth}
parallaxHeight={sizes.homeScreenParallaxHeader}
parallaxHeight={parallaxHeight}
scrollEvent={event([{ nativeEvent: { contentOffset: { y: this.scrollY.y } } }], {
useNativeDriver: false,
listener: (e) => scrollEvent && scrollEvent(e),
Expand Down Expand Up @@ -237,6 +238,7 @@ TabbedHeader.propTypes = {
titleStyle: Text.propTypes.style,
header: func,
onRef: func,
parallaxHeight: number
};

TabbedHeader.defaultProps = {
Expand Down Expand Up @@ -280,4 +282,5 @@ TabbedHeader.defaultProps = {
refreshControl: undefined,
scrollRef: null,
onRef: null,
parallaxHeight: sizes.homeScreenParallaxHeader
};

0 comments on commit 70b9344

Please sign in to comment.