【问题标题】:JSX element type 'HTMLImageElement' is not a constructor function for JSX elementsJSX 元素类型“HTMLImageElement”不是 JSX 元素的构造函数
【发布时间】:2020-05-31 06:35:36
【问题描述】:
I am trying an example with React Native and Typescript and for the following code: 

<Image
        style={{
          width: 51,
          height: 51,
          resizeMode: 'contain',
        }}
        source={{ uri: portretPhoto }}
        style={styles.uploadedImage}
        resizeMode="contain"
      />

我得到错误: JSX 元素类型“HTMLImageElement”不是 JSX 元素的构造函数。 “HTMLImageElement”类型缺少“ElementClass”类型中的以下属性:render、context、setState、forceUpdate 和另外 3 个。

我该如何解决?

【问题讨论】:

标签: typescript react-native


【解决方案1】:

有一个全局定义的Image。你需要从react-native导入一个

【讨论】:

    猜你喜欢
    • 2019-11-24
    • 2019-05-29
    • 2019-03-06
    • 2019-05-18
    • 2019-07-21
    • 1970-01-01
    • 2020-09-16
    • 1970-01-01
    • 2020-08-14
    相关资源
    最近更新 更多