Coder Social home page Coder Social logo

react-crouton's People

Contributors

davidsonsns avatar winkler1 avatar xeodou 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  avatar

react-crouton's Issues

setState(...): Can only update a mounted or mounting component.

I'm getting this warning when onDismiss is fired. Any ideas what I could do to fix this?

Warning: setState(...): Can only update a mounted or mounting component. This usually means you called setState() on an unmounted component. This is a no-op. Please check the code for the react-crouton component.

Parent:

<Alert alert={this.props.alert} clearAlert={this.props.clearAlert} />

Alert Component:

import React, {Component} from 'react'
import Crouton from 'react-crouton'

export default class Alert extends Component {

  handleDismiss(){
    this.props.clearAlert();
  }

  renderAlert(){
    if(this.props.alert.type !== null){
      return(
        <Crouton
        id = {Date.now()}
        message={this.props.alert.message}
        onDismiss={this.handleDismiss.bind(this)}
        type={this.props.alert.type}/>
      );
    }
  }

  render(){
    return(
      <div>
      {this.renderAlert()}
      </div>
    );
  }
}
```

Style not showing up

While, trying to use it I am unable to get styles shown. All text comes with white background. What could be the reason or any direction where I can look at possible issue?
I have intergrated the provided styles.css using following line in html code.

Cannot resolve module 'react/lib/emptyFunction'

Hi,
Using [email protected], I'm getting this when trying to test out a Crouton.

[0] Module not found: Error: Cannot resolve module 'react/lib/emptyFunction' in /Users/gustavojimenez/Projects/myProject/node_modules/react-crouton
[0] resolve module react/lib/emptyFunction in /Users/gustavojimenez/Projects/myProject/node_modules/react-crouton
[0]   looking for modules in /Users/gustavojimenez/Projects/myProject/src
[0]     /Users/gustavojimenez/Projects/myProject/src/react doesn't exist (module as directory)
[0]   looking for modules in /Users/gustavojimenez/node_modules
[0]     /Users/gustavojimenez/node_modules/react doesn't exist (module as directory)
[0]   looking for modules in /Users/gustavojimenez/Projects/myProject/node_modules
[0]     resolve 'file' or 'directory' lib/emptyFunction in /Users/gustavojimenez/Projects/myProject/node_modules/react
[0]       resolve file
[0]         /Users/gustavojimenez/Projects/myProject/node_modules/react/lib/emptyFunction doesn't exist
[0]         /Users/gustavojimenez/Projects/myProject/node_modules/react/lib/emptyFunction.json doesn't exist
[0]         /Users/gustavojimenez/Projects/myProject/node_modules/react/lib/emptyFunction.js doesn't exist
[0]       resolve directory
[0]         /Users/gustavojimenez/Projects/myProject/node_modules/react/lib/emptyFunction doesn't exist (directory default file)
[0]         /Users/gustavojimenez/Projects/myProject/node_modules/react/lib/emptyFunction/package.json doesn't exist (directory description file)
[0] [/Users/gustavojimenez/Projects/myProject/src/react]
[0] [/Users/gustavojimenez/node_modules/react]
[0] [/Users/gustavojimenez/Projects/myProject/node_modules/react/lib/emptyFunction]
[0] [/Users/gustavojimenez/Projects/myProject/node_modules/react/lib/emptyFunction.json]
[0] [/Users/gustavojimenez/Projects/myProject/node_modules/react/lib/emptyFunction.js]
[0]  @ ./~/react-crouton/index.js 2:20-54
[0] webpack built edf326036966f1f37af1 in 7951ms

If this is because of using [email protected], by any chance will you be supporting it in the future?

prop autoMiss not working

Hy, to prop autoMiss when it has the value true and also some button in the component does not work, is this behavior any better?
I will do it in my repository and make a new pull request, if it is valid.
thank you again

Update react version?

I'm trying to use your component altogether with react-bootstrap, but while installing dependencies I'm seeing this:

39251 error peerinvalid The package react does not satisfy its siblings' peerDependencies requirements!
39251 error peerinvalid Peer [email protected] wants react@>=0.13
39251 error peerinvalid Peer [email protected] wants [email protected]

Is it possible to upgrade react version in your dependencies?

[React v15] Accessing PropTypes via the main React package is deprecated

After upgrading to react 15.5.4 I'm getting these warnings in the browser console:

Warning: Accessing PropTypes via the main React package is deprecated. Use the prop-types package from npm instead.
warning.js:36 Warning: react-crouton: React.createClass is deprecated and will be removed in version 16. Use plain JavaScript classes instead. If you're not yet ready to migrate, create-react-class is available on npm as a drop-in replacement.

Send message as HTML string or as component

Make it possible to send the prop message as an HTML string or as a component, for example:

message={<div>my <strong>message</strong></div>}

// or

message={"<div>my <strong>message</strong></div>"}

CSS class names for buttons

Are there plans to send the CSS class names for the buttons along with the name and listener?
It would come in handy for styling especially with Bootstrap.

onDismiss called immediately

The tests are failing for me but this is the test:

Create a new Crouton and check that the onDismiss function is not called before the timeout has expired.

it('should not call onDismiss directly', function() {
    var dismissCalled = 0;
    var crouton = TestUtils.renderIntoDocument(
      Crouton({
        id: 123456,
        message: 'data.message',
        type: 'errorClassName',
        hidden: false,
        onDismiss: function() {
          dismissCalled++;
        }
      }))

      expect(dismissCalled, 0)
  })

At the moment this test would fail because index.js::changeState is called from componentWillMount where this line is executed:

this.dismiss();

Solutions?

  • Uncomment the line? The dismiss should be called (eventually) due the setTimeout
  • Do not call changeState from componentWillMount but instead use getInitialState and getDefaultProps for the 'startup' logic

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.