Skip to content

Commit 0a17bfa

Browse files
fix: Remove unncessary image load check
1 parent c262265 commit 0a17bfa

File tree

1 file changed

+7
-10
lines changed

1 file changed

+7
-10
lines changed

src/components/ImageWithSizeCalculation.js

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import React, {PureComponent} from 'react';
22
import {View} from 'react-native';
33
import PropTypes from 'prop-types';
4-
import lodashGet from 'lodash/get';
54
import Log from '../libs/Log';
65
import styles from '../styles/styles';
76
import FullscreenLoadingIndicator from './FullscreenLoadingIndicator';
@@ -45,7 +44,7 @@ class ImageWithSizeCalculation extends PureComponent {
4544
this.imageLoadingStart = this.imageLoadingStart.bind(this);
4645
this.imageLoadingEnd = this.imageLoadingEnd.bind(this);
4746
this.onError = this.onError.bind(this);
48-
this.imageLoadedSuccessfuly = this.imageLoadedSuccessfuly.bind(this);
47+
this.imageLoadedSuccessfully = this.imageLoadedSuccessfully.bind(this);
4948
}
5049

5150
onError() {
@@ -60,13 +59,11 @@ class ImageWithSizeCalculation extends PureComponent {
6059
this.setState({isLoading: false});
6160
}
6261

63-
imageLoadedSuccessfuly(event) {
64-
if (!lodashGet(event, 'nativeEvent.width', false) || !lodashGet(event, 'nativeEvent.height', false)) {
65-
// Image didn't load properly
66-
return;
67-
}
68-
69-
this.props.onMeasure({width: event.nativeEvent.width, height: event.nativeEvent.height});
62+
imageLoadedSuccessfully(event) {
63+
this.props.onMeasure({
64+
width: event.nativeEvent.width,
65+
height: event.nativeEvent.height,
66+
});
7067
}
7168

7269
render() {
@@ -89,7 +86,7 @@ class ImageWithSizeCalculation extends PureComponent {
8986
onLoadStart={this.imageLoadingStart}
9087
onLoadEnd={this.imageLoadingEnd}
9188
onError={this.onError}
92-
onLoad={this.imageLoadedSuccessfuly}
89+
onLoad={this.imageLoadedSuccessfully}
9390
/>
9491
{this.state.isLoading && (
9592
<FullscreenLoadingIndicator

0 commit comments

Comments
 (0)