diff --git a/ios/Video/RCTVideo.m b/ios/Video/RCTVideo.m index 4710afaa5a..fe319992bd 100644 --- a/ios/Video/RCTVideo.m +++ b/ios/Video/RCTVideo.m @@ -704,7 +704,27 @@ - (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(N if (!CGRectEqualToRect(oldRect, newRect)) { if (CGRectEqualToRect(newRect, [UIScreen mainScreen].bounds)) { NSLog(@"in fullscreen"); - } else NSLog(@"not fullscreen"); + if (!_fullscreenPlayerPresented && _controls) { + _fullscreenPlayerPresented = YES; + if(self.onVideoFullscreenPlayerWillPresent) { + self.onVideoFullscreenPlayerWillPresent(@{@"target": self.reactTag}); + } + if(self.onVideoFullscreenPlayerDidPresent) { + self.onVideoFullscreenPlayerDidPresent(@{@"target": self.reactTag}); + } + } + } else { + NSLog(@"not fullscreen"); + if (_fullscreenPlayerPresented && _controls) { + _fullscreenPlayerPresented = NO; + if(self.onVideoFullscreenPlayerWillDismiss) { + self.onVideoFullscreenPlayerWillDismiss(@{@"target": self.reactTag}); + } + if(self.onVideoFullscreenPlayerDidDismiss) { + self.onVideoFullscreenPlayerDidDismiss(@{@"target": self.reactTag}); + } + } + } [self.reactViewController.view setFrame:[UIScreen mainScreen].bounds]; [self.reactViewController.view setNeedsLayout];