[英]Objects are not valid as a React child (found: object with keys {seconds, nanoseconds}). If you meant to render a collection of children, use an array
I worked now 33 days straight to code my app.我现在连续工作 33 天来编写我的应用程序。 Everything works fine.
一切正常。 Yersterday evening there occurs this error:
昨天晚上出现这个错误:
Error: Objects are not valid as a React child (found: object with keys {seconds, nanoseconds}). If you meant to render a collection of children, use an array instead.
I undo my changes, the error is still there.我撤消了我的更改,错误仍然存在。 I decided to checkout an old commit.
我决定检查一个旧的提交。 At the moment of commit, the codebase works.
在提交的那一刻,代码库工作。 I have a running app in testmode on google play.
我在 Google Play 的测试模式下有一个正在运行的应用程序。
But today... even this code has this error.但是今天......即使是这段代码也有这个错误。 I could imagine this is a Firebase rules problem because they forced me after 30 days to change them.
我可以想象这是一个 Firebase 规则问题,因为他们强迫我在 30 天后更改它们。 but after my changes the code runs for a while.
但在我更改代码后运行了一段时间。
[Unhandled promise rejection: Error: Objects are not valid as a React child (found: object with keys {seconds, nanoseconds}). If you meant to render a collection of children, use an array instead.]
at http://192.168.178.47:19000/node_modules/expo/AppEntry.bundle?platform=android&dev=true&hot=false&strict=false&minify=false:281758:22 in <unknown>
Firebase converts date/time to timestamp objects {seconds: number, nanoseconds: number}
so if you passing that in the date field from your response object, you get that error. Firebase 将日期/时间转换为时间戳对象
{seconds: number, nanoseconds: number}
因此,如果您在响应 object 的日期字段中传递它,则会收到该错误。 you have to convert the firebase date to javascript date or string.您必须将 firebase 日期转换为 javascript 日期或字符串。 See this question from more
从 more 看到这个问题
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.