From 8b7038fde79bb9267ab7c296150f7839ee8cc9b4 Mon Sep 17 00:00:00 2001 From: Josh Thomas Date: Wed, 18 Oct 2017 13:17:44 -0500 Subject: [PATCH] fix(): check if values are undef before passing down to input. --- packages/core/src/components/input/input.tsx | 60 ++++++++++++-------- 1 file changed, 35 insertions(+), 25 deletions(-) diff --git a/packages/core/src/components/input/input.tsx b/packages/core/src/components/input/input.tsx index 75812dcc12..502c85ad09 100644 --- a/packages/core/src/components/input/input.tsx +++ b/packages/core/src/components/input/input.tsx @@ -318,6 +318,14 @@ export class Input implements InputComponent { return (this.value !== null && this.value !== undefined && this.value !== ''); } + reduceUndefProps(props: { [ key: string]: any}) { + return Object.keys(props).reduce((final, propName) => { + if (props[propName] != null) { + final[propName] = props[propName]; + } + return final; + }, {} as { [key: string]: any}); + } protected render() { const themedClasses = createThemedClasses(this.mode, this.color, 'text-input'); @@ -326,35 +334,37 @@ export class Input implements InputComponent { return [ ,