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
So I'm in a situation where I want a horizontal list of items that also stack verticaly when too much items are sent to it, and your tool is perfect for that job <3
...but! I also want it to be on top of a multiline text view, so I put both in a VStack.
The thing is that by doing that, the GridStack and the text view take each half the VStack's height. I looked into the GridStack's code because I expected it to take as small space as possible but I came accros a GeometryReader surrounding the elements, and this is understandable because you need to know the available width to work.
But I know the GeometryReader doesn't shrink to it compact size but rather always take all the space it can, wether its content takes less or not. And it all made sense then!
I've copied your GridStack locally in my project to work on it, and by removing the GeometryReader and sending the width to the GridStack (and removing the ScrollView too because of the same behavior), it all worked perfectly for my intention!
So here is (finaly) my proposal:
making the scroll feature optional
removing the GeometryReader and let the "upper" view sending the desired width to the GridStack
(optionnaly, for the sake of easing the use of most cases) using an enum as the width with a case like "auto" that will add your current GeometryReader so that the "upper" view won't have to use a GeometryReady if it deosn't need to
Here is the result I targeted, the GridStack is (obviously) the row of circles
The text was updated successfully, but these errors were encountered:
Hi!
So I'm in a situation where I want a horizontal list of items that also stack verticaly when too much items are sent to it, and your tool is perfect for that job <3
...but! I also want it to be on top of a multiline text view, so I put both in a VStack.
The thing is that by doing that, the GridStack and the text view take each half the VStack's height. I looked into the GridStack's code because I expected it to take as small space as possible but I came accros a GeometryReader surrounding the elements, and this is understandable because you need to know the available width to work.
But I know the GeometryReader doesn't shrink to it compact size but rather always take all the space it can, wether its content takes less or not. And it all made sense then!
I've copied your GridStack locally in my project to work on it, and by removing the GeometryReader and sending the width to the GridStack (and removing the ScrollView too because of the same behavior), it all worked perfectly for my intention!
So here is (finaly) my proposal:
Here is the result I targeted, the GridStack is (obviously) the row of circles
The text was updated successfully, but these errors were encountered: