react-native-parallax-scroll-view
Advanced tools
Comparing version 0.18.0 to 0.18.1
{ | ||
"name": "react-native-parallax-scroll-view", | ||
"version": "0.18.0", | ||
"version": "0.18.1", | ||
"description": "A ScrollView-like component with parallax and sticky header support", | ||
@@ -5,0 +5,0 @@ "main": "src/index.js", |
@@ -19,2 +19,4 @@ [![](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) | ||
**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 | ||
@@ -83,7 +85,13 @@ | ||
## Changelog | ||
## Latest changes | ||
### 0.18.1 | ||
- Fixes error when inspecting the sticky header due to cyclical object structure | ||
on `style` (#23) | ||
### 0.18.0 (Compatibility with React Native 0.20.0) | ||
- **Breaking:** Removes `ParallaxScrollView#scrollWithoutAnimationTo` since this has been deprecated in React Native. | ||
- **Breaking:** Removes `ParallaxScrollView#scrollWithoutAnimationTo` since this has been deprecated in React Native. If you used this method previously, use `scrollTo` instead. | ||
- Adds `ParallaxScrollView#getScrollableNode` method, which is required in React Native 0.20.0 for components implementing | ||
@@ -96,14 +104,8 @@ `ScrollView` interface. | ||
### 0.17.3 | ||
See full changelog [here](./CHANGELOG.md). | ||
- Allows `renderFixedHeader` to be used without providing `renderStickyHeader` and `stickyHeaderHeight`. | ||
## Contributing | ||
### 0.17.2 | ||
- Adds optional `fadeOutForeground` property that can be set to false to disable fading out of the foreground. | ||
### 0.17.1 | ||
- **Breaking:** `renderParallaxHeader` is now `renderForeground`, and now scrolls with the same speed as scroll content. | ||
- Refactored parallax header calculations to keep their scroll speeds consistent with user scroll speed. | ||
- Parallax effect is now calculated using the `backgroundSpeed` prop. | ||
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. :) |
@@ -22,2 +22,11 @@ const React = require('react-native'); | ||
// Override `toJSON` of interpolated value because of | ||
// an error when serializing style on view inside inspector. | ||
// See: https://github.com/jaysoo/react-native-parallax-scroll-view/issues/23 | ||
const interpolate = (value, opts) => { | ||
const x = value.interpolate(opts); | ||
x.toJSON = () => x.__getValue(); | ||
return x; | ||
}; | ||
// Properties accepted by `ParallaxScrollView`. | ||
@@ -184,3 +193,3 @@ const IPropTypes = { | ||
opacity: fadeOutBackground | ||
? scrollY.interpolate({ | ||
? interpolate(scrollY, { | ||
inputRange: [0, p * (1/2), p * (3/4), p], | ||
@@ -192,3 +201,3 @@ outputRange: [1, 0.3, 0.1, 0], | ||
transform: [{ | ||
translateY: scrollY.interpolate({ | ||
translateY: interpolate(scrollY, { | ||
inputRange: [0, p], | ||
@@ -200,3 +209,3 @@ outputRange: [0, -(p / backgroundScrollSpeed)], | ||
}, { | ||
scale: scrollY.interpolate({ | ||
scale: interpolate(scrollY, { | ||
inputRange: [-viewHeight, 0], | ||
@@ -224,3 +233,3 @@ outputRange: [5, 1], | ||
opacity: fadeOutForeground | ||
? scrollY.interpolate({ | ||
? interpolate(scrollY, { | ||
inputRange: [0, p * (1/2), p * (3/4), p], | ||
@@ -278,3 +287,3 @@ outputRange: [1, 0.3, 0.1, 0], | ||
height: stickyHeaderHeight, | ||
opacity: scrollY.interpolate({ | ||
opacity: interpolate(scrollY, { | ||
inputRange: [0, p], | ||
@@ -288,3 +297,3 @@ outputRange: [0, 1], | ||
transform: [{ | ||
translateY: scrollY.interpolate({ | ||
translateY: interpolate(scrollY, { | ||
inputRange: [0, p], | ||
@@ -291,0 +300,0 @@ outputRange: [stickyHeaderHeight, 0], |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
18990
6
329
109