Skip to content

Navigation callbacks within mounted contextual router #95

Closed
@0nn0

Description

@0nn0

I'd like to make use of the navigation callbacks onBeforeNavigation and onNavigation within a mounted contextual router. It works fine when I add the callback to the main router, however when I use it within a contextual router mounted under another router, the callbacks don't get called.

Modified example:

var App = React.createClass({
  handleNavigation: function() {
    console.log( 'works great' );
  },
  render: function() {
    return (
      <Locations onBeforeNavigation={this.handleNavigation}>
        <Location path="/" handler={MainPage} />
        <Location path="/photos(/*)" handler={Photos} />
      </Locations>
    )
  }
})

var Photos = React.createClass({
  handleNavigation: function() {
    console.log( 'does not get triggered' );
  },
  render: function() {
    return (
      <Locations contextual onBeforeNavigation={this.handleNavigation}>
        <Location path="/" handler={AlbumPage} />
        <Location path="/:slug" handler={PhotoPage} />
      </Locations>
    )
  }
})

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions