Skip to content

Commit d37f9e2

Browse files
committed
chore: clean up logic
1 parent c726c43 commit d37f9e2

File tree

2 files changed

+8
-8
lines changed
  • packages/uikit-react-native-foundation/src/components

2 files changed

+8
-8
lines changed

packages/uikit-react-native-foundation/src/components/ProgressBar/index.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,8 @@ const ProgressBar = ({ current = 100, total = 100, trackColor, barColor, overlay
4343
}, [percent]);
4444

4545
const progressBarPosition = (() => {
46-
if (I18nManager.isRTL) {
47-
if (I18nManager.doLeftAndRightSwapInRTL) return { right: 0 };
46+
if (I18nManager.isRTL && I18nManager.doLeftAndRightSwapInRTL) {
47+
return { right: 0 };
4848
}
4949

5050
return { left: 0 };

packages/uikit-react-native-foundation/src/components/TextInput/index.tsx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,15 +35,15 @@ const TextInput = React.forwardRef<RNTextInput, Props>(function TextInput(
3535

3636
const textAlign = (() => {
3737
if (I18nManager.isRTL && supportRTLAlign) {
38-
// Note: TextInput is not affected by doLeftAndRightSwapInRTL
39-
if (originalText) {
40-
return isStartsWithRTL(originalText) ? 'right' : 'left';
41-
} else if (props.placeholder) {
42-
return isStartsWithRTL(props.placeholder) ? 'right' : 'left';
38+
const text = originalText || props.value || props.placeholder;
39+
if (text && isStartsWithRTL(text)) {
40+
// Note: TextInput is not affected by doLeftAndRightSwapInRTL
41+
return 'right';
4342
}
4443
}
4544

46-
return textStyle.textAlign;
45+
if (textStyle.textAlign) textStyle.textAlign;
46+
return undefined;
4747
})();
4848

4949
return (

0 commit comments

Comments
 (0)