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

Remove vertical scrollbars from views on native #3429

Merged
merged 9 commits into from
Apr 12, 2024

Conversation

haileyok
Copy link
Contributor

@haileyok haileyok commented Apr 5, 2024

Rationale

Because a lot of our lists are virtualized, there is a bit of "jank" whenever the view resizes. For example in the feed, each time a new batch of items gets rendered below our current scroll position, the scrollbar changes position. Additionally, whenever we load the next batch of items from the server, the scrollbar jumps up the page to account for the new items.

Other apps, such as Meta products, do not show the vertical scrollbar in any scroll view - including non-virtual lists such as settings, etc.

My opinion is that we definitely should now show scrollbars on our virtualized lists for two reasons:

  1. They are janky and just look weird
  2. They take away from the sense of "infinite" items (where applicable). I expect my feed to be continuous no matter how far I scroll. Having a scrollbar makes takes away from that thought a bit.

And since we are removing the scrollbars from the main parts of the app, I also believe we should just remove them from the other few ScrollView areas. I have two reasons for that as well:

  1. If we don't show them everywhere, it's a bit strange to show them only in some places. Users don't care or know about why virtualization causes jank and why we removed them from those screens, they just know that sometimes they see a scrollbar and sometimes they do not.
  2. Even without the virtualization jank, our scrollbars still get hidden under parts of our UI shell (since we are not using the native navigation shell from react-navigation, primarily.

How

This was pretty simple. There are two places where we get these: List and ScrollView. Thankfully, we have nice little wrappers for these already, so I only needed to modify this prop in two places. I went through the app and can't find anywhere that I missed this.

There were a few places that we are using FlatList directly as well, which can get fixed in a separate PR (there's some other things there that are no good like using anonymous functions as props). For now I added showsVerticalScrollIndicator={false} to those FlatLists manually.

Test Plan

This is mainly a visual change, so really its a matter of going around the app and seeing if not having the scrollbars is something that seriously bothers you or not. We might decide some areas need them, but from my experience so far I have not ran into any of those cases.

Copy link

github-actions bot commented Apr 5, 2024

Old size New size Diff
6.36 MB 6.36 MB 152 B (0.00%)

@@ -130,6 +131,7 @@ export function RecommendedFeeds({next}: Props) {
renderItem={({item}) => <RecommendedFeedsItem item={item} />}
keyExtractor={item => item.uri}
style={{flex: 1}}
showsVerticalScrollIndicator={false}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

These screens actually look better in general without indicators (and already do not show them on web) so let's just set the prop to false.

@haileyok haileyok force-pushed the hailey/remove-vertical-scroll-bar-native branch from f14985c to 9d6053a Compare April 9, 2024 06:22
Comment on lines 43 to 44
const showsVerticalScrollIndicator =
useGate('shows_vertical_scroll_indicator') && isWeb
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I am using shows_vertical_scroll_indicator for the gate name, even though we're actually removing the indicators. I think it makes more sense to use the wording shows_vertical_scroll_indicator just so we are not inverting the boolean. We can change the name though if we want to keep the gate name identical to what we are actually testing.

Copy link
Contributor Author

@haileyok haileyok Apr 9, 2024

Choose a reason for hiding this comment

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

Ah, I just realized this isn't ideal because the useGate will return false IIRC. Just going to use hide_vertical_scroll_indicators instead.

Comment on lines 13 to 15
const showsVerticalScrollIndicator = useGate(
'shows_vertical_scroll_indicator',
)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This component is only used on native, so we don't need an isWeb check here.

@@ -37,7 +40,8 @@ function ListImpl<ItemT>(
const isScrolledDown = useSharedValue(false)
const contextScrollHandlers = useScrollHandlers()
const pal = usePalette('default')

const showsVerticalScrollIndicator =
!useGate('hide_vertical_scroll_indicators') && isWeb
Copy link
Collaborator

Choose a reason for hiding this comment

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

should this be && or should it be || ?

Copy link
Collaborator

Choose a reason for hiding this comment

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

nm that's correct

Copy link
Collaborator

Choose a reason for hiding this comment

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

wait. is it?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

God I had my explanation typed out and then realized you're right. What a mind fuck. Sec.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

okay fixed...

Case 1:

  • Gate false -> inverted -> true
  • Is not on web -> false
  • Shows indicator

Case 2:

  • Gate false -> inverted -> true
  • Is on web -> true
  • Shows indicator

Case 3:

  • Gate true -> inverted -> false
  • Is not on web -> false
  • Doesn't show

Case 4:

  • Gate true -> inverted -> false
  • Is on web -> true
  • Shows indicator

Copy link
Collaborator

@pfrazee pfrazee left a comment

Choose a reason for hiding this comment

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

Yeah I'm +1 to this, especially with the new profile header behavior it becomes super noticable

@pfrazee pfrazee merged commit c3821fd into main Apr 12, 2024
6 checks passed
@pfrazee pfrazee deleted the hailey/remove-vertical-scroll-bar-native branch April 12, 2024 22:22
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