Skip to content

Commit 6811abc

Browse files
committed
updates API to be compatible with RN 0.20.0
1 parent 15024d9 commit 6811abc

File tree

6 files changed

+15
-16
lines changed

6 files changed

+15
-16
lines changed

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,12 @@ The `ParallaxScrollView` component adds a few additional properties, as describe
8181

8282
## Changelog
8383

84+
### 0.18.0 (Compatibility with React Native 0.20.0)
85+
86+
- **Breaking:** Removes `ParallaxScrollView#scrollWithoutAnimationTo` since this has been deprecated in React Native.
87+
- Adds `ParallaxScrollView#getScrollableNode` method, which is required in React Native 0.20.0 for components implementing
88+
`ScrollView` interface.
89+
8490
### 0.17.4
8591

8692
- The background now fades out in the same manner as the foreground. Thanks @generalChaos for the PR.

examples/ListView/Talks.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ class Talks extends Component {
8686
renderFixedHeader={() => (
8787
<View key="fixed-header" style={styles.fixedSection}>
8888
<Text style={styles.fixedSectionText}
89-
onPress={() => this.refs.ParallaxView.getScrollResponder().scrollResponderScrollTo(0, 0)}>
89+
onPress={() => this.refs.ParallaxView.scrollTo({ x: 0, y: 0 })}>
9090
Scroll to top
9191
</Text>
9292
</View>

examples/ListView/android/app/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,5 +74,5 @@ android {
7474
dependencies {
7575
compile fileTree(dir: "libs", include: ["*.jar"])
7676
compile "com.android.support:appcompat-v7:23.0.1"
77-
compile "com.facebook.react:react-native:0.19.+"
77+
compile "com.facebook.react:react-native:0.20.+"
7878
}

examples/ListView/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"start": "react-native start"
77
},
88
"dependencies": {
9-
"react-native": "0.19.0",
9+
"react-native": "0.20.0",
1010
"react-native-parallax-scroll-view": "../../"
1111
}
1212
}

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "react-native-parallax-scroll-view",
3-
"version": "0.17.4",
3+
"version": "0.18.0",
44
"description": "A ScrollView-like component with parallax and sticky header support",
55
"main": "src/index.js",
66
"repository": {

src/index.js

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -108,21 +108,14 @@ class ParallaxScrollView extends Component {
108108
getScrollResponder() {
109109
return this.refs[SCROLLVIEW_REF].getScrollResponder();
110110
}
111+
getScrollableNode() {
112+
return this.getScrollResponder().getScrollableNode();
113+
}
111114
getInnerViewNode() {
112115
return this.getScrollResponder().getInnerViewNode();
113116
}
114-
scrollTo(destY, destX) {
115-
const sr = this.getScrollResponder();
116-
// TODO: Remove this when RN 0.21.0 is released.
117-
// This is to make ParallaxScrollView compatible with older RN versions.
118-
if (sr.scrollTo.length === 2) {
119-
this.getScrollResponder().scrollTo(destY, destX);
120-
} else {
121-
this.getScrollResponder().scrollTo({ x: destY, y: destX });
122-
}
123-
}
124-
scrollWithoutAnimationTo(destY, destX) {
125-
this.getScrollResponder().scrollWithoutAnimationTo(destY, destX);
117+
scrollTo(...args) {
118+
this.getScrollResponder().scrollTo(...args);
126119
}
127120
setNativeProps(props) {
128121
this.refs[SCROLLVIEW_REF].setNativeProps(props);

0 commit comments

Comments
 (0)