简体   繁体   English

如何更换/重置RNRF路由器的Relay.Environment

[英]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.

相关问题 如何使用react-native-router-flux(RNRF)将功能传递给其他组件? - How to pass function to other component with react-native-router-flux(RNRF)? 如何基于RNRF中的条件进行导航 - How to navigate based on a condition in RNRF react native 如何将React-native-router-flux与Relay集成在一起 - How can I integrate react-native-router-flux with Relay 使用中继环境的突变 - Mutations using Relay Environment 具有“替换”,“重置”和“刷新”的react-native-router-flux刷新组件 - react-native-router-flux refreshing component with Replace, Reset, and Refresh 如何在RNRF中使自定义导航栏透明 - How can I make the custom navigation bar transparent in RNRF 现代中继:如何模拟中继进行单元测试 - relay modern: how to mock relay for unit testing react navigation v5 如何重置或更换? - react navigation v5 How to reset or replace? 如何在基于承诺的环境中设置Relay Modern? (例如Auth0或其他异步身份验证服务?) - How to set up Relay Modern with a Promise-based Environment? (e.g. Auth0 or another async authentication service?) 如何在“中显示传递的道具”<Scene/> RNRF v4.0.6 中的“title”属性? - How to show passed props in "<Scene/>" "title" attribute in RNRF v4.0.6?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM