Proper way to mock react-navigation-shared-element

Viewed 95

I want to run my test by i'm getting errors related to SharedElement component from react-navigation-shared-element

My mocks are this:

jest.mock('react-native-shared-element', () => {
      return () => ({});
});
    
jest.mock('react-navigation-shared-element', () => {
   return () => ({
      createSharedElementStackNavigator: jest.fn(),
   });
});

When I run my tests:

Warning: React.createElement: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: undefined. You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.
0 Answers
Related