benevbright/react-navigation-collapsible

Non-serializable values were found in the navigation state

Closed this issue · 1 comments

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.

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