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.

Make sure component is mounted before calling setState.

See original GitHub issue

https://github.com/react-native-elements/react-native-elements/blob/0ae0852b48c62af30f6c53af48a4ed3fdb5b5751/src/tooltip/Tooltip.js#L202

Here the setState is called in callback (measure, requestAnimationFrame). In react code can happen that tooltip is removed before this code is executed (virtual lists) and throws an error.

Warning: Can't perform a React state update on an unmounted component. This is a no-op, but it indicates a memory leak in your application. To fix, cancel all subscriptions and asynchronous tasks in the componentWillUnmount method.
    in Tooltip (at withTheme.js:42)
    in ThemedComponent (at withTheme.js:59)
    in ForwardRef(Themed.Tooltip) (at base.item.component.tsx:249)

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:7

github_iconTop GitHub Comments

1reaction
flyingcirclecommented, Jan 15, 2021

This also isn’t an error. Just a warning.

0reactions
keshavagarwal17commented, Mar 10, 2021

@flyingcircle i am getting this error while committing the changes and because of this I am not able to push my code. image It is showing there is some error in withTheme.tsx but I didn’t make any changes in that file. Can you please tell me what is going wrong so that I can push my changes.

Read more comments on GitHub >

github_iconTop Results From Across the Web

React: Stop checking if your component is mounted - Medium
This article will provide solutions to the “Can't perform a React state update on an unmounted component” warning and why a call to...
Read more >
Is there a way to check if the react component is unmounted?
The one you need depends on why you are calling setState when the component is unmounted. if you are using a Flux store...
Read more >
React - How to Check if a Component is Mounted or Unmounted
This is a quick post to show how to track the mounted status of a React component so you can check if it's...
Read more >
isMounted is an Antipattern – React Blog
Specifically, calling setState() in an unmounted component means that your app is still holding a reference to the component after the component ......
Read more >
Prevent React setState on unmounted Component
How to avoid the React warning: Can only update a mounted or mounting component. It usually means you have called setState on an...
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