From fbb82d68435f93026bf18c2ef9c8cdc03963d2e7 Mon Sep 17 00:00:00 2001 From: Adam Rowe Date: Thu, 28 May 2026 13:16:37 -0400 Subject: [PATCH] fix(android): use reactApplicationContext.currentActivity MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit `ReactContextBaseJavaModule.getCurrentActivity()` was made `protected` and `@Deprecated` in React Native 0.80+ (the recommendation in the deprecation message is to use `reactApplicationContext.currentActivity` directly). In RN 0.80 with Kotlin compiling against the updated Java stub, the Kotlin-inherited property syntax `currentActivity` no longer resolves at the subclass level — the compiler emits `Cannot access 'getCurrentActivity': it is protected/protected and package/package in 'ReactContextBaseJavaModule'` or, depending on the toolchain version, a runtime crash on the `auth.login(activity!!, ...)` call site. Switching to `reactApplicationContext.currentActivity` (the property the deprecation message recommends) restores the behaviour on RN 0.80+ and leaves older RN versions functionally identical, since `reactApplicationContext` was already used elsewhere in the file (see `getName()` / `auth` getter). Affected entry points: `login`, `directLoginAction`, `loginWithPasskeys`, `registerPasskeys` (4 sites). --- .../java/com/frontegg/reactnative/FronteggRNModule.kt | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/android/src/main/java/com/frontegg/reactnative/FronteggRNModule.kt b/android/src/main/java/com/frontegg/reactnative/FronteggRNModule.kt index 4f0e41a..6e1825d 100644 --- a/android/src/main/java/com/frontegg/reactnative/FronteggRNModule.kt +++ b/android/src/main/java/com/frontegg/reactnative/FronteggRNModule.kt @@ -119,7 +119,7 @@ class FronteggRNModule(val reactContext: ReactApplicationContext) : @ReactMethod fun login(loginHint: String?, promise: Promise) { - val activity = currentActivity + val activity = reactApplicationContext.currentActivity auth.login(activity!!, loginHint) { promise.resolve("") } @@ -134,7 +134,7 @@ class FronteggRNModule(val reactContext: ReactApplicationContext) : @ReactMethod fun directLoginAction(type: String, data: String, ephemeralSession: Boolean, promise: Promise) { - val activity = currentActivity + val activity = reactApplicationContext.currentActivity auth.directLoginAction(activity!!, type, data) promise.resolve(true) } @@ -147,7 +147,7 @@ class FronteggRNModule(val reactContext: ReactApplicationContext) : @ReactMethod fun loginWithPasskeys(promise: Promise) { - val activity = currentActivity + val activity = reactApplicationContext.currentActivity auth.loginWithPasskeys(activity!!) { error -> if (error != null) { promise.reject(error) @@ -179,7 +179,7 @@ class FronteggRNModule(val reactContext: ReactApplicationContext) : @ReactMethod fun registerPasskeys(promise: Promise) { - val activity = currentActivity + val activity = reactApplicationContext.currentActivity auth.registerPasskeys(activity!!) { error -> if (error != null) { promise.reject(error)