Shopify / restyle

A type-enforced system for building UI components in React Native with TypeScript.

Home Page:https://shopify.github.io/restyle/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

More flexible restyle functions

mrjackdavis opened this issue · comments

Hey!

I think restyle functions could be way more powerful if you could set multiple and arbitrary style properties.

Consider this

const theme = {
  //...
  elevations:{
    '$1':{
        shadowColor: '#000',
        shadowOffset: {width: '0pt', height: '2pt'},
        shadowOpacity: 0.2,
        shadowRadius: '3pt',
    }
  }
}
<Card elevation='$1' />

Where the resulting style object would contain

{
  shadowColor: '#000',
  shadowOffset: {width: '0pt', height: '2pt'},
  shadowOpacity: 0.2,
  shadowRadius: '3pt',
}

I'd like to write a restyle function to do this, but I am restricted by the 1:1 relationship between property and styleProperty