Installations
npm install react-native-parallax-scroll-view
Developer Guide
Typescript
No
Module System
CommonJS
Node Version
8.6.0
NPM Version
6.0.0
Score
73.8
Supply Chain
99
Quality
77.8
Maintenance
100
Vulnerability
100
License
Releases
Contributors
Unable to fetch Contributors
Languages
JavaScript (100%)
Love this project? Help keep it running — sponsor us today! 🚀
Developer
jaysoo
Download Statistics
Total Downloads
1,569,969
Last Day
401
Last Week
2,088
Last Month
9,415
Last Year
120,288
GitHub Statistics
ISC License
2,318 Stars
178 Commits
379 Forks
35 Watchers
3 Branches
20 Contributors
Updated on Feb 12, 2025
Package Meta Information
Latest Version
0.21.3
Package Id
react-native-parallax-scroll-view@0.21.3
Size
6.52 kB
NPM Version
6.0.0
Node Version
8.6.0
Published on
Jun 20, 2018
Total Downloads
Cumulative downloads
Total Downloads
1,569,969
Last Day
35.9%
401
Compared to previous day
Last Week
10.7%
2,088
Compared to previous week
Last Month
37.7%
9,415
Compared to previous month
Last Year
-39.5%
120,288
Compared to previous year
Daily Downloads
Weekly Downloads
Monthly Downloads
Yearly Downloads
Dependencies
1
Rodrigocs - Animated Driver
This component now uses Native Driver by default.
Remember to pass a Animated component to renderScrollComponent
, by default it has Animated.ScrollView
Example
1import ParallaxScrollView from 'react-native-parallax-scroll-view'; 2import CustomScrollView from 'custom-scroll-view' 3 4const AnimatedCustomScrollView = Animated.createAnimatedComponent(CustomScrollView) 5 6render() { 7 return ( 8 <ParallaxScrollView 9 backgroundColor="blue" 10 contentBackgroundColor="pink" 11 parallaxHeaderHeight={300} 12 // renderScrollComponent={() => <Animated.View />} 13 renderScrollComponent={() => <AnimatedCustomScrollView />} 14 renderForeground={() => ( 15 <View style={{ height: 300, flex: 1, alignItems: 'center', justifyContent: 'center' }}> 16 <Text>Hello World!</Text> 17 </View> 18 )}> 19 <View style={{ height: 500 }}> 20 <Text>Scroll me</Text> 21 </View> 22 </ParallaxScrollView> 23 ); 24}
react-native-parallax-scroll-view
A ScrollView
-like component that:
- Has a parallax header
- Has an optional sticky header
- Is composable with any component that expects a
ScrollView
(e.g.ListView
orInfiniteScrollView
) - Can be nested within other views
- Works on iOS and Android
Installation
$ npm install react-native-parallax-scroll-view --save
Note: For React Native 0.19.0 and earlier, you'll want to use react-native-parallax-scroll-view@0.17.4
. Version 0.18.0
changes the scrolling API to be compatible with React Native 0.20.0.
Demo
iOS | Android |
---|---|
![]() | ![]() |
Basic Usage
1import ParallaxScrollView from 'react-native-parallax-scroll-view'; 2 3// Inside of a component's render() method: 4render() { 5 return ( 6 <ParallaxScrollView 7 backgroundColor="blue" 8 contentBackgroundColor="pink" 9 parallaxHeaderHeight={300} 10 renderForeground={() => ( 11 <View style={{ height: 300, flex: 1, alignItems: 'center', justifyContent: 'center' }}> 12 <Text>Hello World!</Text> 13 </View> 14 )}> 15 <View style={{ height: 500 }}> 16 <Text>Scroll me</Text> 17 </View> 18 </ParallaxScrollView> 19 ); 20}
Examples
Please refer to the ListView example provided to see how ParallaxScrollView
can be used in
combination with ListView
.
The Android ListView example shows how you can use PullToRefreshViewAndroid
with ParallaxScrollView
.
There are more examples in the examples folder.
Usage (API)
All of the properties of ScrollView
are supported. Please refer to the
ScrollView
documentation for more detail.
The ParallaxScrollView
component adds a few additional properties, as described below.
Property | Type | Required | Description |
---|---|---|---|
backgroundColor | string | No | The color of the header background. Defaults to #000 ) |
backgroundScrollSpeed | number | No | The speed factor that the background moves at relative to the foreground. Defaults to 5. |
contentBackgroundColor | string | No | This is the background color of the content. (Defaults to '#fff' ) |
fadeOutForeground | bool | No | If true , the foreground will fade out as the user scrolls up. (Defaults to true ) |
onChangeHeaderVisibility | func | No | A callback function that is invoked when the parallax header is hidden or shown (as the user is scrolling). Function is called with a boolean value to indicate whether header is visible or not. |
parallaxHeaderHeight | number | Yes | This is the height of parallax header. |
renderBackground | func | No | This renders the background of the parallax header. Can be used to display cover images for example. (Defaults to an opaque background using backgroundColor ) |
renderContentBackground | func | No | This renders the background of the content. Can be used to display cover images for example. (Defaults to a non-visible View ) |
renderFixedHeader | func | No | This renders an optional fixed header that will always be visible and fixed to the top of the view (and sticky header). You should set its height and width appropriately. |
renderForeground | func | No | This renders the foreground header that moves at same speed as scroll content. |
renderScrollComponent | func | No | A function with input props and outputs an Animated.ScrollView -like component in which the content is rendered. This is useful if you want to provide your own scrollable component, remember however to make it an Animated component. (See: https://github.com/exponentjs/react-native-scrollable-mixin) (By default, returns a Animated.ScrollView with the given props) |
renderStickyHeader | func | No | This renders an optional sticky header that will stick to the top of view when parallax header scrolls up. |
stickyHeaderHeight | number | If renderStickyHeader is used | If renderStickyHeader is set, then its height must be specified. |
contentContainerStyle | object | No | These styles will be applied to the scroll view content container which wraps all of the child views. (same as for ScrollView) |
outputScaleValue | number | No | The value for the scale interpolation output value, default 5 |
scrollEvent | func | No | Callback to recieve the animated scroll event values |
Latest changes
0.20.1
- Added prop to change interpolated Scale Output Value
0.20.0 // Rodrigocs
- Now uses native driver, and tested with React Native 0.46.0
- Adds
useNativeDriver
to improve performance, but renderScrollComponent must be a Animated component ( ie: Animated.createAnimatedComponent(component))
See full changelog here.
Contributing
I welcome contributions! Please open an issues if you have any feature ideas or find any bugs. I also accept pull requests with open arms. I will go over the issues when I have time. :)

No vulnerabilities found.
Reason
license file detected
Details
- Info: project has a license file: LICENSE.md:0
- Info: FSF or OSI recognized license: ISC License: LICENSE.md:0
Reason
0 existing vulnerabilities detected
Reason
binaries present in source code
Details
- Warn: binary detected: examples/ListView/android/gradle/wrapper/gradle-wrapper.jar:1
- Warn: binary detected: examples/NestedViews/android/gradle/wrapper/gradle-wrapper.jar:1
Reason
Found 8/20 approved changesets -- score normalized to 4
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
- Warn: no security policy file detected
- Warn: no security file to analyze
- Warn: no security file to analyze
- Warn: no security file to analyze
Reason
project is not fuzzed
Details
- Warn: no fuzzer integrations found
Reason
branch protection not enabled on development/release branches
Details
- Warn: branch protection not enabled for branch 'master'
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
- Warn: 0 commits out of 19 are checked with a SAST tool
Score
3.3
/10
Last Scanned on 2025-02-03
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn MoreOther packages similar to react-native-parallax-scroll-view
@avkholion/react-native-parallax-scroll-view
A ScrollView-like component with parallax and sticky header support
react-native-parallax-scroll-view-new
new version of react-native-parallax-scroll-view
sadooghi-react-native-parallax-scroll-view
Updated version of react-native-parallax-scroll-view
react-native-parallax-scroll-view-sadooghi
Updated version of [react-native-parallax-scroll-view](https://www.npmjs.com/package/react-native-parallax-scroll-view) I published this because the height for the page was much longer than it needed to be.