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

Fix for issue #1351 - Button Text does not take empty value #1395

Merged
merged 2 commits into from
Dec 7, 2017
Merged
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
24 changes: 22 additions & 2 deletions src/basic/ToastContainer.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -66,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,
Expand All @@ -75,7 +95,7 @@ class ToastContainer extends Component {
closeToast() {
const { onClose } = this.state;

if(onClose && typeof onClose === "function") {
if (onClose && typeof onClose === "function") {
onClose();
}

Expand Down