【问题标题】:Use InteractionManager from redux-saga使用来自 redux-saga 的 InteractionManager
【发布时间】:2023-10-28 08:45:01
【问题描述】:

在 react-native 应用程序中,我想使用来自 redux-sagaInteractionManager

InteractionManager.runAfterInteractions(() => {
  // ...long-running synchronous task...
});

有可能吗?怎么用?

【问题讨论】:

    标签: reactjs react-native redux redux-saga


    【解决方案1】:

    InteractionManager.runAfterInteractions() 返回一个承诺,因此您可以在具有call 效果的 Saga 中使用它:

    yield call(InteractionManager.runAfterInteractions)
    

    【讨论】:

    • 我已经没有机会尝试了,但如果有人确认,我会接受这个答案。
    • @JulienMalige 已确认。该解决方案有效。 Adamvert,thanx,兄弟