You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Directly allow strings for margin and size, too? #450
Should we use the approach for color props from #448 for margin and size props, too? I.e. have modules Margin and Size with "safe" helper functions, but Margin.t = Size.t = string?
Would make things easier for people coming from React Native JS.
I was wondering about a thing that bother me a little (but not too much :D ). We recently moved some submodules from Style, like Margin, Size etc, but I was wondering if that's a good idea to have so much "generic names" taken as soon as you open ReactNative.
I remember in the past being unhappy because bs-rn had generic names like "Types" taken by the open... And I just saw that in some projects (some personals & some for clients), I have a Color module, as well as a Font one & sometimes a Style one too.
So I was asking myself if we shouldn't keep Margin & Friend in Style, even if that's require 2 () when you want to use those, to avoid this kind if "issues".
@MoOx I see your point. On the other hand, that's what happens when you open modules. 😉 I am currently working on a GIS application where I have a Map module, so when I open Belt I get a warning because of Belt.Map...
Anyway, I am not opposed to moving Margin and Size back into Style because they are only referenced from Style. We should have types/Style_Margin.re and types/Style_Size.re then and alias these in Style.
Color should remain outside of Style though as it is used outside of Style (directly in the props of many different components).
@DCKT we discussed about that in private & are going to remove those 2 in favor of simpler function directly inside Style module (less safe but way more accessible)
Activity
MoOx commentedon Apr 27, 2019
I am more than ok with this change.
cknitt commentedon Apr 27, 2019
Hmmm, compared to
Color, the problem with margin and size is that these accept either floats or strings.MoOx commentedon Apr 27, 2019
This is because in JS "1" == 1...
Should we accept string only for unsafe usage & have method sending float as unitless value (pt) or string for %?
DCKT commentedon Apr 29, 2019
I think it's a good idea too, we should find the good compromise 🤔
We have to deal with
Pt(),Float(),Floatthis is pretty confusing for beginnersActually :
String should be an escape hatch I think
MoOx commentedon Apr 29, 2019
Float won't be a thing in new bindings, that said, we still try to add a safety layer to avoid accepting anything that won't work anyway...
MoOx commentedon May 1, 2019
I was wondering about a thing that bother me a little (but not too much :D ). We recently moved some submodules from Style, like Margin, Size etc, but I was wondering if that's a good idea to have so much "generic names" taken as soon as you
open ReactNative.I remember in the past being unhappy because bs-rn had generic names like "Types" taken by the open... And I just saw that in some projects (some personals & some for clients), I have a Color module, as well as a Font one & sometimes a Style one too.
So I was asking myself if we shouldn't keep Margin & Friend in Style, even if that's require 2 () when you want to use those, to avoid this kind if "issues".
Thoughts?
cknitt commentedon May 1, 2019
@MoOx I see your point. On the other hand, that's what happens when you open modules. 😉 I am currently working on a GIS application where I have a
Mapmodule, so when Iopen BeltI get a warning because ofBelt.Map...Anyway, I am not opposed to moving
MarginandSizeback intoStylebecause they are only referenced fromStyle. We should havetypes/Style_Margin.reandtypes/Style_Size.rethen and alias these inStyle.Colorshould remain outside ofStylethough as it is used outside ofStyle(directly in the props of many different components).DCKT commentedon May 1, 2019
+1 with @cknitt ;
Margin&Sizeshould be part ofStyle😃MoOx commentedon May 1, 2019
@DCKT we discussed about that in private & are going to remove those 2 in favor of simpler function directly inside Style module (less safe but way more accessible)
cknitt commentedon May 1, 2019
Strings are not feasible because we need to pass floats for pt values.
We found another simplification though, see #478.