dhre-ui-kit 0.0.388 → 0.0.389
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 +1 -0
- package/lib/index.js +7 -3
- package/lib/index.js.map +1 -1
- package/lib/index.mjs +7 -3
- package/lib/index.mjs.map +1 -1
- package/package.json +1 -1
package/lib/index.d.ts
CHANGED
|
@@ -384,6 +384,7 @@ interface ToastProps {
|
|
|
384
384
|
sucessIcon: React$1.ReactElement;
|
|
385
385
|
errorIcon: React$1.ReactElement;
|
|
386
386
|
warningIcon: React$1.ReactElement;
|
|
387
|
+
language?: string;
|
|
387
388
|
}
|
|
388
389
|
interface ToastRef {
|
|
389
390
|
showToast: (message: string, duration?: number, isSuccess?: boolean, buttonText?: string | null, buttonAction?: (() => void) | null, height?: number, subText?: string | null, subTextPress?: (() => void) | null, warning?: boolean) => void;
|
package/lib/index.js
CHANGED
|
@@ -3747,7 +3747,7 @@ const styles$l = reactNative.StyleSheet.create({
|
|
|
3747
3747
|
});
|
|
3748
3748
|
|
|
3749
3749
|
const Toast = React__default["default"].forwardRef(
|
|
3750
|
-
({ sucessIcon, errorIcon, warningIcon }, ref) => {
|
|
3750
|
+
({ sucessIcon, errorIcon, warningIcon, language }, ref) => {
|
|
3751
3751
|
const [visible, setVisible] = React.useState(false);
|
|
3752
3752
|
const [message, setMessage] = React.useState("");
|
|
3753
3753
|
const [isSuccess, setIsSuccess] = React.useState(true);
|
|
@@ -3807,13 +3807,17 @@ const Toast = React__default["default"].forwardRef(
|
|
|
3807
3807
|
React.useEffect(() => {
|
|
3808
3808
|
const translateText = async () => {
|
|
3809
3809
|
try {
|
|
3810
|
-
const res = await translate__default["default"](message, { to:
|
|
3810
|
+
const res = await translate__default["default"](message, { to: language });
|
|
3811
3811
|
setTranslatedText(res?.text);
|
|
3812
3812
|
} catch (error) {
|
|
3813
3813
|
setTranslatedText(message);
|
|
3814
3814
|
}
|
|
3815
3815
|
};
|
|
3816
|
-
|
|
3816
|
+
if (language === "en") {
|
|
3817
|
+
setTranslatedText(message);
|
|
3818
|
+
} else {
|
|
3819
|
+
translateText();
|
|
3820
|
+
}
|
|
3817
3821
|
}, [message]);
|
|
3818
3822
|
return visible && translatedText?.length ? /* @__PURE__ */ React__default["default"].createElement(
|
|
3819
3823
|
reactNative.Animated.View,
|