-
Notifications
You must be signed in to change notification settings - Fork 47.3k
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
Delete ReactNativeStack 🎉 🎉 🎉 #10511
Conversation
…ativeComponentClassFiber => createReactNativeComponentClass
…iber => findNumericNodeHandle
…ably remove 'fiber' references later
Excited about this! I feel like someone from the RN team should +1 it but I'll review it as much as I can. |
cc @sebmarkbage flat bundle diff ReactNativeFiber-dev.js287c287
< 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.js287c287
< 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, |
There was a problem hiding this comment.
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 @@ | |||
/** |
There was a problem hiding this comment.
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.
I just went ahead and assumed removing this test wasn't intentional because it's new. |
Thanks Dan! |
I prefer to wait for @sebmarkbage to sign off on this PR since he expressed mild reservations about deleting code before 16. |
lgtm |
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. ¯\_(ツ)_/¯