question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

React hooks crashes onLoadEnd

See original GitHub issue

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

enter image description here

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?

Issue Analytics

  • State:open
  • Created 4 years ago
  • Comments:6 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
manithincommented, Nov 25, 2019

@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.

1reaction
dimaportenkocommented, Nov 22, 2019
Read more comments on GitHub >

github_iconTop Results From Across the Web

react-native-fast-image with React hooks crashes onLoadEnd
I'm new to React hooks. Any ideas on how to correctly deal with such cases? reactjs · react-native · react-hooks.
Read more >
[Solved]-React Native ListView dataSource allways null-React ...
Coding example for the question React Native ListView dataSource allways null-React Native. ... react-native-fast-image with React hooks crashes onLoadEnd ...
Read more >
Hooks FAQ - React
Hooks are a new addition in React 16.8. They let you use state and other React features without writing a class. This page...
Read more >
Untitled
Bug Fixes. hippy-react: add overflow scroll to fix listview unable to scroll (96c670a) ... hippy-vue: add animaiton actionsDidUpdate hook (f61b48e) ...
Read more >
RUM Now Offers React Native Crash Reporting and Error ...
Expedite debugging your React Native applications with readable error reports and built-in alerting.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found