Skip to content

Commit e1df119

Browse files
AndersDJohnsonclaydiffrient
authored andcommitted
[fixed] remove portal context in timeout (#353)
Fixes the binding of the `removePortal` call in the `setTimeout` callback by capturing a this reference in a variable in the closure scope. Doesn't use `bind` which apparently causes warnings. Fixes #344, fixes #348
1 parent dbaaef2 commit e1df119

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

lib/components/Modal.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,8 @@ var Modal = React.createClass({
9494
this.portal.closeWithTimeout();
9595
}
9696

97-
setTimeout(function() { this.removePortal(); }, closesAt - now);
97+
var that = this;
98+
setTimeout(function() { that.removePortal(); }, closesAt - now);
9899
} else {
99100
this.removePortal();
100101
}

0 commit comments

Comments
 (0)