Skip to content

Commit

Permalink
Merge pull request #18768 from bernhardoj/fix/18230-append-ltr-unicod…
Browse files Browse the repository at this point in the history
…e-on-android-only

Append LTR unicode on Android only
  • Loading branch information
cead22 authored May 12, 2023
2 parents f52eeeb + 90aced1 commit 1de10c2
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 14 deletions.
3 changes: 2 additions & 1 deletion src/components/MenuItem.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import * as StyleUtils from '../styles/StyleUtils';
import Icon from './Icon';
import * as Expensicons from './Icon/Expensicons';
import getButtonState from '../libs/getButtonState';
import convertToLTR from '../libs/convertToLTR';
import Avatar from './Avatar';
import Badge from './Badge';
import CONST from '../CONST';
Expand Down Expand Up @@ -160,7 +161,7 @@ const MenuItem = (props) => {
style={titleTextStyle}
numberOfLines={1}
>
{StyleUtils.convertToLTR(props.title)}
{convertToLTR(props.title)}
</Text>
)}
{Boolean(props.description) && !props.shouldShowDescriptionOnTop && (
Expand Down
9 changes: 9 additions & 0 deletions src/libs/convertToLTR/index.android.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
/**
* Android only - convert RTL text to a LTR text using Unicode controls.
* https://www.w3.org/International/questions/qa-bidi-unicode-controls
* @param {String} text
* @returns {String}
*/
export default function convertToLTR(text) {
return `\u2066${text}`;
}
3 changes: 3 additions & 0 deletions src/libs/convertToLTR/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export default function convertToLTR(text) {
return text;
}
4 changes: 2 additions & 2 deletions src/pages/home/report/ReportActionItemFragment.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import withWindowDimensions, {windowDimensionsPropTypes} from '../../../componen
import withLocalize, {withLocalizePropTypes} from '../../../components/withLocalize';
import * as DeviceCapabilities from '../../../libs/DeviceCapabilities';
import compose from '../../../libs/compose';
import * as StyleUtils from '../../../styles/StyleUtils';
import convertToLTR from '../../../libs/convertToLTR';
import {withNetwork} from '../../../components/OnyxProvider';
import CONST from '../../../CONST';
import applyStrikethrough from '../../../components/HTMLEngineProvider/applyStrikethrough';
Expand Down Expand Up @@ -115,7 +115,7 @@ const ReportActionItemFragment = (props) => {
selectable={!DeviceCapabilities.canUseTouchScreen() || !props.isSmallScreenWidth}
style={[EmojiUtils.containsOnlyEmojis(text) ? styles.onlyEmojisText : undefined, styles.ltr, ...props.style]}
>
{StyleUtils.convertToLTR(Str.htmlDecode(text))}
{convertToLTR(Str.htmlDecode(text))}
{Boolean(props.fragment.isEdited) && (
<Text
fontSize={variables.fontSizeSmall}
Expand Down
11 changes: 0 additions & 11 deletions src/styles/StyleUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -734,16 +734,6 @@ function getPaddingLeft(paddingLeft) {
};
}

/**
* Android only - convert RTL text to a LTR text using Unicode controls.
* https://www.w3.org/International/questions/qa-bidi-unicode-controls
* @param {String} text
* @returns {String}
*/
function convertToLTR(text) {
return `\u2066${text}`;
}

/**
* Checks to see if the iOS device has safe areas or not
*
Expand Down Expand Up @@ -1151,7 +1141,6 @@ export {
parseStyleFromFunction,
combineStyles,
getPaddingLeft,
convertToLTR,
hasSafeAreas,
getHeight,
getMinimumHeight,
Expand Down

0 comments on commit 1de10c2

Please sign in to comment.