Giter VIP home page Giter VIP logo

Comments (11)

ericvicenti avatar ericvicenti commented on March 29, 2024 17

We have an advanced feature that may help here: you can create a nested navigate action. In your case, it would look like this:

this.props.dispatch({
  type: 'Navigate',
  routeName: 'Home',
  action: {
    type: 'Navigate',
    routeName: 'Main',
  },
});

from react-navigation.

temitope avatar temitope commented on March 29, 2024 5

@ericvicenti that was extremely helpful, but i had to use
this.props.navigation.dispatch vs this.props.dispatch for any future readers.

from react-navigation.

satya164 avatar satya164 commented on March 29, 2024

I don't think this will work. What do you expect it to do? You might wanna dispatch a custom action to reset the stack and then navigate to the view instead of using navigate

from react-navigation.

elliottjro avatar elliottjro commented on March 29, 2024

I expect it to go from one nested view to another nested view ideally hahah

Can I use a custom router to go from one path to another using absolute keys instead of having local keys? eg: /welcome/login to /home/main or something

from react-navigation.

satya164 avatar satya164 commented on March 29, 2024

I expect it to go from one nested view to another nested view ideally hahah

What'll animation do you expect?

Can I use a custom router to go from one path to another using absolute keys instead of having local keys? eg: /welcome/login to /home/main or something

Use navigation.dispatch to dispatch a nested 'Reset' action which does 'Navigate' after the reset

https://reactnavigation.org/docs/navigators/navigation-prop

from react-navigation.

elliottjro avatar elliottjro commented on March 29, 2024

@ericvicenti ahaha it works!! So when I dispatch the navigate action its caught by the parent Navigator or does it look first in sibling views and then passes to the parent?

One thing I did notice is: I don't see a second Navigation Dispatch in console log, is this expected?

from react-navigation.

ericvicenti avatar ericvicenti commented on March 29, 2024

It is caught by the parent navigator because the action's routeName matches the route config name for that navigator. It is expected that there is only one action logged, because only one action happens at the top level.

I'm closing this out for now, feel free to file more issues as you come across them. If you have a chance, consider improving the docs to help make this feature more apparent!

from react-navigation.

mateofd avatar mateofd commented on March 29, 2024

Hi Everyone,
@ericvicenti's comment on Jan 28 was crucial for me to make the nested navigation work.
However, I'm having trouble passing parameters to the target route in the child navigator.
Any ideas?

Thanks!

from react-navigation.

githubmss avatar githubmss commented on March 29, 2024

facing similar issue , so i posted my question here , hope you can help me out in this issue .Please have a look at this link
https://stackoverflow.com/questions/44801667/navigate-to-root-screen-from-nested-stack-navigator?noredirect=1#comment76584210_44801667

from react-navigation.

dmr07 avatar dmr07 commented on March 29, 2024

@ericvicenti There is a memory leak with your solution when used in a modal view. Under the performance monitor, RAM went up ~40mb every time that command is called.

from react-navigation.

ericvicenti avatar ericvicenti commented on March 29, 2024

Could you show a full example of the memory leak? Hard to tell exactly what you're doing

from react-navigation.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.