RN now to supports percentages now. I.e. { height: "50%" }. We actually mostly support this, so you can write height: 50 or height: 50%, and both will work.
This makes it a little inconsistent, where sometimes you include a unit, and sometimes you don’t. We should try and achieve more consistency by forcing a unit when the value is a length. In the previous example, you would have to write height: 50px.
This would remove ambiguities in the flex shorthand, and would allow us to accept line-heights as a multiple of font-size in the font shorthand.
Not only that, but you could sort of share code between web and native.
const Component = isWeb ? 'div' : View;
const StyledComponent = styled(Component)`
height: 50px;
`;
This is obviously a breaking change, so we should look towards v2.
RN now to supports percentages now. I.e.
{ height: "50%" }. We actually mostly support this, so you can writeheight: 50orheight: 50%, and both will work.This makes it a little inconsistent, where sometimes you include a unit, and sometimes you don’t. We should try and achieve more consistency by forcing a unit when the value is a length. In the previous example, you would have to write
height: 50px.This would remove ambiguities in the
flexshorthand, and would allow us to acceptline-heights as a multiple offont-sizein thefontshorthand.Not only that, but you could sort of share code between web and native.
This is obviously a breaking change, so we should look towards v2.