2.0.0 • Published 5 years ago

react-native-header-scroll-view v2.0.0

Weekly downloads
49
License
MIT
Repository
github
Last release
5 years ago

react-native-header-scroll-view

A React Native component that mimicks Apple's large header that fades in a smaller header as you scroll, and slightly expands as you scroll up. You can see this effect in Apple's Messages, Books, etc.

header scroll view gif

Installation

# yarn
yarn add react-native-header-scroll-view

# npm
npm install react-native-header-scroll-view --save

Then, import with:

import HeaderScrollView from 'react-native-header-scroll-view';

Usage

Example usage:

import React, { Component } from 'react';
import { Text } from 'react-native';
import HeaderScrollView from 'react-native-header-scroll-view';

class App extends Component {
  render() {
    return (
      <HeaderScrollView title="For You">
        <Text>...</Text>
      </HeaderScrollView>
    );
  }
}

Props

For default Apple-style settings, you only need to provide:

PropTypeDescription
titlestringThe title of the header. This will show up as large text inside the scroll view and then fade in as the smaller text inside the header.

From there, you can customize this component to get exactly what you want.

PropTypeDescription
titleStyleReact Native style or ObjectStyles the large header title component inside the scroll view.
containerStyleReact Native style or ObjectStyles the entire container wrapping the header and the scrollview.
headerContainerStyleReact Native style or ObjectStyles the container of the header component that appears after scrolling.
headerComponentContainerStyleReact Native style or ObjectStyles the component inside the header. Anything within this style will fade in and out as the scroll position changes.
headlineStyleReact Native style or ObjectStyles the header text inside the header that appears after scrolling.
scrollContainerStyleReact Native style or ObjectStyles the scroll view component.
fadeDirectionStringWhen the header component fades, it can fade 'up' or 'down',
scrollViewPropsObjectPass any extra props to the scrollView.

Visual reference of the styles containers: