react-navigation-browser-history-helpers
react-navigation-browser-history-helpers copied to clipboard
Issue when url finish with "/"
I constated that the helper cannot find the correct route in case or the browser add "/" at the end.
nota my screens path never finish by "/"
I added in reducer one line:
const { path, params = {} } = Navigator.router.getPathAndParamsForState(state);
//->
let pathf = path.lastIndexOf('/') !== -1 ? path.slice(0, path.lastIndexOf('/')) : path;
//
const qs = queryToString(params);
if (!action.dontPushHistory) {
history.push({
pathname: `${basePath}${pathf}`,
search: qs,
});
}
same in browser history:
setNavFromPath = (path) => {
let pathWithoutQuery = path.indexOf('?') !== -1 ? path.slice(0, path.indexOf('?')) : path;
pathWithoutQuery = path.lastIndexOf('/') !== -1 ? path.slice(0, path.lastIndexOf('/')) : path;
This sounds like the route are created with strict: true in term of react-router <Route /> terms. Did you sort this out?