类型'IntrinsicAttributes不存在属性'style'

时间:2018-08-04 13:11:57

标签: reactjs typescript react-native jsx

我将Typescript与react-native和react-native网站一起使用。由于某种原因,它无法识别jsx的styles属性。

import * as React from 'react'
import * as Redux from 'redux'
import {Button, StyleSheet, Text, View} from "react-native";

const _component: React.SFC<Props & State & DispatchProps> = (props) => (
    <View>
        <Button
            onPress={props.onPingClick(props.id)}
            title="Ping"
            color="#841584"
            style={styles.button}
        />
        <Text>{props.id}</Text>
    </View>

);

我的tsconfig.json

{
  "compilerOptions": {
    "baseUrl": ".",
    "outDir": "build/dist",
    "module": "esnext",
    "target": "es5",
    "lib": ["es6", "dom"],
    "sourceMap": true,
    "allowJs": true,
    "jsx": "react",
    "moduleResolution": "node",
    "rootDir": "src",
    "forceConsistentCasingInFileNames": true,
    "noImplicitReturns": true,
    "noImplicitThis": true,
    "noImplicitAny": true,
    "strictNullChecks": true,
    "suppressImplicitAnyIndexErrors": true,
    "noUnusedLocals": true,
    "skipLibCheck": true
  },
  "exclude": [
    ...
  ]
}

0 个答案:

没有答案