Skip to content

Commit 5a3c6fa

Browse files
SergioEstevaofacebook-github-bot
authored andcommitted
Fix mock for TextInput (#28332)
Summary: This PR adds the `isFocused` method to the mock of the TextInput component. My understanding some of the latest changes on the TextInput to make it use a forwardRef change the way this method is mock giving an error when trying to use in on a mock. The change suggested here fixes the issue. ## Changelog [JavaScript] [Fixed] - Fix the mock for TextInput to support the `isFocused` method Pull Request resolved: #28332 Reviewed By: cpojer Differential Revision: D20538044 Pulled By: TheSavior fbshipit-source-id: be734af105ab62ffdf9ed4017bd70845e207f8cd
1 parent 18a8c85 commit 5a3c6fa

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

jest/setup.js

+6-4
Original file line numberDiff line numberDiff line change
@@ -89,10 +89,12 @@ jest
8989
mockComponent('../Libraries/Text/Text', MockNativeMethods),
9090
)
9191
.mock('../Libraries/Components/TextInput/TextInput', () =>
92-
mockComponent(
93-
'../Libraries/Components/TextInput/TextInput',
94-
MockNativeMethods,
95-
),
92+
mockComponent('../Libraries/Components/TextInput/TextInput', {
93+
...MockNativeMethods,
94+
isFocused: jest.fn(),
95+
clear: jest.fn(),
96+
getNativeRef: jest.fn(),
97+
}),
9698
)
9799
.mock('../Libraries/Modal/Modal', () =>
98100
mockComponent('../Libraries/Modal/Modal'),

0 commit comments

Comments
 (0)