Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

problem with Actions.pop ,, send me to initial Scene #2975

Closed
Q8hma opened this issue Mar 30, 2018 · 6 comments
Closed

problem with Actions.pop ,, send me to initial Scene #2975

Q8hma opened this issue Mar 30, 2018 · 6 comments

Comments

@Q8hma
Copy link

Q8hma commented Mar 30, 2018

Version

  • react-native-router-flux v4.0.0-beta.28
  • react-native v0.54.3

the problem when im on Scene 5 and i used "Actions.pop" send me to Scene 1

the steps
Scene 1 > 2 > 3 > 4 > 5 (when i use "Actions.pop" it must push me back to Scene 4 but it send me to the first Scene)

thnx and sorry if i add wrong issues and make new one and so sorry for my bad english

@asciifaceman
Copy link
Contributor

Can you give your code examples?

Actions.pop() will only work if you were using Actions.push() to add new views, if you are using replace for example it clears the routing stack.

Also IOS or Android as their "back" functionality is different.

@Q8hma
Copy link
Author

Q8hma commented Apr 1, 2018

i used action.SceneName
i test it on ios not android

@drailanjohngss
Copy link

im also experiencing this problem.

@Blapi
Copy link
Collaborator

Blapi commented Apr 4, 2018

You might have replace the navigation stack at a moment, Actions.pop works just fine, the issue is in your code, not in the library.

Have a look at the example project, the best practices and the solution for your problems will be there.

Moreover, check your navigation stack by doing this :

const reducerCreate = (params) => {
  const defaultReducer = new Reducer(params)
  return (state, action) => {
    console.log('Action :', action)
    console.log('State :', state)
    return defaultReducer(state, action)
  }
}

...
...

<Router createReducer={reducerCreate}>

You will have the best overview to see what's wrong.

@Blapi Blapi closed this as completed Apr 4, 2018
@Q8hma
Copy link
Author

Q8hma commented Apr 4, 2018

thnx alot and i fix it by move Drawer over ()
new code :
<Router hideNavBar= "true" createReducer={reducerCreate}> <Drawer key="drawer" contentComponent={DrawerContent} drawerWidth={250} hideNavBar> <Scene key="root" hideNavBar> <Scene key="home_page" component={home_page} title="home_page" initial={true} hideNavBar/> <Scene key="search_page" component={search_page} title="search_page" hideNavBar/> <Scene key="cats_page" component={cats_page} title="cats_page" hideNavBar/> <Scene key="tops_page" component={tops_page} title="tops_page" hideNavBar/> <Scene key="sound_page" component={sound_page} title="sound_page" hideNavBar /> <Scene key="sounds_page" component={sounds_page} title="sounds_page" hideNavBar /> <Scene key="aboutus_page" component={aboutus_page} title="aboutus_page" hideNavBar /> </Scene> </Drawer> </Router>

old code :
<Router hideNavBar= "true" createReducer={reducerCreate}> <Scene key="root" hideNavBar> <Drawer key="drawer" contentComponent={DrawerContent} drawerWidth={250} hideNavBar> <Scene key="home_page" component={home_page} title="home_page" initial={true} hideNavBar/> <Scene key="search_page" component={search_page} title="search_page" hideNavBar/> <Scene key="cats_page" component={cats_page} title="cats_page" hideNavBar/> <Scene key="tops_page" component={tops_page} title="tops_page" hideNavBar/> <Scene key="sound_page" component={sound_page} title="sound_page" hideNavBar /> <Scene key="sounds_page" component={sounds_page} title="sounds_page" hideNavBar /> <Scene key="aboutus_page" component={aboutus_page} title="aboutus_page" hideNavBar /> </Drawer> </Scene> </Router>

thnx alot u help me

@jeff63115
Copy link

This helped me. Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants