mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-08-14 10:01:08 +08:00
chore: format and fix ci build
This commit is contained in:
@ -30,6 +30,7 @@
|
||||
}
|
||||
},
|
||||
"include": [
|
||||
"../global-types.d.ts",
|
||||
"./**/*.ts"
|
||||
],
|
||||
"exclude": [
|
||||
|
@ -476,24 +476,23 @@ function ensureBroadCastReceiverClass() {
|
||||
return;
|
||||
}
|
||||
|
||||
@NativeClass
|
||||
class BroadcastReceiver extends android.content.BroadcastReceiver {
|
||||
private _onReceiveCallback: (context: android.content.Context, intent: android.content.Intent) => void;
|
||||
@NativeClass
|
||||
class BroadcastReceiver extends android.content.BroadcastReceiver {
|
||||
private _onReceiveCallback: (context: android.content.Context, intent: android.content.Intent) => void;
|
||||
|
||||
constructor(onReceiveCallback: (context: android.content.Context, intent: android.content.Intent) => void) {
|
||||
super();
|
||||
this._onReceiveCallback = onReceiveCallback;
|
||||
constructor(onReceiveCallback: (context: android.content.Context, intent: android.content.Intent) => void) {
|
||||
super();
|
||||
this._onReceiveCallback = onReceiveCallback;
|
||||
|
||||
return global.__native(this);
|
||||
}
|
||||
|
||||
public onReceive(context: android.content.Context, intent: android.content.Intent) {
|
||||
if (this._onReceiveCallback) {
|
||||
this._onReceiveCallback(context, intent);
|
||||
}
|
||||
}
|
||||
}
|
||||
return global.__native(this);
|
||||
}
|
||||
|
||||
public onReceive(context: android.content.Context, intent: android.content.Intent) {
|
||||
if (this._onReceiveCallback) {
|
||||
this._onReceiveCallback(context, intent);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
BroadcastReceiverClass = BroadcastReceiver;
|
||||
}
|
||||
|
2
packages/core/application/index.d.ts
vendored
2
packages/core/application/index.d.ts
vendored
@ -62,7 +62,7 @@ export let autoSystemAppearanceChanged: boolean;
|
||||
/**
|
||||
* enable/disable systemAppearanceChanged
|
||||
*/
|
||||
export function setAutoSystemAppearanceChanged (value: boolean);
|
||||
export function setAutoSystemAppearanceChanged(value: boolean);
|
||||
|
||||
/**
|
||||
* Updates root view classes including those of modals
|
||||
|
@ -1,4 +1,4 @@
|
||||
import type {InstrumentationMode} from '../profiling'
|
||||
import type { InstrumentationMode } from '../profiling';
|
||||
|
||||
interface IConfigPlatform {
|
||||
/**
|
||||
@ -144,4 +144,3 @@ export interface NativeScriptConfig {
|
||||
*/
|
||||
cssParser?: 'rework' | 'nativescript' | 'css-tree';
|
||||
}
|
||||
|
||||
|
@ -1 +1 @@
|
||||
export * from './config.interface';
|
||||
export * from './config.interface';
|
||||
|
@ -1,4 +1,4 @@
|
||||
import {android as androidApp, getNativeApplication} from '../application';
|
||||
import { android as androidApp, getNativeApplication } from '../application';
|
||||
|
||||
export enum connectionType {
|
||||
none = 0,
|
||||
|
@ -359,5 +359,5 @@ export function initGlobal() {
|
||||
}
|
||||
}
|
||||
if (!global.NativeScriptHasInitGlobal) {
|
||||
initGlobal();
|
||||
}
|
||||
initGlobal();
|
||||
}
|
||||
|
@ -29,9 +29,9 @@ export const Application = {
|
||||
loadAppCss,
|
||||
addCss,
|
||||
on,
|
||||
off,
|
||||
notify,
|
||||
hasListeners,
|
||||
off,
|
||||
notify,
|
||||
hasListeners,
|
||||
run,
|
||||
orientation,
|
||||
getNativeApplication,
|
||||
@ -135,11 +135,11 @@ export const Utils = {
|
||||
android: androidUtils,
|
||||
// legacy (a lot of plugins use the shorthand "ad" Utils.ad instead of Utils.android)
|
||||
ad: androidUtils,
|
||||
ios: iosUtils,
|
||||
setTimeout,
|
||||
setInterval,
|
||||
clearInterval,
|
||||
clearTimeout,
|
||||
ios: iosUtils,
|
||||
setTimeout,
|
||||
setInterval,
|
||||
clearInterval,
|
||||
clearTimeout,
|
||||
Source,
|
||||
ClassInfo,
|
||||
getClass,
|
||||
|
@ -1,5 +1,5 @@
|
||||
console.log('Loading inspector modules...');
|
||||
import './globals';
|
||||
import './globals';
|
||||
require('./debugger/webinspector-network');
|
||||
require('./debugger/webinspector-dom');
|
||||
require('./debugger/webinspector-css');
|
||||
|
@ -456,7 +456,7 @@ export class BottomNavigation extends TabNavigationBase {
|
||||
const fragmentManager = this._getFragmentManager();
|
||||
const transaction = fragmentManager.beginTransaction();
|
||||
const fragments = fragmentManager.getFragments().toArray();
|
||||
for (let i=0;i<fragments.length;i++) {
|
||||
for (let i = 0; i < fragments.length; i++) {
|
||||
transaction.remove(fragments[i]);
|
||||
}
|
||||
|
||||
|
@ -1,24 +1,18 @@
|
||||
// Types
|
||||
import {TabContentItem} from '../tab-navigation-base/tab-content-item';
|
||||
import {TabStrip} from '../tab-navigation-base/tab-strip';
|
||||
import {TabStripItem} from '../tab-navigation-base/tab-strip-item';
|
||||
import {getTransformedText, TextTransform} from '../text-base';
|
||||
import { TabContentItem } from '../tab-navigation-base/tab-content-item';
|
||||
import { TabStrip } from '../tab-navigation-base/tab-strip';
|
||||
import { TabStripItem } from '../tab-navigation-base/tab-strip-item';
|
||||
import { getTransformedText, TextTransform } from '../text-base';
|
||||
|
||||
// Requires
|
||||
import {Color} from '../../color';
|
||||
import {ImageSource} from '../../image-source';
|
||||
import {Device} from '../../platform';
|
||||
import {iOSNativeHelper, isFontIconURI, layout} from '../../utils';
|
||||
import {CSSType, IOSHelper, View} from '../core/view';
|
||||
import {Frame} from '../frame';
|
||||
import {Font} from '../styling/font';
|
||||
import {
|
||||
getIconSpecSize,
|
||||
itemsProperty,
|
||||
selectedIndexProperty,
|
||||
TabNavigationBase,
|
||||
tabStripProperty
|
||||
} from '../tab-navigation-base/tab-navigation-base';
|
||||
import { Color } from '../../color';
|
||||
import { ImageSource } from '../../image-source';
|
||||
import { Device } from '../../platform';
|
||||
import { iOSNativeHelper, isFontIconURI, layout } from '../../utils';
|
||||
import { CSSType, IOSHelper, View } from '../core/view';
|
||||
import { Frame } from '../frame';
|
||||
import { Font } from '../styling/font';
|
||||
import { getIconSpecSize, itemsProperty, selectedIndexProperty, TabNavigationBase, tabStripProperty } from '../tab-navigation-base/tab-navigation-base';
|
||||
|
||||
// TODO:
|
||||
// import { profile } from "../../profiling";
|
||||
|
@ -95,7 +95,7 @@ const createComponentInstance = profile('createComponentInstance', (elementName:
|
||||
}
|
||||
|
||||
// Get the component type from module.
|
||||
const instanceType = instanceModule[elementName];
|
||||
const instanceType = instanceModule[elementName];
|
||||
|
||||
// Create instance of the component.
|
||||
instance = new instanceType();
|
||||
|
@ -305,7 +305,7 @@ export abstract class ViewBase extends Observable implements ViewBaseDefinition
|
||||
super();
|
||||
this._domId = viewIdCounter++;
|
||||
this._style = new Style(new WeakRef(this));
|
||||
this.notify({eventName: ViewBase.createdEvent, type: this.constructor.name, object: this});
|
||||
this.notify({ eventName: ViewBase.createdEvent, type: this.constructor.name, object: this });
|
||||
}
|
||||
|
||||
// Used in Angular.
|
||||
|
@ -54,7 +54,7 @@ export class TabContentItem extends TabContentItemBase {
|
||||
}
|
||||
|
||||
const fragments = fragmentManager.getFragments().toArray();
|
||||
for (let i=0;i<fragments.length;i++) {
|
||||
for (let i = 0; i < fragments.length; i++) {
|
||||
if (fragments[i].index === this.index) {
|
||||
tabFragment = fragments[i];
|
||||
break;
|
||||
|
@ -366,7 +366,7 @@ export class TabViewItem extends TabViewItemBase {
|
||||
let tabFragment = null;
|
||||
const fragmentManager = tabView._getFragmentManager();
|
||||
const fragments = fragmentManager.getFragments().toArray();
|
||||
for (let i=0;i<fragments.length;i++) {
|
||||
for (let i = 0; i < fragments.length; i++) {
|
||||
if (fragments[i].index === this.index) {
|
||||
tabFragment = fragments[i];
|
||||
break;
|
||||
@ -624,7 +624,7 @@ export class TabView extends TabViewBase {
|
||||
const fragmentManager = this._getFragmentManager();
|
||||
const transaction = fragmentManager.beginTransaction();
|
||||
let fragments = <Array<any>>fragmentManager.getFragments().toArray();
|
||||
for (let i=0;i<fragments.length;i++) {
|
||||
for (let i = 0; i < fragments.length; i++) {
|
||||
transaction.remove(fragments[i]);
|
||||
}
|
||||
transaction.commitNowAllowingStateLoss();
|
||||
|
@ -566,7 +566,7 @@ export class Tabs extends TabsBase {
|
||||
const fragmentManager = this._getFragmentManager();
|
||||
const transaction = fragmentManager.beginTransaction();
|
||||
let fragments = <Array<any>>fragmentManager.getFragments().toArray();
|
||||
for (let i=0;i<fragments.length;i++ ) {
|
||||
for (let i = 0; i < fragments.length; i++) {
|
||||
transaction.remove(fragments[i]);
|
||||
}
|
||||
transaction.commitNowAllowingStateLoss();
|
||||
|
@ -27,25 +27,25 @@ export abstract class TextBaseCommon extends View implements TextBaseDefinition
|
||||
public formattedText: FormattedString;
|
||||
|
||||
/***
|
||||
* In the NativeScript Core; by default the nativeTextViewProtected points to the same value as nativeViewProtected.
|
||||
* At this point no internal NS components need this indirection functionality.
|
||||
* This indirection is used to allow support usage by third party components so they don't have to duplicate functionality.
|
||||
*
|
||||
* A third party component can just override the `nativeTextViewProtected` getter and return a different internal view and that view would be
|
||||
* what all TextView/TextInput class features would be applied to.
|
||||
*
|
||||
* A example is the Android MaterialDesign TextInput class, it has a wrapper view of a TextInputLayout
|
||||
* https://developer.android.com/reference/com/google/android/material/textfield/TextInputLayout
|
||||
* which wraps the actual TextInput. This wrapper layout (TextInputLayout) must be assigned to the nativeViewProtected as the entire
|
||||
* NS Core uses nativeViewProtected for everything related to layout, so that it can be measured, added to the parent view as a child, ect.
|
||||
*
|
||||
* However, its internal view would be the actual TextView/TextInput and to allow that sub-view to have the normal TextView/TextInput
|
||||
* class features, which we expose and to allow them to work on it, the internal TextView/TextInput is what the needs to have the class values applied to it.
|
||||
*
|
||||
* So all code that works on what is expected to be a TextView/TextInput should use `nativeTextViewProtected` so that any third party
|
||||
* components that need to have two separate components can work properly without them having to duplicate all the TextBase (and decendants) functionality
|
||||
* by just overriding the nativeTextViewProtected getter.
|
||||
**/
|
||||
* In the NativeScript Core; by default the nativeTextViewProtected points to the same value as nativeViewProtected.
|
||||
* At this point no internal NS components need this indirection functionality.
|
||||
* This indirection is used to allow support usage by third party components so they don't have to duplicate functionality.
|
||||
*
|
||||
* A third party component can just override the `nativeTextViewProtected` getter and return a different internal view and that view would be
|
||||
* what all TextView/TextInput class features would be applied to.
|
||||
*
|
||||
* A example is the Android MaterialDesign TextInput class, it has a wrapper view of a TextInputLayout
|
||||
* https://developer.android.com/reference/com/google/android/material/textfield/TextInputLayout
|
||||
* which wraps the actual TextInput. This wrapper layout (TextInputLayout) must be assigned to the nativeViewProtected as the entire
|
||||
* NS Core uses nativeViewProtected for everything related to layout, so that it can be measured, added to the parent view as a child, ect.
|
||||
*
|
||||
* However, its internal view would be the actual TextView/TextInput and to allow that sub-view to have the normal TextView/TextInput
|
||||
* class features, which we expose and to allow them to work on it, the internal TextView/TextInput is what the needs to have the class values applied to it.
|
||||
*
|
||||
* So all code that works on what is expected to be a TextView/TextInput should use `nativeTextViewProtected` so that any third party
|
||||
* components that need to have two separate components can work properly without them having to duplicate all the TextBase (and decendants) functionality
|
||||
* by just overriding the nativeTextViewProtected getter.
|
||||
**/
|
||||
get nativeTextViewProtected() {
|
||||
return this.nativeViewProtected;
|
||||
}
|
||||
|
Reference in New Issue
Block a user