Closed
Description
Describe the bug
When using userEvent
, the event passed to the onKeyPress
callback of a TextInput
has no persist
method, when it does have this method in a real react-native runtime. This is causing errors when using Gluestack's Input
component with react-native-testing-library
.
TypeError: e.persist is not a function
at persist (../../node_modules/@gluestack-ui/input/src/Input.tsx:92:15)
at apply (../../node_modules/@testing-library/react-native/src/user-event/utils/dispatch-event.ts:19:12)
at callback (../../node_modules/@testing-library/react-native/src/act.ts:31:24)
at callback (../../node_modules/react/cjs/react.development.js:2512:16)
at actImplementation (../../node_modules/@testing-library/react-native/src/act.ts:30:25)
at dispatchEvent (../../node_modules/@testing-library/react-native/src/user-event/utils/dispatch-event.ts:18:11)
at ../../node_modules/@testing-library/react-native/src/user-event/type/type.ts:77:16
at asyncGeneratorStep (../../node_modules/@babel/runtime/helpers/asyncToGenerator.js:3:24)
at asyncGeneratorStep (../../node_modules/@babel/runtime/helpers/asyncToGenerator.js:22:9)
Expected behavior
persist
method should exist on the event object so that code that works fine in react-native works in react-native-testing-library.
Steps to Reproduce
Use @gluestack-ui/input
with react-native-testing-library
and use userEvent.type
to enter text into it.
Screenshots
Versions
@testing-library/react-native version 12.4.4
@gluestack-ui/input version 0.1.26
Metadata
Metadata
Assignees
Labels
No labels