diff options
author | Pokai Chang <pokaichang72@gmail.com> | 2024-05-21 08:41:12 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-05-21 01:41:12 +0100 |
commit | cadc33c625949aedea7504bff6aa405aee029f73 (patch) | |
tree | ecfc27ea3ae651a13df197b58e3478f473606a0a /src/screens/Profile/Sections/Labels.tsx | |
parent | 4a7436886d0548ae453997286f5a8c2ac4b297a0 (diff) | |
download | voidsky-cadc33c625949aedea7504bff6aa405aee029f73.tar.zst |
Fix laggy scrolling on mobile app's home screen, etc. (#4108)
* Improve scrolling performance for List * Update List.tsx * Apply same fix to profile labels --------- Co-authored-by: dan <dan.abramov@gmail.com>
Diffstat (limited to 'src/screens/Profile/Sections/Labels.tsx')
-rw-r--r-- | src/screens/Profile/Sections/Labels.tsx | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/src/screens/Profile/Sections/Labels.tsx b/src/screens/Profile/Sections/Labels.tsx index 553d94d2e..67c827d90 100644 --- a/src/screens/Profile/Sections/Labels.tsx +++ b/src/screens/Profile/Sections/Labels.tsx @@ -111,20 +111,27 @@ export function ProfileLabelsSectionInner({ headerHeight: number }) { const t = useTheme() - const contextScrollHandlers = useScrollHandlers() + // Intentionally destructured outside the main thread closure. + // See https://github.com/bluesky-social/social-app/pull/4108. + const { + onBeginDrag: onBeginDragFromContext, + onEndDrag: onEndDragFromContext, + onScroll: onScrollFromContext, + onMomentumEnd: onMomentumEndFromContext, + } = useScrollHandlers() const scrollHandler = useAnimatedScrollHandler({ onBeginDrag(e, ctx) { - contextScrollHandlers.onBeginDrag?.(e, ctx) + onBeginDragFromContext?.(e, ctx) }, onEndDrag(e, ctx) { - contextScrollHandlers.onEndDrag?.(e, ctx) + onEndDragFromContext?.(e, ctx) }, onScroll(e, ctx) { - contextScrollHandlers.onScroll?.(e, ctx) + onScrollFromContext?.(e, ctx) }, onMomentumEnd(e, ctx) { - contextScrollHandlers.onMomentumEnd?.(e, ctx) + onMomentumEndFromContext?.(e, ctx) }, }) |