From 3ea7e4e3cd9cf31cfb96724e8e2cdfcfcf3aab45 Mon Sep 17 00:00:00 2001 From: akhil-geekyants Date: Mon, 27 Nov 2017 17:46:43 +0530 Subject: [PATCH 1/2] Fix for issue #1351. Button Text does not take empty value --- src/basic/ToastContainer.js | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/basic/ToastContainer.js b/src/basic/ToastContainer.js index 99782e211..13acde59f 100644 --- a/src/basic/ToastContainer.js +++ b/src/basic/ToastContainer.js @@ -40,11 +40,19 @@ class ToastContainer extends Component { return 0; } } + getButtonText(buttonText) { + if (buttonText) { + if (buttonText.trim().length === 0) { + return undefined; + } else return buttonText + } + return undefined; + } showToast({ config }) { this.setState({ modalVisible: true, text: config.text, - buttonText: config.buttonText, + buttonText: this.getButtonText(config.buttonText), type: config.type, position: config.position ? config.position : "bottom", supportedOrientations: config.supportedOrientations, @@ -75,7 +83,7 @@ class ToastContainer extends Component { closeToast() { const { onClose } = this.state; - if(onClose && typeof onClose === "function") { + if (onClose && typeof onClose === "function") { onClose(); } From ebdb82510eb09875f0ed6febf47b3477f78343f9 Mon Sep 17 00:00:00 2001 From: akhil-geekyants Date: Tue, 28 Nov 2017 17:09:59 +0530 Subject: [PATCH 2/2] Added default duration of 1500ms for Toast --- src/basic/ToastContainer.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/basic/ToastContainer.js b/src/basic/ToastContainer.js index 13acde59f..d7fba63a0 100644 --- a/src/basic/ToastContainer.js +++ b/src/basic/ToastContainer.js @@ -74,6 +74,18 @@ class ToastContainer extends Component { }); }, 500); }, config.duration); + } else { + setTimeout(() => { + Animated.timing(this.state.fadeAnim, { + toValue: 0, + duration: 200, + }).start(); + setTimeout(() => { + this.setState({ + modalVisible: false, + }); + }, 500); + }, 1500); } Animated.timing(this.state.fadeAnim, { toValue: 1,