Skip to content

fix(android): resolve current activity via ReactContext - #11

Merged
blazejkustra merged 1 commit into
mainfrom
fix/android-current-activity
Oct 20, 2026
Merged

blazejkustra merged 1 commit into
mainfrom
fix/android-current-activity

Conversation

@blazejkustra

Copy link
Copy Markdown
Owner

Fixes #10

Problem

On RN 0.88 / Kotlin 2.4 the Android module fails to compile with Unresolved reference 'currentActivity': ReactContextBaseJavaModule is Kotlin now and only exposes a deprecated getCurrentActivity() function.

Approach

Read the activity from reactContext.currentActivity (Java ReactContext getter), the replacement RN recommends; works on old and new versions.

Tests

  • Reproduced the exact error in the example app (RN 0.85.3) by bumping Kotlin to 2.4.0; fixed code compiles there and on the default Kotlin 2.1.20
  • Example app on Android emulator: Basic Prompt opens, OK fires the callback ("Hello, John Doe!")
  • Not tested on an actual RN 0.88 / Expo 58 app, nor on iOS (unchanged)

Screenshots

ReactContextBaseJavaModule is now Kotlin and only exposes a deprecated
getCurrentActivity() function, so the synthetic currentActivity property
no longer resolves with newer Kotlin/RN (e.g. RN 0.88, Kotlin 2.4).

Fixes #10
@blazejkustra
blazejkustra merged commit 432472b into main Oct 20, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Android build fails on React Native 0.88: Unresolved reference 'currentActivity' in ReactNativeAlertModule.kt

1 participant