Skip to content
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

View.measure throws error due to difference in _privateFlags handling from JavaScriptCore ios-runtime #43

Closed
NathanWalker opened this issue May 3, 2020 · 0 comments
Assignees
Labels
bug Something isn't working

Comments

@NathanWalker
Copy link
Contributor

NathanWalker commented May 3, 2020

From core modules view.ios.js:

View.prototype.measure = function (widthMeasureSpec, heightMeasureSpec) {
        var measureSpecsChanged = this._setCurrentMeasureSpecs(widthMeasureSpec, heightMeasureSpec);
        var forceLayout = (this._privateFlags & PFLAG_FORCE_LAYOUT) === PFLAG_FORCE_LAYOUT;
        if (forceLayout || measureSpecsChanged) {
            this._privateFlags &= ~PFLAG_MEASURED_DIMENSION_SET;
            this.onMeasure(widthMeasureSpec, heightMeasureSpec);
            this._privateFlags |= PFLAG_LAYOUT_REQUIRED;
            if ((this._privateFlags & PFLAG_MEASURED_DIMENSION_SET) !== PFLAG_MEASURED_DIMENSION_SET) {
                throw new Error("onMeasure() did not set the measured dimension by calling setMeasuredDimension() " + this);
            }
        }
    };

The throw new Error will occur with latest v8 runtime whereas with JSC runtime never occurs. I suspect this has something to do with _privateFlags handling? Perhaps JSC runtime is assisting with something here which is not yet present in v8 runtime?

Repro: I will demonstrate in a project (not sure exactly what conditions give rise to it) but can say that with JSC runtime the throw never occurs under same circumstances.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants