Skip to content

Added inheritance for StyleSheet. - #859

Closed
lukasredev wants to merge 1 commit into
react:masterfrom
lukasredev:master
Closed

Added inheritance for StyleSheet.#859
lukasredev wants to merge 1 commit into
react:masterfrom
lukasredev:master

Conversation

@lukasredev

Copy link
Copy Markdown

In my current project I have a iOS application, where the user can switch between an edit and a normal view. Edit and normal view are displayed by the same component but with different styles. Only a few styles differ between the two states. That's why I though it would be really nice, if one had some sort of inhertiance for the styles.

Current Code

var styles = StyleSheet.create( {
  viewStyle: {
    marginTop: 5,
    marginBottom: 5,
    backgroundColor: '#bbbbbb',
    flex: 1
  },
  viewStyleEdit: {
    marginTop: 20,
    marginBottom: 5,
    backgroundColor: '#fffffff',
    flex: 1
  }
});

Proposal

var styles = StyleSheet.create( {
  viewStyle: {
    marginTop: 5,
    marginBottom: 5,
    backgroundColor: '#bbbbbb',
    flex: 1
  },
  viewStyleEdit: ["viewStyle". {
    marginTop: 20,
    backgroundColor: '#fffffff'
  } ]
});

The StyleSheetInheritance module I wrote, merges all values from the "viewStyle" into the "viewStyleEdit" object.

@facebook-github-bot

Copy link
Copy Markdown
Contributor

Thank you for your pull request and welcome to our community. We require contributors to sign our Contributor License Agreement, and we don't seem to have you on file. In order for us to review and merge your code, please sign up at https://code.facebook.com/cla - and if you have received this in error or have any questions, please drop us a line at cla@fb.com. Thanks!

@facebook-github-bot

Copy link
Copy Markdown
Contributor

Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Facebook open source project. Thanks!

@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Apr 15, 2015
@lukasredev lukasredev closed this Apr 15, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants