Skip to content

Commit

Permalink
feat: add setDefaultIndicator
Browse files Browse the repository at this point in the history
  • Loading branch information
hosseinmd committed Nov 19, 2021
1 parent 71568a8 commit 8c6c61a
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions packages/component/src/molecules/loadingView/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@ import { View, ViewProps } from "../../atoms/view";
import { Loader } from "./loader";
import useStyles from "./styles";

let defaultLoader = <Loader />;

function setDefaultIndicator(indicator: JSX.Element) {
defaultLoader = indicator;
}
export interface LoadingViewProps extends ViewProps {
// size?: "small" | "large" | "default";
// color?: string;
Expand Down Expand Up @@ -39,12 +44,11 @@ const LoadingView = ({
return (
<View {...rest}>
{(!isLoading || !isLazy) && children}
{isLoading && (
<View className={classes.wrapper}>
<Loader />
</View>
)}
{isLoading && <View className={classes.wrapper}>{defaultLoader}</View>}
</View>
);
};

LoadingView.setDefaultIndicator = setDefaultIndicator;

export { LoadingView };

0 comments on commit 8c6c61a

Please sign in to comment.