Parcourir la source

[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.
master
Saúl Ibarra Corretgé il y a 8 ans
Parent
révision
84463d8cf0
1 fichiers modifiés avec 10 ajouts et 8 suppressions
  1. 10
    8
      android/sdk/src/main/java/org/jitsi/meet/sdk/JitsiMeetView.java

+ 10
- 8
android/sdk/src/main/java/org/jitsi/meet/sdk/JitsiMeetView.java Voir le fichier

@@ -142,15 +142,17 @@ public class JitsiMeetView extends FrameLayout {
142 142
             props.putString("url", url.toString());
143 143
         }
144 144
 
145
-        if (mReactRootView == null) {
146
-            mReactRootView = new ReactRootView(getContext());
147
-            mReactRootView.startReactApplication(mReactInstanceManager, "App", props);
148
-            mReactRootView.setBackgroundColor(BACKGROUND_COLOR);
149
-            addView(mReactRootView);
150
-        } else {
151
-            // TODO: ReactRootView#setAppProperties is only available on React Native 0.45.
152
-            throw new RuntimeException("Not yet supported");
145
+        // TODO: ReactRootView#setAppProperties is only available on React Native 0.45, so destroy
146
+        // the current root view and create a new one.
147
+        if (mReactRootView != null) {
148
+            removeView(mReactRootView);
149
+            mReactRootView = null;
153 150
         }
151
+
152
+        mReactRootView = new ReactRootView(getContext());
153
+        mReactRootView.startReactApplication(mReactInstanceManager, "App", props);
154
+        mReactRootView.setBackgroundColor(BACKGROUND_COLOR);
155
+        addView(mReactRootView);
154 156
     }
155 157
 
156 158
     /**

Chargement…
Annuler
Enregistrer