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

Need help to understand how transition works #59

Open
smontlouis opened this issue Oct 12, 2016 · 7 comments
Open

Need help to understand how transition works #59

smontlouis opened this issue Oct 12, 2016 · 7 comments

Comments

@smontlouis
Copy link

I have a regular Tabs interface, and I want to slide between tabs (this one works).
But when I click for example on a Topic in Topics Tab, I want to go in topics/:topicId with a horizontal-card-stack (this one is not working).

Am I doing something wrong ?

    <Router
      history={nativeHistory}
      addressBar
    >
      <TabsRoute
        path="/home"
        component={Master}
        onEnter={userIsLogged}
        transition="horizontal-pager"
      >
        <Route
          path="/"
          component={Topics}
        />
        <Route
          path="/favorites"
          component={Favorites}
        />
        <Route
          path="/profile"
          component={Profile}
        />
        <Route
          path="/more"
          component={More}
        />
      </TabsRoute>
      <Route
        path="/topics/:topicId"
        component={Topic}
        transition="horizontal-card-stack"
      />
      <Route
        path="/questions/:questionId"
        component={Question}
        transition="horizontal-card-stack"
      />
      <Route
        path="/login"
        component={Login}
        onEnter={userIsNotLogged}
      />
    </Router>
@jonathanglasmeyer
Copy link
Collaborator

Try a StackRoute with path /topics with a child Route with path /topics/:topicId. Specify the transition on the StackRoute.

@smontlouis
Copy link
Author

Thank you @jonathanewerner, but if I do this, :topicId will inherits from /topics, but their layouts are totally different.

@smontlouis
Copy link
Author

smontlouis commented Oct 12, 2016

I tried something like that :

     <TabsRoute
        path="mainApp"
        component={MasterWithTabs}
        onEnter={userIsLogged}
        transition="horizontal-pager"
      >
        <StackRoute
          path="something"
          component={Master}
          transition="horizontal-card-stack"
        >
          <Route
            path="/"
            component={Topics}
          />
          <Route
            path="/topics/:topicId"
            component={Topic}
          />
          <Route
            path="/questions/:questionId"
            component={Question}
          />
        </StackRoute>
        <Route
          path="/favorites"
          component={Favorites}
        />
        <Route
          path="/profile"
          component={Profile}
        />
        <Route
          path="/more"
          component={More}
        />
      </TabsRoute>

But now topics inherits tabs from MasterWithTabs... I'm lost ^^'

@smontlouis
Copy link
Author

smontlouis commented Oct 12, 2016

@jonathanewerner This is what I'm trying to achieve link here
(EDIT: @DenJohX, @jonathanewerner here is the correct link)

Just have Tabs and want to open Topics/:topicId with a card stack style

@DenJohX
Copy link
Contributor

DenJohX commented Oct 12, 2016

This is actually related to #56, the only solution I found was to show a modal for the "stacked" routes inside the tabs route, that way you can style them the way you want.

Edit: The downside of showing a modal is that you cant have a url for it, unless you create the modal inside the view then handle the opening/closing with the changes in the url, this is something i was thinking to do, but I have not needed yet. So if you do, please post the code ;-)

PS. I can't see the example, check the link.

@jonathanglasmeyer
Copy link
Collaborator

Yea the link doesn't work.
I don't fully understand what you mean by "inherits tabs". A visualization / reference gif will surely help. :)

@farwayer
Copy link

farwayer commented Nov 3, 2016

I have the same question. How can I have no animation between tabs and stack animation in one of them?

<Router>
      <TabsRoute path='/' component={UI}>
        <StackRoute path='tab1' component={Container} transition='none'>
          <IndexRoute component={screens.Portfolio} />
          <Route path='/register' component={screens.Register} />
        </StackRoute>
        <Route path='tab2' component={screens.Info} />
        <Route path='tab3' component={screens.Info} />
        <Route path='tab4' component={screens.Info} />
      </TabsRoute>
    </Router>

And is it possible to not reset stack state after switching to another tab?

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

4 participants