microsoft / microsoft/AdaptiveCards

[Rendering] React Wrapper hostConfig is not optional

Open
#7,998 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Area-Renderers Bug
Dominant language
C#
Stars
2k
Forks
595
Avg merge
1d 19h
Merged PRs (30d)
1

Description

Target Platforms

NodeJS

SDK Version

1.3

Application Name

React

Problem Description

If you use adpativecards-react wrapper, documentation and code both do not specify hostConfig as required. But if you leave out hostConfig the Card is not rendered, just an empty <div /> appears.
This behaviour only appears with adaptivecards-react@1.1.1 - it was working with adaptivecards-react@1.0.0

Screenshots

No response

Card JSON
{
    "type": "AdaptiveCard",
    "body": [
        {
            "type": "TextBlock",
            "wrap": true,
            "spacing": "medium",
            "separator": true,
            "text": "hello"
        }
    ],
    "$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
    "version": "1.3"
}
Sample Code Language

React

Sample Code
import { AdaptiveCard } from "adaptivecards-react";
import React from "react";

const ChatMessage = () => {
  return (
    <AdaptiveCard
      payload={{
        $schema: "https://adaptivecards.io/schemas/adaptive-card.json",
        type: "AdaptiveCard",
        version: "1.3",
        body: [
          {
            type: "TextBlock",
            text: "hello",
            wrap: true,
            spacing: "Medium",
            separator: true,
          },
        ],
      }}
      /* hostConfig is needed - remove it, and the card won't show "hello" */
      hostConfig={{}}
    />
  );
};

export { ChatMessage };

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the supplied React example with adaptivecards-react 1.1.1, comparing it with 1.0.0, then inspect the adaptivecards-react wrapper entry point and its documentation. Done means the hostConfig requirement and the wrapper's rendering behavior are consistent and covered by an appropriate verification.

Written by the indexing model from the issue text.

Assessment

Tech stack
react, typescript
Domain
frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.