From 84463d8cf02c9ae749a9a8689db331b16d84f121 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sa=C3=BAl=20Ibarra=20Corretg=C3=A9?= Date: Thu, 8 Jun 2017 18:09:54 +0200 Subject: [PATCH] [RN] Add workaround for loading different URLs on Android Changing the props from native (Java) code was only added in 0.45, so add a workaround until we get to updating our React Native dependency. --- .../java/org/jitsi/meet/sdk/JitsiMeetView.java | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/android/sdk/src/main/java/org/jitsi/meet/sdk/JitsiMeetView.java b/android/sdk/src/main/java/org/jitsi/meet/sdk/JitsiMeetView.java index e7cd956f2..b1b3d5ec2 100644 --- a/android/sdk/src/main/java/org/jitsi/meet/sdk/JitsiMeetView.java +++ b/android/sdk/src/main/java/org/jitsi/meet/sdk/JitsiMeetView.java @@ -142,15 +142,17 @@ public class JitsiMeetView extends FrameLayout { props.putString("url", url.toString()); } - if (mReactRootView == null) { - mReactRootView = new ReactRootView(getContext()); - mReactRootView.startReactApplication(mReactInstanceManager, "App", props); - mReactRootView.setBackgroundColor(BACKGROUND_COLOR); - addView(mReactRootView); - } else { - // TODO: ReactRootView#setAppProperties is only available on React Native 0.45. - throw new RuntimeException("Not yet supported"); + // TODO: ReactRootView#setAppProperties is only available on React Native 0.45, so destroy + // the current root view and create a new one. + if (mReactRootView != null) { + removeView(mReactRootView); + mReactRootView = null; } + + mReactRootView = new ReactRootView(getContext()); + mReactRootView.startReactApplication(mReactInstanceManager, "App", props); + mReactRootView.setBackgroundColor(BACKGROUND_COLOR); + addView(mReactRootView); } /**