所以我有一个带有活动的应用程序。该应用程序会在开始时检查 Internet 连接。如果没有 Internet 连接,它将显示一个带有刷新页面按钮的屏幕。问题是我的 API 调用 (Axios) 位于componentDidMount()第一次渲染后仅调用一次的位置。有什么办法可以重新加载页面,以便它调用componentDidMount再次?
我的意思是完全刷新。顺便说一句,我正在使用 EXPO。任何帮助表示赞赏。抱歉,没有示例,如果可能的话,我只是想了解一下
所以我有一个使用“react-native-off-canvas-menu”的 Drawer.Js,其唯一目的是打开和关闭抽屉。问题是这个抽屉只能通过手势(向左/向右滑动)打开和关闭。我想用一个按钮绑定这个打开和关闭功能。问题是当我尝试从 Home.Js 调用函数 handleClick 到我的 Drawer.Js 时,它显示错误
在我的 Drawer.Js 里面
class FirstScreen extends Component {
constructor(props) {
super(props);
this.state = {
menuOpen: false
};
this.handleClick = this.handleMenu.bind(this);
}
handleMenu() {
const { menuOpen } = this.state;
this.setState({
menuOpen: !menuOpen
});
}
// Some Render Method Where i tried to create a button, and calling
this.handleMenu() on the onPress event, and it's successful
*//After the Render Method
export function a() {
return this.handleClick();
}
Run Code Online (Sandbox Code Playgroud)
我还使用 React Native Router Flux,我的应用程序的第一条路线是 Home.js,在 …