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

[BUG] - NextUI seems to break/clash with Mapbox GL JS #4297

Open
newguy123-creator opened this issue Dec 9, 2024 · 7 comments
Open

[BUG] - NextUI seems to break/clash with Mapbox GL JS #4297

newguy123-creator opened this issue Dec 9, 2024 · 7 comments

Comments

@newguy123-creator
Copy link

NextUI Version

2.6.5

Describe the bug

I'm adding NextUI to my existing React project that is also using mapbox gl js and tailwind
My app works perfectly fine without NextUI, but as soon as I add the tags around my app, the mapbox map no longer displays - everything else still works fine, but the map no longer displays

Your Example Website or App

No response

Steps to Reproduce the Bug or Issue

Well just add NextUI to an existing React app that also has tailwind and mapbox gl js

Expected behavior

I expect the map to still work, but it appears that NextUI overrides something in Mapbox. Mapbox uses its own css by the way...

Screenshots or Videos

No response

Operating System Version

Windows 10 pro

Browser

Chrome

Copy link

linear bot commented Dec 9, 2024

@wingkwong
Copy link
Member

please provide a minimal reproducible environment.

@newguy123-creator
Copy link
Author

please provide a minimal reproducible environment.

Reproducable with ANY existing React app with Tailwind and Mapbox GL JS. Just add NextUI and the map no longer displays

@newguy123-creator
Copy link
Author

What does step4 in the Installation actualy do for Vite?
image

If I simply omit this step, then everything seems to work fine and the NextUI components work fine with my Mabbox components, so then what is step 4 actually for?

@newguy123-creator
Copy link
Author

newguy123-creator commented Dec 10, 2024

...spoke too soon
even if I omit NextUIProvider, mapbox map then break again as soon as I try and use a theme

        <main className="dark text-foreground bg-background">
            <App />
        </main>

It must be overriding the mapbox-gl/dist/mapbox-gl.css file I geuss :-(

@newguy123-creator
Copy link
Author

newguy123-creator commented Dec 10, 2024

Seems I may have resolved the issue, although not sure why!?!
My map container has a tailwind css styling on it "className="h-full w-full bg-[lightgrey]"
If I remove this style, then use the container's id and use regular css in my css file like so:

#map-container {
    width: 100%;
    height: 100vh;
}

...it seems to resolve the issue. Very weird, but it works

@wingkwong
Copy link
Member

The provider is a component in NextUI that serves several important functions such as client-side routing, locale for internationalization, global prop control and etc.

The problem could be due to some styles conflicting. Without a reproducible environment, we couldn't investigate further.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants