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.

UI does not update on state change

See original GitHub issue

Currently it seems the active param doesn’t listen to the provided state, as a result it doesn’t seem to update when the state changes.

Issue Analytics

  • State:open
  • Created 6 years ago
  • Reactions:5
  • Comments:9 (2 by maintainers)

github_iconTop GitHub Comments

3reactions
cbettacommented, Apr 3, 2017

Tnx for the tip @dereksweet, that might work for me.

1reaction
dereksweetcommented, Apr 2, 2017

I can verify this is indeed an issue. So long as you modify the state by clicking the hamburger then it animates properly. If you modify the state outside of the hamburger component the hamburger does not animate.

I got a workaround to work by creating a ref to the hamburger and then calling the ._animate() function manually whenever I update the state:

// clickNavLink is called outside of Hamburger from a nav bar that pops up. 
const clickNavLink = (pane) => {
  routingActions.setVisiblePane(pane);
  statusBarActions.toggleHamburgerActive();
  this.hamburger._animate();
};

<Hamburger ref={hamburger => { this.hamburger = hamburger }}
           active={state.hamburger_active}
           type="spinCross"
           color="black"
           onPress={() => statusBarActions.toggleHamburgerActive()} />
Read more comments on GitHub >

github_iconTop Results From Across the Web

React ui not updating although i'm changing the state
Issue. The issue here is one of state mutation. You are mutating a reference to the current state and then saving it back...
Read more >
Why React doesn't update state immediately - LogRocket Blog
State updates in React are asynchronous; when an update is requested, there is no guarantee that the updates will be made immediately.
Read more >
Why React setState/useState does not update immediately
The answer: They're just queues. React this.setState , and useState does not make changes directly to the state object. React this.setState ...
Read more >
React useState array update not updating the UI fix ... - YouTube
... when we put array item in react state and try to change its value and set the new value to react ......
Read more >
React state not updating immediately? - Daggala
You update the state and you expect it to happen immediately but it doesn't. It might seems like the state update isn't updating...
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