Skip to content

Units? #20

Description

@jacobp100

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions