NativeScript: [TNS 3.0] iOS:Layout will not update on modal page
Which platform(s) does your issue occur on?
iOS
Please provide the following version numbers that your issue occurs with:
- CLI: 3.0.0
- Cross-platform modules: 3.0.0
- Runtime(s): 3.0.0
- Plugin(s): -
Please tell us how to recreate the issue in as much detail as possible.
- create default project with iOS platform(tns create…)
- make a modal page like below and open it by tap event on 1st page
<StackLayout>
<Label id=‘label1’ text=‘short’ textWrap=‘true’ />
<Button button=‘label’ text=‘tap’ />
<Label id=‘label2’ text=‘’ textWrap=‘true’ />
</StackLayout>
- in modal pages tap handler, modify label1 or label2 text property to long text(like ‘foooooooooooooooooooo……’)
-> text will be not wrapped(label1) and text will not be shown (label2)
Besides this issue, I found that another UI has similar problem in modal page. such as Html or Image. when expanding height of these UI parts programmatically, no layout change happens.
When text or src or html property is bound to model. The behavior is same.This problem is very critical when bounded properties initial value is null. (Nothing shown when setting value.)
I checked same test on non modal page and seems ok. so the problem looks like modal page specific issue.
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Comments: 17 (11 by maintainers)
Commits related to this issue
- fix ios modal layout issue #4151 — committed to NativeScript/NativeScript by kssfilo 7 years ago
Ah! This sounds like the cause of one of the MAJOR headaches I’m having upgrading a 2.5 iOS app to 3.0.
Before 3.0, I was able to hide/show layouts in a modal view using model properties bound to the
visibilityproperty (think: loading/error/normal view states). After 3.0, layouts that are not visible on the initial load are never displayed, even when their bound visibility properties are true.Gave this workaround a quick test and it works! This is definitely a regression in the layout system.
@tsonevn We should prioritize this bug/fix given that it is a breaking change regression in 3.0 from 2.5.x.
https://github.com/kssfilo/NativeScript/tree/fix-modal-layout
I made some change to tns-core-modules and send PR #4170 .
My apps and @tsonevn 's sample app are working like before 3.0.0 without “Page.nativeView.setNeedsLayout()” workaround now.