sanfilippopablo / react-swipeable-routes

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

Support history.replace instead of history.push #5

Closed voxbono closed 6 years ago

voxbono commented 6 years ago

Thanks for an awesome project! I'm currently developing an app that needs to ability to replace the the history prop instead of pushing to it, so that the back button takes me to the previous visited page instead of back to a previous route in my app.

It's a supported feature in react-router, so it would be nice to have it available when swiping as well. React Router Link component

Is this supported in your project?

sanfilippopablo commented 6 years ago

Hi! Thanks for reporting. It is supported now! I just published react-swipeable-routes@0.4.1 with support for this. Just add a replace={true} prop to the SwipeableRoutes component and you're ready to go:

<SwipeableRoutes replace containerStyle={{"height: 100%"}}>
  <Route path="/red" component={RedView} />
  <Route path="/blue" component={BlueView} />
  <Route path="/green" component={GreenView} />
  <Route path="/yellow" component={YellowView} />
</SwipeableRoutes>

Let me know if you have any issue with this.

voxbono commented 6 years ago

Wow! You are awesome! It works like a charm!

Thank you so much!!!