-
-
Notifications
You must be signed in to change notification settings - Fork 663
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
Group Nav: Use ScrollView instead of View #4513
base: main
Are you sure you want to change the base?
Conversation
d96db73
to
fdb75c9
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, @im-adithya! I've just tried this out on my iPhone, and it's looking good.
A nice-to-have would be a more graceful way to handle the left and right sides of the fixed rectangle, the one that acts as a "window" onto the content that scrolls left and right. Right now, it just ends abruptly:
I seem to remember a pattern where a rectangle like this fades into the background at the edge. Here's a Stack Overflow answer with an image that conveys what I'm thinking of (screenshot below):
(We'd leave out the users' names.)
Am I imagining things, or is that a common pattern to use?
I see a prop for ScrollView
called FadingEdgeLength
that might do something like what I'm thinking of. What happens if you use something greater than zero for that prop? Looks like it's Android-only, though, hmm.
A small nit in the commit message: instead of "Fixes #3700", our habit is to say "Fixes: #3700" (note the colon).
src/title/TitleGroup.js
Outdated
@@ -22,7 +22,7 @@ const componentStyles = createStyleSheet({ | |||
export default function TitleGroup(props: Props) { | |||
const { userIds } = props; | |||
return ( | |||
<View style={styles.navWrapper}> | |||
<ScrollView horizontal showsHorizontalScrollIndicator={false}> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's the reason for removing the style={styles.navWrapper}
? 🙂 I don't think I'm attached to it (though I haven't thought super hard about it yet). But if we remove it, I'd like to record a reason for doing so.
…Ah, I see that I get the following error if I try to add that back in on the ScrollView
:
Invariant Violation: ScrollView child layout (["alignItems","justifyContent"]) must be applied through the contentContainerStyle prop.
What happens if you follow that recommendation, and apply alignItems
and justifyContent
through the contentContainerStyle
prop, instead of the style
prop?
Or is there some other motivation for dropping styles.navWrapper
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Or is there some other motivation for dropping styles.navWrapper?
I thought it was of no use as the ScrollView horizontal is equivalent to flexDirection: row
, and the spacing is taken care of by the marginRight
property of the avatars
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ScrollView horizontal is equivalent to
flexDirection: row
This may sound a bit nit-picky, but this isn't really true. 🙂 Strictly speaking, they aren't equivalent: passing true
for horizontal
will help us have horizontal scrolling behavior, while flexDirection: 'row'
will not (and it hasn't been; we've been setting that, and we don't have horizontal scrolling). Since we know of at least that difference, it might be useful to explore more, to help avoid accidentally introducing bugs.
What happens if you follow that recommendation, and apply
alignItems
andjustifyContent
through thecontentContainerStyle
prop, instead of thestyle
prop?
Have you tried this out? 🙂 Do you notice anything?
So what should we do now? Can we use a component to solve this for both platforms or leave it as is for iOS? I found react-native-fading-edge as a good option after some research. |
49a8bd8
to
6a7ac21
Compare
6a7ac21
to
3cd6768
Compare
Sorry for being late! Added the fadingEdgeLength for now. See thread here @chrisbobbe, Please review it now :) |
No problem! 🙂 One nit I see is let's put a code comment on the Android-only prop that gives the fade effect, so we can tell it's Android-only without having to look it up (that seems like a useful thing to know right away when reading that code). |
Updates TitleGroup to use ScrollView instead of View so that the avatars in nav bar don't overflow and can be scrolled to view. Fixes: zulip#3700
3cd6768
to
725d29e
Compare
Done! |
Description
This PR updates TitleGroup.js to use ScrollView so that the avatars don't overflow
and can be scrolled to view entire contents.
Issues related to PR
Fixes issue: #3700
Screenshots
Normal:
On rotating screen: