【问题标题】:How do I define style react-native using tyepscript?如何使用 typescript 定义样式 react-native?
【发布时间】:2017-11-12 19:37:17
【问题描述】:

我在打字稿中有以下代码。当我运行它时,我收到以下错误:

错误 TS2339:“IntrinsicAttributes & IntrinsicClassAttributes> & Read...”类型上不存在属性“sytle”。

import React, { SFC } from 'react'
import { Image, StyleSheet } from 'react-native'

const logo = require('../../assets/Logo.png') // tslint:disable-line:no-var-requires

export const NamedLogo: SFC<any> = () =>
  <Image
    source={logo}
    sytle={styles.logo}
  />

const styles = StyleSheet.create({
  logo: {
    width: 88,
    height: 42
  }
})

如何在 typescript 的 SFC 中破坏样式?

【问题讨论】:

    标签: typescript react-native


    【解决方案1】:

    检查style 的拼写。你有yttle

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2016-09-25
      • 1970-01-01
      • 2021-03-29
      • 2021-02-23
      • 2017-06-06
      • 2018-11-03
      • 1970-01-01
      • 2020-08-02
      相关资源
      最近更新 更多