Closed
Description
Describe the bug
After upgrading from 0.71 to 0.72 one of my test fails because fireEvent
no longer triggers the event. If I disable the new isPointerEventEnabled
check the test passes again.
Steps to Reproduce
I am mocking react-native-maps like so:
/* eslint-disable no-shadow, max-classes-per-file */
const React = jest.requireActual('react');
const MapView = jest.requireActual('react-native-maps');
/* eslint-enable no-shadow */
const mockShowCallout = jest.fn();
// eslint-disable-next-line react/prefer-stateless-function, react/no-multi-comp
class MockMarker extends React.Component {
constructor(props) {
super(props);
this.showCallout = mockShowCallout;
}
render() {
const { children } = this.props;
return React.createElement('Marker', this.props, children);
}
}
// eslint-disable-next-line react/prefer-stateless-function, react/no-multi-comp
class MockMapView extends React.Component {
static PROVIDER_GOOGLE = 'google';
render() {
const { children } = this.props;
return React.createElement('MapView', this.props, children);
}
}
MockMarker.propTypes = MapView.Marker.propTypes;
MockMapView.propTypes = MapView.propTypes;
MockMapView.Marker = MockMarker;
MockMapView.Callout = MapView.Callout;
MockMapView.exposedMarkerShowCallout = mockShowCallout;
module.exports = MockMapView;
The MapView
implements the event onRegionChangeComplete
which is what I trigger in the test like so:
fireEvent(wrapper.UNSAFE_getByType(RNMapView), 'RegionChangeComplete');
Screenshots
Versions
@testing-library/react-native: ^7.2.0 => 7.2.0
react: 17.0.1 => 17.0.1
react-native: 0.63.4 => 0.63.4
react-test-renderer: ^17.0.1 => 17.0.1
Metadata
Metadata
Assignees
Labels
No labels