From 2510736eef1a66ff3c5b220ac42ca6cc0bce366d Mon Sep 17 00:00:00 2001
From: brian-tagg <brian@tagg.id>
Date: Fri, 7 May 2021 15:51:35 -0700
Subject: Made TaggPrompt changes cleaner, added logoLink to
 NotificationPrompts type, made image in chat notification a link to the Chat
 screen

---
 src/components/common/TaggPrompt.tsx | 20 ++++++++++++++++----
 1 file changed, 16 insertions(+), 4 deletions(-)

(limited to 'src/components/common/TaggPrompt.tsx')

diff --git a/src/components/common/TaggPrompt.tsx b/src/components/common/TaggPrompt.tsx
index 20901e65..236501ff 100644
--- a/src/components/common/TaggPrompt.tsx
+++ b/src/components/common/TaggPrompt.tsx
@@ -3,11 +3,13 @@ import {StyleSheet, Text, TouchableOpacity} from 'react-native';
 import {Image, View} from 'react-native-animatable';
 import CloseIcon from '../../assets/ionicons/close-outline.svg';
 import {normalize, SCREEN_HEIGHT} from '../../utils';
+import {useNavigation} from '@react-navigation/core';
 
 type TaggPromptProps = {
   messageHeader: string;
   messageBody: string | Element;
   logoType: 'plus' | 'tagg' | 'invite_friends' | 'private_accounts' | 'chat';
+  logoLink: string | null;
   hideCloseButton?: boolean;
   noPadding?: boolean;
   onClose: () => void;
@@ -17,6 +19,7 @@ const TaggPrompt: React.FC<TaggPromptProps> = ({
   messageHeader,
   messageBody,
   logoType,
+  logoLink,
   hideCloseButton,
   noPadding,
   onClose,
@@ -44,9 +47,17 @@ const TaggPrompt: React.FC<TaggPromptProps> = ({
   const topPadding = {paddingTop: noPadding ? 0 : SCREEN_HEIGHT / 10};
   const bottomPadding = {paddingBottom: noPadding ? 0 : SCREEN_HEIGHT / 50};
 
+  const navigation = useNavigation();
+
   return (
     <View style={[styles.container, topPadding, bottomPadding]}>
-      <Image style={styles.icon} source={logo()} />
+      {logoLink
+        ? 
+          <TouchableOpacity
+            onPress={() => navigation.navigate(logoLink)}>
+            <Image style={styles.chat} source={logo()} />
+          </TouchableOpacity>
+        : <Image style={styles.icon} source={logo()} />}
       <Text style={styles.header}>{messageHeader}</Text>
       <Text style={styles.subtext}>{messageBody}</Text>
       {!hideCloseButton && (
@@ -78,9 +89,10 @@ const styles = StyleSheet.create({
     alignSelf: 'flex-end',
   },
   icon: {
-    // Original, prior to chat notification
-    // width: normalize(40),
-    // height: normalize(40),
+    width: normalize(40),
+    height: normalize(40),
+  },
+  chat: {
     width: normalize(350),
     height: normalize(70),
   },
-- 
cgit v1.2.3-70-g09d2

