|
@@ -199,6 +199,21 @@ public class JitsiMeetView extends FrameLayout {
|
199
|
199
|
views.add(this);
|
200
|
200
|
}
|
201
|
201
|
|
|
202
|
+ /**
|
|
203
|
+ * Releases the React resources (specifically the {@link ReactRootView})
|
|
204
|
+ * associated with this view.
|
|
205
|
+ *
|
|
206
|
+ * This method MUST be called when the Activity holding this view is destroyed, typically in the
|
|
207
|
+ * {@code onDestroy} method.
|
|
208
|
+ */
|
|
209
|
+ public void dispose() {
|
|
210
|
+ if (reactRootView != null) {
|
|
211
|
+ removeView(reactRootView);
|
|
212
|
+ reactRootView.unmountReactApplication();
|
|
213
|
+ reactRootView = null;
|
|
214
|
+ }
|
|
215
|
+ }
|
|
216
|
+
|
202
|
217
|
/**
|
203
|
218
|
* Gets the {@link JitsiMeetViewListener} set on this {@code JitsiMeetView}.
|
204
|
219
|
*
|
|
@@ -257,10 +272,7 @@ public class JitsiMeetView extends FrameLayout {
|
257
|
272
|
|
258
|
273
|
// TODO: ReactRootView#setAppProperties is only available on React
|
259
|
274
|
// Native 0.45, so destroy the current root view and create a new one.
|
260
|
|
- if (reactRootView != null) {
|
261
|
|
- removeView(reactRootView);
|
262
|
|
- reactRootView = null;
|
263
|
|
- }
|
|
275
|
+ dispose();
|
264
|
276
|
|
265
|
277
|
reactRootView = new ReactRootView(getContext());
|
266
|
278
|
reactRootView.startReactApplication(reactInstanceManager, "App", props);
|