[英]How to replace/reset Relay.Environment for RNRF Router
When user logs out of the app I want to reset Relay.Environment
(replace existing one with a new one). 当用户退出应用程序时,我想重置
Relay.Environment
(用新的替换现有的)。 I've tried passing the new Relay.Environment
to Router
, when re-rendering the component, <Router wrapBy={createRenderer()} sceneStyle={styles.scene}> <Scene key="root" tabs tabBarStyle={{ backgroundColor: '#333333' }}>
createRenderer()
returns current `Relay.Environment 我尝试将新的
Relay.Environment
传递给Router
,当重新渲染组件时, <Router wrapBy={createRenderer()} sceneStyle={styles.scene}> <Scene key="root" tabs tabBarStyle={{ backgroundColor: '#333333' }}>
createRenderer()
返回当前的`Relay.Environment
but I still see that scenes created with old Relay.Environment
. 但我仍然看到用旧的
Relay.Environment
创建的场景。 Is there a correct way to do this? 有没有正确的方法来做到这一点? Am I missing something.
我错过了什么。
Alex 亚历克斯
If you are using Relay Classic, there is a bug that exposes the old environment instead of the new one after a replacement when accessed via this.props.relay
. 如果您使用的是Relay Classic,则在通过
this.props.relay
访问时,有一个错误会在替换后暴露旧环境而不是新环境。 Try accessing the environment via this._reactInternalInstance._context.relay.environment
to see if it matches your new environment. 尝试通过
this._reactInternalInstance._context.relay.environment
访问环境,看它是否与您的新环境匹配。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.