Skip to content

Update height and width documentation to reflect percentage support #2071

@dscheffy

Description

@dscheffy

I can't find reference to support for height and width as a percentage value -- the height and width documentation incorrectly says right at the beginning -- "All dimensions in React Native are unitless, and represent density-independent pixels."

As somebody new to react-native, that's a pretty big oversight in the documentation. After reading that I was surprised to see that support was added for percentage values over two years ago. There was a comment on the issue in the react-native repository kind of hinting at the question "why hasn't this been added to the documentation yet":

Has this been changed recently? I have working code, that uses '100%' in width and height. I also came across Yellobox.js in the RN repo that uses percentages (https://github.com/facebook/react-native/blob/9f33fe258312987f490cc0f3a71c0c4f93494e7f/Libraries/ReactNative/YellowBox.js). However, I can't find any mention of this in the documentation

Is this unintended or is the documentation lacking?

Originally posted by @andrioid in react/react-native#364 (comment)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions