Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
diff --git a/node_modules/@react-navigation/core/.vscode/settings.json b/node_modules/@react-navigation/core/.vscode/settings.json
new file mode 100644
index 0000000..81a8778
--- /dev/null
+++ b/node_modules/@react-navigation/core/.vscode/settings.json
@@ -0,0 +1,3 @@
+{
+ "deno.enable": false
+}
\ No newline at end of file
diff --git a/node_modules/@react-navigation/core/src/BaseNavigationContainer.tsx b/node_modules/@react-navigation/core/src/BaseNavigationContainer.tsx
index a61023e..5b00af3 100644
--- a/node_modules/@react-navigation/core/src/BaseNavigationContainer.tsx
+++ b/node_modules/@react-navigation/core/src/BaseNavigationContainer.tsx
@@ -245,16 +245,17 @@ const BaseNavigationContainer = React.forwardRef(
React.useEffect(() => {
if (process.env.NODE_ENV !== 'production') {
- if (
- state !== undefined &&
- !isSerializable(state) &&
- !hasWarnedForSerialization
- ) {
- hasWarnedForSerialization = true;
-
- console.warn(
- "Non-serializable values were found 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 components with callbacks 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 for more details."
- );
+ if (state !== undefined) {
+ const r = isSerializable(state)
+ if(!r[0] &&
+ !hasWarnedForSerialization
+ ) {
+ hasWarnedForSerialization = true;
+
+ console.warn(
+ "Non-serializable values were found 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 components with callbacks 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 for more details.", r[1]
+ );
+ }
}
}
diff --git a/node_modules/@react-navigation/core/src/isSerializable.tsx b/node_modules/@react-navigation/core/src/isSerializable.tsx
index 3164c48..f3adf0b 100644
--- a/node_modules/@react-navigation/core/src/isSerializable.tsx
+++ b/node_modules/@react-navigation/core/src/isSerializable.tsx
@@ -1,7 +1,7 @@
const isSerializableWithoutCircularReference = (
o: { [key: string]: any },
seen: Set<any>
-): boolean => {
+): [boolean] | [false, string] => {
if (
o === undefined ||
o === null ||
@@ -9,37 +9,39 @@ const isSerializableWithoutCircularReference = (
typeof o === 'number' ||
typeof o === 'string'
) {
- return true;
+ return [true];
}
if (
Object.prototype.toString.call(o) !== '[object Object]' &&
!Array.isArray(o)
) {
- return false;
+ return [false];
}
if (seen.has(o)) {
- return false;
+ return [false];
}
seen.add(o);
if (Array.isArray(o)) {
for (const it of o) {
- if (!isSerializableWithoutCircularReference(it, new Set<any>(seen))) {
- return false;
+ const r = isSerializableWithoutCircularReference(it, new Set<any>(seen))
+ if (!r[0]) {
+ return [false, `[${o.indexOf(it)}]${r[1] ? `.${r[1]}`:''}`];
}
}
} else {
for (const key in o) {
- if (!isSerializableWithoutCircularReference(o[key], new Set<any>(seen))) {
- return false;
+ const r = isSerializableWithoutCircularReference(o[key], new Set<any>(seen))
+ if (!r[0]) {
+ return [false, `${key}${r[1] ? `.${r[1]}`: ''}`];
}
}
}
- return true;
+ return [true];
};
export default function isSerializable(o: { [key: string]: any }) {
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.