diff --git a/src/__tests__/fireEvent.test.tsx b/src/__tests__/fireEvent.test.tsx
index a8a7dca84..3de94a59a 100644
--- a/src/__tests__/fireEvent.test.tsx
+++ b/src/__tests__/fireEvent.test.tsx
@@ -216,23 +216,28 @@ test('should not fire on disabled Pressable', () => {
expect(handlePress).not.toHaveBeenCalled();
});
-test('should not fire on non-editable TextInput', () => {
- const placeholder = 'Test placeholder';
- const onChangeTextMock = jest.fn();
- const NEW_TEXT = 'New text';
+test('should not fire on non-editable composite TextInput', () => {
+ const onChangeText = jest.fn();
+ const view = render(
+
+ );
- const { getByPlaceholderText } = render(
-
-
-
+ fireEvent.changeText(view.getByPlaceholderText('subject'), 'new text');
+ expect(onChangeText).not.toHaveBeenCalled();
+});
+
+test('should not fire on non-editable host TextInput', () => {
+ const onChangeText = jest.fn();
+ const view = render(
+
);
- fireEvent.changeText(getByPlaceholderText(placeholder), NEW_TEXT);
- expect(onChangeTextMock).not.toHaveBeenCalled();
+ fireEvent.changeText(view.getByTestId('subject'), 'new text');
+ expect(onChangeText).not.toHaveBeenCalled();
});
test('should not fire on non-editable TextInput with nested Text', () => {
diff --git a/src/fireEvent.ts b/src/fireEvent.ts
index 0f95381e4..497531b45 100644
--- a/src/fireEvent.ts
+++ b/src/fireEvent.ts
@@ -7,9 +7,16 @@ const isHostElement = (element?: ReactTestInstance) => {
return typeof element?.type === 'string';
};
+// Rendering TextInput results in having composite `TextInput` component with
+// child text input host component. Both will have the same `editable` and
+// `onChangeText` props.
const isTextInput = (element?: ReactTestInstance) => {
const { TextInput } = require('react-native');
- return element?.type === TextInput;
+
+ const isExportedCompositeTextInput = element?.type === TextInput;
+ const isChildHostTextInput = element?.parent?.type === TextInput;
+
+ return isExportedCompositeTextInput || isChildHostTextInput;
};
const isTouchResponder = (element?: ReactTestInstance) => {