From 5c8d73a54503f45cfb1175e937889e84b7d50e52 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kamil=20Moska=C5=82a?= <91079590+moskalakamil@users.noreply.github.com> Date: Tue, 3 Feb 2026 00:09:08 +0100 Subject: [PATCH] fix(ios): handle fullscreen transition cancellation events (#4833) --- .../ios/view/VideoComponentViewObserver.swift | 22 +++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/packages/react-native-video/ios/view/VideoComponentViewObserver.swift b/packages/react-native-video/ios/view/VideoComponentViewObserver.swift index f3065fa2..25cc844e 100644 --- a/packages/react-native-video/ios/view/VideoComponentViewObserver.swift +++ b/packages/react-native-video/ios/view/VideoComponentViewObserver.swift @@ -123,9 +123,16 @@ class VideoComponentViewObserver: NSObject, AVPlayerViewControllerDelegate { willEndFullScreenPresentationWithAnimationCoordinator coordinator: UIViewControllerTransitionCoordinator ) { delegate?.willExitFullscreen() - - coordinator.animate(alongsideTransition: nil) { [weak self] _ in + + coordinator.animate(alongsideTransition: nil) { [weak self] context in guard let self = self else { return } + + if context.isCancelled { + self.delegate?.willEnterFullscreen() + + return + } + self.delegate?.onFullscreenChange(false) } } @@ -135,9 +142,16 @@ class VideoComponentViewObserver: NSObject, AVPlayerViewControllerDelegate { willBeginFullScreenPresentationWithAnimationCoordinator coordinator: UIViewControllerTransitionCoordinator ) { delegate?.willEnterFullscreen() - - coordinator.animate(alongsideTransition: nil) { [weak self] _ in + + coordinator.animate(alongsideTransition: nil) { [weak self] context in guard let self = self else { return } + + if context.isCancelled { + self.delegate?.willExitFullscreen() + + return + } + self.delegate?.onFullscreenChange(true) } }