-
-
Notifications
You must be signed in to change notification settings - Fork 32.3k
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
[RefreshIndicator] Port component #9614
Conversation
@leMaik Thanks for working on it! I fear I won't have the time to deep dive into reviewing this PR anytime soon. I'm focusing on fixing bug with existing components. I hope people can jump in to help. At the end of the day I don't think that adding new components should be our priority. At least, it's not mine. |
Well, I needed a refresh indicator for a project and some other people seem do be looking for one too, so I don't think it's a bad thing to add this feature. Focusing on fixing bugs is a good thing to do, though. 👍 |
Wait, adding new components can harm, I have experienced it with v0.x. Either because it's increasing the code base, making refactorisation slower, introducting x new issues because the component wasn't polished, creating users and maintainers frustration. Worse, people jump to conclusion. One broken component can potentially mean the other are too. Supporting a new component is 1x for building it and 5x for maintaining it.
Antoine de Saint-Exupery To sum up, if you are willing to maintaine the component in the long run, it's awesome and it worth going forward. Otherwise my strategy would rather be the TimePicker / DatePicker approach. i.e. Focusing on the core components for the next 6 months (stable v1). |
I agree that adding a new component brings some maintenance overhead, but this is really sad. 😞 Remember the table pagination? The expansion panel? Nobody refused it just because it was new. That said, I see that the |
@leMaik True and we can't support all the components features. I would rather support the expansion panel and the table pagination than the refresh indicator. From my experience, very few people use the indicator and ask for it. It was added in #1312. It has received very few feedback since then. Here the only implementation I'm aware of and nobody uses it: https://github.com/maoziliang/react-refresh-indicator. |
@oliviertassinari Following the last revision of your comment, I'll close this PR and implement the |
@leMaik Wait, let's hear what the other maintainers want to do here :). This is just my point of view on the topic. |
I'm more like "the less we do, the more we have to do anyway but in seperate projects" 😄 Reopened, but |
Exactly 💯 |
cc @mui-org/core-contributors |
I think a refreshable container is a great widget that others will use, but I do not know if it is a core component. Either way - it will be created and we want everyone to find/contribute to it in one place. Either: The only problem with One last option - create another Thoughts? |
I agree, and I'd suggest that perhaps it's absence on v0.x was part of the reason for the lack of interest in the refresh indicator component. By itself, that isn't particularly useful.
That strikes a nice balance for components which aren't initially accepted for mui-org/material-ui, with the possibility to "graduate" to MUI if proved valuable / stable / popular. |
I agree with @rosskevin and @mbrookes - the idea of a proving ground for new components would be great. |
What is the simplest project skeleton + demo to get going? @oliviertassinari may want to stub it. I propose the name is
The name is generic/abstract enough that it can be whatever it grows into. |
Names are hard. I was thinking this would be something like a collection of near-production prototypes fresh from the lab, or work table, work bench, etc. |
What about creating one project/package per feature that is to be benchmarked? E.g. Edit: Maybe, the component doesn't even need to be included in the core library. If the integration in the documentation is good enough, why not keep components that not everybody will need separated? |
I'm proposing a plan going forward in #9673. Now, regarding the
What do you guys prefer? |
My vote is for Edit: @oliviertassinari I just saw your monorepo comment in the "release v1" issue. I'm cool with that too. There's also git submodules... Not precious about the name, just using it as a placeholder, although I'm not sure about "denovo". (Sorry @rosskevin!) |
@mbrookes So you would vote for having a different repository for the lab? What're the advantages? The disadvantages I can see:
The advantages I can see:
|
Sorry, I edited my comment while you were writing yours. I'm with you on monorepo. It's a long time since I used submodules, but I think they may have the same disadvantages? |
@oliviertassinari I'd vote for 3, but |
@leMaik I agree. Monorepo means issue noise/growth for things that may never be core, which rules it out in my opinion. |
@leMaik Sounds good to me. Does #9673 (comment) address your concern? |
2562c8a
to
b040d5c
Compare
|
||
class RefreshIndicator extends React.Component { | ||
getPaddingSize() { | ||
const padding = this.props.size * 0.14; |
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.
Shouldn't we return padding directily.
return this.props.size * 0.14
The syntax used in this function and getPaperSize function should be same
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.
Absolutely! 👍
|
||
if (touchNow > this.state.touchStart) { | ||
// swiped down | ||
e.preventDefault() |
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.
Why do we need event.preventDefault only in case of swipe down?
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.
To prevent the browser's swipe-to-refresh function.
b040d5c
to
25a9d9a
Compare
It's almost ready for the lab! 🎉 |
@leMaik What's the current status of this component? Is it nearly ready for review? |
@mbrookes I think it is, feel free to give me a review. 👍 I just want to improve the example, it looks a bit ugly. |
@kgregory EDIT: never mind...
|
What about: https://material.io/design/platform-guidance/android-swipe-to-refresh.html#usage |
@kgregory Right, the refresh indicator is still in the specification. It's definitely some nice to have (I won't say it's a must-have).
@leMaik I'm closing the pull request for now. After more thoughts, I have nothing against accepting a refresh-indicator in the lab :). Feel free to complete the implementation! I haven't reviewed any of lab components yet. I think that it's healthy. I shouldn't be a bottleneck. It's also giving space and freedom for people to jump in. |
Is someone developing this somewhere else, where I could take a look? I'm having trouble finding a decent pull-to-refresh implementation that doesn't result in jerky scrolling on iOS (or lack of momentum scrolling). |
This PR ports the
RefreshIndicator
from material-ui 0.x and brings a newRefreshableContainer
component that provides a container that can be refreshed (hence the name, duh 😄) with pull-to-refresh.Some of the things that still need to be done:
RefreshableContainer
RefreshableContainer
to be used ondocument
instead of its owndiv
RefreshableContainer
a custom (top) offset for the refresh indicatorRelated issues: #2833 and #6214 (the latter isn't really a duplicate, it asks for a HOC like the proposed
RefreshableContainer
)