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

Component Flashes on Screen #19

Open
leadhkr opened this issue Jun 17, 2019 · 5 comments
Open

Component Flashes on Screen #19

leadhkr opened this issue Jun 17, 2019 · 5 comments

Comments

@leadhkr
Copy link

leadhkr commented Jun 17, 2019

I've tried out your library for a react project of mine and it seems to work with the breakpoints, however, regardless of the width, the components will always flash on the screen then disappear. For example:

        <Breakpoint xlarge up>
          <SearchBar />
        </Breakpoint>

For the above code, I want the search bar to render only for screens larger than xlarge. When the screen size is small (mobile), the SearchBar flashes on the screen then disappears. Which tells me that, while the library is adhering to the screen sizes, it is still rendering the component and then unmounting it.

Is there a fix for this?

@flexdinesh
Copy link
Owner

flexdinesh commented Jun 20, 2019

@sagarpatel8384 Can you add more info about the project in which you are using this lib?

This might happen if you're server rendering your React code. The lib has to have a default for Server Render when there are no event listeners (server side). Right now, XL is the default if there is no event listener (server render).

Maybe we can build an option to configure default for server render so folks can use a different default for different server renders (ex. m.site.com can use mobile as default and site.com can use desktop as default).

Pl add more info on the code where this lib is used and we'll see if it is a code issue or a known SSR problem.

@thedern
Copy link

thedern commented Jun 24, 2019

We have the same flicker/flashing issue as we are attempting to use this package with Next.js

@flexdinesh
Copy link
Owner

This is definitely default desktop fallback for SSR. I'll try to wrap something that makes the default configurable (desktop/mobile/nothing).

@twhite96
Copy link

twhite96 commented Nov 3, 2020

This is still an issue. I'll try to take a look to see if I can help out.

@flexdinesh
Copy link
Owner

A potential work around for this is to use the setDefaultWidth API merged in #44 and published in version 2.2.0.

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

No branches or pull requests

4 participants