Skip to content

Commit 72fc6b7

Browse files
committed
android: Clear reactNativeHost in onDestroy if it has an instance.
This fixes the 'double initialization' bug.
1 parent a53f336 commit 72fc6b7

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

android/app/src/main/java/com/zulipmobile/MainActivity.kt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,13 @@ open class MainActivity : ReactActivity() {
3636
super.onNewIntent(intent)
3737
}
3838

39+
override fun onDestroy() {
40+
super.onDestroy()
41+
if (reactNativeHost.hasInstance()) {
42+
reactNativeHost.clear()
43+
}
44+
}
45+
3946
/* Returns true just if we did handle the intent. */
4047
private fun maybeHandleIntent(intent: Intent?): Boolean {
4148
// We handle intents from "sharing" something to Zulip.

0 commit comments

Comments
 (0)