React Native 警告:“长时间设置计时器...".如何定位原因? [英] React Native Warning: "Setting a timer for a long period of time...". How to locate cause?

查看:34
本文介绍了React Native 警告:“长时间设置计时器...".如何定位原因?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

iOS 上的一切正常.在 Android 上,我收到警告长时间设置计时器,即多分钟,是 Android 上的性能和正确性问题,因为它使计时器模块保持唤醒状态,并且计时器只能在应用程序处于前景.见 https://github.com/facebook/react-native/issues/12981 了解更多信息.(看到持续时间为 589668 毫秒的 setTimeout)"

Everything on iOS works fine. On Android I am getting the warning "Setting a timer for a long period of time, i.e. multiple minutes, is a performance and correctness issue on Android as it keeps the timer module awake, and timers can only be called when the app is in the foreground. See https://github.com/facebook/react-native/issues/12981 for more info. (Saw setTimeout with duration 589668ms)"

我没有在我的应用程序中使用任何计时器,所以我假设这是来自我安装的 NPM 模块.我如何确定是哪一个导致了这种情况?

I don't use any timers in my app so I am assuming this is from an NPM module I have installed. How can I determine which one is causing this?

我看到我可以忽略警告,但我想向模块维护者报告这个问题.

I see that I can ignore the waring, but I would like to report the issue to the module maintainer.

推荐答案

这是一个警告,某些 javascript 依赖项会由于其方面的问题而在 react-native 上引发,并且必须在 react-native 的代码库中解决,但不是令人担忧的原因.如果它困扰你,只需添加 console.ignoredYellowBox = ['Setting a timer'];.要找出导致它的依赖项,您必须使用 chrome 调试应用程序并确保启用了源映射.

This is a warning that certain javascript dependencies will raise on react-native due to an issue on their side and must be solved in react-native's codebase but is not a cause for concern. If it bothers you just add console.ignoredYellowBox = ['Setting a timer'];. To find out which dependency is causing it you must debug the app with chrome and ensure sourcemaps are enabled.

这篇关于React Native 警告:“长时间设置计时器...".如何定位原因?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆