From e1df119caf3e6cd20f06abf25cfde3dd9afdcf55 Mon Sep 17 00:00:00 2001 From: "Anders D. Johnson" Date: Fri, 10 Mar 2017 19:16:12 -0600 Subject: [PATCH] [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 --- lib/components/Modal.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/components/Modal.js b/lib/components/Modal.js index 4efeee1b..36252c1e 100644 --- a/lib/components/Modal.js +++ b/lib/components/Modal.js @@ -94,7 +94,8 @@ var Modal = React.createClass({ this.portal.closeWithTimeout(); } - setTimeout(function() { this.removePortal(); }, closesAt - now); + var that = this; + setTimeout(function() { that.removePortal(); }, closesAt - now); } else { this.removePortal(); }