Skip to content

Commit

Permalink
pr comments
Browse files Browse the repository at this point in the history
  • Loading branch information
Shamoil authored and Shamoil committed Aug 28, 2024
1 parent 4b79b67 commit 5e0bae0
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 2 additions & 1 deletion app/components/atoms/T/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
<Text testID="t" style={style} {...otherProps}>
{id ? t(id, { ...values }) : text}
{conditionalOperatorFunction(id, t(id, { ...values }), text)}
</Text>
);
};
Expand Down
2 changes: 2 additions & 0 deletions app/utils/common.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export const conditionalOperatorFunction = (condition, val1, val2) =>
condition ? val1 : val2;

0 comments on commit 5e0bae0

Please sign in to comment.