Skip to content

Commit

Permalink
Don't include AVPlayerView in traverseForScrollView method
Browse files Browse the repository at this point in the history
  • Loading branch information
tboba committed Nov 14, 2023
1 parent 4224c7c commit b15e2dc
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions ios/RNSScreen.mm
Original file line number Diff line number Diff line change
Expand Up @@ -1423,6 +1423,15 @@ - (void)traverseForScrollView:(UIView *)view
// we don't want to send `scrollViewDidEndDecelerating` event to JS before the JS thread is ready
return;
}

if ([NSStringFromClass([view class]) isEqualToString:@"AVPlayerView"]) {
// Traversing through AVPlayerView is an uncommon edge case that causes the disappearing screen
// to an excessive traversal through all video player elements
// (e.g., for react-native-video, this includes all controls and additional video views).
// Thus, we want to avoid unnecessary traversals through these views.
return;
}

if ([view isKindOfClass:[UIScrollView class]] &&
([[(UIScrollView *)view delegate] respondsToSelector:@selector(scrollViewDidEndDecelerating:)])) {
[[(UIScrollView *)view delegate] scrollViewDidEndDecelerating:(id)view];
Expand Down

0 comments on commit b15e2dc

Please sign in to comment.