diff --git a/app/components/atoms/T/index.js b/app/components/atoms/T/index.js index 364d681..4b05071 100644 --- a/app/components/atoms/T/index.js +++ b/app/components/atoms/T/index.js @@ -9,12 +9,13 @@ import PropTypes from 'prop-types'; import { Text } from 'react-native'; import { useTranslation } from 'react-i18next'; +import { conditionalOperatorFunction } from '@app/utils/common'; const T = ({ intl, id, values, style, text, ...otherProps }) => { const { t } = useTranslation(); return ( - {id ? t(id, { ...values }) : text} + {conditionalOperatorFunction(id, t(id, { ...values }), text)} ); }; diff --git a/app/utils/common.js b/app/utils/common.js new file mode 100644 index 0000000..3a13210 --- /dev/null +++ b/app/utils/common.js @@ -0,0 +1,2 @@ +export const conditionalOperatorFunction = (condition, val1, val2) => + condition ? val1 : val2;