about summary refs log tree commit diff
path: root/src/view/lib/useAnimatedValue.ts
diff options
context:
space:
mode:
authorPaul Frazee <pfrazee@gmail.com>2022-12-06 17:43:54 -0600
committerPaul Frazee <pfrazee@gmail.com>2022-12-06 17:43:54 -0600
commit79d5708b695be94750af4c49785a7de0801dc2ae (patch)
tree3a15b22ecade46b5048320b182ead9350c17a3c9 /src/view/lib/useAnimatedValue.ts
parentae522c86fe41c1449fe28972eeb45be6074ef227 (diff)
downloadvoidsky-79d5708b695be94750af4c49785a7de0801dc2ae.tar.zst
Switch to react-native default animation tools for composer and post controls
Diffstat (limited to 'src/view/lib/useAnimatedValue.ts')
-rw-r--r--src/view/lib/useAnimatedValue.ts12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/view/lib/useAnimatedValue.ts b/src/view/lib/useAnimatedValue.ts
new file mode 100644
index 000000000..1307ef952
--- /dev/null
+++ b/src/view/lib/useAnimatedValue.ts
@@ -0,0 +1,12 @@
+import * as React from 'react'
+import {Animated} from 'react-native'
+
+export function useAnimatedValue(initialValue: number) {
+  const lazyRef = React.useRef<Animated.Value>()
+
+  if (lazyRef.current === undefined) {
+    lazyRef.current = new Animated.Value(initialValue)
+  }
+
+  return lazyRef.current as Animated.Value
+}