react-native-material-ripple icon indicating copy to clipboard operation
react-native-material-ripple copied to clipboard

Cannot read property nativeEvent of undefined while testing with JEST and react-testing-library

Open Prernabudh opened this issue 3 years ago • 3 comments

This is my component: image

I try to simulate on press while testing using react testing library and this is the error I get:

image

Please let me know how I can test the on-press event. Any help is appreciated.

Prernabudh avatar May 03 '21 06:05 Prernabudh

Same issue here!

LaurenceM10 avatar Jul 11 '21 18:07 LaurenceM10

Any solution ? @Prernabudh

faizazafar avatar Mar 22 '22 10:03 faizazafar

@faizazafar @Prernabudh you guys can try

const item = await findByTestId("switch"); fireEvent(item, 'onChange', {nativeEvent: {}}));

for react native

itsFarzi avatar Nov 23 '22 12:11 itsFarzi