Javascript 天然碱组分的酶安装试验

Javascript 天然碱组分的酶安装试验,javascript,typescript,react-native,enzyme,native-base,Javascript,Typescript,React Native,Enzyme,Native Base,我试着用酶支架测试一些复合成分。但我收到了一条错误信息 Invariant Violation: Element 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 def

我试着用酶支架测试一些复合成分。但我收到了一条错误信息

Invariant Violation: Element 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.
LoginScreen作为默认类导出,因此导入该类的方式是正确的。 然后我测试了LoginScreen类中的每个组件,我意识到测试只会在本机基本组件上失败。但我不确定原因,也没有解释这种情况的文件

对以下五个组件的测试失败

import { Form, Icon, Input, Item, Label } from "native-base";
从“React”导入React;
从“../../src/views/LoginScreen/index”导入LoginScreen;
从“酶”导入{mount,render};
从“./\u utils\u\u/Tester”导入{TesterUtils}”;
从“mobx react/custom”导入{Provider};
从“./../src/services/injection”导入{RootServiceInjector}”;
描述(“带挂载的登录功能”,()=>{
它(“尝试挂载”,()=>{
常量testerUtils=新的testerUtils();
const rootService=testerUtils.getServiceRoot();
常量包装器=装入(
);
});
});
是否还有其他人遇到过此问题并有解决方案?
非常感谢你

我现在面临着同样的问题。
import React from 'react';
import LoginScreen from "../../src/views/LoginScreen/index";
import { mount, render } from 'enzyme';
import {TesterUtils} from "../__utils__/Tester";
import {Provider} from "mobx-react/custom";
import {RootServiceInjector} from "../../src/services/injection";


describe("login function with mount", () => {
    it("try with mount", () => {
        const testerUtils = new TesterUtils();
        const rootService = testerUtils.getServiceRoot();
        const wrapper = mount(
            <Provider {...{[RootServiceInjector]: rootService}}>
                <LoginScreen/>
            </Provider>
        );
    });
});