From 2ef2a8e6f549d77bcf43e2dbfc184bd911d96a6b Mon Sep 17 00:00:00 2001 From: Sebastian Markbage Date: Thu, 17 Nov 2016 15:02:39 +0000 Subject: [PATCH] Pass props explicitly instead of getting them off currentElement We don't store currentElement and I'm trying to get rid of accessing the Fiber directly inside the host config. --- .../dom/fiber/ReactDOMFiberComponent.js | 23 +++++++++---------- .../dom/fiber/wrappers/ReactDOMFiberInput.js | 18 ++++++--------- .../dom/fiber/wrappers/ReactDOMFiberOption.js | 3 +-- .../dom/fiber/wrappers/ReactDOMFiberSelect.js | 7 ++---- .../fiber/wrappers/ReactDOMFiberTextarea.js | 10 ++++---- 5 files changed, 25 insertions(+), 36 deletions(-) diff --git a/src/renderers/dom/fiber/ReactDOMFiberComponent.js b/src/renderers/dom/fiber/ReactDOMFiberComponent.js index 98ea6f480d..e38f6861a5 100644 --- a/src/renderers/dom/fiber/ReactDOMFiberComponent.js +++ b/src/renderers/dom/fiber/ReactDOMFiberComponent.js @@ -453,6 +453,7 @@ var ReactDOMFiberComponent = { mountComponent: function( workInProgress : Fiber, + props : Object, hostParent : Fiber, hostContainerInfo : Object, context : Object @@ -463,8 +464,6 @@ var ReactDOMFiberComponent = { workInProgress._hostParent = hostParent; workInProgress._hostContainerInfo = hostContainerInfo; - var props = workInProgress._currentElement.props; - switch (workInProgress._tag) { case 'audio': case 'form': @@ -577,13 +576,13 @@ var ReactDOMFiberComponent = { switch (workInProgress._tag) { case 'input': - ReactDOMFiberInput.postMountWrapper(workInProgress); + ReactDOMFiberInput.postMountWrapper(workInProgress, props); if (props.autoFocus) { focusNode(getNode(workInProgress)); } break; case 'textarea': - ReactDOMFiberTextarea.postMountWrapper(workInProgress); + ReactDOMFiberTextarea.postMountWrapper(workInProgress, props); if (props.autoFocus) { focusNode(getNode(workInProgress)); } @@ -599,7 +598,7 @@ var ReactDOMFiberComponent = { } break; case 'option': - ReactDOMFiberOption.postMountWrapper(workInProgress); + ReactDOMFiberOption.postMountWrapper(workInProgress, props); break; default: if (typeof props.onClick === 'function') { @@ -652,29 +651,29 @@ var ReactDOMFiberComponent = { // Update the wrapper around inputs *after* updating props. This has to // happen after `updateDOMProperties`. Otherwise HTML5 input validations // raise warnings and prevent the new value from being assigned. - ReactDOMFiberInput.updateWrapper(workInProgress); + ReactDOMFiberInput.updateWrapper(workInProgress, nextProps); break; case 'textarea': - ReactDOMFiberTextarea.updateWrapper(workInProgress); + ReactDOMFiberTextarea.updateWrapper(workInProgress, nextProps); break; case 'select': //