about summary refs log tree commit diff
path: root/src/view/shell/mobile/TabsSelector.tsx
diff options
context:
space:
mode:
authorPaul Frazee <pfrazee@gmail.com>2023-01-26 11:25:52 -0600
committerPaul Frazee <pfrazee@gmail.com>2023-01-26 11:25:52 -0600
commit7e3f6f030680a8cf7b5baa3ce6f33acd5766fca8 (patch)
tree38ad7a0c586caa6cd0635653cb812d602210b718 /src/view/shell/mobile/TabsSelector.tsx
parentc4ba5e7fd507a2f5295fd3fcbcea0796223c744c (diff)
downloadvoidsky-7e3f6f030680a8cf7b5baa3ce6f33acd5766fca8.tar.zst
Fix all type errors
Diffstat (limited to 'src/view/shell/mobile/TabsSelector.tsx')
-rw-r--r--src/view/shell/mobile/TabsSelector.tsx11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/view/shell/mobile/TabsSelector.tsx b/src/view/shell/mobile/TabsSelector.tsx
index 433471602..921a0c85b 100644
--- a/src/view/shell/mobile/TabsSelector.tsx
+++ b/src/view/shell/mobile/TabsSelector.tsx
@@ -36,11 +36,12 @@ export const TabsSelector = observer(
       undefined,
     )
     const closeInterp = useAnimatedValue(0)
+    const tabsContainerRef = useRef<View>(null)
     const tabsRef = useRef<ScrollView>(null)
     const tabRefs = useMemo(
       () =>
         Array.from({length: store.nav.tabs.length}).map(() =>
-          createRef<Animated.View>(),
+          createRef<View>(),
         ),
       [store.nav.tabs.length],
     )
@@ -90,9 +91,9 @@ export const TabsSelector = observer(
     const onLayout = () => {
       // focus the current tab
       const targetTab = tabRefs[store.nav.tabIndex]
-      if (tabsRef.current && targetTab.current) {
+      if (tabsContainerRef.current && tabsRef.current && targetTab.current) {
         targetTab.current.measureLayout?.(
-          tabsRef.current,
+          tabsContainerRef.current,
           (_left: number, top: number) => {
             tabsRef.current?.scrollTo({y: top, animated: false})
           },
@@ -162,7 +163,9 @@ export const TabsSelector = observer(
               </TouchableWithoutFeedback>
             </View>
           </View>
-          <View style={[s.p10, styles.section, styles.sectionGrayBg]}>
+          <View
+            ref={tabsContainerRef}
+            style={[s.p10, styles.section, styles.sectionGrayBg]}>
             <ScrollView ref={tabsRef} style={styles.tabs}>
               {store.nav.tabs.map((tab, tabIndex) => {
                 const {icon} = match(tab.current.url)