Skip to content

Commit

Permalink
fixed local image requiring issue
Browse files Browse the repository at this point in the history
  • Loading branch information
shahen94 committed Oct 30, 2016
1 parent 59d13a8 commit e8a23d4
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lib/ImageViewer.js
Original file line number Diff line number Diff line change
Expand Up @@ -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));

Expand All @@ -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 };
Expand Down

0 comments on commit e8a23d4

Please sign in to comment.