aksonov / aksonov/react-native-mobx

Respond to the START of a Scene transition from within a Scene's child component

未关闭
#8 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
主要语言
Objective-C
星标
224
派生
37
PR 合并指标
30 天内没有已合并 PR

描述

I asked this question on the react-native-router-flux repo and was given the following answer, though I'm not sure how it applies to react-native-mobx as I don't think there is an explicit reducer?

Question:

Is there a way to respond to the START of a Scene transition from within a Scene's child component?

I have audio playing which I stop within componentWillUnmount. componentWillUnmount is only triggered at the completion of a scene transition (and only when popping a scene, not pushing).

I'd like to be able to stop the audio as soon as the transition is triggered while keeping that logic encapsulated within the relevant component. (i.e. without creating global audio control logic)

Answer:

You can listen to the reducer - check the Example app for a way to do this.

贡献指南

这个仓库没有索引到贡献指南

评估

这个 Issue 还没有评估数据。

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。