Repository: NativeScript/NativeScript
File: packages/core/ui/core/view/index.ios.ts (TypeScript)

Code before:
	 *  - `invalid` - the view background must be redrawn on the next layot.
	 *  - `drawn` - the view background has been property drawn, on subsequent layouts it may need to be redrawn if the background depends on the view's size.
	 */
	_nativeBackgroundState: 'unset' | 'invalid' | 'drawn';

	get isLayoutRequired(): boolean {
		return (this._privateFlags & PFLAG_LAYOUT_REQUIRED) === PFLAG_LAYOUT_REQUIRED;
	}

	get isLayoutRequested(): boolean {
		return (this._privateFlags & PFLAG_FORCE_LAYOUT) === PFLAG_FORCE_LAYOUT;
	}

	requestlayoutIfNeeded() {
		if ( this.isLayoutRequired) {
			this._requetLayoutNeeded = false;
			this.requestLayout();
		}
	}

	public requestLayout(): void {
		if (this._suspendRequestLayout) {
			this._requetLayoutNeeded = true;
			return;
		}
		this._requetLayoutNeeded = false;
		this._privateFlags |= PFLAG_FORCE_LAYOUT;
		super.requestLayout();

		const nativeView = this.nativeViewProtected;
		if (nativeView && nativeView.setNeedsLayout) {
			nativeView.setNeedsLayout();
		}

		if (this.viewController && this.viewController.view !== nativeView) {
			this.viewController.view.setNeedsLayout();
		}
	}

	public measure(widthMeasureSpec: number, heightMeasureSpec: number): void {
		const measureSpecsChanged = this._setCurrentMeasureSpecs(widthMeasureSpec, heightMeasureSpec);
		const forceLayout = (this._privateFlags & PFLAG_FORCE_LAYOUT) === PFLAG_FORCE_LAYOUT;
		if (forceLayout || measureSpecsChanged) {
			// first clears the measured dimension flag
			this._privateFlags &= ~PFLAG_MEASURED_DIMENSION_SET;

			// measure ourselves, this should set the measured dimension flag back
			this.onMeasure(widthMeasureSpec, heightMeasureSpec);
			this._privateFlags |= PFLAG_LAYOUT_REQUIRED;

			// flag not set, setMeasuredDimension() was not invoked, we raise

Review comment (suggestion):
```suggestion
		this._requestLayoutNeeded = false;
```

Code after:
	/**
	 * Native background states.
	 *  - `unset` - is the default, from this state it transitions to "invalid" in the base backgroundInternalProperty.setNative, overriding it without calling `super` will prevent the background from ever being drawn.
	 *  - `invalid` - the view background must be redrawn on the next layot.
	 *  - `drawn` - the view background has been property drawn, on subsequent layouts it may need to be redrawn if the background depends on the view's size.
	 */
	_nativeBackgroundState: 'unset' | 'invalid' | 'drawn';

	get isLayoutRequired(): boolean {
		return (this._privateFlags & PFLAG_LAYOUT_REQUIRED) === PFLAG_LAYOUT_REQUIRED;
	}

	get isLayoutRequested(): boolean {
		return (this._privateFlags & PFLAG_FORCE_LAYOUT) === PFLAG_FORCE_LAYOUT;
	}

	constructor() {
		super();

		this.once(View.loadedEvent, () => setupAccessibleView(this));
	}

	requestLayoutIfNeeded() {
		if (this.isLayoutRequired) {
			this._requestLayoutNeeded = false;
			this.requestLayout();
		}
	}

	public requestLayout(): void {
		if (this._suspendRequestLayout) {
			this._requestLayoutNeeded = true;
			return;
		}
		this._requestLayoutNeeded = false;
		this._privateFlags |= PFLAG_FORCE_LAYOUT;
		super.requestLayout();

		const nativeView = this.nativeViewProtected;
		if (nativeView && nativeView.setNeedsLayout) {
			nativeView.setNeedsLayout();
		}

		if (this.viewController && this.viewController.view !== nativeView) {
			this.viewController.view.setNeedsLayout();
		}
	}

	public measure(widthMeasureSpec: number, heightMeasureSpec: number): void {
		const measureSpecsChanged = this._setCurrentMeasureSpecs(widthMeasureSpec, heightMeasureSpec);
		const forceLayout = (this._privateFlags & PFLAG_FORCE_LAYOUT) === PFLAG_FORCE_LAYOUT;