rafgraph / react-router-hash-link

Hash link scroll functionality for React Router
https://react-router-hash-link.rafgraph.dev
MIT License
734 stars 62 forks source link

On mobile apps it is not working #38

Closed irfanDC closed 4 years ago

irfanDC commented 5 years ago

All is working on the website but on the mobile navigation not working, here is the code

import React, { Component } from "react"

import { NavHashLink as NavLink } from 'react-router-hash-link';

// and the link creation script

<NavLink to={"#schedule"}

Note: I am also using HashRouter as without it mobile app showing blank page.

roeliman commented 5 years ago

yes! got same problem here on mobile it doesn't work at all but perfectly work on desktop version

rafgraph commented 5 years ago

You have to use <BrowserRouter>, this does not work with <HashRouter>.

I'm unable to reproduce an issue on mobile.. does the example site http://react-router-hash-link.rafrex.com/ work for you on mobile.. if not which device and browser? Thanks.

alamothe commented 4 years ago

Facing the same issue on iOS and even desktop Safari.

EDIT: I think if http://react-router-hash-link.rafrex.com/ had two pages (foo and bar) each with 3 sections pointing from one to the other, you would see the issue.

rafgraph commented 4 years ago

The demo site has the home page which links to the page with 3 sections. The scroll works fine for me, but note that when navigating to a new page it won't smooth scroll. If this is still an issue, please open a new issue and with a failing example, thanks.

dev-cmaliwal commented 2 years ago

I am facing the same issue, this is not working in mobile nor in responsive mode. Also, I am using BrowseRouter.