diff --git a/README.md b/README.md index 07006c505c..c6dfec0922 100644 --- a/README.md +++ b/README.md @@ -29,6 +29,9 @@ For most people using an app built from the react-native template, that means ed You should add this code, which specifically discards any Activity state persisted during the Activity restart process, to avoid inconsistencies that lead to crashes. Please note that the override code should not be placed inside `MainActivityDelegate`, but rather directly in `MainActivity`. +
+Java + ```java import android.os.Bundle; @@ -47,6 +50,25 @@ public class MainActivity extends ReactActivity { } } ``` +
+ +
+Kotlin + +```kotlin +import android.os.Bundle; + +class MainActivity: ReactActivity() { + + //...code + + //react-native-screens override + override fun onCreate(savedInstanceState: Bundle?) { + super.onCreate(null); + } +} +``` +
For people that must handle cases like this, there is [a more detailed discussion of the difficulties in a series of related comments](https://github.com/software-mansion/react-native-screens/issues/17#issuecomment-424704633). diff --git a/ios/RNSScreen.mm b/ios/RNSScreen.mm index 740d48c738..4b24cffff6 100644 --- a/ios/RNSScreen.mm +++ b/ios/RNSScreen.mm @@ -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];