From 4fc5eab25e48c0efe13c3764fcf81f59aac95ded Mon Sep 17 00:00:00 2001 From: Gary Fung Date: Wed, 23 May 2018 16:48:07 -0700 Subject: [PATCH 1/4] fixes #582 (Android not setting this onLayout first?) --- src/index.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/index.js b/src/index.js index 9bc71954..d57d7e15 100644 --- a/src/index.js +++ b/src/index.js @@ -394,6 +394,8 @@ export default class extends Component { updateIndex = (offset, dir, cb) => { const state = this.state let index = state.index + if (!this.internals.offset) // Android not setting this onLayout first? https://github.com/leecade/react-native-swiper/issues/582 + this.internals.offset = {} const diff = offset[dir] - this.internals.offset[dir] const step = dir === 'x' ? state.width : state.height let loopJump = false From 2c52e01067137abd534e061f0070f678db7635f2 Mon Sep 17 00:00:00 2001 From: Gary Fung Date: Tue, 28 Aug 2018 13:23:46 -0700 Subject: [PATCH 2/4] https://github.com/leecade/react-native-swiper/pull/684 to fix onScrollBeginDrag not being called on Android --- examples/android/gradlew | 0 src/index.js | 11 +++++++++++ 2 files changed, 11 insertions(+) mode change 100755 => 100644 examples/android/gradlew diff --git a/examples/android/gradlew b/examples/android/gradlew old mode 100755 new mode 100644 diff --git a/src/index.js b/src/index.js index d57d7e15..a81ace2a 100644 --- a/src/index.js +++ b/src/index.js @@ -621,6 +621,16 @@ export default class extends Component { this.scrollView = view; } + onPageScrollStateChanged = state => { + switch (state) { + case 'dragging': + return this.onScrollBegin(); + case 'idle': + case 'settling': + if (this.props.onTouchEnd) this.props.onTouchEnd(); + } + } + renderScrollView = pages => { if (Platform.OS === 'ios') { return ( @@ -641,6 +651,7 @@ export default class extends Component { From 23d62e09e49d4579ef87049cde5d72621541d01e Mon Sep 17 00:00:00 2001 From: Gary Fung Date: Wed, 21 Nov 2018 22:40:43 +0800 Subject: [PATCH 3/4] fixed styling (indent) --- src/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/index.js b/src/index.js index a81ace2a..3312c886 100644 --- a/src/index.js +++ b/src/index.js @@ -625,7 +625,7 @@ export default class extends Component { switch (state) { case 'dragging': return this.onScrollBegin(); - case 'idle': + case 'idle': case 'settling': if (this.props.onTouchEnd) this.props.onTouchEnd(); } From 658923f70752514d2fe504a95eac071d5e33899b Mon Sep 17 00:00:00 2001 From: Gary Fung Date: Fri, 23 Nov 2018 08:56:38 +0700 Subject: [PATCH 4/4] resolve styling conflict --- src/index.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/index.js b/src/index.js index 3312c886..d9deeb48 100644 --- a/src/index.js +++ b/src/index.js @@ -625,6 +625,7 @@ export default class extends Component { switch (state) { case 'dragging': return this.onScrollBegin(); + case 'idle': case 'settling': if (this.props.onTouchEnd) this.props.onTouchEnd();