Skip to content

Commit f338a61

Browse files
authored
Release 25.4.2 (#733)
* Fix UIViewControllerHierarchyInconsistency crash * Release 25.4.2
1 parent f58efe4 commit f338a61

File tree

4 files changed

+30
-15
lines changed

4 files changed

+30
-15
lines changed

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
# React Native Module 25.0.0 Changelog
22

3+
## Version 25.4.2 - April 10, 2026
4+
5+
Patch release that fixes a `UIViewControllerHierarchyInconsistency` crash in the Airship embedded view wrapper on iOS when an embedded view is pushed and popped on a navigation stack.
6+
7+
### Changes
8+
- Fixed iOS embedded view wrapper to properly remove its hosted `UIHostingController` as a child view controller when its window is detached, avoiding a `UIViewControllerHierarchyInconsistency` crash on re-attachment.
9+
310
## Version 25.4.1 - March 26, 2026
411

512
Patch release that fixes an Xcode 26.4 Swift compiler crash affecting iOS builds.

ios/AirshipEmbeddedViewWrapper.swift

Lines changed: 21 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,20 @@ public final class AirshipEmbeddedViewWrapper: UIView {
3939

4040
public override func didMoveToWindow() {
4141
super.didMoveToWindow()
42-
guard !self.isAdded else { return }
43-
self.viewController.willMove(toParent: self.parentViewController())
44-
self.parentViewController().addChild(self.viewController)
45-
self.viewController.didMove(toParent: self.parentViewController())
42+
43+
if self.window == nil {
44+
if self.isAdded {
45+
self.viewController.willMove(toParent: nil)
46+
self.viewController.removeFromParent()
47+
self.isAdded = false
48+
}
49+
return
50+
}
51+
52+
guard !self.isAdded, let parentVC = self.parentViewController() else { return }
53+
self.viewController.willMove(toParent: parentVC)
54+
parentVC.addChild(self.viewController)
55+
self.viewController.didMove(toParent: parentVC)
4656
self.viewController.view.isUserInteractionEnabled = true
4757
isAdded = true
4858
}
@@ -53,18 +63,16 @@ public final class AirshipEmbeddedViewWrapper: UIView {
5363
}
5464
}
5565

56-
extension UIView
57-
{
58-
//Get Parent View Controller from any view
59-
func parentViewController() -> UIViewController {
66+
extension UIView {
67+
func parentViewController() -> UIViewController? {
6068
var responder: UIResponder? = self
61-
while !(responder is UIViewController) {
62-
responder = responder?.next
63-
if nil == responder {
64-
break
69+
while let r = responder {
70+
if let vc = r as? UIViewController {
71+
return vc
6572
}
73+
responder = r.next
6674
}
67-
return (responder as? UIViewController)!
75+
return nil
6876
}
6977
}
7078

ios/AirshipReactNative.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ public class AirshipReactNative: NSObject {
3939
AirshipProxy.shared
4040
}
4141

42-
public static let version: String = "25.4.0"
42+
public static let version: String = "25.4.2"
4343

4444
private let eventNotifier = EventNotifier()
4545

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@ua/react-native-airship",
3-
"version": "25.4.1",
3+
"version": "25.4.2",
44
"description": "Airship plugin for React Native apps.",
55
"source": "./src/index.tsx",
66
"main": "./lib/module/index.js",

0 commit comments

Comments
 (0)