about summary refs log tree commit diff
path: root/src/lib/hooks
diff options
context:
space:
mode:
authorhailey <me@haileyok.com>2025-06-12 10:46:22 -0700
committerGitHub <noreply@github.com>2025-06-12 10:46:22 -0700
commit477e5f4ecfaa0007aeed90b51274c78a730c1a9e (patch)
tree45cd5cfff9eab1bd52b5ade6c60efebe3cc5e6b6 /src/lib/hooks
parenta26b20b56cd0ac80f625a5eb5136b805b9341e8d (diff)
downloadvoidsky-477e5f4ecfaa0007aeed90b51274c78a730c1a9e.tar.zst
new arch (#8295)
Co-authored-by: Samuel Newman <mozzius@protonmail.com>
Co-authored-by: Charlotte Som <charlotte@som.codes>
Co-authored-by: Hailey <me@haileyok.com>
Diffstat (limited to 'src/lib/hooks')
-rw-r--r--src/lib/hooks/useHandleRef.ts39
1 files changed, 0 insertions, 39 deletions
diff --git a/src/lib/hooks/useHandleRef.ts b/src/lib/hooks/useHandleRef.ts
deleted file mode 100644
index 167ba270b..000000000
--- a/src/lib/hooks/useHandleRef.ts
+++ /dev/null
@@ -1,39 +0,0 @@
-import {useState} from 'react'
-import {AnimatedRef, measure, MeasuredDimensions} from 'react-native-reanimated'
-
-export type HandleRef = {
-  (node: any): void
-  current: null | number
-}
-
-// This is a lighterweight alternative to `useAnimatedRef()` for imperative UI thread actions.
-// Render it like <View ref={ref} />, then pass `ref.current` to `measureHandle()` and such.
-export function useHandleRef(): HandleRef {
-  return useState(() => {
-    const ref = (node: any) => {
-      if (node) {
-        ref.current =
-          node._nativeTag ??
-          node.__nativeTag ??
-          node.canonical?.nativeTag ??
-          null
-      } else {
-        ref.current = null
-      }
-    }
-    ref.current = null
-    return ref
-  })[0] as HandleRef
-}
-
-// When using this version, you need to read ref.current on the JS thread, and pass it to UI.
-export function measureHandle(
-  current: number | null,
-): MeasuredDimensions | null {
-  'worklet'
-  if (current !== null) {
-    return measure((() => current) as AnimatedRef<any>)
-  } else {
-    return null
-  }
-}