@etsoo/materialui
Version:
TypeScript Material-UI Implementation
35 lines (34 loc) • 886 B
JavaScript
import { jsx as _jsx } from "react/jsx-runtime";
import React from "react";
import { ExtendUtils } from "@etsoo/shared";
let pr;
/**
* PullToRefresh UI
* Use hammerjs or touchemulator to simulate browser as mobile device
* @param props Props
* @returns Component
*/
export function PullToRefreshUI(props) {
// Ready
React.useEffect(() => {
if (pr) {
// Loaded, delay a little bit
pr.destroyAll();
ExtendUtils.waitFor(() => {
pr?.init(props);
}, 100);
}
else {
import("pulltorefreshjs").then((PullToRefresh) => {
pr = PullToRefresh.default;
pr.init(props);
});
}
return () => {
if (pr) {
pr.destroyAll();
}
};
}, [props]);
return _jsx(React.Fragment, {});
}