Closed trcoffman closed 2 months ago
@trcoffman we could add a simple no-op method: ``perisist: () => {}
. Would that solve Gluestack issue?
I've done some cursory search on pesist
and it seems like it's no longer used:
Note: As of v17, e.persist() doesn’t do anything because the SyntheticEvent is no longer pooled. Source: https://legacy.reactjs.org/docs/events.html
We're on React v18 for some time now, so looks like gluestack might be calling this method unnecessarily.
@mdjastrzebski , Thanks for the quick reply. It looks like it's still relevant for react-native:
https://react.dev/reference/react-dom/components/common#react-event-object-methods
persist(): Not used with React DOM. With React Native, call this to read event’s properties after the event.
I think that a simple no-op method persist
on all synthetic events generated by react-native-testing-library would make a lot of sense.
That's interesting, thanks for linking the material.
Describe the bug
When using
userEvent
, the event passed to theonKeyPress
callback of aTextInput
has nopersist
method, when it does have this method in a real react-native runtime. This is causing errors when using Gluestack'sInput
component withreact-native-testing-library
.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
withreact-native-testing-library
and useuserEvent.type
to enter text into it.Screenshots
Versions
@testing-library/react-native version 12.4.4
@gluestack-ui/input version 0.1.26