Skip to content

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

fix possible crash due to null value in toast

ammarahm-ed3bc892fc9295
diff --git a/apps/mobile/src/components/Toast/index.js b/apps/mobile/src/components/Toast/index.js
index 85e04d5aa..dd3661439 100644
--- a/apps/mobile/src/components/Toast/index.js
+++ b/apps/mobile/src/components/Toast/index.js
@@ -37,7 +37,7 @@ export const Toast = ({context = 'global'}) => {
}
toastMessages.push(data);
if (toastMessages?.length > 1) return;
-
+ console.log(data);
setData(data);
if (data.type === 'success') {
setToastStyle({
@@ -199,7 +199,7 @@ export const Toast = ({context = 'global'}) => {
flexGrow: 1,
paddingRight: 25,
}}>
- {data?.heading && (
+ {data?.heading ? (
<Heading
color={colors.pri}
size={SIZE.md}
@@ -208,9 +208,9 @@ export const Toast = ({context = 'global'}) => {
}}>
{data.heading}
</Heading>
- )}
+ ) : null}
- {data?.message && (
+ {data?.message ? (
<Paragraph
color={colors.pri}
onPress={() => {
@@ -218,7 +218,7 @@ export const Toast = ({context = 'global'}) => {
}}>
{data.message}
</Paragraph>
- )}
+ ) : null}
</View>
</View>