我是 react-native-router-flux 的新手,正在看这个例子。我检查了文档,但我似乎仍然无法弄清楚是什么 <Scene key='modal' component={Modal}/>
.那么它的用途是什么呢?
这是确切的行:https://github.com/aksonov/react-native-router-flux/blob/master/Example/Example.js#L95-Lundefined
谢谢
最佳答案
<Scene key='modal' component={Modal}/>
设置应用程序,以便模式可以出现在其他所有内容之上。这不是模态本身,只是用于准备应用程序的那一行,它“可以”在它的顶部加载其他东西……比如 z-index 或正在初始化的最顶层。这有帮助吗?
从下面的代码示例中,您可以看到“根”(模态行下方的一层)与“实际”模态位于同一层:
import StatusModal from './components/StatusModal'
<Router>
<Scene key="modal" component={Modal} >
<Scene key="root">
<Scene key="screen1" initial={true} component={Screen1} />
<Scene key="screen2" component={Screen2} />
</Scene>
<Scene key="statusModal" component={StatusModal} />
</Scene>
</Router>
如果您没有模态,则不需要该行。它只是在 react native router flux examples 中,因为那里有一个模态演示。
关于javascript - react 原生 + react 原生路由器通量 : What does <Scene key ='modal' component={Modal}/> do?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39621790/