From 5827a80002738abd1c0dc08428303c79bbc840c0 Mon Sep 17 00:00:00 2001 From: trexpert Date: Fri, 31 Jul 2020 15:09:01 +0200 Subject: [PATCH] scroll to new position if swipe container size chages (ex: orientation change) (#1137) Co-authored-by: B.Isberner --- src/index.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/index.js b/src/index.js index da429c2a..f52cc707 100644 --- a/src/index.js +++ b/src/index.js @@ -321,8 +321,11 @@ export default class extends Component { // related to https://github.com/leecade/react-native-swiper/issues/570 // contentOffset is not working in react 0.48.x so we need to use scrollTo // to emulate offset. - if (this.initialRender && this.state.total > 1) { + if(this.state.total > 1) { this.scrollView.scrollTo({ ...offset, animated: false }) + } + + if (this.initialRender) { this.initialRender = false }