Fix image preview initial scroll (#959)

This commit is contained in:
enahum 2017-09-28 11:31:44 -03:00
parent 0a7b297a6f
commit 86c697aa55

View file

@ -84,7 +84,7 @@ export default class ImagePreview extends PureComponent {
componentDidMount() {
InteractionManager.runAfterInteractions(() => {
this.scrollView.scrollTo({x: (this.state.currentFile) * this.state.deviceWidth, animated: false});
this.scrollView.scrollTo({x: (this.state.currentFile) * this.props.deviceWidth, animated: false});
Animated.timing(this.state.wrapperViewOpacity, {
toValue: 1,
duration: 100
@ -93,7 +93,7 @@ export default class ImagePreview extends PureComponent {
}
componentWillReceiveProps(nextProps) {
if (this.props.deviceWidth !== nextProps.deviceWidth && Platform.OS === 'android') {
if (this.props.deviceWidth !== nextProps.deviceWidth) {
InteractionManager.runAfterInteractions(() => {
this.scrollView.scrollTo({x: (this.state.currentFile * nextProps.deviceWidth), animated: false});
});