-Router.js
const RouterWithRedux = connect()(Router);
const RouterComponent = () => {
return (
<View style={{ flex: 1 }}>
<Header />
<RouterWithRedux>
<Scene key='root' hideNavBar gestureEnabled={false} panHandlers={null} duration={0}>
<Scene key='auth' hideNavBar initial duration={0}>
<Scene
key='Login'
component={Login}
title='Login'
/>
</Scene>
<Scene key='Main' hideNavBar duration={0}>
<Scene
key='Wallet'
component={Wallet}
title='Wallet'
/>
<Scene
key='Card'
component={Card}
title='Card'
/>
</Scene>
</Scene>
</RouterWithRedux>
<Bottom />
</View>
);
};
export default RouterComponent;
-Header.js
onPress(button) {
Keyboard.dismiss();
Actions.refresh({ key: Actions.currentScene });
}
Hear my routing file and header file onpress method.
-On Press button i want refresh current screen on header file.
-When i refresh first time Actions.refresh working.
-Second time not Actions.refresh not working for current screen.
i refresh same page second time.
First time - Actions.refresh({ key: 'Wallet'});
Second time - Actions.refresh({ key: 'Wallet'});
Any solution for second time same page refresh?
I am having same issue,
I tried to console.log the prop inside the componentWillReceiveProps
First time I can see the prop value
Second time the console.log is not run. So nothing is displayed.
Okay I found the issue f and fixed my problem.
The problem is that if you pass the same parameter to Actions.refresh, then the refresh doesn't happen, so I have added one more variable and gave it a "Math.random()" value. which makes sure the view is updated everytime.
It makes sense..
Most helpful comment
It makes sense..