Skip to content

Commit 430058c

Browse files
author
alvaromb
committed
Android image paner scroll
1 parent eaf7db0 commit 430058c

1 file changed

Lines changed: 16 additions & 5 deletions

File tree

lib/ImagePaner.js

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import React from 'react'
44
import {
55
Animated,
6+
Platform,
67
StatusBar,
78
StyleSheet,
89
Dimensions,
@@ -75,6 +76,14 @@ class ImagePaner extends React.PureComponent<Props> {
7576
}
7677

7778
_onLoad = () => {
79+
if (Platform.OS === 'android') {
80+
this._scroll &&
81+
this._scroll.scrollTo({
82+
x: -this.props.zoomedImageMeasurements.x,
83+
y: 0,
84+
animated: false
85+
})
86+
}
7887
Animated.timing(this._buttonOpacity, {
7988
toValue: 1,
8089
duration: 1000,
@@ -90,11 +99,13 @@ class ImagePaner extends React.PureComponent<Props> {
9099
if (ref) {
91100
this._scroll = ref.getNode()
92101
if (this.props.enableTilt === false) {
93-
this._scroll.scrollTo({
94-
x: -this.props.zoomedImageMeasurements.x,
95-
y: 0,
96-
animated: false
97-
})
102+
if (Platform.OS === 'ios') {
103+
this._scroll.scrollTo({
104+
x: -this.props.zoomedImageMeasurements.x,
105+
y: 0,
106+
animated: false
107+
})
108+
}
98109
}
99110
}
100111
}

0 commit comments

Comments
 (0)