Closed eightyfive closed 5 years ago
@eightyfive I'm no longer at Hyr but I will see if @LuisRizo has time to look this over.
Thanks guys, FYI I started a branch with a couple of improvements: https://github.com/eightyfive/react-native-spacing
@eightyfive Great work on that repo. Would you like to open a PR with the features that you wrote in your repo? I can merge it into this repo if you'd like
Hey,
I changed things quite a bit so I am not sure the PR would be readable nor easy to assess. For ex I use prettify for code formatting and I moved files around... So I am not sure what's the best/cleanest way to merge those changes.
Any recommandation?
Anyway I moved away from the idea of having the margin/padding helpers as props.
I separated the whole spacing strategy into a new standalone helper: https://github.com/eightyfive/react-native-spacesheet
And cleaned the react-native-row
implementation to focus only on the dial
idea:
https://github.com/eightyfive/react-native-col
Proper credits added.
Just an idea.
I find it easier and more readable to write:
Writing the shorthand like this is one
String.split
/Array.map
/parseInt
away from the original/needed array.But one drawback is that we loose that use case:
margin={[20]}
{marginVertical: 20}
Writing
<View margin="20" />
would end up inmargin = [20]
but really it should bemargin = 20
.There are 2 solutions to this problem:
<View margin={20} />
and<View margin="20" />
remainsmargin = [20]
<View margin="20" />
becomes the full margin, and if you want vertical only:<View margin="20 0" />
I'm leaning toward solution 2 because it's in line with CSS shorthand syntax. Not to mention that solution 2 would be a clearly separated syntax choice on its own, not overlapping with original Number/Array syntax.