microsoft / microsoft/AdaptiveCards

[Rendering] adaptivecards-react should list swiper as dependency

Open
#8,505 0 comments 3 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Target Platforms

NodeJS

SDK Version

adaptivecards-react v1.1.1

Application Name

Web app

Problem Description

Following the instructions of adaptivecards-react to render an adaptive card in an React app. Hit the following errors

Module not found: Error: Can't resolve 'swiper' in 'MY_APP_ROOT\webapp\node_modules\adaptivecards\lib' ERROR in ./node_modules/adaptivecards/lib/carousel.js 51:15-32 Module not found: Error: Can't resolve 'swiper' in 'MY_APP_ROOT\webapp\node_modules\adaptivecards\lib'

After manually installing swiper from npm, the issue is resolved.

Per observation, adaptivecards-react has hard dependency on swiper which should be listed in the documentation. The following command should be npm install react adaptivecards-react swiper --save
image

Screenshots

image

Card JSON
var card = {
        type: 'AdaptiveCard',
        version: '1.0',
        body: [
            {
                type: 'TextBlock',
                text: 'Here is a ninja cat',
            },
            {
                type: 'TextBlock',
                text: 'Here is another ninja cat',
            },
            {
                type: 'Image',
                url: 'http://adaptivecards.io/content/cats/1.png',
            },
        ],
    };
Sample Code Language

Typescript

Sample Code
// ....
// test adaptive card
    var card = {
        type: 'AdaptiveCard',
        version: '1.0',
        body: [
            {
                type: 'TextBlock',
                text: 'Here is a ninja cat',
            },
            {
                type: 'TextBlock',
                text: 'Here is another ninja cat',
            },
            {
                type: 'Image',
                url: 'http://adaptivecards.io/content/cats/1.png',
            },
        ],
    };

    var hostConfig = {
        fontFamily: 'Segoe UI, Helvetica Neue, sans-serif',
    };
    
    return (
         <AdaptiveCard payload={card} hostConfig={hostConfig} />
    );

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 reviewing the adaptivecards-react npm README instructions and the dependency usage shown in adaptivecards/lib/carousel.js. Reproduce the documented React installation in a fresh app, then verify that the package metadata or installation instructions account for swiper so the sample renders without manually installing it.

Written by the indexing model from the issue text.

Assessment

Tech stack
react, typescript
Domain
frontend
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.