Code Monkey home page Code Monkey logo

react-notifications's People

Contributors

2betop avatar dependabot[bot] avatar egore avatar frontenddeveloping avatar hyperh avatar inzkornel avatar minhtranite avatar omantere avatar tjrexer 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

Watchers

 avatar  avatar

react-notifications's Issues

NotificationContainer has a method called componentDidUnmount()

Hello,

thank you for the nice library! If I'm not wrong, when I include it I get the following error message in the console:

"NotificationContainer has a method called componentDidUnmount(). But there is no such lifecycle method. Did you mean componentWillUnmount()?"

As far as I see replacing:

componentDidUnmount with componentWillUnmount

will do the job ....

Could you check?

Salut
D063520

Update React to v17.

In order to get rid of remaining componentWillMount warnings, need to update react to v17.

Upgrade node-sass

Due to security issues, node-sass, webpack, & dependencies needs to be upgraded.

Does it make sense to add a syncing notification?

I'm using the library to indicate success and error based on ajax requests initiated by the user. I want to have a syncing notification when its in the middle of an ajax call that either turns into a success or error based on the result.

Timeout to close multiple toaster is not correct

if you have multiple toaster, the rerender of the list of toaster reset timeout after each change (New toaster in or old toaster out).

**Reproduce bug **

    for (let i = 1; i < 10; i++) {
      NotificationManager.success('Success test ' + i, null, 1000);
    }

All toaster are remove in 5- 10 seconds instead of 1 second

Fix bug
on File

Change key in CSSTransition :

 const items = notifications.map((notification, i) => {
      const key = notification.id || new Date().getTime();
      return (
        <CSSTransition
          key={i} <===== this key need to be  key={key}
          classNames="notification"
          timeout={{ enter: enterTimeout, exit: leaveTimeout }}
        >
          <Notification
            key={key} <====== this key is useless
            type={notification.type}
            title={notification.title}
            message={notification.message}
            timeOut={notification.timeOut}
            onClick={notification.onClick}
            onRequestHide={this.handleRequestHide(notification)}
          />
        </CSSTransition>
      );
    });

NotificationContainer properties are not being used

Hello there!

In my tests I saw that enterTimeout and leaveTimeout don't reflect any change to the NotificationContainer component. Looking through the code I realized that this component just pass all it's props to the Notification component and it just don't use these props, cause the names there are different there.

Original Issue

Not working with react 18

react_devtools_backend.js:4026 Warning: findDOMNode is deprecated in StrictMode. findDOMNode was passed an instance of Transition which is inside StrictMode. Instead, add a ref directly to the element you want to reference. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-find-node
    at div
    at Notification (http://localhost:3000/static/js/bundle.js:76938:5)
    at Transition (http://localhost:3000/static/js/bundle.js:79562:30)
    at CSSTransition (http://localhost:3000/static/js/bundle.js:78680:35)
    at div
    at TransitionGroup (http://localhost:3000/static/js/bundle.js:80130:30)
    at div
    at Notifications (http://localhost:3000/static/js/bundle.js:77701:5)
    at NotificationContainer (http://localhost:3000/static/js/bundle.js:77198:5)
    at div
    at Alert (http://localhost:3000/main.59cf04c906a101ce3069.hot-update.js:60:164)
    at div
    at Control (http://localhost:3000/static/js/bundle.js:76603:57)
    at UpdatePtsBtn (http://localhost:3000/main.59cf04c906a101ce3069.hot-update.js:162:25)
    at div
    at MapContainerComponent (http://localhost:3000/static/js/bundle.js:92314:21)
    at BaseMap (http://localhost:3000/static/js/bundle.js:489:66)
    at div
    at App

Warning : findDOMNode is deprecated in StrictMode

Getting warning

index.js:1 Warning: findDOMNode is deprecated in StrictMode. findDOMNode was passed an instance of Transition which is inside StrictMode. Instead, add a ref directly to the element you want to reference. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-find-node
at div
at Notification (http://localhost:3003/static/js/vendors~main.chunk.js:87799:5)
at Transition (http://localhost:3003/static/js/vendors~main.chunk.js:94322:30)
at CSSTransition (http://localhost:3003/static/js/vendors~main.chunk.js:93439:35)
at div
at TransitionGroup (http://localhost:3003/static/js/vendors~main.chunk.js:94891:30)
at div
at Notifications (http://localhost:3003/static/js/vendors~main.chunk.js:88565:5)
at NotificationContainer (http://localhost:3003/static/js/vendors~main.chunk.js:88060:5)
at div
at App (http://localhost:3003/static/js/main.chunk.js:196:1)
console. @ index.js:1
printWarning @ react-dom.development.js:67
error @ react-dom.development.js:43
findHostInstanceWithWarning @ react-dom.development.js:25406
findDOMNode @ react-dom.development.js:26067
performEnter @ Transition.js:245
updateStatus @ Transition.js:228
componentDidMount @ Transition.js:172
commitLifeCycles @ react-dom.development.js:20663
commitLayoutEffects @ react-dom.development.js:23426
callCallback @ react-dom.development.js:3945
invokeGuardedCallbackDev @ react-dom.development.js:3994
invokeGuardedCallback @ react-dom.development.js:4056
commitRootImpl @ react-dom.development.js:23151
unstable_runWithPriority @ scheduler.development.js:468
runWithPriority$1 @ react-dom.development.js:11276
commitRoot @ react-dom.development.js:22990
performSyncWorkOnRoot @ react-dom.development.js:22329
(anonymous) @ react-dom.development.js:11327
unstable_runWithPriority @ scheduler.development.js:468
runWithPriority$1 @ react-dom.development.js:11276
flushSyncCallbackQueueImpl @ react-dom.development.js:11322
flushSyncCallbackQueue @ react-dom.development.js:11309
discreteUpdates$1 @ react-dom.development.js:22420
discreteUpdates @ react-dom.development.js:3756
dispatchDiscreteEvent @ react-dom.development.js:5889

Can't resolve './fonts/notification.eot'

Getting error: Module not found: Error: Can't resolve './fonts/notification.eot'

image

All my css is loaded this way (above). I tried doing this in my component (which I'd rather not do):

import 'react-notifications/lib/notifications.css'

But this only worked in development (not production). Using Rails 6 with webpacker.

Exit animations are broken on some versions of react

The CSS of the repository uses the class .notification-leave to draw the exit animations. Some versions of react however use .notification-exit (and .notification-exit-active) as the exit animations. On these versions of react the exit animations do not work, the CSS is wrong, and the notifications leave by simply disappearing (which is pretty ugly).

I created a new React app using the standard create-react-template. I installed only react-notifications, and I was able to reproduce this error. You can see the error in https://github.com/goodyguts/react-notifs-issue

Additionally, I show how the animation can easily be brought back just by changing the CSS to say exit instead of leave. You can see it working on https://github.com/goodyguts/react-notifs-issue/tree/the-solution

Recommended fix: Add classes that say exit to the SCSS

Update React TransitionsGroup To solve "componentWillMount has been renamed"

React TransitionGroup is already updated. Here is a really old dep in use -
i checked the guid and changed the Notifications.js the use the TransistionGroup
would be nice to get it updated.

Thanks

image

Mirgation Guide:
https://github.com/reactjs/react-transition-group/blob/master/Migration.md

src/Notifications.js

import React from 'react';
import PropTypes from 'prop-types';
import { CSSTransition, TransitionGroup } from 'react-transition-group';
import classnames from 'classnames';
import Notification from './Notification';

class Notifications extends React.Component {
  static propTypes = {
    notifications: PropTypes.array.isRequired,
    onRequestHide: PropTypes.func,
    enterTimeout: PropTypes.number,
    leaveTimeout: PropTypes.number
  };

  static defaultProps = {
    notifications: [],
    onRequestHide: () => {
    },
    enterTimeout: 400,
    leaveTimeout: 400
  };

  handleRequestHide = notification => () => {
    const { onRequestHide } = this.props;
    if (onRequestHide) {
      onRequestHide(notification);
    }
  };

  render() {
    const { notifications, enterTimeout, leaveTimeout } = this.props;
    const className = classnames('notification-container', {
      'notification-container-empty': notifications.length === 0
    });

    const items = notifications.map((notification,i) => {
        const key = notification.id || new Date().getTime();
        return (
          <CSSTransition
            key={i}
            classNames="notification"
            timeout={{ enter: enterTimeout, exit: leaveTimeout }}
          >
          <Notification
            key={key}
            type={notification.type}
            title={notification.title}
            message={notification.message}
            timeOut={notification.timeOut}
            onClick={notification.onClick}
            onRequestHide={this.handleRequestHide(notification)}
          />
          </CSSTransition>
        );
      })
    return (
      <div className={className}>

        <TransitionGroup >
          {items}
        </TransitionGroup>
      </div>
    );
  }
}

export default Notifications;

Support request. UMD usage.

I cant get this working. My source code code wont recognise ReactNotifications object even though its being loaded in the index.html file. Ive tried restarting the react app makes no difference. Any help appreciated.

index.html

    <!-- react notifications UMD -->
    <link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/react-notifications.css">
    <script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/react-notifications.js"></script>

mysource.js (every other line of source code working ok)


// UMD react notifications
export const NotificationContainer = window.ReactNotifications.NotificationContainer;
export const NotificationManager = window.ReactNotifications.NotificationManager;

result in browser:

Module../src/InteractiveMap.jsx
src/InteractiveMap.jsx:88
  85 | const geoWatchDiffThreshold = 0.001;
  86 | 
  87 | // UMD react notifications
> 88 | export const NotificationContainer = window.ReactNotifications.NotificationContainer;
  89 | export const NotificationManager = window.ReactNotifications.NotificationManager;
  90 | 
  91 | // a small component to clear local storage

is it possible to include html content?

Is it possible to add title or content as HTML? To add clickable links, formatting, images etc. Do you have any plans to include this in the future?

thanks

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.