【发布时间】:2018-05-28 04:46:58
【问题描述】:
错误: undefined 不是对象(评估 '_this.context.router.history')
index.js:
<Left>
<Link to="/menu">
<Image
source={require("./src/assets/images/home.png")}
style={styles.homeIcon}
/>
</Link>
</Left>
...
<NativeRouter>
<Container>
<Stack>
<Route exact path="/" component={Login} />
<Route
path="/menu"
component={() => <Menu showMenuIcon={this.showMenuIcon} />}
/>
<Route
path="/dialog"
component={() => <Dialog showMenuIcon={this.showMenuIcon} />}
/>
...
</Stack>
</Container>
</NativeRouter>
点击链接后显示错误。怎么了?
【问题讨论】:
-
用
NativeRouter包围你的整个应用程序。
标签: reactjs react-native react-router-native