mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-08-17 21:01:34 +08:00
refactor: circular deps part 13
This commit is contained in:
@ -1,19 +1,24 @@
|
||||
// Types
|
||||
import { ViewBase } from '../ui/core/view-base';
|
||||
|
||||
//Requires
|
||||
import { androidGetCurrentActivity } from '../application/helpers';
|
||||
import { getRootView } from '../application/helpers-common';
|
||||
import type { ViewBase } from '../ui/core/view-base';
|
||||
import { unsetValue } from '../ui/core/properties/property-shared';
|
||||
import { getNodeById } from './dom-types';
|
||||
import { mainThreadify } from '../utils';
|
||||
|
||||
// Use lazy requires for core modules
|
||||
const getAppRootView = () => require('../application').getRootView();
|
||||
|
||||
let unsetValue;
|
||||
function unsetViewValue(view, name) {
|
||||
if (!unsetValue) {
|
||||
unsetValue = require('../ui/core/properties').unsetValue;
|
||||
function getAppRootView() {
|
||||
if (__ANDROID__) {
|
||||
const activity = androidGetCurrentActivity();
|
||||
if (!activity) {
|
||||
return undefined;
|
||||
}
|
||||
const callbacks = activity['_callbacks'];
|
||||
return callbacks ? callbacks.getRootView() : undefined;
|
||||
} else {
|
||||
return getRootView();
|
||||
}
|
||||
}
|
||||
|
||||
function unsetViewValue(view, name) {
|
||||
view[name] = unsetValue;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user