Skip to content

Layout Props passed outside of style throw #12469

Closed

Description

@f0rr0
// margin is a style prop and (as far as the docs go) belongs in a style prop.
const MyApp = () => <View margin="10 10" />

// Above throws (when rendered) JSON value '0 10' of type NSString cannot be converted to NSNumber

// Above behavior was expected with following:
const MyOtherApp = () => <View style={{ margin: "10 10" }} />

Why is margin even being looked at by RN?
This happens with other style props as well. For instance padding.

Additional Information

  • React Native version: 0.41.2
  • Platform: both
  • Operating System: MacOS

Activity

  1. changed the title [-]View style props[/-] [+]Layout Props passes outside of `style` throw[/+] on Feb 20, 2017
  2. changed the title [-]Layout Props passes outside of `style` throw[/-] [+]Layout Props passed outside of `style` throw[/+] on Feb 20, 2017
  3. ssomnoremac commented on Feb 21, 2017

    @ssomnoremac

    I'll chime in to say that this is an issue outside of styled components in setting props that collide with "layout props". And why do layout props exist as props outside of styles in the first place? There is no discussion of this feature besides the docs outlining them -- at least as far as I can tell. Is it kosher to use these props to set styles and, more importantly, it is a side-effect or was this intended?

  4. brentvatne commented on Feb 22, 2017

    @brentvatne
    Collaborator

    I'll chime in to say that this is an issue outside of styled components in setting props that collide with "layout props".

    And why do layout props exist as props outside of styles in the first place? There is no discussion of this feature besides the docs outlining them -- at least as far as I can tell. Is it kosher to use these props to set styles and, more importantly, it is a side-effect or was this intended?

    I wouldn't depend on these remaining exposed, you should go through the style prop. It is a side effect of how the properties are implemented as far as I know.

  5. f0rr0 commented on Mar 6, 2017

    @f0rr0
    Author

    @brentvatne shouldn't this be in the docs? In case of naming collision, user supplied props get over ridden with the layout ones.

  6. hramos commented on Jul 25, 2017

    @hramos
    Contributor

    Hi there! This issue is being closed because it has been inactive for a while. Maybe the issue has been fixed in a recent release, or perhaps it is not affecting a lot of people. Either way, we're automatically closing issues after a period of inactivity. Please do not take it personally!

    If you think this issue should definitely remain open, please let us know. The following information is helpful when it comes to determining if the issue should be re-opened:

    • Does the issue still reproduce on the latest release candidate? Post a comment with the version you tested.
    • If so, is there any information missing from the bug report? Post a comment with all the information required by the issue template.
    • Is there a pull request that addresses this issue? Post a comment with the PR number so we can follow up.

    If you would like to work on a patch to fix the issue, contributions are very welcome! Read through the contribution guide, and feel free to hop into #react-native if you need help planning your contribution.

  7. locked as resolved and limited conversation to collaborators on Jul 25, 2018
  8. added
    Resolution: Locked
    on Jul 25, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Resolution: Locked

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions