Skip to content

Centerer: Remove, as unnecessary.#4868

Closed
chrisbobbe wants to merge 1 commit intozulip:mainfrom
chrisbobbe:pr-remove-centerer
Closed

Centerer: Remove, as unnecessary.#4868
chrisbobbe wants to merge 1 commit intozulip:mainfrom
chrisbobbe:pr-remove-centerer

Conversation

@chrisbobbe
Copy link
Copy Markdown
Contributor

AccountPickScreen and AuthScreen both pass centerContent to the
<Screen /> that they use. Empirically, this strategy seems to do
just fine on its own in both cases: removing the <Centerer /> in
both cases doesn't seem to change anything at all, in my testing.
This is as we'd expect, from reading Screen's interface and noting
that it seems to work just fine without a <Centerer /> in three
existing uses.

What's more, we have a hypothesis that the <Centerer /> is causing
an important bug that prevents some users from logging in at all, by
obscuring crucial pieces of the UI; see
https://chat.zulip.org/#narrow/stream/48-mobile/topic/login.20bug/near/1225893.

AccountPickScreen and AuthScreen both pass `centerContent` to the
`<Screen />` that they use. Empirically, this strategy seems to do
just fine on its own in both cases: removing the `<Centerer />` in
both cases doesn't seem to change anything at all, in my testing.
This is as we'd expect, from reading `Screen`'s interface and noting
that it seems to work just fine without a `<Centerer />` in three
existing uses.

What's more, we have a hypothesis that the `<Centerer />` is causing
an important bug that prevents some users from logging in at all, by
obscuring crucial pieces of the UI; see
  https://chat.zulip.org/#narrow/stream/48-mobile/topic/login.20bug/near/1225893.
@chrisbobbe chrisbobbe requested review from WesleyAC and gnprice July 6, 2021 19:58
Copy link
Copy Markdown
Member

@gnprice gnprice left a comment

Choose a reason for hiding this comment

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

Thanks @chrisbobbe! I'll be surprised if what's in this component is affecting anything like that bug, but good to clean it up. One comment below.

Comment thread src/common/Centerer.js
},
inner: {
width: '100%',
maxWidth: 480,
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This maxWidth looks like it was probably doing something. In particular, on AccountPickScreen, if your screen is wide (like on a tablet, or in landscape on a phone) then I think this is what stops the items in the accounts list from stretching across the whole width.

Maybe move this down into the two callsites? Those are better places for this layout choice to appear anyway.

Copy link
Copy Markdown
Contributor Author

@chrisbobbe chrisbobbe Jul 7, 2021

Choose a reason for hiding this comment

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

Makes sense.

Hmm, here's a question about Screen's interface:

When you pass centerContent to a Screen, that gives justifyContent: 'center' to a container element (so, centers that element's children vertically), but doesn't set alignItems: 'center', to center content horizontally; alignItems is left with its default, 'stretch'. This means children with a maxWidth aren't centered horizontally, but rather sit to the left. Children without a maxWidth are stretched to fill the container (so I guess they are effectively centered).

Would it be an improvement to Screen's interface to have centerContent set both justifyContent and alignItems to 'center'?

https://css-tricks.com/snippets/css/a-guide-to-flexbox/#align-items

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Yeah, good find -- I think that would be an improvement.

@chrisbobbe
Copy link
Copy Markdown
Contributor Author

I'd like to pause on this and will come back once #4893 is resolved.

chrisbobbe added a commit to chrisbobbe/zulip-mobile that referenced this pull request Aug 27, 2021
We're not totally satisfied with how we annotate `defaultProps` (see
f801c97), but it works, and we'd like to remove `Centerer` anyway;
issue zulip#4868 is in progress toward that.

Related: zulip#4907
gnprice pushed a commit to chrisbobbe/zulip-mobile that referenced this pull request Sep 1, 2021
We're not totally satisfied with how we annotate `defaultProps` (see
f801c97), but it works, and we'd like to remove `Centerer` anyway;
issue zulip#4868 is in progress toward that.

Related: zulip#4907
@chrisbobbe chrisbobbe closed this in b55d0b3 Feb 9, 2023
@chrisbobbe chrisbobbe deleted the pr-remove-centerer branch February 9, 2023 00:08
@chrisbobbe
Copy link
Copy Markdown
Contributor Author

Closing as stale, with TODOs added in b55d0b3.

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

Successfully merging this pull request may close these issues.

2 participants