From d9d597cb5195c921fd2ffffecf42c6d750f642fd Mon Sep 17 00:00:00 2001 From: EnesKartal Date: Mon, 23 Nov 2026 22:33:46 +0300 Subject: [PATCH] fix(TextInput): avoid double-dimming disabled text on Android --- src/components/TextInput/utils.ts | 4 +-- src/components/__tests__/TextInput.test.tsx | 34 +++++++++++++++++++++ 2 files changed, 36 insertions(+), 2 deletions(-) diff --git a/src/components/TextInput/utils.ts b/src/components/TextInput/utils.ts index 6d3c2b02f6..2bb202316c 100644 --- a/src/components/TextInput/utils.ts +++ b/src/components/TextInput/utils.ts @@ -429,7 +429,7 @@ export const getFilledTextInputData = ( Platform.OS === 'web' && { outlineStyle: 'none' as const, }, - isDisabled && styles.disabled, + isDisabled && Platform.OS !== 'android' && styles.disabled, inputStyleOverride, ]; @@ -550,7 +550,7 @@ export const getOutlinedTextInputData = ( Platform.OS === 'web' && { outlineStyle: 'none' as const, }, - isDisabled && styles.disabled, + isDisabled && Platform.OS !== 'android' && styles.disabled, inputStyleOverride, ]; diff --git a/src/components/__tests__/TextInput.test.tsx b/src/components/__tests__/TextInput.test.tsx index fa1f39b695..b8bb8a1c32 100644 --- a/src/components/__tests__/TextInput.test.tsx +++ b/src/components/__tests__/TextInput.test.tsx @@ -653,6 +653,40 @@ it('applies disabled opacity to the TextInput when disabled is true (outlined)', }); }); +it('does not apply extra disabled opacity to the TextInput on Android', async () => { + const platformOS = jest.replaceProperty(Platform, 'OS', 'android'); + try { + await render( + <> + {}} + disabled + testID="tf-input-dis-android" + /> + {}} + disabled + testID="tf-input-dis-out-android" + /> + + ); + + expect(screen.getByTestId('tf-input-dis-android')).not.toHaveStyle({ + opacity: stateOpacity.disabled, + }); + expect(screen.getByTestId('tf-input-dis-out-android')).not.toHaveStyle({ + opacity: stateOpacity.disabled, + }); + } finally { + platformOS.restore(); + } +}); + it('forwards TextInput props such as testID', async () => { await render(