【发布时间】:2017-10-15 12:16:03
【问题描述】:
我正在使用带有 typescript 的 react native。我有一个具有以下结构的组件
component
- component.ios.tsx
- component.android.tsx
现在我想导入组件。所以,我正在这样做:
import component from '../component/component';
但它说:
[ts] Cannot find module ../component/component
位置正确。我需要在 tslint 文件中添加一些内容以使其理解。
我也尝试过:
let component = require('../component/component');
这并没有给出打字稿错误。但它给出了运行时错误。
element type is invalid expected a string or a class/function but got undefined
有人遇到过这个问题吗? 谢谢。
【问题讨论】: