react-native-router-flux: Actions.refresh not working
Version
Tell us which versions you are using:
- react-native-router-flux v4.0.0-beta.12
- react-native v0.46.4
Expected behaviour
Actions.refresh() refresh the current scene. If my approach was wrong, or Actions.refresh has some requirement, please provide me with the information
Actual behaviour
const ConnectRouter = connect()(Router);
const Routes = () => (
<ConnectRouter>
<Scene key="root">
<Scene key="launchScreen" component={LoadingFull} hideNavBar />
<Scene key="login" component={LoginForm} hideNavBar type={ActionConst.RESET} />
<Scene key="lostPassword" component={LostPasswordForm} hideNavBar />
<Scene key="dashboard" component={Dashboard} hideNavBar type={ActionConst.RESET} />
<Scene key="search" component={SearchResult} hideNavBar />
</Scene>
</ConnectRouter>
);
When i was at search scene (plain component with state), i was trying to refresh the scene by using Actions.refresh. But somehow it didn’t work at all.
Steps to reproduce
- Using provided scene list go to search Component (it was just plain component with state)
- trigger actions.refresh by pressing button/ triggering some event
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Reactions: 8
- Comments: 24 (5 by maintainers)
@jaysassyinfotech Actions.refresh({ key: Actions.currentScene }); not working second time It works if you do like this 😃 Actions.refresh({key: Math.random()})
Jesus, I came here looking for an answer for the original issue. Please, try not to piggyback on non related issues !
public componentWillMount (): void { this.props.navigation.setParams({ onRight: () => {this.myOnRight();}, rightTitle:‘newTitle’, }); } It working for me.
It works for me. rnrf-4-beta22
leftButton
for left iconright
for right icon+1 i want to use renderBackButton from scene. My example code,
It’s not working. I think it’s same issue.
@kesha-antonov It’s not working. I create new issue for this.
Try
leftButton
instead ofrenderBackButton
and pass Component to it.@cosinus84 You sir are a lifesaver.
@cosinus84 It is really work. wow But is there any explaination why Math.random() does all the tricks?
Actions.refresh({ key: Actions.currentScene });
not working second time https://github.com/aksonov/react-native-router-flux/issues/2862 @aksonovHi
I have the same problem … When i try to refresh with Actions.refresh() nothing happen
Hopefully random is not needed for latest version now