简体   繁体   English

VS 代码 1.65.0 中样式格式的奇怪红色标记

[英]Strange red marking for style format in VS code 1.65.0

In my React Native 0.67.4 app, I just notice some red marking in some component's js file.在我的 React Native 0.67.4 应用程序中,我只注意到某些组件的 js 文件中有一些红色标记。 The red marking is only about the style sheets.红色标记仅与样式表有关。 Here is an image of the red marking:这是红色标记的图像:

在此处输入图像描述

Here is the styles definition:这是 styles 的定义:

const styles = Style.create(
 ...
 centeredView: {
    flex: 1,
    justifyContent: "center",
    alignItems: "center",
    marginTop: 22
  },
  modalView: {
    margin: 30,
    backgroundColor: "white",
    borderRadius: 20,
    padding: 35,
    alignItems: "center",
    alignContent:"center",
    shadowColor: "#000",
    shadowOffset: {
      width: 0,
      height: 2
    },
    shadowOpacity: 0.25,
    shadowRadius: 4,
    elevation: 5
  },
)

The same red marking also appears for the format below:同样的红色标记也出现在以下格式中:

<View style={styles.cneteredView, {fontSize:20}}>...</View>

Here is the devDependency in package.json :这是devDependency中的package.json

"devDependencies": {
    "@babel/core": "^7.12.9",
    "@babel/runtime": "^7.12.5",
    "@react-native-community/eslint-config": "^2.0.0",
    "babel-jest": "^26.6.3",
    "eslint": "7.14.0",
    "jest": "^26.6.3",
    "metro-react-native-babel-preset": "^0.66.2",
    "react-test-renderer": "17.0.2"
  },

Is there a way to get rid of the red marking?有没有办法去掉红色标记?

yoo if you want to use two styles of classes or styling it is not how you use it that is why the editor is showing you error correct way to use it is like this yoo 如果你想使用两个 styles 类或样式它不是你如何使用它这就是为什么编辑器向你显示错误正确的使用方法是这样的

style={[styles.red, styles.big]}
style={[styles.cneteredView, {fontSize:20}]}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM