-
Notifications
You must be signed in to change notification settings - Fork 13.5k
fix(refresher): border should only show when pulled #12015
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
This looks good, however, using the name |
My understanding from the Ionic source code is that properties that are prefixed with an underscore are for framework-internal use, and properties that are explicitly declared as private are for class-internal use. I'm sure the Ionic team can comment on this! |
Did you try to do it only using CSS? (on Like:
Or perhaps in refresher, there is this line:
You can try and change to
|
@@ -202,6 +202,7 @@ export class Refresher { | |||
|
|||
constructor(private _plt: Platform, @Host() private _content: Content, private _zone: NgZone, gestureCtrl: GestureController) { | |||
this._events = new UIEventManager(_plt); | |||
_content._hasRefresher = true; | |||
_content.setElementClass('has-refresher', true); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe this is a good oportunity to merge:
_content._hasRefresher = true;
_content.setElementClass('has-refresher', true);
to something like:
_content._setRefresher(true);
this way we reduce the coupling between both components a little bit, thoughts?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@manucorporat Yes, that would be nice. Maybe we could use the following on Content
and remove the setElementClass
completely, so there's no need for a setter function either?
host {
'[class.has-refresher]': '_hasRefresher'
}
@Manduro yes, prefixed with _ is the way most of the components are created. private instance variables can't be tested directly in unit tests and the angular compiler "crashes" when used in the template. |
@manucorporat Yeah my suggestions are different. pure css one (I think it works), OR just a translation change in JS |
@AmitMY not a big fan of the translation solution though |
Originally this was working with css only, a rule for this still exists: .has-refresher .scroll-content {
margin-top: -1px;
} The problem with this is that it gets overwritten by |
@Manduro but is |
It is not as far as I know, but it could definitely introduce other problems with the absolute positioning which I can not oversee. The scroll area would be 1px underneath the header as well, which is not the case with margins. |
I can't prove it, but I do agree with @Manduro on this. Even if this adds small complexity in content:
Also, I like the small refactor proposed:
However, the change detection strategy used by Content is |
@manucorporat Agreed on all three points! I was just testing that Should I rewrite the property like below, or is it fine as it is? /** @hidden */
hasRefresher: boolean; |
@Manduro you right! it should not cause any problem
|
@manucorporat Alright! I pushed the additional change, needs a squash on merge. Thanks for taking a look! |
src/components/content/content.ts
Outdated
@@ -782,6 +785,11 @@ export class Content extends Ion implements OnDestroy, AfterViewInit, IContent { | |||
this._cBottom += this._tabbarHeight; | |||
} | |||
|
|||
// Refresher uses a border which should be hidden unless pulled | |||
if (this._hasRefresher === true) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let's trust TS a little bit :D it should be a valid boolean. I think it is ok to drop the "=== true"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cc @Manduro
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
btw, I probably rename statusbarPadding
to _statusbarPadding
soon
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@manucorporat Haha, I like the explicitness and it could be a tiny bit faster but sure ;)
merged! |
Short description of what this resolves:
See #10994
Changes proposed in this pull request:
Content
has aRefresher
, the calculated top margin is reduced by 1px to hide the border.Ionic Version: 3.x
Fixes: #10994