Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

A React Native component that creates a Apple-esque large header that fades in a smaller header as you scroll.

License

NotificationsYou must be signed in to change notification settings

jonsamp/react-native-header-scroll-view

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

25 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation


🚨 DEPRECATED and unmaintained 🚨

This library is an emulation of native iOS large headers. Now you can access the real thing withreact-native-screens/native-stack. This library is a drop-in replacement for React Navigation's stack view, and includes direct access to native large headers/transitions etc. It has awesome performance.

You can see it in action in this app:github,download on the app stores.


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

# yarnyarn add react-native-header-scroll-view# npmnpm install react-native-header-scroll-view --save

Then, import with:

importHeaderScrollViewfrom'react-native-header-scroll-view';

Usage

Example usage:

importReact,{Component}from'react';import{Text}from'react-native';importHeaderScrollViewfrom'react-native-header-scroll-view';classAppextendsComponent{render(){return(<HeaderScrollViewtitle="For You"><Text>...</Text></HeaderScrollView>);}}

To use this component with React Navigation, you'd want to disable the built-in header. There are 2 ways to disable the header in React Navigation:

Disable the default header for one screen:

staticnavigationOptions={headerShown:false};

Disable header globally increateStackNavigator:

constHome=createStackNavigator({    ExampleScreen1,    ExampleScreen1,},{headerMode:'none',});

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:

screen shot 2018-12-07 at 10 55 25 am

About

A React Native component that creates a Apple-esque large header that fades in a smaller header as you scroll.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors2

  •  
  •  

[8]ページ先頭

©2009-2025 Movatter.jp