-
-
Notifications
You must be signed in to change notification settings - Fork 18
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
Fix issue with element below the anchor blinking during data loading. #53
base: main
Are you sure you want to change the base?
Conversation
bump |
@jmeistrich I think I was able to crack this problem by allowing containers above anchor to grow up. This requires no additional opacity cycles and seems to be quite performant. Now trying to cleanup code and fix numColumns regression, but overall i have good feeling about this solution. |
Oh that's awesome! Yes, I think that might be bad for performance since the top and bottom versions have different view hierarchy, so it wouldn't recycle well when switching between them. Is it possible to just change the style to use bottom instead of top rather than returning different hierarchy? |
@jmeistrich I can try to have two hierarchies, shallow hierarchy will be used when maintainVisibleContentPosition={false} and deeper for maintainVisibleContentPosition={true}. PS: we have orphaned LeanView component, does it still make sense to use it? |
Ok that seems reasonable. So the bottom behavior requires the extra level of hierarchy? It can't just set bottom instead of top on the style? Oh yeah, LeanView supposedly has slightly better perf but I lost track of it with all the experimenting. So we could use that whenever we need a simple View. |
@jmeistrich Just bottom style will require distance from the bottom of the scrollview's content to the top, and calculating it is super hard(lot of Animated magic is needed), i tried to make it few weeks ago, and it's pain in the ass. |
Oh right of course 😅. I think this looks like a good solution, an extra view isn't a big problem. |
Just checking - are you still working on this or is it ready for merge? It's a good fix so I'd like to get it in if it's ready :) |
src/LegendList.tsx
Outdated
@@ -1186,6 +1209,7 @@ const LegendListInner: <T>(props: LegendListProps<T> & { ref?: ForwardedRef<Lege | |||
ListEmptyComponent={data.length === 0 ? ListEmptyComponent : undefined} | |||
maintainVisibleContentPosition={maintainVisibleContentPosition} | |||
scrollEventThrottle={scrollEventThrottle ?? (Platform.OS === "web" ? 16 : undefined)} | |||
waitForInitialLayout={true} |
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.
@jmeistrich I think that waitForInitialLayout should be default option, and should be opted out when needed. Because that's behaviour most users are expecting. WDYT?
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.
Yeah, I think that's probably right. My general criteria is to default to expected and opt-in to optimized performance if it would alter expected behavior. I think you're probably right that would be expected.
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.
But this would always set it to true - should initialize the value to default to true at the top of the component?
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.
Yeah, you're right, i need to set default prop. Let me fix that!
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.
@jmeistrich fixed
@jmeistrich I have found another blinking bug, where old elements are blinking(because of momentarily invalid scroll), it looks i will need to bring back scroll position filter. |
Anchors all elements below anchor to the bottom edge, which reduces visual glitches