From 0b3257997a97088e22c9b6881c20a4807422ec05 Mon Sep 17 00:00:00 2001
From: Akshay Nair <phenax5@gmail.com>
Date: Sun, 29 Sep 2024 17:22:19 +0530
Subject: Open alarm when clock is pressed

---
 src/components/Clock.tsx | 17 ++++++++++++++---
 1 file changed, 14 insertions(+), 3 deletions(-)

(limited to 'src/components/Clock.tsx')

diff --git a/src/components/Clock.tsx b/src/components/Clock.tsx
index f41a298..cbf1857 100644
--- a/src/components/Clock.tsx
+++ b/src/components/Clock.tsx
@@ -1,5 +1,8 @@
 import React, {useEffect, useMemo, useState} from 'react';
-import {Text, View} from 'react-native';
+import {Pressable, Text, View} from 'react-native';
+// @ts-expect-error No declaration file
+import IntentLauncher from '@angelkrak/react-native-intent-launcher';
+import {useStableCallback} from '../hooks/useStableCallback';
 
 export const Clock: React.FC = React.memo(() => {
   const [date, setDate] = useState(() => new Date());
@@ -28,10 +31,18 @@ export const Clock: React.FC = React.memo(() => {
     return formatter.format(date);
   }, [date]);
 
+  const showAlarms = useStableCallback(() =>
+    IntentLauncher.startActivity({
+      action: 'android.intent.action.SHOW_ALARMS',
+    }),
+  );
+
   return (
     <View className="p-6">
-      <Text className="text-4xl font-bold">{timeText}</Text>
-      <Text className="text-lg">{dateText}</Text>
+      <Pressable onPress={showAlarms} className="self-start">
+        <Text className="text-4xl font-bold">{timeText}</Text>
+        <Text className="text-lg">{dateText}</Text>
+      </Pressable>
     </View>
   );
 });
-- 
cgit v1.3.1

