Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/components/TextInput/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -429,7 +429,7 @@ export const getFilledTextInputData = (
Platform.OS === 'web' && {
outlineStyle: 'none' as const,
},
isDisabled && styles.disabled,
isDisabled && Platform.OS !== 'android' && styles.disabled,
inputStyleOverride,
];

Expand Down Expand Up @@ -550,7 +550,7 @@ export const getOutlinedTextInputData = (
Platform.OS === 'web' && {
outlineStyle: 'none' as const,
},
isDisabled && styles.disabled,
isDisabled && Platform.OS !== 'android' && styles.disabled,
inputStyleOverride,
];

Expand Down
34 changes: 34 additions & 0 deletions src/components/__tests__/TextInput.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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(
<>
<TextInput
label="Filled"
value="x"
onChangeText={() => {}}
disabled
testID="tf-input-dis-android"
/>
<TextInput
variant="outlined"
label="Outlined"
value="x"
onChangeText={() => {}}
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(
<TextInput
Expand Down
Loading