dhre-ui-kit 0.0.375 → 0.0.377

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.mjs CHANGED
@@ -1,7 +1,6 @@
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';
@@ -339,55 +338,14 @@ const FONT_STYLES = {
339
338
  [FontStyle.L3_REGULAR]: createFontStyle("MeraasAktiv-Regular", 10, 14)
340
339
  };
341
340
 
342
- const translateToArabic = async (text) => {
343
- if (!text || text.trim() === "") {
344
- return text;
345
- }
346
- try {
347
- const result = await translate(text, { to: "ar" });
348
- return result.text || text;
349
- } catch (error) {
350
- console.error("Translation error:", error);
351
- return text;
352
- }
353
- };
354
- const useArabicTranslation = (text, shouldTranslate = false) => {
355
- const [translatedText, setTranslatedText] = useState(text || "");
356
- const [isTranslating, setIsTranslating] = useState(false);
357
- const [error, setError] = useState(null);
358
- useEffect(() => {
359
- if (!shouldTranslate || !text) {
360
- setTranslatedText(text || "");
361
- return;
362
- }
363
- const translate2 = async () => {
364
- setIsTranslating(true);
365
- setError(null);
366
- try {
367
- const translated = await translateToArabic(text);
368
- setTranslatedText(translated);
369
- } catch (err) {
370
- setError(err instanceof Error ? err.message : "Translation failed");
371
- setTranslatedText(text);
372
- } finally {
373
- setIsTranslating(false);
374
- }
375
- };
376
- translate2();
377
- }, [text, shouldTranslate]);
378
- return { translatedText, isTranslating, error };
379
- };
380
-
381
341
  const CustomTypography = ({
382
342
  variant,
383
343
  style,
384
344
  text,
385
345
  testID = "CUSTOM_TYPOGRAPHY",
386
- translateToArabic = true,
387
346
  ...props
388
347
  }) => {
389
348
  const textStyle = FONT_STYLES[variant];
390
- const { translatedText } = useArabicTranslation(text, translateToArabic);
391
349
  return /* @__PURE__ */ React.createElement(
392
350
  Text,
393
351
  {
@@ -395,7 +353,7 @@ const CustomTypography = ({
395
353
  style: [textStyle, styles$B.container, style],
396
354
  ...props
397
355
  },
398
- translatedText
356
+ text
399
357
  );
400
358
  };
401
359
  const styles$B = StyleSheet.create({