diff --git a/lib/ImageViewer.js b/lib/ImageViewer.js index 6f30afb..7cb045b 100644 --- a/lib/ImageViewer.js +++ b/lib/ImageViewer.js @@ -91,6 +91,8 @@ export class ImageViewer extends Component { } componentWillMount() { + const { source } = this.props; + this.state.layout.x.addListener((animated) => this.handleLayoutChange(animated, LAYOUT_ENUM.X)); this.state.layout.y.addListener((animated) => this.handleLayoutChange(animated, LAYOUT_ENUM.Y)); @@ -102,7 +104,9 @@ export class ImageViewer extends Component { onPanResponderTerminate: this.handleRelease }); - Image.prefetch(this.props.source); + if (typeof source === 'object' source.uri) { + Image.prefetch(this.props.source); + } Image.getSize(this.props.source, (width, height) => { this._imageSize = { width, height };