[TIMOB-24247] Layout behave different than native
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | n/a |
Status | Open |
Resolution | Unresolved |
Affected Version/s | n/a |
Fix Version/s | n/a |
Components | n/a |
Labels | n/a |
Reporter | Hazem Khaled |
Assignee | Unknown |
Created | 2016-12-16T20:31:26.000+0000 |
Updated | 2018-02-28T19:54:59.000+0000 |
Description
Titanium has a horizontal and vertical layout before iOS stack view, by calculating the position of each child view, it was very good at that time.
Since iOS has native support now, thanks UIStackView and very soon iOS 9 will be the minimum iOS supported by Xcode, it's the time to refactor that old code in favor of UIStackView and force autolayout in all apps.
At least it's the time now to refactor Android code with LinearLayout.
This part very important for RTL applications, with UIStackView and LinearLayout, apps flipping automatically with max 5% effort to optimize switching between both RTL and LTR.
Unfortunately till now we need more effort with Titanium.
Hello, Can you share an example of the issue you described?
Hey [~hazemkhaled], this more an improvement than issue or am I missing something? But anyway, I think it's a great idea we could follow. I'm currently thinking if we should expose the
UIStackView
as an own API, maybe even with parity with the existingTi.UI.Android.CardView
*or* handle it internally whenever people use a vertical/horizontal layout.@Sharif AbuDarda I'll add example and screenshots to my [RTL guide](https://github.com/HazemKhaled/Titanium_RTL_guide) and update the issue again @Hans Knoechel I'll give it a try titanium and native and return you with different behavior
The big problem with this is that there are "portability" issues between Android and iOS on how they natively handle layouts. That is, if we were to do this, views would end up being layed-out different between Android and iOS. For example, how Android and iOS handle Ti.UI.SIZE and Ti.UI.FILL conflicts between a parent and child respectively is handled very differently. That is, when the parent is set up to auto-size itself based on the child and the child wants to auto-size itself based on the parent (this is unfortunately a very common scenario in Titanium apps). In this scenario on iOS, the child will be increased in size to fill the parent's parent. On Android, the parent will be shrunk down to just-fit the min size of the child. This is their opposing native behaviors. Another issue is with zIndex handling. iOS does support views with a higher zIndex in the middle of a vertical or horizontal layout. On Android, LinearLayout do not support this. Also, I'm pretty sure an Android LinearLayout doesn't support overlapping views, which is something our Titanium top/left/bottom/right properties support. On Android, I recommend that we keep our custom layout code. We need it to make Android Titanium app layouts behave like iOS for portability reasons. Features such as right-to-left handling in horizontal layouts will have to be implemented ourselves.