react本机路由器流量遇到两个具有相同密钥的子节点

react native router flux Encountered two children with the same key

本文关键字:密钥 子节点 两个 流量 路由器 本机 遇到 react      更新时间:2023-09-26

版本

  • react native router flux v3.31.2
  • react native v15.2.1

我不知道我做错了什么,但当我多次尝试调用Actions.dialog()时,我出现了这个错误。

我认为这个解决方案https://github.com/aksonov/react-native-router-flux/issues/327修复了它,但它不是,它应该是其他的东西,但我没有主意。。。

我唯一没有这个的时候,是当我用pop((关闭它的时候。不幸的是,我不想弹出(它可能会破坏我应用程序中的其他功能(。

有人能帮忙吗?

错误:

`1:$dialog_1_dialog`. Child keys must be unique; when two children share a key, only the first child will be used.
    in RCTView (created by View)
    in View (created by Modal)
    in Modal (created by DefaultRenderer)
    in RCTView (created by View)
    in View (created by DefaultRenderer)
    in DefaultRenderer (created by SceneView)
    in SceneView (created by NavigationCard)
    in RCTView (created by View)
    in View (created by AnimatedComponent)
    in AnimatedComponent (created by NavigationCard)
    in NavigationCard (created by Container)
    in Container (created by NavigationComponent)
    in NavigationComponent (created by NavigationAnimatedView)
    in RCTView (created by View)
    in View (created by NavigationAnimatedView)
    in RCTView (created by View)
    in View (created by NavigationAnimatedView)
    in NavigationAnimatedView (created by NavigationComponent)
    in NavigationComponent (created by DefaultRenderer)
    in DefaultRenderer (created by NavigationRootContainer)
    in NavigationRootContainer (created by Router)
    in Router (created by Connect(Router))
    in Connect(Router) (created by CdiscountReact)
    in Provider (created by CdiscountReact)
    in CdiscountReact
    in RCTView (created by View)
    in View (created by AppContainer)
    in RCTView (created by View)
    in View (created by AppContainer)
    in AppContainer
2016-08-08 14:23:04.269 [warn][tid:com.facebook.react.JavaScript] Warning: flattenChildren(...): Encountered two children with the same key, `1:$dialog_2_dialog`. Child keys must be unique; when two children share a key, only the first child will be used.
    in RCTView (created by View)
    in View (created by Modal)
    in Modal (created by DefaultRenderer)
    in RCTView (created by View)
    in View (created by DefaultRenderer)
    in DefaultRenderer (created by SceneView)
    in SceneView (created by NavigationCard)
    in RCTView (created by View)
    in View (created by AnimatedComponent)
    in AnimatedComponent (created by NavigationCard)
    in NavigationCard (created by Container)
    in Container (created by NavigationComponent)
    in NavigationComponent (created by NavigationAnimatedView)
    in RCTView (created by View)
    in View (created by NavigationAnimatedView)
    in RCTView (created by View)
    in View (created by NavigationAnimatedView)
    in NavigationAnimatedView (created by NavigationComponent)
    in NavigationComponent (created by DefaultRenderer)
    in DefaultRenderer (created by NavigationRootContainer)
    in NavigationRootContainer (created by Router)
    in Router (created by Connect(Router))
    in Connect(Router) (created by CdiscountReact)
    in Provider (created by CdiscountReact)
    in CdiscountReact
    in RCTView (created by View)
    in View (created by AppContainer)
    in RCTView (created by View)
    in View (created by AppContainer)
    in AppContainer

代码

<Scene key="modal" component={Modal} >
  <Scene key="root">
    <Scene key="launch" initial={true} component={Launch} />
    ...
  </Scene>
  {/*Modals*/}
  ...
  <Modal key="dialog" component={Dialog} direction="vertical"/>
</Scene>

希望能有所帮助:

<Modal key="dialog" clone component={Dialog} direction="vertical"/>