Skip to content

Commit 9a00cec

Browse files
SergioEstevaoalloy
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 8e705b7 commit 9a00cec

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

jest/setup.js

Lines changed: 6 additions & 4 deletions
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)