react-native-theoplayer 8.13.0 → 8.13.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
5
5
  The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.1.0/)
6
6
  and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [8.13.1] - 25-01-27
9
+
10
+ ### Fixed
11
+
12
+ - Fixed an issue on iOS where fullscreen-inline transitions would cause a UIViewControllerHierarchyInconsistency when the current view's viewcController has sibling viewControllers that manage views that don't descend of the moving view.
13
+
8
14
  ## [8.13.0] - 25-01-15
9
15
 
10
16
  ### Added
@@ -11,7 +11,6 @@ public class THEOplayerRCTPresentationModeManager {
11
11
  var presentationModeContext = THEOplayerRCTPresentationModeContext()
12
12
  private var presentationMode: THEOplayerSDK.PresentationMode = .inline
13
13
  private var rnInlineMode: THEOplayerSDK.PresentationMode = .inline // while native player is inline, RN player can be inline or fullsceen
14
- private var movingChildVCs: [UIViewController] = [] // list of playerView's child VCs that need to be reparented while moving the playerView
15
14
 
16
15
 
17
16
  private weak var containerView: UIView? // view containing the playerView and it's siblings (e.g. UI)
@@ -27,7 +26,6 @@ public class THEOplayerRCTPresentationModeManager {
27
26
  func destroy() {
28
27
  // dettach listeners
29
28
  self.dettachListeners()
30
- self.clearMovingVCs()
31
29
  }
32
30
 
33
31
  // MARK: - player setup / breakdown
@@ -40,21 +38,22 @@ public class THEOplayerRCTPresentationModeManager {
40
38
  }
41
39
 
42
40
  // MARK: - logic
43
- private func storeMovingVCs(for view: UIView) {
41
+ private func movingVCs(for view: UIView) -> [UIViewController] {
42
+ var viewControllers: [UIViewController] = []
44
43
  if let viewController = view.findViewController() {
45
44
  viewController.children.forEach { childVC in
46
- self.movingChildVCs.append(childVC)
45
+ if childVC.view.isDescendant(of: view) {
46
+ viewControllers.append(childVC)
47
+ }
47
48
  }
48
49
  }
49
- }
50
-
51
- private func clearMovingVCs() {
52
- self.movingChildVCs = []
50
+ return viewControllers
53
51
  }
54
52
 
55
53
  private func moveView(_ movingView: UIView, to targetView: UIView) {
56
54
  // detach the moving viewControllers from their parent
57
- self.movingChildVCs.forEach { movedVC in
55
+ let movingViewControllers = self.movingVCs(for: movingView)
56
+ movingViewControllers.forEach { movedVC in
58
57
  movedVC.removeFromParent()
59
58
  }
60
59
 
@@ -65,7 +64,7 @@ public class THEOplayerRCTPresentationModeManager {
65
64
 
66
65
  // attach the moving viewControllers to their new parent
67
66
  if let targetViewController = targetView.findViewController() {
68
- self.movingChildVCs.forEach { movedVC in
67
+ movingViewControllers.forEach { movedVC in
69
68
  targetViewController.addChild(movedVC)
70
69
  movedVC.didMove(toParent: targetViewController)
71
70
  }
@@ -73,13 +72,12 @@ public class THEOplayerRCTPresentationModeManager {
73
72
  }
74
73
 
75
74
  private func enterFullscreen() {
76
- self.containerView = self.view?.findParentViewOfType(RCTView.self)
77
- self.inlineParentView = self.containerView?.findParentViewOfType(RCTView.self)
75
+ self.containerView = self.view?.findParentViewOfType(["RCTView", "RCTViewComponentView"])
76
+ self.inlineParentView = self.containerView?.superview
78
77
 
79
78
  // move the player
80
79
  if let containerView = self.containerView,
81
- let fullscreenParentView = self.view?.findParentViewOfType(RCTRootContentView.self) {
82
- self.storeMovingVCs(for: containerView)
80
+ let fullscreenParentView = self.view?.findParentViewOfType(["RCTRootContentView", "RCTRootComponentView"]) {
83
81
  self.moveView(containerView, to: fullscreenParentView)
84
82
 
85
83
  // start hiding home indicator
@@ -96,14 +94,13 @@ public class THEOplayerRCTPresentationModeManager {
96
94
  if let containerView = self.containerView,
97
95
  let inlineParentView = self.inlineParentView {
98
96
  self.moveView(containerView, to: inlineParentView)
99
- self.clearMovingVCs()
100
97
  }
101
98
  self.rnInlineMode = .inline
102
99
  }
103
100
 
104
101
  private func setHomeIndicatorHidden(_ hidden: Bool) {
105
102
  #if os(iOS)
106
- if let fullscreenParentView = self.view?.findParentViewOfType(RCTRootContentView.self),
103
+ if let fullscreenParentView = self.view?.findParentViewOfType(["RCTRootContentView", "RCTRootComponentView"]),
107
104
  let customRootViewController = fullscreenParentView.findViewController() as? HomeIndicatorViewController {
108
105
  customRootViewController.prefersAutoHidden = hidden
109
106
  customRootViewController.setNeedsUpdateOfHomeIndicatorAutoHidden()
@@ -216,11 +213,14 @@ public class THEOplayerRCTPresentationModeManager {
216
213
 
217
214
  // UIView extension to look for parent views
218
215
  extension UIView {
219
- func findParentViewOfType<T: UIView>(_ viewType: T.Type) -> T? {
216
+ func findParentViewOfType(_ viewTypeNames: [String]) -> UIView? {
220
217
  var currentView: UIView? = self
221
218
  while let view = currentView {
222
- if let parentView = view.superview as? T {
223
- return parentView
219
+ if let parentView = view.superview {
220
+ let instanceTypeName = String(describing: type(of: parentView))
221
+ if viewTypeNames.contains(instanceTypeName) {
222
+ return parentView
223
+ }
224
224
  }
225
225
  currentView = view.superview
226
226
  }
@@ -1 +1 @@
1
- {"version":"8.13.0","buildDate":"2025-01-15T19:38:29.644Z"}
1
+ {"version":"8.13.1","buildDate":"2025-01-27T12:46:49.795Z"}
@@ -1 +1 @@
1
- {"version":"8.13.0","buildDate":"2025-01-15T19:38:29.644Z"}
1
+ {"version":"8.13.1","buildDate":"2025-01-27T12:46:49.795Z"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-theoplayer",
3
- "version": "8.13.0",
3
+ "version": "8.13.1",
4
4
  "description": "A THEOplayer video component for react-native.",
5
5
  "main": "lib/commonjs/index",
6
6
  "module": "lib/module/index",
package/src/manifest.json CHANGED
@@ -1 +1 @@
1
- {"version":"8.13.0","buildDate":"2025-01-15T19:38:29.644Z"}
1
+ {"version":"8.13.1","buildDate":"2025-01-27T12:46:49.795Z"}