fix(android-tabs): tab backgroundColor cache can be wrong - DO NOT MERGE#8510
fix(android-tabs): tab backgroundColor cache can be wrong - DO NOT MERGE#8510NathanaelA wants to merge 9 commits into
Conversation
|
|
||
| if (value instanceof Color) { | ||
| this._tabLayout.setBackgroundColor(value.android); | ||
| this._viewPager.setBackgroundColor(value.android); |
There was a problem hiding this comment.
We shouldn't set the background color of the viewPager here as this should change only the background of the tab bar, but not the tab page as well. You can check the following page in the UI test project - https://github.com/NativeScript/NativeScript/blob/master/e2e/ui-tests-app/app/tab-view/all-page.xml
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
|
|
||
| public updateAndroidItemAt(index: number, spec: org.nativescript.widgets.TabItemSpec) { | ||
| this._tabsBar.updateItemAt(index, spec); | ||
| if (index < this._tabsBar.getItemCount()) { |
There was a problem hiding this comment.
I guess the same changes should be applied here - https://github.com/NativeScript/NativeScript/blob/master/nativescript-core/ui/bottom-navigation/bottom-navigation.android.ts#L703
| } | ||
|
|
||
| public setTabBarBackgroundColor(value: android.graphics.drawable.Drawable | Color): void { | ||
| this._originalBackground = null; |
There was a problem hiding this comment.
and this should be applied here - https://github.com/NativeScript/NativeScript/blob/master/nativescript-core/ui/bottom-navigation/bottom-navigation.android.ts#L711
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
|
@NathanaelA did you have a chance to view the comments? |
This comment was marked as abuse.
This comment was marked as abuse.
|
@NathanaelA you can use e2e/ui-tests-app as an example app. |
This comment was marked as abuse.
This comment was marked as abuse.
|
@NathanaelA Best regards, |
This comment was marked as abuse.
This comment was marked as abuse.
|
@NathanaelA ,
@HostListener('loaded')
#8775 Are these issues related to the same underlaying problem we are dealing with here?
If I can help with testing, please let me know. And thank you very much for your support. Best regards, |
8753605 to
86395da
Compare
d4ced42 to
53488b5
Compare
|
Further investigation into property (and CSS in general) handling will be done separately. |
PR Checklist
What is the current behavior?
Currently on android if you set the Tab & TabView's background color; it cache's the color when you leave the page and resets it when you return to the page. (Good behavior so far). However, if you navigate away; and then change the global CSS from say light theme to a dark theme, then return back to the page with a tab/tab-view the tab attempts to use the old cached color, despite the CSS system passing a new backgroundColor into the control on refresh.
On tab-views; the ViewPager can cache the background color; so we need to force it to change the color also.
Crashing issue with
updateAndroidItemAtduring startup of control.What is the new behavior?
This clears the
_originalBackgroundcached value if a new backgroundColor is set.sets the viewPagers color also
Adds a safety check to make sure updateAndroidItemAt can't update something that doesn't exist.
Fixes/Implements/Closes #
Fixes two issues repoted in NativeScript-Themes repo with the "tabs" and "tab-view" controls.