Replies: 1 comment 4 replies
-
|
Hi @imsyf! I'm Dosu and I’m helping the ant-design-mobile team. Currently, PullToRefresh in ant-design-mobile does not support controlling its status via React state or a "controlled mode"—the status is managed internally and transitions are tied to the promise returned by the onRefresh prop. There is no prop or API for syncing status with parent state or for handling non-promise-based refresh functions directly. The only way to update external UI based on PullToRefresh status is by customizing renderText or using CSS selectors like :has, but this does not provide true state synchronization or external control [docs] [source]. There are multiple feature requests for a controlled mode or ref-based API (e.g., ref.current.startRefresh, ref.current.completeRefresh), and maintainers have acknowledged the need for this, but it is not implemented yet [issue #6270] [issue #5653]. For now, if you need to sync external state, you can wrap your onRefresh handler to set your own React state before and after the refresh logic, but this won't control the PullToRefresh UI itself. For non-promise-based refresh functions, you could create a promise wrapper around your logic, but again, this is a workaround and not a true controlled solution. If you need full external control, you'll need to wait for a future update or consider a custom implementation. To reply, just mention @dosu. Share context across your team and agents. Try Dosu. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Currently
PullToRefreshstatus is handled internally by awaiting promise passed toonRefreshprops.Would it be possible to control PullToRefresh status with React state?
It would be useful when:
renderTextprops (though right now it can be done by utilizing CSS has selector)Therefore I think it's pretty important to have a way to sync its status with parent state
Beta Was this translation helpful? Give feedback.
All reactions