Skip to content

[PW-149] Fix PaywallView landscape issue#1631

Merged
facumenzella merged 8 commits into
mainfrom
facundo/pw-149-flutter-paywallview-fails-in-landscape-with
Mar 20, 2026
Merged

[PW-149] Fix PaywallView landscape issue#1631
facumenzella merged 8 commits into
mainfrom
facundo/pw-149-flutter-paywallview-fails-in-landscape-with

Conversation

@facumenzella

@facumenzella facumenzella commented Feb 12, 2026

Copy link
Copy Markdown
Member

Summary

Fixes PaywallView rendering/hosting behavior in horizontal (landscape) mode on iOS.

FlutterSemanticsScrollView implements focusItemsInRect: - caching for linear focus movement is limited as long as this view is on screen. is expected iOS accessibility logging and is not the root cause.

Changes

  • Replaced the custom PaywallViewWrapper usage with ViewControllerWrapper<PaywallViewController> in PurchasesUiPaywallView
  • Updated ViewControllerWrapper to support configurable constraints:
    • default remains safe-area constrained
    • PaywallView now opts into edge-to-edge constraints (usesSafeAreaLayoutGuide: false) for proper landscape layout
  • Hardened wrapper attachment lifecycle by attempting attach on:
    • layoutSubviews
    • didMoveToSuperview
    • didMoveToWindow
  • Kept proper child view-controller cleanup on removal/deinit

Why

In landscape, safe-area anchoring for embedded PaywallView can create poor horizontal presentation and may miss expected full-container layout. This change makes PaywallView fill its container while preserving safe-area behavior for other wrappers by default.

Test plan

  • PaywallView renders correctly in portrait on iOS
  • PaywallView renders correctly in landscape on iOS
  • Rotate device while PaywallView is visible and verify layout remains correct
  • Confirm the FlutterSemanticsScrollView ... focusItemsInRect log may still appear and is non-fatal

Related Issues

  • Fixes PW-149
  • Related to PW-148 (presentPaywall landscape work)

Note

Medium Risk
Medium risk because it changes iOS paywall presentation options and the UIKit child-view-controller attachment/constraint logic, which can affect layout and view controller lifecycle across devices/orientations.

Overview
Fixes iOS paywall landscape layout issues by switching PaywallView to use the shared ViewControllerWrapper with edge-to-edge constraints (opting out of safe-area anchoring for this specific embed).

Enhances ViewControllerWrapper with a usesSafeAreaLayoutGuide option (defaulting to safe-area) and hardens attachment/cleanup by attempting attachment in layoutSubviews, didMoveToSuperview, and didMoveToWindow, plus guaranteed removal in removeFromSuperview/deinit.

Adjusts presentPaywall to use full-screen presentation on iPhone (leaving iPad behavior unchanged) to avoid side whitespace in landscape.

Written by Cursor Bugbot for commit aeeb84c. This will update automatically on new commits. Configure here.

Adds debug logging to PaywallViewWrapper to help diagnose why
PaywallView() shows nothing in landscape mode.

Changes:
- Initialize PaywallViewWrapper with .zero frame instead of
  paywallViewController.view.bounds (matches ViewControllerWrapper)
- Add debug prints for view hierarchy setup

The FlutterSemanticsScrollView warning mentioned in the issue is
NOT an exception - it's a standard iOS accessibility log message.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@facumenzella facumenzella marked this pull request as ready for review February 16, 2026 09:06
@facumenzella facumenzella requested a review from a team as a code owner February 16, 2026 09:06
@facumenzella

Copy link
Copy Markdown
Member Author

@tonidero just reworked and retested this. Now it works smoothly.

Simulator.Screen.Recording.-.iPhone.17.Pro.-.2026-02-27.at.11.21.10.mov

@tonidero tonidero left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think this makes sense, but would love @ajpallares and/or @rickvdl to take a look before approving 🙏

@ajpallares ajpallares left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think it makes sense! And nice cleanup too! With ViewControllerWrapper we certainly didn't need to have PaywallViewWrapper 👍

@facumenzella facumenzella enabled auto-merge (squash) March 20, 2026 06:50
@facumenzella facumenzella merged commit 58b59a9 into main Mar 20, 2026
14 checks passed
@facumenzella facumenzella deleted the facundo/pw-149-flutter-paywallview-fails-in-landscape-with branch March 20, 2026 06:58
facumenzella pushed a commit that referenced this pull request Mar 23, 2026
**This is an automatic release.**

## RevenueCat SDK
### 🐞 Bugfixes
* [PW-148] Add PaywallPresentationConfiguration for per-platform
presentation style (#1623) via Facundo Menzella (@facumenzella)
### 📦 Dependency Updates
* [AUTOMATIC BUMP] Updates purchases-hybrid-common to 17.53.0 (#1692)
via RevenueCat Git Bot (@RCGitBot)
* [Android
9.27.0](https://github.com/RevenueCat/purchases-android/releases/tag/9.27.0)
* [iOS
5.66.0](https://github.com/RevenueCat/purchases-ios/releases/tag/5.66.0)

## RevenueCatUI SDK
### 🐞 Bugfixes
* [PW-149] Fix PaywallView landscape issue (#1631) via Facundo Menzella
(@facumenzella)

### 🔄 Other Changes
* Bump json from 2.18.1 to 2.19.2 (#1691) via dependabot[bot]
(@dependabot[bot])

<!-- CURSOR_SUMMARY -->
---

> [!NOTE]
> **Low Risk**
> Primarily a versioned release bump across metadata/changelogs with no
functional code changes beyond updating reported plugin version strings
and dependency versions.
> 
> **Overview**
> Bumps the Flutter Purchases and Purchases UI plugins to **`9.15.1`**
across `pubspec.yaml`, Gradle, CocoaPods specs, and the runtime-reported
plugin version constants (Android/iOS/Web).
> 
> Updates release documentation (`CHANGELOG.md`, `CHANGELOG-LATEST.md`,
`VERSIONS.md`) to record the included bugfixes and dependency changes,
including `purchases-hybrid-common` **`17.53.0`** (Android `9.27.0`, iOS
`5.66.0`) and a `json` dependency bump.
> 
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
59eaab9. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
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.

3 participants