Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Artifact when changing content on second screen #368

Closed
kaioberst opened this issue Oct 29, 2021 · 1 comment
Closed

Artifact when changing content on second screen #368

kaioberst opened this issue Oct 29, 2021 · 1 comment

Comments

@kaioberst
Copy link

Hi,

we are having artifacts on the second screen when changing the content of the second screen. First we display some text and further change to a webrtc view which covers the whole stream. I debugged a bit the code and found out, that some (not all) text views of the formerly added screen where still into the render tree.
I tried to remove them in RNExternalDisplayView.removeViewAt, but failed with IndexOutOfBounds.
Help would be appreciated!

Thanks in advance!

Kai

@femmon
Copy link
Contributor

femmon commented Oct 16, 2023

I have created a PR to address this problem #762

You can try it out by applying this patch:

diff --git a/node_modules/react-native-external-display/android/src/main/java/com/externaldisplay/RNExternalDisplayView.java b/node_modules/react-native-external-display/android/src/main/java/com/externaldisplay/RNExternalDisplayView.java
index 68bab8b..20c9702 100644
--- a/node_modules/react-native-external-display/android/src/main/java/com/externaldisplay/RNExternalDisplayView.java
+++ b/node_modules/react-native-external-display/android/src/main/java/com/externaldisplay/RNExternalDisplayView.java
@@ -59,13 +59,14 @@ public class RNExternalDisplayView extends ReactRootView implements LifecycleEve
 
   @Override
   public void removeViewAt(int index) {
-    if (index > 0) return;
     View child = getChildAt(index);
     super.removeView(child);
     subviews.remove(index);
     if (wrap != null && wrap.getChildCount() > 0) {
       for (int i = 0; i < wrap.getChildCount(); i++) {
-        wrap.removeViewAt(i);
+        if (i == index) {
+          wrap.removeViewAt(i);
+        }
       }
     }
   }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants