I'm using FastImage component from react-native-fast-image with React useState in callback.
like this
const Avatar = (props) => {
const [isImageUploaded, setIsImageUploaded] = useState(false);
return (
<View style={sizeStyle}>
<FastImage
source={{ uri: profileImg }}
onLoadEnd={() => {
setIsImageUploaded(true);
}}
/>
</View>
);
};
Avatar component used inside FlatList and when I'm clearing its data I'm getting crash
Crash disappear without setIsImageUploaded(true); like
<FastImage
source={{ uri: profileImg }}
onLoadEnd={() => {
// setIsImageUploaded(true);
}}
/>
I'm new to React hooks. Any ideas on how to correctly deal with such cases?
I've added pull request which prevents crash in my case
https://github.com/troublediehard/react-native-fast-image/pull/1
I'd like to be able to reproduce this issue. It would also be good to know if this affects other callbacks.
I'll try to create a sample project with reproduction.
I'll try to create a sample project with reproduction.
did you get a solution for this? noticed that this happens a lot for me too
@manithin you can use workaround from my pull request https://github.com/DylanVann/react-native-fast-image/pull/506
@manithin you can use workaround from my pull request #506
Thank you! my crash was at setOnFastImageError, however, the same approach you made in the pull request worked there too.