Skip to content

Click actions to display further details in notification #159

Description

@vaibhav-kona

Is it possible to place a click action on a an element passed in the "children" props to show more details when that button or element is clicked ? I am trying it but could not get it to work.

I want to show the message only when the "Know More" is clicked. But when "Know More" is clicked I no action is happening. I placed console.log and checked in handleMessageVisibility

handleMessageVisibility = () => {
    console.log("isShowMessage");
    this.setState({ isShowMessage: true });
  }

  render() {
    const { title, icon, message } = this.props;
    const { isShowMessage } = this.state;
    return (
      <Fragment>

        <div>

          {icon && <i className={icon} />}

          <span style={{ marginLeft: 16 }}>
            {title}
          </span>

          <span
            style={{ textDecoration: 'underline', float: 'right' }}
            onClick={() => this.handleMessageVisibility}
            role="presentation"
          >
            {!isShowMessage && 'Know More'}
          </span>

        </div>

        {
          isShowMessage && (
            <div>
              {message}
            </div>
          )
        }

      </Fragment>
    );
  }

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions