about summary refs log tree commit diff
path: root/src/screens/Profile/Sections/Labels.tsx
diff options
context:
space:
mode:
authorPokai Chang <pokaichang72@gmail.com>2024-05-21 08:41:12 +0800
committerGitHub <noreply@github.com>2024-05-21 01:41:12 +0100
commitcadc33c625949aedea7504bff6aa405aee029f73 (patch)
treeecfc27ea3ae651a13df197b58e3478f473606a0a /src/screens/Profile/Sections/Labels.tsx
parent4a7436886d0548ae453997286f5a8c2ac4b297a0 (diff)
downloadvoidsky-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.tsx17
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)
     },
   })