Skip to content

Delete ReactNativeStack 🎉 🎉 🎉 #10511

Merged
bvaughn merged 14 commits into
react:masterfrom
bvaughn:delete-rn-stack
Aug 23, 2017
Merged

Delete ReactNativeStack 🎉 🎉 🎉 #10511
bvaughn merged 14 commits into
react:masterfrom
bvaughn:delete-rn-stack

Conversation

@bvaughn

@bvaughn bvaughn commented Aug 22, 2017

Copy link
Copy Markdown
Contributor

For now, I left "fiber" in the names of several modules because I wanted to reduce the amount of churn introduced with this PR. This change has minimal impact on the fiber flat bundle (see diff in comment below).

Commits are vaguely atomic. (Renames are isolated at least.)

@spicyj and I are tagged on a couple of tangentially-related TODO items in the repo still, but I think they are probably better done as smaller follow-up items.

Synced to fbsource, ran Flow+Jest, and did a quick smoke-test with Ads Manager. ¯\_(ツ)_/¯

@flarnie

flarnie commented Aug 22, 2017

Copy link
Copy Markdown
Contributor

Excited about this! I feel like someone from the RN team should +1 it but I'll review it as much as I can.

@bvaughn

bvaughn commented Aug 22, 2017

Copy link
Copy Markdown
Contributor Author

cc @sebmarkbage flat bundle diff

ReactNativeFiber-dev.js

287c287
<         var tag = "number" != typeof inst.tag ? inst._rootNodeID : inst.stateNode._nativeTag;
---
>         var tag = inst.stateNode._nativeTag;
3231,3235c3231
<     }, ReactVersion = "16.0.0-beta.5", ReactNativeFeatureFlags = require("ReactNativeFeatureFlags"), ReactCurrentOwner$3 = ReactGlobalSharedState_1.ReactCurrentOwner, warning$11 = require$$0, injectedFindNode = ReactNativeFeatureFlags.useFiber ? function(fiber) {
<         return ReactNativeFiberRenderer.findHostInstance(fiber);
<     } : function(instance) {
<         return instance;
<     };
---
>     }, ReactVersion = "16.0.0-beta.5", ReactCurrentOwner$3 = ReactGlobalSharedState_1.ReactCurrentOwner, warning$11 = require$$0;
3242c3238
<         return internalInstance ? injectedFindNode(internalInstance) : component || (invariant("object" == typeof component && ("_rootNodeID" in component || "_nativeTag" in component) || null != component.render && "function" == typeof component.render, "findNodeHandle(...): Argument is not a component " + "(type: %s, keys: %s)", typeof component, Object.keys(component)), 
---
>         return internalInstance ? ReactNativeFiberRenderer.findHostInstance(internalInstance) : component || (invariant("object" == typeof component && "_nativeTag" in component || null != component.render && "function" == typeof component.render, "findNodeHandle(...): Argument is not a component " + "(type: %s, keys: %s)", typeof component, Object.keys(component)), 
3245c3241
<     var findNodeHandle_1 = findNodeHandle, findNumericNodeHandleFiber = function(componentOrHandle) {
---
>     var findNodeHandle_1 = findNodeHandle, findNumericNodeHandle = function(componentOrHandle) {
3645c3641
<                 var tag = "number" != typeof to.tag ? to._rootNodeID : to.stateNode._nativeTag;
---
>                 var tag = to.stateNode._nativeTag;
3887d3882
<     var DevOnlyStubShim = null;
3906c3901
<     var ReactNativeFeatureFlags$1 = require("ReactNativeFeatureFlags"), mountSafeCallback$2 = NativeMethodsMixinUtils.mountSafeCallback, findNumericNodeHandle = ReactNativeFeatureFlags$1.useFiber ? findNumericNodeHandleFiber : DevOnlyStubShim, ReactNativeComponent = function(_React$Component) {
---
>     var mountSafeCallback$2 = NativeMethodsMixinUtils.mountSafeCallback, ReactNativeComponent = function(_React$Component) {
3922c3917,3924
<             injectedSetNativeProps(this, nativeProps);
---
>             var maybeInstance = void 0;
>             try {
>                 maybeInstance = findNodeHandle_1(this);
>             } catch (error) {}
>             if (null != maybeInstance) {
>                 var viewConfig = maybeInstance.viewConfig, updatePayload = ReactNativeAttributePayload_1.create(nativeProps, viewConfig.validAttributes);
>                 null != updatePayload && UIManager.updateView(maybeInstance._nativeTag, viewConfig.uiViewClassName, updatePayload);
>             }
3924,3949c3926
<     }(react.Component);
<     function setNativePropsFiber(componentOrHandle, nativeProps) {
<         var maybeInstance = void 0;
<         try {
<             maybeInstance = findNodeHandle_1(componentOrHandle);
<         } catch (error) {}
<         if (null != maybeInstance) {
<             var viewConfig = maybeInstance.viewConfig, updatePayload = ReactNativeAttributePayload_1.create(nativeProps, viewConfig.validAttributes);
<             null != updatePayload && UIManager.updateView(maybeInstance._nativeTag, viewConfig.uiViewClassName, updatePayload);
<         }
<     }
<     function setNativePropsStack(componentOrHandle, nativeProps) {
<         var maybeInstance = findNodeHandle_1(componentOrHandle);
<         if (null != maybeInstance) {
<             var viewConfig = void 0;
<             if (void 0 !== maybeInstance.viewConfig) viewConfig = maybeInstance.viewConfig; else if (void 0 !== maybeInstance._instance && void 0 !== maybeInstance._instance.viewConfig) viewConfig = maybeInstance._instance.viewConfig; else {
<                 for (;void 0 !== maybeInstance._renderedComponent; ) maybeInstance = maybeInstance._renderedComponent;
<                 viewConfig = maybeInstance.viewConfig;
<             }
<             var tag = "function" == typeof maybeInstance.getHostNode ? maybeInstance.getHostNode() : maybeInstance._rootNodeID, updatePayload = ReactNativeAttributePayload_1.create(nativeProps, viewConfig.validAttributes);
<             null != updatePayload && UIManager.updateView(tag, viewConfig.uiViewClassName, updatePayload);
<         }
<     }
<     var injectedSetNativeProps = void 0;
<     injectedSetNativeProps = ReactNativeFeatureFlags$1.useFiber ? setNativePropsFiber : setNativePropsStack;
<     var ReactNativeComponent_1 = ReactNativeComponent, ReactNativeFeatureFlags$2 = require("ReactNativeFeatureFlags"), mountSafeCallback$3 = NativeMethodsMixinUtils.mountSafeCallback, throwOnStylesProp$1 = NativeMethodsMixinUtils.throwOnStylesProp, warnForStyleProps$2 = NativeMethodsMixinUtils.warnForStyleProps, findNumericNodeHandle$1 = ReactNativeFeatureFlags$2.useFiber ? findNumericNodeHandleFiber : DevOnlyStubShim, NativeMethodsMixin = {
---
>     }(react.Component), ReactNativeComponent_1 = ReactNativeComponent, mountSafeCallback$3 = NativeMethodsMixinUtils.mountSafeCallback, throwOnStylesProp$1 = NativeMethodsMixinUtils.throwOnStylesProp, warnForStyleProps$2 = NativeMethodsMixinUtils.warnForStyleProps, NativeMethodsMixin = {
3951c3928
<             UIManager.measure(findNumericNodeHandle$1(this), mountSafeCallback$3(this, callback));
---
>             UIManager.measure(findNumericNodeHandle(this), mountSafeCallback$3(this, callback));
3954c3931
<             UIManager.measureInWindow(findNumericNodeHandle$1(this), mountSafeCallback$3(this, callback));
---
>             UIManager.measureInWindow(findNumericNodeHandle(this), mountSafeCallback$3(this, callback));
3957c3934
<             UIManager.measureLayout(findNumericNodeHandle$1(this), relativeToNativeNode, mountSafeCallback$3(this, onFail), mountSafeCallback$3(this, onSuccess));
---
>             UIManager.measureLayout(findNumericNodeHandle(this), relativeToNativeNode, mountSafeCallback$3(this, onFail), mountSafeCallback$3(this, onSuccess));
3960c3937,3946
<             injectedSetNativeProps$1(this, nativeProps);
---
>             var maybeInstance = void 0;
>             try {
>                 maybeInstance = findNodeHandle_1(this);
>             } catch (error) {}
>             if (null != maybeInstance) {
>                 var viewConfig = maybeInstance.viewConfig;
>                 warnForStyleProps$2(nativeProps, viewConfig.validAttributes);
>                 var updatePayload = ReactNativeAttributePayload_1.create(nativeProps, viewConfig.validAttributes);
>                 null != updatePayload && UIManager.updateView(maybeInstance._nativeTag, viewConfig.uiViewClassName, updatePayload);
>             }
3963c3949
<             TextInputState.focusTextInput(findNumericNodeHandle$1(this));
---
>             TextInputState.focusTextInput(findNumericNodeHandle(this));
3966c3952
<             TextInputState.blurTextInput(findNumericNodeHandle$1(this));
---
>             TextInputState.blurTextInput(findNumericNodeHandle(this));
3968,3997c3954
<     };
<     function setNativePropsFiber$1(componentOrHandle, nativeProps) {
<         var maybeInstance = void 0;
<         try {
<             maybeInstance = findNodeHandle_1(componentOrHandle);
<         } catch (error) {}
<         if (null != maybeInstance) {
<             var viewConfig = maybeInstance.viewConfig;
<             warnForStyleProps$2(nativeProps, viewConfig.validAttributes);
<             var updatePayload = ReactNativeAttributePayload_1.create(nativeProps, viewConfig.validAttributes);
<             null != updatePayload && UIManager.updateView(maybeInstance._nativeTag, viewConfig.uiViewClassName, updatePayload);
<         }
<     }
<     function setNativePropsStack$1(componentOrHandle, nativeProps) {
<         var maybeInstance = findNodeHandle_1(componentOrHandle);
<         if (null != maybeInstance) {
<             var viewConfig = void 0;
<             if (void 0 !== maybeInstance.viewConfig) viewConfig = maybeInstance.viewConfig; else if (void 0 !== maybeInstance._instance && void 0 !== maybeInstance._instance.viewConfig) viewConfig = maybeInstance._instance.viewConfig; else {
<                 for (;void 0 !== maybeInstance._renderedComponent; ) maybeInstance = maybeInstance._renderedComponent;
<                 viewConfig = maybeInstance.viewConfig;
<             }
<             var tag = "function" == typeof maybeInstance.getHostNode ? maybeInstance.getHostNode() : maybeInstance._rootNodeID;
<             warnForStyleProps$2(nativeProps, viewConfig.validAttributes);
<             var updatePayload = ReactNativeAttributePayload_1.create(nativeProps, viewConfig.validAttributes);
<             updatePayload && UIManager.updateView(tag, viewConfig.uiViewClassName, updatePayload);
<         }
<     }
<     var injectedSetNativeProps$1 = void 0;
<     injectedSetNativeProps$1 = ReactNativeFeatureFlags$2.useFiber ? setNativePropsFiber$1 : setNativePropsStack$1;
<     var NativeMethodsMixin_DEV = NativeMethodsMixin;
---
>     }, NativeMethodsMixin_DEV = NativeMethodsMixin;
4037c3994
<     }, TouchHistoryMath_1 = TouchHistoryMath, createReactNativeComponentClassFiber = function(viewConfig) {
---
>     }, TouchHistoryMath_1 = TouchHistoryMath, createReactNativeComponentClass = function(viewConfig) {
4039c3996
<     }, createReactNativeComponentClassFiber_1 = createReactNativeComponentClassFiber, ReactNativeFeatureFlags$3 = require("ReactNativeFeatureFlags"), createReactNativeComponentClass = ReactNativeFeatureFlags$3.useFiber ? createReactNativeComponentClassFiber_1 : DevOnlyStubShim, ReactNativeFeatureFlags$4 = require("ReactNativeFeatureFlags"), findNumericNodeHandle$2 = ReactNativeFeatureFlags$4.useFiber ? findNumericNodeHandleFiber : DevOnlyStubShim;
---
>     }, createReactNativeComponentClass_1 = createReactNativeComponentClass;
4041c3998
<         return "number" != typeof view && "window" !== view && (view = findNumericNodeHandle$2(view) || "window"), 
---
>         return "number" != typeof view && "window" !== view && (view = findNumericNodeHandle(view) || "window"), 
4473c4430
<         findNodeHandle: findNumericNodeHandleFiber,
---
>         findNodeHandle: findNumericNodeHandle,
4500c4457
<             createReactNativeComponentClass: createReactNativeComponentClass,
---
>             createReactNativeComponentClass: createReactNativeComponentClass_1,

ReactNativeFiber-prod.js

287c287
<     var tag = "number" != typeof inst.tag ? inst._rootNodeID : inst.stateNode._nativeTag;
---
>     var tag = inst.stateNode._nativeTag;
2906,2910c2906
< }, ReactVersion = "16.0.0-beta.5", ReactNativeFeatureFlags = require("ReactNativeFeatureFlags"), injectedFindNode = ReactNativeFeatureFlags.useFiber ? function(fiber) {
<     return ReactNativeFiberRenderer.findHostInstance(fiber);
< } : function(instance) {
<     return instance;
< };
---
> }, ReactVersion = "16.0.0-beta.5";
2916c2912
<     return internalInstance ? injectedFindNode(internalInstance) : component || (invariant("object" == typeof component && ("_rootNodeID" in component || "_nativeTag" in component) || null != component.render && "function" == typeof component.render, "findNodeHandle(...): Argument is not a component " + "(type: %s, keys: %s)", typeof component, Object.keys(component)), 
---
>     return internalInstance ? ReactNativeFiberRenderer.findHostInstance(internalInstance) : component || (invariant("object" == typeof component && "_nativeTag" in component || null != component.render && "function" == typeof component.render, "findNodeHandle(...): Argument is not a component " + "(type: %s, keys: %s)", typeof component, Object.keys(component)), 
2920c2916
< var findNodeHandle_1 = findNodeHandle, findNumericNodeHandleFiber = function(componentOrHandle) {
---
> var findNodeHandle_1 = findNodeHandle, findNumericNodeHandle = function(componentOrHandle) {
3316c3312
<             var tag = "number" != typeof to.tag ? to._rootNodeID : to.stateNode._nativeTag;
---
>             var tag = to.stateNode._nativeTag;
3574,3575d3569
< var DevOnlyStubShim = null;
< 
3597c3591
< var ReactNativeFeatureFlags$1 = require("ReactNativeFeatureFlags"), mountSafeCallback$2 = NativeMethodsMixinUtils.mountSafeCallback, findNumericNodeHandle = ReactNativeFeatureFlags$1.useFiber ? findNumericNodeHandleFiber : DevOnlyStubShim, ReactNativeComponent = function(_React$Component) {
---
> var mountSafeCallback$2 = NativeMethodsMixinUtils.mountSafeCallback, ReactNativeComponent = function(_React$Component) {
3613,3634c3607,3613
<         injectedSetNativeProps(this, nativeProps);
<     }, ReactNativeComponent;
< }(react.Component);
< 
< function setNativePropsFiber(componentOrHandle, nativeProps) {
<     var maybeInstance = void 0;
<     try {
<         maybeInstance = findNodeHandle_1(componentOrHandle);
<     } catch (error) {}
<     if (null != maybeInstance) {
<         var viewConfig = maybeInstance.viewConfig, updatePayload = ReactNativeAttributePayload_1.create(nativeProps, viewConfig.validAttributes);
<         null != updatePayload && UIManager.updateView(maybeInstance._nativeTag, viewConfig.uiViewClassName, updatePayload);
<     }
< }
< 
< function setNativePropsStack(componentOrHandle, nativeProps) {
<     var maybeInstance = findNodeHandle_1(componentOrHandle);
<     if (null != maybeInstance) {
<         var viewConfig = void 0;
<         if (void 0 !== maybeInstance.viewConfig) viewConfig = maybeInstance.viewConfig; else if (void 0 !== maybeInstance._instance && void 0 !== maybeInstance._instance.viewConfig) viewConfig = maybeInstance._instance.viewConfig; else {
<             for (;void 0 !== maybeInstance._renderedComponent; ) maybeInstance = maybeInstance._renderedComponent;
<             viewConfig = maybeInstance.viewConfig;
---
>         var maybeInstance = void 0;
>         try {
>             maybeInstance = findNodeHandle_1(this);
>         } catch (error) {}
>         if (null != maybeInstance) {
>             var viewConfig = maybeInstance.viewConfig, updatePayload = ReactNativeAttributePayload_1.create(nativeProps, viewConfig.validAttributes);
>             null != updatePayload && UIManager.updateView(maybeInstance._nativeTag, viewConfig.uiViewClassName, updatePayload);
3636,3645c3615,3616
<         var tag = "function" == typeof maybeInstance.getHostNode ? maybeInstance.getHostNode() : maybeInstance._rootNodeID, updatePayload = ReactNativeAttributePayload_1.create(nativeProps, viewConfig.validAttributes);
<         null != updatePayload && UIManager.updateView(tag, viewConfig.uiViewClassName, updatePayload);
<     }
< }
< 
< var injectedSetNativeProps = void 0;
< 
< injectedSetNativeProps = ReactNativeFeatureFlags$1.useFiber ? setNativePropsFiber : setNativePropsStack;
< 
< var ReactNativeComponent_1 = ReactNativeComponent, ReactNativeFeatureFlags$2 = require("ReactNativeFeatureFlags"), mountSafeCallback$3 = NativeMethodsMixinUtils.mountSafeCallback, findNumericNodeHandle$1 = ReactNativeFeatureFlags$2.useFiber ? findNumericNodeHandleFiber : DevOnlyStubShim, NativeMethodsMixin = {
---
>     }, ReactNativeComponent;
> }(react.Component), ReactNativeComponent_1 = ReactNativeComponent, mountSafeCallback$3 = NativeMethodsMixinUtils.mountSafeCallback, NativeMethodsMixin = {
3647c3618
<         UIManager.measure(findNumericNodeHandle$1(this), mountSafeCallback$3(this, callback));
---
>         UIManager.measure(findNumericNodeHandle(this), mountSafeCallback$3(this, callback));
3650c3621
<         UIManager.measureInWindow(findNumericNodeHandle$1(this), mountSafeCallback$3(this, callback));
---
>         UIManager.measureInWindow(findNumericNodeHandle(this), mountSafeCallback$3(this, callback));
3653c3624
<         UIManager.measureLayout(findNumericNodeHandle$1(this), relativeToNativeNode, mountSafeCallback$3(this, onFail), mountSafeCallback$3(this, onSuccess));
---
>         UIManager.measureLayout(findNumericNodeHandle(this), relativeToNativeNode, mountSafeCallback$3(this, onFail), mountSafeCallback$3(this, onSuccess));
3656c3627,3634
<         injectedSetNativeProps$1(this, nativeProps);
---
>         var maybeInstance = void 0;
>         try {
>             maybeInstance = findNodeHandle_1(this);
>         } catch (error) {}
>         if (null != maybeInstance) {
>             var viewConfig = maybeInstance.viewConfig, updatePayload = ReactNativeAttributePayload_1.create(nativeProps, viewConfig.validAttributes);
>             null != updatePayload && UIManager.updateView(maybeInstance._nativeTag, viewConfig.uiViewClassName, updatePayload);
>         }
3659c3637
<         TextInputState.focusTextInput(findNumericNodeHandle$1(this));
---
>         TextInputState.focusTextInput(findNumericNodeHandle(this));
3662,3686c3640
<         TextInputState.blurTextInput(findNumericNodeHandle$1(this));
<     }
< };
< 
< function setNativePropsFiber$1(componentOrHandle, nativeProps) {
<     var maybeInstance = void 0;
<     try {
<         maybeInstance = findNodeHandle_1(componentOrHandle);
<     } catch (error) {}
<     if (null != maybeInstance) {
<         var viewConfig = maybeInstance.viewConfig, updatePayload = ReactNativeAttributePayload_1.create(nativeProps, viewConfig.validAttributes);
<         null != updatePayload && UIManager.updateView(maybeInstance._nativeTag, viewConfig.uiViewClassName, updatePayload);
<     }
< }
< 
< function setNativePropsStack$1(componentOrHandle, nativeProps) {
<     var maybeInstance = findNodeHandle_1(componentOrHandle);
<     if (null != maybeInstance) {
<         var viewConfig = void 0;
<         if (void 0 !== maybeInstance.viewConfig) viewConfig = maybeInstance.viewConfig; else if (void 0 !== maybeInstance._instance && void 0 !== maybeInstance._instance.viewConfig) viewConfig = maybeInstance._instance.viewConfig; else {
<             for (;void 0 !== maybeInstance._renderedComponent; ) maybeInstance = maybeInstance._renderedComponent;
<             viewConfig = maybeInstance.viewConfig;
<         }
<         var tag = "function" == typeof maybeInstance.getHostNode ? maybeInstance.getHostNode() : maybeInstance._rootNodeID, updatePayload = ReactNativeAttributePayload_1.create(nativeProps, viewConfig.validAttributes);
<         updatePayload && UIManager.updateView(tag, viewConfig.uiViewClassName, updatePayload);
---
>         TextInputState.blurTextInput(findNumericNodeHandle(this));
3688,3694c3642
< }
< 
< var injectedSetNativeProps$1 = void 0;
< 
< injectedSetNativeProps$1 = ReactNativeFeatureFlags$2.useFiber ? setNativePropsFiber$1 : setNativePropsStack$1;
< 
< var NativeMethodsMixin_1 = NativeMethodsMixin, TouchHistoryMath = {
---
> }, NativeMethodsMixin_1 = NativeMethodsMixin, TouchHistoryMath = {
3727c3675
< }, TouchHistoryMath_1 = TouchHistoryMath, createReactNativeComponentClassFiber = function(viewConfig) {
---
> }, TouchHistoryMath_1 = TouchHistoryMath, createReactNativeComponentClass = function(viewConfig) {
3729c3677
< }, createReactNativeComponentClassFiber_1 = createReactNativeComponentClassFiber, ReactNativeFeatureFlags$3 = require("ReactNativeFeatureFlags"), createReactNativeComponentClass = ReactNativeFeatureFlags$3.useFiber ? createReactNativeComponentClassFiber_1 : DevOnlyStubShim, ReactNativeFeatureFlags$4 = require("ReactNativeFeatureFlags"), findNumericNodeHandle$2 = ReactNativeFeatureFlags$4.useFiber ? findNumericNodeHandleFiber : DevOnlyStubShim;
---
> }, createReactNativeComponentClass_1 = createReactNativeComponentClass;
3732c3680
<     return "number" != typeof view && "window" !== view && (view = findNumericNodeHandle$2(view) || "window"), 
---
>     return "number" != typeof view && "window" !== view && (view = findNumericNodeHandle(view) || "window"), 
3746c3694
<     findNodeHandle: findNumericNodeHandleFiber,
---
>     findNodeHandle: findNumericNodeHandle,
3773c3721
<         createReactNativeComponentClass: createReactNativeComponentClass,
---
>         createReactNativeComponentClass: createReactNativeComponentClass_1,

@sophiebits sophiebits left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#m firelike

@@ -1,201 +0,0 @@
/**

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was this test deleted intentionally? It looks valuable to me and tests public API.

@gaearon

gaearon commented Aug 23, 2017

Copy link
Copy Markdown
Collaborator

I just went ahead and assumed removing this test wasn't intentional because it's new.
So I added it back and removed Stack-only hack from it.
This should also fix CI.

@bvaughn

bvaughn commented Aug 23, 2017

Copy link
Copy Markdown
Contributor Author

Thanks Dan!

@bvaughn

bvaughn commented Aug 23, 2017

Copy link
Copy Markdown
Contributor Author

I prefer to wait for @sebmarkbage to sign off on this PR since he expressed mild reservations about deleting code before 16.

delete-all-images

@sebmarkbage

Copy link
Copy Markdown
Contributor

lgtm

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants