TuNguyenThanh / react-native-image-placeholder

React native Image Placeholder
141 stars 53 forks source link

children is rendered 2 times on successful loading of image. Why? #25

Open efleurine opened 6 years ago

efleurine commented 6 years ago

In the code there are two references to children props where it is rendrerd. The first one here https://github.com/TuNguyenThanh/react-native-image-placeholder/blob/64ca8c7aa668c7c0783c45ab2478d729053351c9/index.js#L50 and the second one here https://github.com/TuNguyenThanh/react-native-image-placeholder/blob/64ca8c7aa668c7c0783c45ab2478d729053351c9/index.js#L73

If I close my network so the network image is inaccessible then only the second one will be rendered. But with a successful loading both will rendered.

I could not figure out why ?

Do we really need that?

thanks for helping me understand.

sjonchhe commented 4 years ago

You can fix it by removing from line 69 to 76 { this.props.children &&

{ this.props.children }
    }