mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-11-05 13:26:48 +08:00
fix(android): dialogs activity usage (#10246)
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { android as ad } from '../application';
|
||||
import { ad } from './native-helper';
|
||||
|
||||
export function dispatchToMainThread(func: () => void) {
|
||||
const runOnMainThread = (global as any).__runOnMainThread;
|
||||
@@ -20,7 +20,7 @@ export function isMainThread(): boolean {
|
||||
}
|
||||
|
||||
export function dispatchToUIThread(func: () => void) {
|
||||
const activity: androidx.appcompat.app.AppCompatActivity = ad.foregroundActivity || ad.startActivity;
|
||||
const activity: androidx.appcompat.app.AppCompatActivity = ad.getCurrentActivity();
|
||||
if (activity && func) {
|
||||
activity.runOnUiThread(
|
||||
new java.lang.Runnable({
|
||||
|
||||
Reference in New Issue
Block a user