From c88cef08cb7e7185acfcf23c740cc3e3e9696844 Mon Sep 17 00:00:00 2001 From: Ibad Ahmed Date: Tue, 11 Nov 2025 12:38:24 +0500 Subject: [PATCH 1/4] Fix IMA ad container not resizing on orientation change (iOS) --- ios/Video/Features/RCTIMAAdsManager.swift | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/ios/Video/Features/RCTIMAAdsManager.swift b/ios/Video/Features/RCTIMAAdsManager.swift index cf7a56f84f..e9985243a2 100644 --- a/ios/Video/Features/RCTIMAAdsManager.swift +++ b/ios/Video/Features/RCTIMAAdsManager.swift @@ -34,6 +34,15 @@ let adContainerView = UIView(frame: _video.bounds) adContainerView.backgroundColor = .clear _video.addSubview(adContainerView) + + // added layout resize according to subview of video + adContainerView.translatesAutoresizingMaskIntoConstraints = false + NSLayoutConstraint.activate([ + adContainerView.topAnchor.constraint(equalTo: _video.topAnchor), + adContainerView.bottomAnchor.constraint(equalTo: _video.bottomAnchor), + adContainerView.leadingAnchor.constraint(equalTo: _video.leadingAnchor), + adContainerView.trailingAnchor.constraint(equalTo: _video.trailingAnchor) + ]) // Create ad display container for ad rendering. let adDisplayContainer = IMAAdDisplayContainer(adContainer: adContainerView, viewController: _video.reactViewController()) From b8bcf68ee733a72b276b14146c196e1811de26f3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kamil=20Moska=C5=82a?= <91079590+moskalakamil@users.noreply.github.com> Date: Wed, 19 Nov 2025 18:15:05 +0100 Subject: [PATCH 2/4] refactor: lint --- ios/Video/Features/RCTIMAAdsManager.swift | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ios/Video/Features/RCTIMAAdsManager.swift b/ios/Video/Features/RCTIMAAdsManager.swift index e9985243a2..920ab456f3 100644 --- a/ios/Video/Features/RCTIMAAdsManager.swift +++ b/ios/Video/Features/RCTIMAAdsManager.swift @@ -34,14 +34,14 @@ let adContainerView = UIView(frame: _video.bounds) adContainerView.backgroundColor = .clear _video.addSubview(adContainerView) - + // added layout resize according to subview of video adContainerView.translatesAutoresizingMaskIntoConstraints = false NSLayoutConstraint.activate([ adContainerView.topAnchor.constraint(equalTo: _video.topAnchor), adContainerView.bottomAnchor.constraint(equalTo: _video.bottomAnchor), adContainerView.leadingAnchor.constraint(equalTo: _video.leadingAnchor), - adContainerView.trailingAnchor.constraint(equalTo: _video.trailingAnchor) + adContainerView.trailingAnchor.constraint(equalTo: _video.trailingAnchor), ]) // Create ad display container for ad rendering. From 97b3d0a12515ba248bfe78f8ed2df0369f17926a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kamil=20Moska=C5=82a?= <91079590+moskalakamil@users.noreply.github.com> Date: Wed, 19 Nov 2025 18:17:42 +0100 Subject: [PATCH 3/4] chore: change comment text Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- ios/Video/Features/RCTIMAAdsManager.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ios/Video/Features/RCTIMAAdsManager.swift b/ios/Video/Features/RCTIMAAdsManager.swift index 920ab456f3..934cf5141b 100644 --- a/ios/Video/Features/RCTIMAAdsManager.swift +++ b/ios/Video/Features/RCTIMAAdsManager.swift @@ -35,7 +35,7 @@ adContainerView.backgroundColor = .clear _video.addSubview(adContainerView) - // added layout resize according to subview of video + // Enable Auto Layout to ensure the ad container resizes with the video view. adContainerView.translatesAutoresizingMaskIntoConstraints = false NSLayoutConstraint.activate([ adContainerView.topAnchor.constraint(equalTo: _video.topAnchor), From e3c15f9c1367bcf7759e2e7b458e01adf04ee9e6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kamil=20Moska=C5=82a?= <91079590+moskalakamil@users.noreply.github.com> Date: Wed, 19 Nov 2025 18:23:34 +0100 Subject: [PATCH 4/4] refactor: remove redundant frame initialization --- ios/Video/Features/RCTIMAAdsManager.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ios/Video/Features/RCTIMAAdsManager.swift b/ios/Video/Features/RCTIMAAdsManager.swift index 934cf5141b..4840ab2dbe 100644 --- a/ios/Video/Features/RCTIMAAdsManager.swift +++ b/ios/Video/Features/RCTIMAAdsManager.swift @@ -31,7 +31,7 @@ func requestAds() { guard let _video else { return } // fixes RCTVideo --> RCTIMAAdsManager --> IMAAdsLoader --> IMAAdDisplayContainer --> RCTVideo memory leak. - let adContainerView = UIView(frame: _video.bounds) + let adContainerView = UIView() adContainerView.backgroundColor = .clear _video.addSubview(adContainerView)