jayesbe / react-native-cacheable-image

An Image Component for React Native that will cache itself to disk.
MIT License
304 stars 78 forks source link

Fix setState Warnings #25

Closed nbolender closed 7 years ago

nbolender commented 7 years ago

Fixes #22 by not calling setState until after the component is mounted, and by preventing calls to it as the component is unmounting.

I would say going about this a different way may be better, but would require several updates to make sure we aren't setting state before the component mounts.

This also seems to solve the earlier issue I had where certain images were being saved to the disk at 0 bytes, and then never displaying.

jayesbe commented 7 years ago

@nbolender I don't know about this one. I'm wondering if the componentWillMount() should be changed to componentDidMount()

nbolender commented 7 years ago

@jayesbe I'm going to do some exploration to try to find a better solution. There are some problems when just changing componentWillMount to componentDidMount.