Skip to content

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

fix toasts

ammarahm-edfa6c8c9858fd
diff --git a/apps/mobile/src/components/Toast/index.js b/apps/mobile/src/components/Toast/index.js
index aa71fa3d3..029d5dfef 100644
--- a/apps/mobile/src/components/Toast/index.js
+++ b/apps/mobile/src/components/Toast/index.js
@@ -1,11 +1,13 @@
import React, {useEffect, useState} from 'react';
import {Text, TouchableOpacity} from 'react-native';
import * as Animatable from 'react-native-animatable';
-import {opacity, ph, SIZE, WEIGHT} from '../../common/common';
+import {opacity, ph, SIZE, WEIGHT, normalize, pv} from '../../common/common';
import {useTracked} from '../../provider';
import {eSubscribeEvent, eUnSubscribeEvent} from '../../services/eventManager';
import {eHideToast, eShowToast} from '../../services/events';
import {h, w} from '../../utils/utils';
+import Icon from 'react-native-vector-icons/Feather';
+import {DDS} from '../../../App';
const AnimatedTouchableOpacity = Animatable.createAnimatableComponent(
TouchableOpacity,
@@ -73,13 +75,10 @@ export const Toast = () => {
style={{
...toastStyle,
height: 60,
- width: '90%',
- marginHorizontal: w * 0.05,
-
+ width: DDS.isTab ? normalize(350) : w - 24,
+ marginHorizontal: 12,
position: 'absolute',
- bottom: h * 0.025,
- fontFamily: WEIGHT.regular,
- fontSize: SIZE.md,
+ bottom: 15,
zIndex: 999,
borderRadius: 5,
paddingHorizontal: ph + 5,
@@ -98,9 +97,19 @@ export const Toast = () => {
...toastStyle,
backgroundColor: 'transparent',
fontFamily: WEIGHT.regular,
- fontSize: SIZE.md,
+ fontSize: SIZE.sm,
}}>
- {message}
+ <Icon
+ name={
+ toastStyle.color === colors.errorText
+ ? 'alert-circle'
+ : 'check-circle'
+ }
+ color={toastStyle.color}
+ size={SIZE.sm}
+ />
+ {' '}
+ Email address is invalid
</Text>
<TouchableOpacity activeOpacity={1}>
@@ -108,7 +117,7 @@ export const Toast = () => {
style={{
...toastStyle,
fontFamily: WEIGHT.bold,
- fontSize: SIZE.md,
+ fontSize: SIZE.sm,
}}>
{data.actionText}
</Text>
diff --git a/apps/mobile/src/services/validation.js b/apps/mobile/src/services/validation.js
index dfcf38f04..de3e5f9dc 100644
--- a/apps/mobile/src/services/validation.js
+++ b/apps/mobile/src/services/validation.js
@@ -4,22 +4,22 @@ let regex = /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/;
export function validateEmail(email) {
if (email && email.length > 0) {
- //ToastEvent.show('Please enter a valid email address');
+ ToastEvent.show('Please enter a valid email address');
return regex.test(email);
} else {
- //ToastEvent.show('Please enter email or passoword to login');
+ ToastEvent.show('Please enter email or passoword to login');
return false;
}
}
export function validatePass(password) {
if (password && password.length <= 0) {
- //ToastEvent.show('No password provided');
+ ToastEvent.show('No password provided');
return false;
}
if (password && password.length < 8 && password.length > 0) {
- //ToastEvent.show('Password too short');
+ ToastEvent.show('Password too short');
return false;
} else if (password && password.length > 8 && password.length > 0) {
diff --git a/apps/mobile/src/utils/utils.js b/apps/mobile/src/utils/utils.js
index d9116c8ad..b488ae35c 100755
--- a/apps/mobile/src/utils/utils.js
+++ b/apps/mobile/src/utils/utils.js
@@ -49,7 +49,7 @@ export const w = Dimensions.get('window').width;
export const h = Dimensions.get('window').height;
export const ToastEvent = {
- show: (message, type, duration = 10000, func = null, actionText = 'Ok') => {
+ show: (message, type, duration = 10000, func = null, actionText = '') => {
eSendEvent(eShowToast, {
message,
type,
@@ -58,7 +58,7 @@ export const ToastEvent = {
actionText,
});
},
- hide: (message, type, duration = 1000, func = null, actionText = 'Ok') => {
+ hide: (message, type, duration = 1000, func = null, actionText = '') => {
eSendEvent(eHideToast, {
message,
type,