Though most of the CSS properties works in the same way in React native still there are few differences in CSS property values between a browser and React native:
- Only two values of CSS property display (none, flex) is supported in React native. display none is used to hide an element.
- aspectRatio is non-CSS property supported by React Native. we can use aspect ratio to give a size to an element. if either width or height is specified along with aspect ratio then other parameters will be calculated and applied based on aspect ratio value
- marginHorizontal has the same effect as setting both marginLeft and marginRight. Similar to marginHorizontal, marginVertical has the same effect as setting both marginTop and marginBottom.
- The default value of the position in React native is relative instead of static. so absolute positioning is always just relative to the parent.
Apart from the above difference, most of the CSS properties work exactly the same as they work in a browser.
Leave a Reply