diff --git a/src/components/TextInput/utils.ts b/src/components/TextInput/utils.ts index 54c1fbe6ad..6d3c2b02f6 100644 --- a/src/components/TextInput/utils.ts +++ b/src/components/TextInput/utils.ts @@ -418,7 +418,7 @@ export const getFilledTextInputData = ( flex: 1, color: onSurface, fontSize: INPUT_FONT_SIZE, - textAlign: hasSuffix === shared.isRTL ? 'left' : 'right', + textAlign: shared.isRTL ? 'right' : 'left', writingDirection: shared.isRTL ? 'rtl' : 'ltr', }, textInputProps.multiline && { @@ -538,7 +538,7 @@ export const getOutlinedTextInputData = ( flex: 1, color: onSurface, fontSize: INPUT_FONT_SIZE, - textAlign: hasSuffix === shared.isRTL ? 'left' : 'right', + textAlign: shared.isRTL ? 'right' : 'left', writingDirection: shared.isRTL ? 'rtl' : 'ltr', }, textInputProps.multiline && { diff --git a/src/components/__tests__/TextInput.test.tsx b/src/components/__tests__/TextInput.test.tsx index 61ba6bbe27..a3fff796d7 100644 --- a/src/components/__tests__/TextInput.test.tsx +++ b/src/components/__tests__/TextInput.test.tsx @@ -1552,24 +1552,25 @@ it('places prefix Text before the TextInput and suffix Text after it', async () ); }); -it('aligns input text toward the suffix when suffix is active (LTR)', async () => { +it('start-aligns input text even when suffix is active (LTR)', async () => { await render( {}} + prefix="$" suffix="/100" testID="tf-suffix-align-ltr" /> ); expect(screen.getByTestId('tf-suffix-align-ltr')).toHaveStyle({ - textAlign: 'right', + textAlign: 'left', writingDirection: 'ltr', }); }); -it('aligns input text toward the suffix when suffix is active (RTL)', async () => { +it('start-aligns input text even when suffix is active (RTL)', async () => { I18nManager.isRTL = true; await render( @@ -1577,13 +1578,14 @@ it('aligns input text toward the suffix when suffix is active (RTL)', async () = label="Label" value="5" onChangeText={() => {}} + prefix="$" suffix="/100" testID="tf-suffix-align-rtl" /> ); expect(screen.getByTestId('tf-suffix-align-rtl')).toHaveStyle({ - textAlign: 'left', + textAlign: 'right', writingDirection: 'rtl', }); });