Skip to content

A fully open source & end-to-end encrypted note taking alternative to Evernote.

fix: crash on showing tooltip

Ammar Ahmed61b623f1e690
diff --git a/apps/mobile/src/components/tabs/index.tsx b/apps/mobile/src/components/tabs/index.tsx
index 0d12d5118..6b73430b6 100644
--- a/apps/mobile/src/components/tabs/index.tsx
+++ b/apps/mobile/src/components/tabs/index.tsx
@@ -1,4 +1,12 @@
-import React, { forwardRef, useEffect, useImperativeHandle, useState } from 'react';
+import React, {
+ forwardRef,
+ MutableRefObject,
+ RefObject,
+ useEffect,
+ useImperativeHandle,
+ useRef,
+ useState
+} from 'react';
import { BackHandler, ViewProps } from 'react-native';
import { Gesture, GestureDetector } from 'react-native-gesture-handler';
import Animated, {
@@ -29,6 +37,7 @@ export interface TabsRef {
page: number;
setScrollEnabled: () => true;
isDrawerOpen: () => boolean;
+ node: RefObject<Animated.View>;
}
export const FluidTabs = forwardRef<TabsRef, TabProps>(
@@ -48,6 +57,7 @@ export const FluidTabs = forwardRef<TabsRef, TabProps>(
const locked = useSharedValue(false);
const forcedLock = useSharedValue(false);
const [disabled, setDisabled] = useState(false);
+ const node = useRef<Animated.View>(null);
const containerWidth = widths ? widths.a + widths.b + widths.c : dimensions.width;
const drawerPosition = 0;
const homePosition = widths.a;
@@ -120,7 +130,8 @@ export const FluidTabs = forwardRef<TabsRef, TabProps>(
isDrawerOpen.value = false;
},
page: currentTab.value,
- setScrollEnabled: () => true
+ setScrollEnabled: () => true,
+ node: node
}),
[]
);
@@ -250,6 +261,7 @@ export const FluidTabs = forwardRef<TabsRef, TabProps>(
return (
<GestureDetector gesture={gesture}>
<Animated.View
+ ref={node}
removeClippedSubviews={false}
collapsable={false}
style={[
diff --git a/apps/mobile/src/utils/index.js b/apps/mobile/src/utils/index.js
index b14361442..3bcad2776 100755
--- a/apps/mobile/src/utils/index.js
+++ b/apps/mobile/src/utils/index.js
@@ -141,7 +141,7 @@ export function showTooltip(event, text, position = 2) {
prevTarget && RNTooltips.Dismiss(prevTarget);
prevTarget = null;
prevTarget = event._targetInst.ref.current;
- RNTooltips.Show(prevTarget, tabBarRef.current, {
+ RNTooltips.Show(prevTarget, tabBarRef.current?.node?.current, {
text: text,
tintColor: '#000000',
corner: Platform.OS === 'ios' ? 5 : 40,