Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

allow react 15.x dependencies #14

Merged
merged 4 commits into from
Aug 31, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,4 +71,5 @@ if `type` is not set, it will render a neutral notification.


`timeout` is the time (in milliseconds) the toast will remain on screen.
if it's not set, it will display for the default `5000ms` time.
if it's not set, it will display for the default `5000ms` time.
You can also pass `-1` to cause the notification to display persistently.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
},
"dependencies": {
"object-assign": "^3.0.0",
"react": "^0.14.7",
"react-dom": "^0.14.7"
"react": "^0.14.7 || ^15.0.0",
"react-dom": "^0.14.7 || ^15.0.0"
}
}
8 changes: 8 additions & 0 deletions src/notify.js
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,10 @@ class Toast extends React.Component {
context.updateStyle(base, stylesShow);
}, 100); // wait 100ms after the component is called to animate toast.

if (this.props.timeout === -1) {
return;
}

// Hide after timeout
const stylesHide = {
transform: 'translateY(-108px)',
Expand Down Expand Up @@ -186,6 +190,10 @@ function show(text, type, timeout) {
// Render Component with Props.
renderToast(text, type, renderTimeout);

if (timeout === -1) {
return;
}

// Unmount react component after the animation finished.
setTimeout(function() {
hideToast();
Expand Down