This repository has been archived by the owner on Feb 21, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 46
Question - Block only one child in a list #57
Comments
@diegodesouza the BlockUi component only blocks its children. from the screenshot you provided, it looks like you already have it working. can you clarify what the issue is? |
The screenshot is only a mockup, not exactly the implementation. When i tried using BlockUI within a card, it still blocked the whole page. |
can you share a code sandbox or stackblitz demonstrating the issue? |
This should be more than enough of an example without going into styling. It shows a legit list (ul) where a single item (li) is able to be blocked. import React from "react";
import { Button } from "reactstrap";
import BlockUi from "react-block-ui";
import "react-block-ui/style.css";
export default class Example extends React.Component {
constructor(props) {
super(props);
this.toggleBlocking = this.toggleBlocking.bind(this);
this.state = {
blocking: false
};
}
toggleBlocking() {
this.setState({ blocking: !this.state.blocking });
}
render() {
return (
<div>
<ul>
<li>
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do
eiusmod tempor incididunt ut labore et dolore magna aliqua.
</li>
<BlockUi tag="li" blocking={this.state.blocking}>
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do
eiusmod tempor incididunt ut labore et dolore magna aliqua.
</BlockUi>
<li>
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do
eiusmod tempor incididunt ut labore et dolore magna aliqua.
</li>
</ul>
<Button onClick={this.toggleBlocking} color="primary">
Toggle Block
</Button>
</div>
);
}
} Note: We should probably also prevent user selection of blocked content and the loader... |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
I have the following scenario where we display a list in
Card
s within theCard
we have icons that will trigger an action and API call. When the promise is yet to resolve, we would like to give the user some feedback. I was trying to be clever and use theBlockUI
to only block that specific card that the user was interacting with. Can this package do what i'm asking?The text was updated successfully, but these errors were encountered: