Skip to content

Commit

Permalink
scroll to new position if swipe container size chages (ex: orientatio…
Browse files Browse the repository at this point in the history
…n change) (leecade#1137)

Co-authored-by: B.Isberner <git@trexpert-it.com>
  • Loading branch information
trexpert and B.Isberner authored Jul 31, 2020
1 parent f68d062 commit 5827a80
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down

0 comments on commit 5827a80

Please sign in to comment.