react-tag-cloud icon indicating copy to clipboard operation
react-tag-cloud copied to clipboard

Tagcloud is empty

Open SecretUnicorn opened this issue 4 years ago • 5 comments

I have a list of word and I am generating divs inside the Tagcloud tag. The problem is that there are no elements in the dom listed.


const styles = {
        small: {
            fontSize: 15,
            opacity: 0.8,
        },
        medium: {
            fontSize: 18,
            opacity: 0.9,
        },
        big: {
            fontSize: 22,
            opacity: 1,
        }
    }

    const tagCloudWords = [
        { text: "Wiesbaden", size: "medium" },
        { text: "Mainz", size: "small" },
        { text: "Video", size: "big" }
    ]

<TagCloud 
            className='tag-cloud'
            style={{
              fontFamily: 'sans-serif',
              fontSize: 30,
              padding: 5,
            }}>
            {tagCloudWords.map((w,index) => {
                return (
                    <div style={styles[w.size]} key={index}>
                        {w.text}
                    </div>
                )
            })}
            
          </TagCloud>

grafik

SecretUnicorn avatar Apr 09 '20 13:04 SecretUnicorn

I am experiencing the same issues using create-react-app.

briantical avatar May 04 '20 02:05 briantical

Me too

rcolepeterson avatar Jun 02 '20 23:06 rcolepeterson

I also had the same issue, after several testing I found it's just add width and height to 100% on tag-cloud class

.tag-cloud {
	height: 100%;
	width: 100%;
}

.tag-cloud > div {
	transition: 1.4s;
}

you also must add a forceUpdate interval to add the update animation

componentDidMount() {
        setInterval(() => {
            this.forceUpdate();
        }, 3000);
    }

JAlexanderGuzman avatar Jun 16 '20 19:06 JAlexanderGuzman

Same. Couldn't get this to work regardless of forceUpdate or what I throw into it. Moved to https://www.npmjs.com/package/react-d3-cloud

atifsyedali avatar Sep 30 '20 21:09 atifsyedali

Same. I'm using create-react-app and works for me include the divs app-outer and app-inner with the styles respective. How the example

image

cristicares avatar Oct 13 '20 23:10 cristicares