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

[docs] Home: fix layout on mobile with slow connection #19283

Merged
merged 2 commits into from
Oct 24, 2022

Conversation

Simek
Copy link
Collaborator

@Simek Simek commented Sep 28, 2022

Why

Hopefully fixes https://twitter.com/tejas89_patel/status/1574819679947829248

How

The grid component that we are using relay on the JS to inject the correct breakpoint styles, which on slow connection on mobile can lead to the broken layout when loading.

We can alter the default initial screen size setting, but this would lead to the issues with slow connection on desktop.

An alternate solution to that is to switch to the static containers on mobile, utilizing media queries.

Test Plan

The docs apps has been build and served locally, then I have attempted to load it in browser with Throttle settings set to "Slow 3G".

Preview

Locally served docs

scr

https://docs.expo.dev/

scr2

Checklist

@Simek Simek requested a review from byCedric September 28, 2022 11:36
@expo-bot expo-bot added the bot: passed checks ExpoBot has nothing to complain about label Sep 28, 2022
Copy link
Member

@jonsamp jonsamp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for addressing this. I tried to reproduce this bug, but was not able to. To test this branch, I:

  • Cloned your branch
  • Made a production build and ran it
  • Throttled my network to Slow 3G
  • Then navigated from the website to the docs

The result looked fine, so I am happy with shipping this. Just left one code style comment that I would like to fix, but functionality looks good to me.

Comment on lines +19 to +27
const CustomCol = ({ children, sm, md, lg, xl, xxl }: PropsWithChildren<ColProps>) => (
<>
<Col css={cellWrapperStyle} sm={sm} md={md} lg={lg} xl={xl} xxl={xxl}>
{children}
</Col>
<div css={mobileCellWrapperStyle}>{children}</div>
</>
);

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should put this in its own file (one file = one component)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file includes all variation of Cells (multiple components) already, and CustomCol is not exported - it has been only used by those cell components, so I think that moving it to it's own file isn't a great idea in this particular case.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bot: passed checks ExpoBot has nothing to complain about
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants