Commit 5aecdf2
committed
fix(expo): seed Clerk activity ref on cold-start to fix MissingActivity (MOBILE-485)
clerk-android tracks the current foreground Activity via
ActivityLifecycleCallbacks registered inside Clerk.initialize(). In a
React Native app, MainActivity has already passed onResume() by the time
<ClerkProvider> mounts and configure() runs, so the callbacks miss the
initial Activity. Without seeding, the first Credential Manager call
(Google sign-in, passkeys) fails with MissingActivity until the user
backgrounds and foregrounds the app.
Adopt the new public Clerk.attachActivity() API from clerk-android 1.0.16
to seed the Activity reference at two reliable points: in
ClerkExpoModule.configure() right after Clerk.initialize() (using
React's currentActivity), and in ClerkAuthNativeView's findActivity()
result. The second hook is the empirically-reliable backstop — at cold
start, getCurrentActivity() may return null before React's host-resume
sync, but ClerkAuthNativeView is constructed when AuthView mounts, by
which point the Activity is unambiguously available.
Bumps clerk-android-{api,ui} to 1.0.16. Adds an explicit clerk-android-api
dep to override telemetry's transitive pin on the previous release —
without this the version constraint loses the conflict and consumers end
up on the older artifact (which lacks attachActivity).1 parent 30ec271 commit 5aecdf2
4 files changed
Lines changed: 37 additions & 3 deletions
File tree
- .changeset
- packages/expo/android
- src/main/java/expo/modules/clerk
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
21 | | - | |
22 | | - | |
| 21 | + | |
| 22 | + | |
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
| |||
117 | 117 | | |
118 | 118 | | |
119 | 119 | | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
120 | 130 | | |
121 | 131 | | |
122 | 132 | | |
| |||
Lines changed: 8 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
44 | 44 | | |
45 | 45 | | |
46 | 46 | | |
47 | | - | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
48 | 55 | | |
49 | 56 | | |
50 | 57 | | |
| |||
Lines changed: 10 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
85 | 85 | | |
86 | 86 | | |
87 | 87 | | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
88 | 98 | | |
89 | 99 | | |
90 | 100 | | |
| |||
0 commit comments