From 9c51c64d2ddc1e240f1aa5d3b376f0a8b4af97bf Mon Sep 17 00:00:00 2001 From: Sangwoo_Maeng Date: Thu, 14 Jun 2018 15:36:16 +0900 Subject: [PATCH] Fix infinite render() when Toast.show() in componentDidMount() --- lib/Toast.js | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/lib/Toast.js b/lib/Toast.js index f765306..1a32c5d 100644 --- a/lib/Toast.js +++ b/lib/Toast.js @@ -14,12 +14,15 @@ class Toast extends Component { static durations = durations; static show = (message, options = {position: positions.BOTTOM, duration: durations.SHORT}) => { - return new RootSiblings( - {message} - ); + return new Promise(resolve => { + setTimeout(() => resolve(new RootSiblings( + {message} + ), + ), 0); + }); }; static hide = toast => {