Skip to content

Commit a5b11cf

Browse files
authored
Merge pull request #81 from RodrigoCS/master
Changed animation to use native driver
2 parents 8e88ef8 + cefdcca commit a5b11cf

File tree

4 files changed

+475
-354
lines changed

4 files changed

+475
-354
lines changed

CHANGELOG.md

+8-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
## Changelog
22

3+
### 0.20.1
4+
- Added prop to change interpolated Scale Output Value
5+
6+
### 0.20.0 // Rodrigocs
7+
- Now uses native driver, and tested with React Native 0.46.0
8+
- Adds `useNativeDriver` to improve performance, but renderScrollComponent must be a Animated component ( ie: Animated.createAnimatedComponent(component))
9+
310
### 0.19.0
411

512
- Fixes compatibility with React Native 0.27.2
@@ -9,7 +16,7 @@
916

1017
- Fixes error when inspecting the sticky header due to cyclical object structure
1118
on `style` (#23)
12-
19+
1320
### 0.18.0 (Compatibility with React Native 0.20.0)
1421

1522
- **Breaking:** Removes `ParallaxScrollView#scrollWithoutAnimationTo` since this has been deprecated in React Native. If you used this method previously, use `scrollTo` instead.

README.md

+41-15
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,38 @@
11
[![](https://img.shields.io/npm/dm/react-native-parallax-scroll-view.svg?style=flat-square)](https://www.npmjs.com/package/react-native-parallax-scroll-view)
22

3+
# Rodrigocs - Animated Driver
4+
5+
This component now uses Native Driver by default.
6+
Remember to pass a Animated component to `renderScrollComponent`, by default it has `Animated.ScrollView`
7+
8+
# Example
9+
```js
10+
import ParallaxScrollView from 'react-native-parallax-scroll-view';
11+
import CustomScrollView from 'custom-scroll-view'
12+
13+
const AnimatedCustomScrollView = Animated.createAnimatedComponent(CustomScrollView)
14+
15+
render() {
16+
return (
17+
<ParallaxScrollView
18+
backgroundColor="blue"
19+
contentBackgroundColor="pink"
20+
parallaxHeaderHeight={300}
21+
// renderScrollComponent={() => <Animated.View />}
22+
renderScrollComponent={() => <AnimatedCustomScrollView />}
23+
renderForeground={() => (
24+
<View style={{ height: 300, flex: 1, alignItems: 'center', justifyContent: 'center' }}>
25+
<Text>Hello World!</Text>
26+
</View>
27+
)}>
28+
<View style={{ height: 500 }}>
29+
<Text>Scroll me</Text>
30+
</View>
31+
</ParallaxScrollView>
32+
);
33+
}
34+
```
35+
336
# react-native-parallax-scroll-view
437

538
A `ScrollView`-like component that:
@@ -77,29 +110,22 @@ The `ParallaxScrollView` component adds a few additional properties, as describe
77110
| `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`) |
78111
| `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. |
79112
| `renderForeground` | `func` | No |This renders the foreground header that moves at same speed as scroll content. |
80-
| `renderScrollComponent` | `func` | No | A function with input `props` and outputs a `ScrollView`-like component in which the content is rendered. This is useful if you want to provide your own scrollable component. (See: [https://github.com/exponentjs/react-native-scrollable-mixin](https://github.com/exponentjs/react-native-scrollable-mixin)) (By default, returns a `ScrollView` with the given props) |
113+
| `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](https://github.com/exponentjs/react-native-scrollable-mixin)) (By default, returns a `Animated.ScrollView` with the given props) |
81114
| `renderStickyHeader` | `func` | No | This renders an optional sticky header that will stick to the top of view when parallax header scrolls up. |
82115
| `stickyHeaderHeight` | `number` | If `renderStickyHeader` is used | If `renderStickyHeader` is set, then its height must be specified. |
83116
| `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](https://facebook.github.io/react-native/docs/scrollview.html#contentcontainerstyle)) |
117+
| `outputScaleValue` | `number` | No | The value for the scale interpolation output value, default `5` |
84118

85-
## Latest changes
86119

87-
### 0.19.0
88-
89-
- Fixes compatibility with React Native 0.27.2
90-
- Adds `contentContainerStyle` prop to style scroll container (thanks [@alaycock](https://github.com/alaycock))
91-
92-
### 0.18.1
120+
## Latest changes
93121

94-
- Fixes error when inspecting the sticky header due to cyclical object structure
95-
on `style` (#23)
122+
### 0.20.1
123+
- Added prop to change interpolated Scale Output Value
96124

97-
### 0.18.0 (Compatibility with React Native 0.20.0)
125+
### 0.20.0 // Rodrigocs
126+
- Now uses native driver, and tested with React Native 0.46.0
127+
- Adds `useNativeDriver` to improve performance, but renderScrollComponent must be a Animated component ( ie: Animated.createAnimatedComponent(component))
98128

99-
- **Breaking:** Removes `ParallaxScrollView#scrollWithoutAnimationTo` since this has been deprecated in React Native. If you used this method previously, use `scrollTo` instead.
100-
- Adds `ParallaxScrollView#getScrollableNode` method, which is required in React Native 0.20.0 for components implementing
101-
`ScrollView` interface.
102-
103129
See full changelog [here](./CHANGELOG.md).
104130

105131
## Contributing

package.json

+28-28
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,30 @@
11
{
2-
"name": "react-native-parallax-scroll-view",
3-
"version": "0.19.0",
4-
"description": "A ScrollView-like component with parallax and sticky header support",
5-
"main": "src/index.js",
6-
"repository": {
7-
"type": "git",
8-
"url": "https://github.com/jaysoo/react-native-parallax-scroll-view"
9-
},
10-
"files": [
11-
"src",
12-
"demo.ios.gif",
13-
"demo.android.20160117.gif",
14-
"README.md",
15-
"LICENSE"
16-
],
17-
"keywords": [
18-
"react-native",
19-
"react",
20-
"parallax",
21-
"scrollable",
22-
"scrollview",
23-
"sticky",
24-
"react-component",
25-
"ios",
26-
"android"
27-
],
28-
"author": "Jack Hsu",
29-
"license": "ISC"
2+
"name": "react-native-parallax-scroll-view",
3+
"version": "0.20.1",
4+
"description": "A ScrollView-like component with parallax and sticky header support",
5+
"main": "src/index.js",
6+
"repository": {
7+
"type": "git",
8+
"url": "https://github.com/jaysoo/react-native-parallax-scroll-view"
9+
},
10+
"files": [
11+
"src",
12+
"demo.ios.gif",
13+
"demo.android.20160117.gif",
14+
"README.md",
15+
"LICENSE"
16+
],
17+
"keywords": [
18+
"react-native",
19+
"react",
20+
"parallax",
21+
"scrollable",
22+
"scrollview",
23+
"sticky",
24+
"react-component",
25+
"ios",
26+
"android"
27+
],
28+
"author": "Jack Hsu",
29+
"license": "ISC"
3030
}

0 commit comments

Comments
 (0)