dhre-ui-kit 0.0.385 → 0.0.387
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/index.d.ts +0 -2
- package/lib/index.js +20 -27
- package/lib/index.js.map +1 -1
- package/lib/index.mjs +19 -26
- package/lib/index.mjs.map +1 -1
- package/package.json +1 -1
package/lib/index.mjs
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import React, { createContext, useContext, useState, useEffect, useRef, memo, useCallback } from 'react';
|
|
2
2
|
import { useSelector } from 'react-redux';
|
|
3
3
|
import { Dimensions, StyleSheet, Text, Pressable, View, Platform, KeyboardAvoidingView, TextInput, ScrollView, Animated, FlatList, TouchableOpacity, Modal as Modal$1, Alert, Linking, PanResponder } from 'react-native';
|
|
4
|
-
import translate from 'google-translate-api-x';
|
|
5
4
|
import Modal from 'react-native-modal';
|
|
6
5
|
import Clipboard from '@react-native-clipboard/clipboard';
|
|
7
6
|
import LottieView from 'lottie-react-native';
|
|
8
7
|
import Tooltip from 'react-native-walkthrough-tooltip';
|
|
9
8
|
import Pdf from 'react-native-pdf';
|
|
10
9
|
import * as Progress from 'react-native-progress';
|
|
10
|
+
import translate from 'google-translate-api-x';
|
|
11
11
|
import { GestureHandlerRootView, Swipeable, ScrollView as ScrollView$1 } from 'react-native-gesture-handler';
|
|
12
12
|
import DeviceInfo from 'react-native-device-info';
|
|
13
13
|
import { Calendar } from 'react-native-calendars';
|
|
@@ -344,23 +344,9 @@ const CustomTypography = ({
|
|
|
344
344
|
style,
|
|
345
345
|
text,
|
|
346
346
|
testID = "CUSTOM_TYPOGRAPHY",
|
|
347
|
-
translateToArabic = false,
|
|
348
347
|
...props
|
|
349
348
|
}) => {
|
|
350
|
-
const [translatedText, setTranslatedText] = useState();
|
|
351
349
|
const textStyle = FONT_STYLES[variant];
|
|
352
|
-
useEffect(() => {
|
|
353
|
-
const translateText = async () => {
|
|
354
|
-
try {
|
|
355
|
-
const res = await translate(text ?? "", { to: "ar" });
|
|
356
|
-
setTranslatedText(translateToArabic ? res?.text : text);
|
|
357
|
-
} catch (error) {
|
|
358
|
-
console.error("Translation error:", error);
|
|
359
|
-
setTranslatedText(text);
|
|
360
|
-
}
|
|
361
|
-
};
|
|
362
|
-
translateText();
|
|
363
|
-
}, [text, translateToArabic]);
|
|
364
350
|
return /* @__PURE__ */ React.createElement(
|
|
365
351
|
Text,
|
|
366
352
|
{
|
|
@@ -368,7 +354,7 @@ const CustomTypography = ({
|
|
|
368
354
|
style: [textStyle, styles$B.container, style],
|
|
369
355
|
...props
|
|
370
356
|
},
|
|
371
|
-
|
|
357
|
+
text
|
|
372
358
|
);
|
|
373
359
|
};
|
|
374
360
|
const styles$B = StyleSheet.create({
|
|
@@ -3691,7 +3677,10 @@ const styles$l = StyleSheet.create({
|
|
|
3691
3677
|
flex: 1,
|
|
3692
3678
|
color: "#fff",
|
|
3693
3679
|
textAlign: "left",
|
|
3694
|
-
marginLeft: horizontalScale(8)
|
|
3680
|
+
marginLeft: horizontalScale(8),
|
|
3681
|
+
fontSize: moderateScale(12),
|
|
3682
|
+
lineHeight: verticalScale(16.8),
|
|
3683
|
+
fontFamily: "MeraasAktiv-Regular"
|
|
3695
3684
|
},
|
|
3696
3685
|
button: {
|
|
3697
3686
|
marginLeft: 9
|
|
@@ -3734,6 +3723,7 @@ const Toast = React.forwardRef(
|
|
|
3734
3723
|
);
|
|
3735
3724
|
const [subjectText, setSubjectText] = useState(null);
|
|
3736
3725
|
const [warning, setWarning] = useState(false);
|
|
3726
|
+
const [translatedText, setTranslatedText] = useState();
|
|
3737
3727
|
const bottom = useRef(new Animated.Value(-80)).current;
|
|
3738
3728
|
const showToast = (toastMessage, duration = 3e3, success = true, buttonText = null, buttonAction = null, height2 = 72, subText = null, subTextPress = null, warning2 = false) => {
|
|
3739
3729
|
setMessage(toastMessage);
|
|
@@ -3777,6 +3767,17 @@ const Toast = React.forwardRef(
|
|
|
3777
3767
|
React.useImperativeHandle(ref, () => ({
|
|
3778
3768
|
showToast
|
|
3779
3769
|
}));
|
|
3770
|
+
useEffect(() => {
|
|
3771
|
+
const translateText = async () => {
|
|
3772
|
+
try {
|
|
3773
|
+
const res = await translate(message, { to: "ar" });
|
|
3774
|
+
setTranslatedText(res?.text);
|
|
3775
|
+
} catch (error) {
|
|
3776
|
+
setTranslatedText(message);
|
|
3777
|
+
}
|
|
3778
|
+
};
|
|
3779
|
+
translateText();
|
|
3780
|
+
}, [message]);
|
|
3780
3781
|
return visible ? /* @__PURE__ */ React.createElement(
|
|
3781
3782
|
Animated.View,
|
|
3782
3783
|
{
|
|
@@ -3788,15 +3789,7 @@ const Toast = React.forwardRef(
|
|
|
3788
3789
|
],
|
|
3789
3790
|
testID: "TOAST"
|
|
3790
3791
|
},
|
|
3791
|
-
/* @__PURE__ */ React.createElement(View, { style: styles$l.toastContainer }, /* @__PURE__ */ React.createElement(View, { style: styles$l.innerContainer }, /* @__PURE__ */ React.createElement(Pressable, { onPress: hideToast }, isSuccess ? sucessIcon : warning ? warningIcon : errorIcon), /* @__PURE__ */ React.createElement(
|
|
3792
|
-
CustomTypography,
|
|
3793
|
-
{
|
|
3794
|
-
variant: "L2_REGULAR",
|
|
3795
|
-
text: message,
|
|
3796
|
-
translateToArabic: true,
|
|
3797
|
-
style: styles$l.messageText
|
|
3798
|
-
}
|
|
3799
|
-
), btnText && /* @__PURE__ */ React.createElement(
|
|
3792
|
+
/* @__PURE__ */ React.createElement(View, { style: styles$l.toastContainer }, /* @__PURE__ */ React.createElement(View, { style: styles$l.innerContainer }, /* @__PURE__ */ React.createElement(Pressable, { onPress: hideToast }, isSuccess ? sucessIcon : warning ? warningIcon : errorIcon), /* @__PURE__ */ React.createElement(Text, { style: styles$l.messageText }, translatedText), btnText && /* @__PURE__ */ React.createElement(
|
|
3800
3793
|
Pressable,
|
|
3801
3794
|
{
|
|
3802
3795
|
style: styles$l.button,
|