Giter Club home page Giter Club logo

react-tagcloud's People

Contributors

dependabot[bot] avatar madox2 avatar ownadi avatar rahavlussato avatar udovenko avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

react-tagcloud's Issues

`defaultProps` console warning

Currently using v2.3.1, and I see a console error stating TagCloud: Support for defaultProps will be removed from function components in a future major release. Use JavaScript default parameters instead.

Everything seems to be working fine, just wanted to call it out before it potentially breaks down the road.

Update to support react 16

Currently this package has react ^15.5.0 as a peerDependency.

Since react 16 is out, this package should be updated to support it.

Support for React v17

Due to the peerDependency's current value, this library can not be installed alongside React v17.

It would be cool to add support for this version of React!

Let me know if you need any help with this.

TypeError: dispatcher is null

Using react 17.0.2 and nextjs 12.0.8

I simply import tagcloud and place the tag in my html return and get>

Unhandled Runtime Error

TypeError: dispatcher is null
Call Stack
useState
../node_modules/react/cjs/react.development.js (1622:0)
TagCloud
../node_modules/react-tagcloud/lib/TagCloud.js (135:0)
renderWithHooks
node_modules/react-dom/cjs/react-dom.development.js (14985:0)
mountIndeterminateComponent
node_modules/react-dom/cjs/react-dom.development.js (17811:0)
beginWork
node_modules/react-dom/cjs/react-dom.development.js (19049:0)
callCallback
node_modules/react-dom/cjs/react-dom.development.js (3945:0)

I also tried to force client side rendering just in case this was the culprit:

{ process.browser && <TagCloud
                minSize={5}
                maxSize={35}
                tags={this.state.wordcloud_data}
            />    }

But unfortunately still the same error.
The line referenced in the error message is the 2nd one in this snippet:

function TagCloud(props) {
  var _useState = (0, _react.useState)([]),
      _useState2 = _slicedToArray(_useState, 2),

I initialize the data in the component constructor so wordcloud_data should never be null:

this.state = {
            campaign_name: "", 
            tracker: "", 
            talent_table_content: [],
            wordcloud_data: [
                {value: "test1", count: 12}, 
                {value: "test2", count: 25}, 
                {value: "test3", count: 39}, 
                {value: "test4", count: 2}, 
                {value: "test5", count: 40}
            ]
        }

Error while using in nextjs

image

All the classes and tags are made that can be seen in inspect element but all the spans are empty, its like it is not picking the values from data.

Support React Native by allow customize the default container

react-tagcloud already support custom renderer,
so we can use custom renderer to render Text in react native.
But React Native use <View> instead of <div> as the default container.

What's missing is the way to customize the default container, ex:

import { Text, View } from 'react-native'
import { TagCloud } from "react-tagcloud"

// PROPOSED one
const customContainer(props) => {
  <View>
    {props.children}
  </View>
}

const customRenderer = (tag, size, color) => {
      return (
        <Text
          key={tag.value}
          style={{
             color: 'xxx',
             fontSize: 'xxx',
          }}
        >
          {tag.value}
        </Text>
      )
    };

const data = [
  { value: "JavaScript", count: 38 },
  { value: "React", count: 30 },
  { value: "Nodejs", count: 28 },
  { value: "Express.js", count: 25 },
  { value: "HTML5", count: 33 },
  { value: "MongoDB", count: 18 },
  { value: "CSS3", count: 20 }
];

return(
  <TagCloud
    tags={data}
    renderer={customRenderer}
    // PROPOSED one
    container={customContainer}
    style={{flexDirection:'row', flexWrap:'wrap', alignItems: 'center', 
     justifyContent:'center'}}
  />
)

@madox2 how do you think?

Class components compatibility

Is usage supported in react class components?
I am using [email protected]

error reported in console

react.development.js:1622  Uncaught TypeError: Cannot read properties of null (reading 'useState')
    at useState (react.development.js:1622:1)
    at TagCloud (TagCloud.js:161:1)
    at renderWithHooks (react-dom.development.js:14803:1)
    at mountIndeterminateComponent (react-dom.development.js:17482:1)
    at beginWork (react-dom.development.js:18596:1)
    at HTMLUnknownElement.callCallback (react-dom.development.js:188:1)
    at Object.invokeGuardedCallbackDev (react-dom.development.js:237:1)
    at invokeGuardedCallback (react-dom.development.js:292:1)

thanks

Getting warning: React does not recognize the `containerComponent` prop on a DOM element. If you intentionally want it to appear in the DOM as a custom attribute, spell it as lowercase `containercomponent` instead. If you accidentally passed it from a parent component, remove it from the DOM element.

I can see in the library code the use of const Container = props.containerComponent, line 102, TagCloud.js.

React warnings about that:
https://reactjs.org/warnings/unknown-prop.html

Any way to fix that warning?

Mouse hover event

Request - Add onMouseOver and onMouseOut events

Sample API
const onMouseOver = tag => console.log("this is value and count", tag.value, tag.count)

<TagCloud onMouseOver={onMouseOver} onMouseOut={onMouseOut} ... />

Also, I think it'd be great to offer a tooltip render option upon hover.
Thank you for the clean abstractions!

Disabling automatic shuffle

I really need a props parameter that allowed the internal mixing mechanism to be disabled.

Like this:

<TagCloud disableAutoShuffle={true} ...props />

I think this is a very important tweak, especially when you want to sort the items in the cloud in your own way and it's important to keep the order passed on

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.