From ae37f0c55c04ee8c41329c87b294df801d3c5fea Mon Sep 17 00:00:00 2001 From: mufaddalhamidofficial <49232863+mufaddalhamidofficial@users.noreply.github.com> Date: Sun, 15 Mar 2020 20:53:36 +0530 Subject: [PATCH] Update index.js remove two times children rendering and added children rendering in dummy image --- index.js | 43 +++++++++++++++---------------------------- 1 file changed, 15 insertions(+), 28 deletions(-) diff --git a/index.js b/index.js index fd24f2a..91ff2df 100644 --- a/index.js +++ b/index.js @@ -9,7 +9,7 @@ class ImageLoad extends React.Component { static defaultProps = { isShowActivity: true, - }; + }; constructor(props) { super(props); @@ -19,13 +19,13 @@ class ImageLoad extends React.Component { }; } - onLoadEnd(){ + onLoadEnd() { this.setState({ isLoaded: true }); } - onError(){ + onError() { this.setState({ isError: true }); @@ -37,42 +37,29 @@ class ImageLoad extends React.Component { loadingStyle, placeholderSource, placeholderStyle, customImagePlaceholderDefaultStyle } = this.props; - return( + return ( { (this.state.isLoaded && !this.state.isError) ? children : - - { - (this.props.isShowActivity && !this.state.isError) && - - } - - - - } - { - this.props.children && - - { - this.props.children - } - + + {children} + + } );