Skip to content
This repository has been archived by the owner on Jan 5, 2022. It is now read-only.

Non-serializable values were found in the navigation state #113

Closed
losikov opened this issue Mar 15, 2020 · 1 comment · Fixed by #155
Closed

Non-serializable values were found in the navigation state #113

losikov opened this issue Mar 15, 2020 · 1 comment · Fixed by #155
Labels
bug Something isn't working

Comments

@losikov
Copy link

losikov commented Mar 15, 2020

Information

  • react-native version: 0.61.5
  • react-navigation version: 5.0.0-alpha.(latest)
  • react-navigation-collapsible version: from git
  • Platform (iOS/Android): ios
  • react-native init or Expo: init

Detail

Run example:

git clone git@github.com:benevbright/react-navigation-collapsible.git
cd react-navigation-collapsible/example
npm install
cd ios && pod install && cd ..
npm run ios
cd ..
npm install && npm run build
(fix in code: NavigationNativeContainer to NavigationContainer)

After choosing any of examples (Sample1, Sample2), there's warning:
"We found non-serializable values in the navigation state, which can break usage such as persisting and restoring state. This might happen if you passed non-serializable values such as function, class instances etc. in params. If you need to use functions in your options, you can use 'navigation.setOptions' instead. See https://reactnavigation.org/docs/troubleshooting/#i-get-the-warning-non-serializable-values-were-found-in-the-navigation-state"

Where I found solution, but I'm not sure it is a right path:

import { YellowBox } from 'react-native';

YellowBox.ignoreWarnings([
  'Non-serializable values were found in the navigation state',
]);

If this should really added, it should be added to README.
I see the same in my project.

@neilakoh
Copy link

The solution above is just getting rid of the warning but not really solving the real issue... The "Non-serializable values" warning will only show if you pass a function as navigation params... The warning can be ignored, I am just concerned if it can break something along the way...

@benevbright benevbright linked a pull request Sep 27, 2020 that will close this issue
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants