maxWidth/maxHeight and ratio views #33
farfromrefug
started this conversation in
1. Ideas & Discussions
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I have been thinking / wanting for a while a way to define a view ratio. The very simple use case is being able to compute percentage width/height based on height/width.
And i just figured out that it was only what was necessary: a property saying that width is computed based on the height and one saying height is computed based on the height.
I have run a simple test on iOS and it works flawlessly. And it was a very simple change here https://github.com/NativeScript/NativeScript/blob/master/packages/core/ui/core/view/view-common.ts#L965
I have to find where to put it for android but it should be very simple (have to find where percentage width/height are computed).
So the idea of starting here is first is it the right way to allow ratio for views. There is no simple way to do that on css so it has to be something "new". If it the right way to do it what should be the name of the those properties (like
widthComputedOnHeight
or something).Testing that i also realised this was the perfect place to implement maxWidth,maxHeigth(https://github.com/NativeScript/NativeScript/blob/master/packages/core/ui/core/view/view-common.ts#L965).
I even think minWidth/minHeight could be moved there instead of the current way (which requires a second layout pass).
Beta Was this translation helpful? Give feedback.
All reactions