Mocking default export compnents vs named export components is slightly different
When mocking defalut exports the following signature may be helpful.
jest.mock("./SomeDefaultComponent", () => {
const { View } = jest.requireActual("react-native");
return {
__esModule: true,
default: (props: any) => <View testID="some-default-component" {...props} />,
};
});
For named exports, the following example may be helpful
jest.mock("./SomeNamedComponent", () => {
const { View } = jest.requireActual("react-native");
return {
SomeComponent: (props: any) => (
<View testID={"some-named-component"} {...props} />
),
};
});