Gathering detailed insights and metrics for @avkholion/react-native-parallax-scroll-view
Gathering detailed insights and metrics for @avkholion/react-native-parallax-scroll-view
A ScrollView-like component with parallax and sticky header support.
npm install @avkholion/react-native-parallax-scroll-view
Typescript
Module System
Node Version
NPM Version
70.5
Supply Chain
98.4
Quality
75
Maintenance
100
Vulnerability
100
License
JavaScript (100%)
Love this project? Help keep it running — sponsor us today! 🚀
Total Downloads
1,098
Last Day
2
Last Week
4
Last Month
30
Last Year
300
ISC License
1 Stars
167 Commits
1 Branches
1 Contributors
Updated on Sep 05, 2023
Latest Version
0.5.5
Package Id
@avkholion/react-native-parallax-scroll-view@0.5.5
Unpacked Size
20.54 kB
Size
6.33 kB
File Count
6
NPM Version
9.5.1
Node Version
19.8.1
Published on
Jun 02, 2023
Cumulative downloads
Total Downloads
Last Day
100%
2
Compared to previous day
Last Week
-55.6%
4
Compared to previous week
Last Month
30.4%
30
Compared to previous month
Last Year
-62.4%
300
Compared to previous year
1
This component now uses Native Driver by default.
Remember to pass a Animated component to renderScrollComponent
, by default it has Animated.ScrollView
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}
A ScrollView
-like component that:
ScrollView
(e.g. ListView
or InfiniteScrollView
)$ 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.
iOS | Android |
---|---|
![]() | ![]() |
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}
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.
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 |
useNativeDriver
to improve performance, but renderScrollComponent must be a Animated component ( ie: Animated.createAnimatedComponent(component))See full changelog here.
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.
No security vulnerabilities found.