【发布时间】:2018-04-18 12:05:24
【问题描述】:
在 RNNavigation 的版本 1 中,我通过这种方式将我的商店发送到每个屏幕。
Navigation.registerComponent(RouterConstants.SplashScreen, () => SplashScreen, store, Provider)
编辑:
index.js:
import configureNavigation from './routers/app_navigation'
import createStore from './reducers'
const store = createStore()
configureNavigation(store, Provider)
class App extends React.Component {
constructor (props) {
super(props)
.
.
.
this.startApp()
}
startApp () {
Navigation.setRoot({
stack: {
children: [{
component: {
name: RouterConstants.SplashScreen
}
}]
}
})
}
}
const app = new App()
app_navigation.js:
import SplashScreen from '../containers/splash_screen_container'
.....
...
const initializeRouter = (store, Provider) => {
Navigation.registerComponent(RouterConstants.SplashScreen, () => SplashScreen, store, Provider)
....
..
}
export default initializeRouter
【问题讨论】:
-
你能添加导航设置和商店的代码吗?
-
理想情况下它应该是文本,而不是图像,但总比没有好。现在,我在 SO 上找到了很多关于该错误中的术语的结果。你看到他们中的任何一个了吗?如果是这样,他们是否也不能解决您的问题?如果不是,那么正如 Pritish 所说,您应该发布理解错误所需的完整代码,因为我们不知道这些变量是什么仅仅通过查看那 1 行。
-
@underscore_d 我刚刚添加了一些代码
-
我收到类似“应用程序尚未注册”的错误。
标签: react-native react-native-navigation