简体   繁体   English

阿芙罗狄蒂CSS覆盖边距和填充

[英]Aphrodite CSS overwriting margin and padding

I'm having an issue with aphrodite, where if I have my base-component set to the global selector for example margin: 0 or any of the sides marginLeft , marginRight , marginTop , marginBottom set. 我对阿芙罗狄蒂有问题,如果我将基本组件设置为全局选择器,例如margin: 0或设置了marginLeftmarginRightmarginTopmarginBottom任何一个。 Then when I try to overwrite one or the other, it doesn't take. 然后,当我尝试覆盖一个或另一个时,就没有了。

For instance a div set with margin: 0 then I add another style marginBottom: 10 doesn't work. 例如, div设置margin: 0然后添加另一个样式marginBottom: 10不起作用。 Same is true in reverse. 反之亦然。 If marginBottom: 10 is set and I set margin: 0 it doesn't work. 如果设置marginBottom: 10 ,而我设置margin: 0 ,则不起作用。

https://github.com/Khan/aphrodite https://github.com/Khan/aphrodite

From the docs: Object Key Ordering 从文档: 对象键排序

const styles = StyleSheet.create({
ordered: new Map([
    ["margin", 0],
    ["marginLeft", 15],
  ]),
});

Note that Maps are not fully supported in all browsers. 请注意,并非所有浏览器都完全支持地图。 It can be polyfilled by using a package like es6-shim . 可以使用es6-shim这样的软件包对它进行填充

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

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