sanfilippopablo / react-swipeable-routes

Utility for integrating react-swipeable-views with react-router.
MIT License
75 stars 14 forks source link

how do you do a Infinite loop for the routes? #8

Open 888jacklee opened 6 years ago

888jacklee commented 6 years ago

is there a way to do a Infinite loop for the routes?

e.g. to start over again when reach the end of the routes

sanfilippopablo commented 6 years ago

I'm pretty sure you can't do this right now. I'm leaving this open because it'd be a nice to have.

cbourlon commented 5 years ago

Hey @sanfilippopablo, is there something new about this issue? Do you think ''react-swipeable-views-utils" could be integrated in some way?

Thanks a lot this very nice package by the way ;)

sanfilippopablo commented 5 years ago

Hi @cbourlon ! I'm planning to add virtual routes from that package. That'd allow SwipeableRoutes to support infinite loops and lazy loading of routes. Maybe I can implement that this weekend.

cbourlon commented 5 years ago

Hey @sanfilippopablo,

Thanks for your answer. I made an other independent component next to swipeableroutes and it works fine for my purpose but I’m sure that others would be happy to use your implementation if you find time to make it.

Thanks again for this package and your work ;) That’s very nice!

develleoper commented 5 years ago

Their virtualize and slideRenderer functionality would also help immensely with using route match params!

Also +1 on thanks to you for this package! It's so good

888jacklee commented 5 years ago

Great Stuff!!!

sanfilippopablo commented 5 years ago

@develleoper

Their virtualize and slideRenderer functionality would also help immensely with using route match params!

How so? I want to implement the virtualize interoperability, and I'm considering the use cases

r-saba commented 3 years ago

I'm currently doing this to simulate infinite loops. Essentially a swipewable route where the last route redirects to the first route

<PrivateRoute exact path={['/', ROUTES.HOME]}>
  {<Redirect to={ROUTES.DISCOVER.url} />}
</PrivateRoute>
<SwipeableRoutes>
  <PrivateRoute path={ROUTES.DISCOVER.url} component={DiscoverPage} />
  <PrivateRoute path={ROUTES.UPCOMING.url} component={UpcomingPage} />
  <PrivateRoute path={ROUTES.MY_EVENTS.url} component={MyEventsPage} />
  <PrivateRoute exact path={ROUTES.HOME}></PrivateRoute>
</SwipeableRoutes>