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.

[SDK 39] React Navigation navigation.setOptions in function component shows warning

See original GitHub issue

🐛 Bug Report

If I use, for example,navigation.setOptions({ title: 'Title' }) to set a dynamic title in a React Navigation screen, in SDK 39 it now shows me the warning Cannot update a component from inside the function body of a different component. This did not show in SDK 38.

Is this a bug or is there some new recommended way of doing things?

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
Razorholtcommented, Oct 3, 2020

Put navigation.setOptions inside a useEffect

1reaction
brentvatnecommented, Oct 1, 2020

https://github.com/react-navigation/react-navigation/issues/8796

this issue belongs on the react-navigation repo 😃 we work on that library too but we don’t track issues here

Read more comments on GitHub >

github_iconTop Results From Across the Web

Troubleshooting | React Navigation
I get the warning "Non-serializable values were found in the navigation state"​. This can happen if you are passing non-serializable values such as...
Read more >
React Native Cannot update a component from inside the ...
Finally I found solution :) it is simple :) I wrapped navigation.setOption({ ... }) by componentDidUpdate(){}. DefaultLogin.js
Read more >
react cannot update component while rendering a different ...
I'm trying to create a toggle input that has controlled state and will make a call to my apps backend. Functionally it works,...
Read more >
React Native Navigation: Tutorial with examples
In this React Native Navigation tutorial, we'll show you some examples of navigation patterns you can implement with React Navigation.
Read more >
Building a chat app with Socket.io and React Native - Novu
Install Socket.io Client API to the React Native app. ... 1npm install @react-navigation/native 2npx expo install react-native-screens ...
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