Describe the Feature
TextInput component from react-native has its own handling of being disabled/editable. It's not using responder system like Views, Texts and thus Touchables, so the logic we have already fails to catch it.
We should consider adding custom handling specific to native TextInput component, since it was working with @testing-library/react-native before v7.
Possible Implementations
Will likely involve detecting TextInput and verify if it's editable or not.
Test that fails with current implementation:
test('should not fire on disabled TextInput', () => {
const handleChangeText = jest.fn();
const screen = render(
<TextInput onChangeText={handleChangeText} editable={false}>
<Text>Trigger</Text>
</TextInput>
);
fireEvent.changeText(screen.getByText('Trigger'), 'Trigger');
expect(handleChangeText).not.toHaveBeenCalled();
});
Describe the Feature
TextInputcomponent fromreact-nativehas its own handling of being disabled/editable. It's not using responder system like Views, Texts and thus Touchables, so the logic we have already fails to catch it.We should consider adding custom handling specific to native TextInput component, since it was working with
@testing-library/react-nativebefore v7.Possible Implementations
Will likely involve detecting
TextInputand verify if it's editable or not.Test that fails with current implementation: