Skip to content

Commit b84fd63

Browse files
authored
fix: Remove dangling global reference to ScreenModule (#2494)
## Description Removes a dangling global reference to the `ScreenModule`. ## Changes When the application reloads, `nativeInstall` is called, which overwrites the reference to `globalThis` without deleting it. This PR deletes the reference before creating a new one. ## Test code and steps to reproduce I've tested it in a new project created using expo (SDK 52) and with fabric turn on.
1 parent fa51b58 commit b84fd63

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

android/src/main/cpp/jni-adapter.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ Java_com_swmansion_rnscreens_ScreensModule_nativeInstall(
1818
return;
1919
}
2020
jsi::Runtime &rt = *runtime;
21+
if (globalThis) {
22+
env->DeleteGlobalRef(globalThis);
23+
}
2124
globalThis = env->NewGlobalRef(thiz);
2225
JavaVM *jvm;
2326
env->GetJavaVM(&jvm);

0 commit comments

Comments
 (0)