From 920adb9a8a8e7b5953947574503efa9963b88ee3 Mon Sep 17 00:00:00 2001 From: afc163 Date: Sat, 3 Jun 2017 00:55:30 +0800 Subject: [PATCH] props.style in wrapper for input with addons --- components/input/Input.tsx | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/components/input/Input.tsx b/components/input/Input.tsx index cba15b1cf7..b3e9b114bd 100644 --- a/components/input/Input.tsx +++ b/components/input/Input.tsx @@ -180,19 +180,29 @@ export default class Input extends Component { [wrapperClassName]: (addonBefore || addonAfter), }); - const node = ( + // Need another wrapper for changing display:table to display:inline-block + // and put style prop in wrapper + if (addonBefore || addonAfter) { + return ( + + + {addonBefore} + {cloneElement(children, { style: null })} + {addonAfter} + + + ); + } + return ( {addonBefore} {children} {addonAfter} ); - - // Need another wrapper for changing display:table to display:inline-block - if (addonBefore || addonAfter) { - return {node}; - } - return node; } renderLabeledIcon(children) {