Jest Test Fails after Upgrading to v33

After updating my project to v33, my tests are failing with:

TypeError: this.map.setNativeProps is not a function

      at MapView.setNativeProps [as _updateStyle] (node_modules/react-native-maps/lib/components/MapView.js:557:14)
      at MapView._updateStyle [as componentDidMount] (node_modules/react-native-maps/lib/components/MapView.js:551:12)
      at commitLifeCycles (node_modules/react-test-renderer/cjs/react-test-renderer.development.js:9432:22)
      at commitAllLifeCycles (node_modules/react-test-renderer/cjs/react-test-renderer.development.js:10829:7)
      at Object.invokeGuardedCallbackImpl (node_modules/react-test-renderer/cjs/react-test-renderer.development.js:2302:10)
      at invokeGuardedCallback (node_modules/react-test-renderer/cjs/react-test-renderer.development.js:2480:31)
      at commitRoot (node_modules/react-test-renderer/cjs/react-test-renderer.development.js:11041:7)
      at node_modules/react-test-renderer/cjs/react-test-renderer.development.js:12492:5
      at Object.unstable_runWithPriority (node_modules/scheduler/cjs/scheduler.development.js:255:12)
      at completeRoot (node_modules/react-test-renderer/cjs/react-test-renderer.development.js:12491:13)

I switched to importing the map view like this as part of the upgrade:

import MapView from 'react-native-maps';

Any ideas?

It appears to be working when I run the app in development. It’s just in the Jest tests that I see this error message.

Hi @agrc!

I have a feeling this may lie with react-native-maps, have you looked into the issues on the github?

Yes, I’ve looked through their issues and haven’t found anything. I’ll open a new issue in their repo.

BTW - Thanks for the amazing project.

1 Like