当使用 Styled Components 5.x 为 React Native 应用程序设置样式时,我收到警告...
Expected style "borderWidth: 2" to contain units.
这在以前的版本中没有发生。
警告是什么意思?
最佳答案
在 github 上进行了一些研究和问题之后,我找到了这个......
Styled Components 使用包 css-to-react-native因为它是 React Native 转换。
css-to-react-native 最近发布的第 3 版现在要求所有测量都存在单位。 Details here .
您应该使用 px
用于 React Native 的原样 density independent .
关于react-native - 为什么 styled-components 5.x 会警告 "Expected style to contain units.",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58923065/