diff --git a/app/components/swiper.js b/app/components/swiper.js index 72142724f..2a5bc6dfc 100644 --- a/app/components/swiper.js +++ b/app/components/swiper.js @@ -71,9 +71,11 @@ export default class Swiper extends PureComponent { if (this.runOnLayout) { if (Platform.OS === 'ios') { setTimeout(() => { - this.scrollView.scrollTo({x: this.props.width * this.state.index, animated: false}); + if (this.scrollView) { + this.scrollView.scrollTo({x: this.props.width * this.state.index, animated: false}); + } }, 100); - } else { + } else if (this.scrollView) { this.scrollView.setPageWithoutAnimation(this.state.index); } this.runOnLayout = false; diff --git a/app/screens/image_preview/image_preview.js b/app/screens/image_preview/image_preview.js index fbe370d36..aa8333925 100644 --- a/app/screens/image_preview/image_preview.js +++ b/app/screens/image_preview/image_preview.js @@ -91,7 +91,10 @@ export default class ImagePreview extends PureComponent { componentDidMount() { InteractionManager.runAfterInteractions(() => { - this.scrollView.scrollTo({x: (this.state.currentFile) * this.props.deviceWidth, animated: false}); + if (this.scrollView) { + this.scrollView.scrollTo({x: (this.state.currentFile) * this.props.deviceWidth, animated: false}); + } + Animated.timing(this.state.wrapperViewOpacity, { toValue: 1, duration: 100 @@ -102,7 +105,9 @@ export default class ImagePreview extends PureComponent { componentWillReceiveProps(nextProps) { if (this.props.deviceWidth !== nextProps.deviceWidth) { InteractionManager.runAfterInteractions(() => { - this.scrollView.scrollTo({x: (this.state.currentFile * nextProps.deviceWidth), animated: false}); + if (this.scrollView) { + this.scrollView.scrollTo({x: (this.state.currentFile * nextProps.deviceWidth), animated: false}); + } }); }