mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-11-05 13:26:48 +08:00
chore: format
This commit is contained in:
@@ -3,66 +3,100 @@ import * as globals from "../../globals";
|
||||
import * as appModule from "../../application";
|
||||
|
||||
if (global.__snapshot) {
|
||||
globals.initGlobal();
|
||||
globals.initGlobal();
|
||||
}
|
||||
|
||||
//@ts-ignore
|
||||
@JavaProxy("com.tns.NativeScriptActivity")
|
||||
class NativeScriptActivity extends androidx.appcompat.app.AppCompatActivity {
|
||||
private _callbacks: AndroidActivityCallbacks;
|
||||
public isNativeScriptActivity;
|
||||
constructor() {
|
||||
super();
|
||||
private _callbacks: AndroidActivityCallbacks;
|
||||
public isNativeScriptActivity;
|
||||
constructor() {
|
||||
super();
|
||||
|
||||
return global.__native(this);
|
||||
}
|
||||
return global.__native(this);
|
||||
}
|
||||
|
||||
public onCreate(savedInstanceState: android.os.Bundle): void {
|
||||
appModule.android.init(this.getApplication());
|
||||
public onCreate(savedInstanceState: android.os.Bundle): void {
|
||||
appModule.android.init(this.getApplication());
|
||||
|
||||
// Set isNativeScriptActivity in onCreate.
|
||||
// The JS constructor might not be called because the activity is created from Android.
|
||||
this.isNativeScriptActivity = true;
|
||||
if (!this._callbacks) {
|
||||
setActivityCallbacks(this);
|
||||
}
|
||||
// Set isNativeScriptActivity in onCreate.
|
||||
// The JS constructor might not be called because the activity is created from Android.
|
||||
this.isNativeScriptActivity = true;
|
||||
if (!this._callbacks) {
|
||||
setActivityCallbacks(this);
|
||||
}
|
||||
|
||||
this._callbacks.onCreate(this, savedInstanceState, this.getIntent(), super.onCreate);
|
||||
}
|
||||
this._callbacks.onCreate(
|
||||
this,
|
||||
savedInstanceState,
|
||||
this.getIntent(),
|
||||
super.onCreate
|
||||
);
|
||||
}
|
||||
|
||||
public onNewIntent(intent: android.content.Intent): void {
|
||||
this._callbacks.onNewIntent(this, intent, super.setIntent, super.onNewIntent);
|
||||
}
|
||||
public onNewIntent(intent: android.content.Intent): void {
|
||||
this._callbacks.onNewIntent(
|
||||
this,
|
||||
intent,
|
||||
super.setIntent,
|
||||
super.onNewIntent
|
||||
);
|
||||
}
|
||||
|
||||
public onSaveInstanceState(outState: android.os.Bundle): void {
|
||||
this._callbacks.onSaveInstanceState(this, outState, super.onSaveInstanceState);
|
||||
}
|
||||
public onSaveInstanceState(outState: android.os.Bundle): void {
|
||||
this._callbacks.onSaveInstanceState(
|
||||
this,
|
||||
outState,
|
||||
super.onSaveInstanceState
|
||||
);
|
||||
}
|
||||
|
||||
public onStart(): void {
|
||||
this._callbacks.onStart(this, super.onStart);
|
||||
}
|
||||
public onStart(): void {
|
||||
this._callbacks.onStart(this, super.onStart);
|
||||
}
|
||||
|
||||
public onStop(): void {
|
||||
this._callbacks.onStop(this, super.onStop);
|
||||
}
|
||||
public onStop(): void {
|
||||
this._callbacks.onStop(this, super.onStop);
|
||||
}
|
||||
|
||||
public onDestroy(): void {
|
||||
this._callbacks.onDestroy(this, super.onDestroy);
|
||||
}
|
||||
public onDestroy(): void {
|
||||
this._callbacks.onDestroy(this, super.onDestroy);
|
||||
}
|
||||
|
||||
public onPostResume(): void {
|
||||
this._callbacks.onPostResume(this, super.onPostResume);
|
||||
}
|
||||
public onPostResume(): void {
|
||||
this._callbacks.onPostResume(this, super.onPostResume);
|
||||
}
|
||||
|
||||
public onBackPressed(): void {
|
||||
this._callbacks.onBackPressed(this, super.onBackPressed);
|
||||
}
|
||||
public onBackPressed(): void {
|
||||
this._callbacks.onBackPressed(this, super.onBackPressed);
|
||||
}
|
||||
|
||||
public onRequestPermissionsResult(requestCode: number, permissions: Array<string>, grantResults: Array<number>): void {
|
||||
this._callbacks.onRequestPermissionsResult(this, requestCode, permissions, grantResults, undefined /*TODO: Enable if needed*/);
|
||||
}
|
||||
public onRequestPermissionsResult(
|
||||
requestCode: number,
|
||||
permissions: Array<string>,
|
||||
grantResults: Array<number>
|
||||
): void {
|
||||
this._callbacks.onRequestPermissionsResult(
|
||||
this,
|
||||
requestCode,
|
||||
permissions,
|
||||
grantResults,
|
||||
undefined /*TODO: Enable if needed*/
|
||||
);
|
||||
}
|
||||
|
||||
public onActivityResult(requestCode: number, resultCode: number, data: android.content.Intent): void {
|
||||
this._callbacks.onActivityResult(this, requestCode, resultCode, data, super.onActivityResult);
|
||||
}
|
||||
public onActivityResult(
|
||||
requestCode: number,
|
||||
resultCode: number,
|
||||
data: android.content.Intent
|
||||
): void {
|
||||
this._callbacks.onActivityResult(
|
||||
this,
|
||||
requestCode,
|
||||
resultCode,
|
||||
data,
|
||||
super.onActivityResult
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,67 +1,95 @@
|
||||
import { AndroidFragmentCallbacks, setFragmentCallbacks, setFragmentClass } from "./frame";
|
||||
import {
|
||||
AndroidFragmentCallbacks,
|
||||
setFragmentCallbacks,
|
||||
setFragmentClass,
|
||||
} from "./frame";
|
||||
|
||||
@JavaProxy("com.tns.FragmentClass")
|
||||
class FragmentClass extends org.nativescript.widgets.FragmentBase {
|
||||
// This field is updated in the frame module upon `new` (although hacky this eases the Fragment->callbacks association a lot)
|
||||
private _callbacks: AndroidFragmentCallbacks;
|
||||
// This field is updated in the frame module upon `new` (although hacky this eases the Fragment->callbacks association a lot)
|
||||
private _callbacks: AndroidFragmentCallbacks;
|
||||
|
||||
constructor() {
|
||||
super();
|
||||
constructor() {
|
||||
super();
|
||||
|
||||
return global.__native(this);
|
||||
}
|
||||
return global.__native(this);
|
||||
}
|
||||
|
||||
public onHiddenChanged(hidden: boolean): void {
|
||||
this._callbacks.onHiddenChanged(this, hidden, super.onHiddenChanged);
|
||||
}
|
||||
public onHiddenChanged(hidden: boolean): void {
|
||||
this._callbacks.onHiddenChanged(this, hidden, super.onHiddenChanged);
|
||||
}
|
||||
|
||||
public onCreateAnimator(transit: number, enter: boolean, nextAnim: number): android.animation.Animator {
|
||||
return this._callbacks.onCreateAnimator(this, transit, enter, nextAnim, super.onCreateAnimator);
|
||||
}
|
||||
public onCreateAnimator(
|
||||
transit: number,
|
||||
enter: boolean,
|
||||
nextAnim: number
|
||||
): android.animation.Animator {
|
||||
return this._callbacks.onCreateAnimator(
|
||||
this,
|
||||
transit,
|
||||
enter,
|
||||
nextAnim,
|
||||
super.onCreateAnimator
|
||||
);
|
||||
}
|
||||
|
||||
public onStop(): void {
|
||||
this._callbacks.onStop(this, super.onStop);
|
||||
}
|
||||
public onStop(): void {
|
||||
this._callbacks.onStop(this, super.onStop);
|
||||
}
|
||||
|
||||
public onPause(): void {
|
||||
this._callbacks.onPause(this, super.onStop);
|
||||
}
|
||||
public onPause(): void {
|
||||
this._callbacks.onPause(this, super.onStop);
|
||||
}
|
||||
|
||||
public onCreate(savedInstanceState: android.os.Bundle) {
|
||||
if (!this._callbacks) {
|
||||
setFragmentCallbacks(this);
|
||||
}
|
||||
public onCreate(savedInstanceState: android.os.Bundle) {
|
||||
if (!this._callbacks) {
|
||||
setFragmentCallbacks(this);
|
||||
}
|
||||
|
||||
this.setHasOptionsMenu(true);
|
||||
this._callbacks.onCreate(this, savedInstanceState, super.onCreate);
|
||||
}
|
||||
this.setHasOptionsMenu(true);
|
||||
this._callbacks.onCreate(this, savedInstanceState, super.onCreate);
|
||||
}
|
||||
|
||||
public onCreateView(inflater: android.view.LayoutInflater, container: android.view.ViewGroup, savedInstanceState: android.os.Bundle) {
|
||||
let result = this._callbacks.onCreateView(this, inflater, container, savedInstanceState, super.onCreateView);
|
||||
public onCreateView(
|
||||
inflater: android.view.LayoutInflater,
|
||||
container: android.view.ViewGroup,
|
||||
savedInstanceState: android.os.Bundle
|
||||
) {
|
||||
let result = this._callbacks.onCreateView(
|
||||
this,
|
||||
inflater,
|
||||
container,
|
||||
savedInstanceState,
|
||||
super.onCreateView
|
||||
);
|
||||
|
||||
return result;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public onSaveInstanceState(outState: android.os.Bundle) {
|
||||
this._callbacks.onSaveInstanceState(this, outState, super.onSaveInstanceState);
|
||||
}
|
||||
public onSaveInstanceState(outState: android.os.Bundle) {
|
||||
this._callbacks.onSaveInstanceState(
|
||||
this,
|
||||
outState,
|
||||
super.onSaveInstanceState
|
||||
);
|
||||
}
|
||||
|
||||
public onDestroyView() {
|
||||
this._callbacks.onDestroyView(this, super.onDestroyView);
|
||||
}
|
||||
public onDestroyView() {
|
||||
this._callbacks.onDestroyView(this, super.onDestroyView);
|
||||
}
|
||||
|
||||
public onDestroy() {
|
||||
this._callbacks.onDestroy(this, super.onDestroy);
|
||||
}
|
||||
public onDestroy() {
|
||||
this._callbacks.onDestroy(this, super.onDestroy);
|
||||
}
|
||||
|
||||
public toString(): string {
|
||||
const callbacks = this._callbacks;
|
||||
if (callbacks) {
|
||||
return callbacks.toStringOverride(this, super.toString);
|
||||
} else {
|
||||
super.toString();
|
||||
}
|
||||
}
|
||||
public toString(): string {
|
||||
const callbacks = this._callbacks;
|
||||
if (callbacks) {
|
||||
return callbacks.toStringOverride(this, super.toString);
|
||||
} else {
|
||||
super.toString();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
setFragmentClass(FragmentClass);
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -4,13 +4,14 @@
|
||||
* @private
|
||||
*/
|
||||
export function _setAndroidFragmentTransitions(
|
||||
animated: boolean,
|
||||
navigationTransition: NavigationTransition,
|
||||
currentEntry: BackstackEntry,
|
||||
newEntry: BackstackEntry,
|
||||
frameId: number,
|
||||
fragmentTransaction: any,
|
||||
isNestedDefaultTransition?: boolean): void;
|
||||
animated: boolean,
|
||||
navigationTransition: NavigationTransition,
|
||||
currentEntry: BackstackEntry,
|
||||
newEntry: BackstackEntry,
|
||||
frameId: number,
|
||||
fragmentTransaction: any,
|
||||
isNestedDefaultTransition?: boolean
|
||||
): void;
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
@@ -26,7 +27,10 @@ export function _updateTransitions(entry: BackstackEntry): void;
|
||||
* Called once fragment is going to reappear from backstack.
|
||||
* Reverse transitions from entry to fragment if any.
|
||||
*/
|
||||
export function _reverseTransitions(previousEntry: BackstackEntry, currentEntry: BackstackEntry): boolean;
|
||||
export function _reverseTransitions(
|
||||
previousEntry: BackstackEntry,
|
||||
currentEntry: BackstackEntry
|
||||
): boolean;
|
||||
/**
|
||||
* @private
|
||||
* Called when entry is removed from backstack (either back navigation or
|
||||
@@ -44,11 +48,20 @@ export function _clearFragment(entry: BackstackEntry): void;
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
export function _createIOSAnimatedTransitioning(navigationTransition: NavigationTransition, nativeCurve: any, operation: number, fromVC: any, toVC: any): any;
|
||||
export function _createIOSAnimatedTransitioning(
|
||||
navigationTransition: NavigationTransition,
|
||||
nativeCurve: any,
|
||||
operation: number,
|
||||
fromVC: any,
|
||||
toVC: any
|
||||
): any;
|
||||
|
||||
/**
|
||||
* @private
|
||||
* nativeTransition: androidx.transition.Transition
|
||||
*/
|
||||
export function addNativeTransitionListener(entry: any, nativeTransition: any): any;
|
||||
//@endprivate
|
||||
export function addNativeTransitionListener(
|
||||
entry: any,
|
||||
nativeTransition: any
|
||||
): any;
|
||||
//@endprivate
|
||||
|
||||
@@ -6,84 +6,135 @@ import { FadeTransition } from "../transition/fade-transition";
|
||||
import { Trace } from "../../trace";
|
||||
|
||||
module UIViewControllerAnimatedTransitioningMethods {
|
||||
const methodSignature = NSMethodSignature.signatureWithObjCTypes("v@:c");
|
||||
const invocation = NSInvocation.invocationWithMethodSignature(methodSignature);
|
||||
invocation.selector = "completeTransition:";
|
||||
const methodSignature = NSMethodSignature.signatureWithObjCTypes("v@:c");
|
||||
const invocation = NSInvocation.invocationWithMethodSignature(
|
||||
methodSignature
|
||||
);
|
||||
invocation.selector = "completeTransition:";
|
||||
|
||||
export function completeTransition(didComplete: boolean) {
|
||||
const didCompleteReference = new interop.Reference(interop.types.bool, didComplete);
|
||||
invocation.setArgumentAtIndex(didCompleteReference, 2);
|
||||
invocation.invokeWithTarget(this);
|
||||
}
|
||||
export function completeTransition(didComplete: boolean) {
|
||||
const didCompleteReference = new interop.Reference(
|
||||
interop.types.bool,
|
||||
didComplete
|
||||
);
|
||||
invocation.setArgumentAtIndex(didCompleteReference, 2);
|
||||
invocation.invokeWithTarget(this);
|
||||
}
|
||||
}
|
||||
|
||||
class AnimatedTransitioning extends NSObject implements UIViewControllerAnimatedTransitioning {
|
||||
public static ObjCProtocols = [UIViewControllerAnimatedTransitioning];
|
||||
class AnimatedTransitioning extends NSObject
|
||||
implements UIViewControllerAnimatedTransitioning {
|
||||
public static ObjCProtocols = [UIViewControllerAnimatedTransitioning];
|
||||
|
||||
private _transition: Transition;
|
||||
private _operation: UINavigationControllerOperation;
|
||||
private _fromVC: UIViewController;
|
||||
private _toVC: UIViewController;
|
||||
private _transitionType: string;
|
||||
private _transition: Transition;
|
||||
private _operation: UINavigationControllerOperation;
|
||||
private _fromVC: UIViewController;
|
||||
private _toVC: UIViewController;
|
||||
private _transitionType: string;
|
||||
|
||||
public static init(transition: Transition, operation: UINavigationControllerOperation, fromVC: UIViewController, toVC: UIViewController): AnimatedTransitioning {
|
||||
const impl = <AnimatedTransitioning>AnimatedTransitioning.new();
|
||||
impl._transition = transition;
|
||||
impl._operation = operation;
|
||||
impl._fromVC = fromVC;
|
||||
impl._toVC = toVC;
|
||||
public static init(
|
||||
transition: Transition,
|
||||
operation: UINavigationControllerOperation,
|
||||
fromVC: UIViewController,
|
||||
toVC: UIViewController
|
||||
): AnimatedTransitioning {
|
||||
const impl = <AnimatedTransitioning>AnimatedTransitioning.new();
|
||||
impl._transition = transition;
|
||||
impl._operation = operation;
|
||||
impl._fromVC = fromVC;
|
||||
impl._toVC = toVC;
|
||||
|
||||
return impl;
|
||||
}
|
||||
return impl;
|
||||
}
|
||||
|
||||
public animateTransition(transitionContext: any): void {
|
||||
const containerView = transitionContext.valueForKey("containerView");
|
||||
const completion = UIViewControllerAnimatedTransitioningMethods.completeTransition.bind(transitionContext);
|
||||
switch (this._operation) {
|
||||
case UINavigationControllerOperation.Push: this._transitionType = "push"; break;
|
||||
case UINavigationControllerOperation.Pop: this._transitionType = "pop"; break;
|
||||
case UINavigationControllerOperation.None: this._transitionType = "none"; break;
|
||||
}
|
||||
public animateTransition(transitionContext: any): void {
|
||||
const containerView = transitionContext.valueForKey("containerView");
|
||||
const completion = UIViewControllerAnimatedTransitioningMethods.completeTransition.bind(
|
||||
transitionContext
|
||||
);
|
||||
switch (this._operation) {
|
||||
case UINavigationControllerOperation.Push:
|
||||
this._transitionType = "push";
|
||||
break;
|
||||
case UINavigationControllerOperation.Pop:
|
||||
this._transitionType = "pop";
|
||||
break;
|
||||
case UINavigationControllerOperation.None:
|
||||
this._transitionType = "none";
|
||||
break;
|
||||
}
|
||||
|
||||
if (Trace.isEnabled()) {
|
||||
Trace.write(`START ${this._transition} ${this._transitionType}`, Trace.categories.Transition);
|
||||
}
|
||||
this._transition.animateIOSTransition(containerView, this._fromVC.view, this._toVC.view, this._operation, completion);
|
||||
}
|
||||
if (Trace.isEnabled()) {
|
||||
Trace.write(
|
||||
`START ${this._transition} ${this._transitionType}`,
|
||||
Trace.categories.Transition
|
||||
);
|
||||
}
|
||||
this._transition.animateIOSTransition(
|
||||
containerView,
|
||||
this._fromVC.view,
|
||||
this._toVC.view,
|
||||
this._operation,
|
||||
completion
|
||||
);
|
||||
}
|
||||
|
||||
public transitionDuration(transitionContext: UIViewControllerContextTransitioning): number {
|
||||
return this._transition.getDuration();
|
||||
}
|
||||
public transitionDuration(
|
||||
transitionContext: UIViewControllerContextTransitioning
|
||||
): number {
|
||||
return this._transition.getDuration();
|
||||
}
|
||||
|
||||
public animationEnded(transitionCompleted: boolean): void {
|
||||
if (transitionCompleted) {
|
||||
if (Trace.isEnabled()) {
|
||||
Trace.write(`END ${this._transition} ${this._transitionType}`, Trace.categories.Transition);
|
||||
}
|
||||
} else {
|
||||
if (Trace.isEnabled()) {
|
||||
Trace.write(`CANCEL ${this._transition} ${this._transitionType}`, Trace.categories.Transition);
|
||||
}
|
||||
}
|
||||
}
|
||||
public animationEnded(transitionCompleted: boolean): void {
|
||||
if (transitionCompleted) {
|
||||
if (Trace.isEnabled()) {
|
||||
Trace.write(
|
||||
`END ${this._transition} ${this._transitionType}`,
|
||||
Trace.categories.Transition
|
||||
);
|
||||
}
|
||||
} else {
|
||||
if (Trace.isEnabled()) {
|
||||
Trace.write(
|
||||
`CANCEL ${this._transition} ${this._transitionType}`,
|
||||
Trace.categories.Transition
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export function _createIOSAnimatedTransitioning(navigationTransition: NavigationTransition, nativeCurve: UIViewAnimationCurve, operation: UINavigationControllerOperation, fromVC: UIViewController, toVC: UIViewController): UIViewControllerAnimatedTransitioning {
|
||||
const instance = <Transition>navigationTransition.instance;
|
||||
let transition: Transition;
|
||||
export function _createIOSAnimatedTransitioning(
|
||||
navigationTransition: NavigationTransition,
|
||||
nativeCurve: UIViewAnimationCurve,
|
||||
operation: UINavigationControllerOperation,
|
||||
fromVC: UIViewController,
|
||||
toVC: UIViewController
|
||||
): UIViewControllerAnimatedTransitioning {
|
||||
const instance = <Transition>navigationTransition.instance;
|
||||
let transition: Transition;
|
||||
|
||||
if (instance) {
|
||||
// Instance transition should take precedence even if the given name match existing transition.
|
||||
transition = instance;
|
||||
} else if (navigationTransition.name) {
|
||||
const name = navigationTransition.name.toLowerCase();
|
||||
if (name.indexOf("slide") === 0) {
|
||||
const direction = name.substr("slide".length) || "left"; //Extract the direction from the string
|
||||
transition = new SlideTransition(direction, navigationTransition.duration, nativeCurve);
|
||||
} else if (name === "fade") {
|
||||
transition = new FadeTransition(navigationTransition.duration, nativeCurve);
|
||||
}
|
||||
}
|
||||
if (instance) {
|
||||
// Instance transition should take precedence even if the given name match existing transition.
|
||||
transition = instance;
|
||||
} else if (navigationTransition.name) {
|
||||
const name = navigationTransition.name.toLowerCase();
|
||||
if (name.indexOf("slide") === 0) {
|
||||
const direction = name.substr("slide".length) || "left"; //Extract the direction from the string
|
||||
transition = new SlideTransition(
|
||||
direction,
|
||||
navigationTransition.duration,
|
||||
nativeCurve
|
||||
);
|
||||
} else if (name === "fade") {
|
||||
transition = new FadeTransition(
|
||||
navigationTransition.duration,
|
||||
nativeCurve
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
return transition ? AnimatedTransitioning.init(transition, operation, fromVC, toVC) : undefined;
|
||||
return transition
|
||||
? AnimatedTransitioning.init(transition, operation, fromVC, toVC)
|
||||
: undefined;
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//@private
|
||||
export const enum AnimationType {
|
||||
enterFakeResourceId = -10,
|
||||
exitFakeResourceId = -20,
|
||||
popEnterFakeResourceId = -30,
|
||||
popExitFakeResourceId = -40
|
||||
enterFakeResourceId = -10,
|
||||
exitFakeResourceId = -20,
|
||||
popEnterFakeResourceId = -30,
|
||||
popExitFakeResourceId = -40,
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -5,103 +5,145 @@ import { Transition } from "../transition";
|
||||
import { Observable } from "../../data/observable";
|
||||
|
||||
export enum NavigationType {
|
||||
back,
|
||||
forward,
|
||||
replace
|
||||
back,
|
||||
forward,
|
||||
replace,
|
||||
}
|
||||
|
||||
export interface TransitionState {
|
||||
enterTransitionListener: any;
|
||||
exitTransitionListener: any;
|
||||
reenterTransitionListener: any;
|
||||
returnTransitionListener: any;
|
||||
transitionName: string;
|
||||
entry: BackstackEntry;
|
||||
enterTransitionListener: any;
|
||||
exitTransitionListener: any;
|
||||
reenterTransitionListener: any;
|
||||
returnTransitionListener: any;
|
||||
transitionName: string;
|
||||
entry: BackstackEntry;
|
||||
}
|
||||
|
||||
export interface ViewEntry {
|
||||
moduleName?: string;
|
||||
create?: () => View;
|
||||
moduleName?: string;
|
||||
create?: () => View;
|
||||
}
|
||||
|
||||
export interface NavigationEntry extends ViewEntry {
|
||||
context?: any;
|
||||
bindingContext?: any;
|
||||
animated?: boolean;
|
||||
transition?: NavigationTransition;
|
||||
transitioniOS?: NavigationTransition;
|
||||
transitionAndroid?: NavigationTransition;
|
||||
backstackVisible?: boolean;
|
||||
clearHistory?: boolean;
|
||||
context?: any;
|
||||
bindingContext?: any;
|
||||
animated?: boolean;
|
||||
transition?: NavigationTransition;
|
||||
transitioniOS?: NavigationTransition;
|
||||
transitionAndroid?: NavigationTransition;
|
||||
backstackVisible?: boolean;
|
||||
clearHistory?: boolean;
|
||||
}
|
||||
|
||||
export interface NavigationContext {
|
||||
entry: BackstackEntry;
|
||||
// TODO: remove isBackNavigation for NativeScript 7.0
|
||||
isBackNavigation: boolean;
|
||||
navigationType: NavigationType;
|
||||
entry: BackstackEntry;
|
||||
// TODO: remove isBackNavigation for NativeScript 7.0
|
||||
isBackNavigation: boolean;
|
||||
navigationType: NavigationType;
|
||||
}
|
||||
|
||||
export interface NavigationTransition {
|
||||
name?: string;
|
||||
instance?: Transition;
|
||||
duration?: number;
|
||||
curve?: any;
|
||||
name?: string;
|
||||
instance?: Transition;
|
||||
duration?: number;
|
||||
curve?: any;
|
||||
}
|
||||
|
||||
export interface BackstackEntry {
|
||||
entry: NavigationEntry;
|
||||
resolvedPage: Page;
|
||||
navDepth: number;
|
||||
fragmentTag: string;
|
||||
fragment?: any;
|
||||
viewSavedState?: any;
|
||||
frameId?: number;
|
||||
recreated?: boolean;
|
||||
entry: NavigationEntry;
|
||||
resolvedPage: Page;
|
||||
navDepth: number;
|
||||
fragmentTag: string;
|
||||
fragment?: any;
|
||||
viewSavedState?: any;
|
||||
frameId?: number;
|
||||
recreated?: boolean;
|
||||
}
|
||||
|
||||
export interface AndroidFrame extends Observable {
|
||||
rootViewGroup: any /* android.view.ViewGroup */;
|
||||
activity: any /* androidx.appcompat.app.AppCompatActivity */;
|
||||
currentActivity: any /* androidx.appcompat.app.AppCompatActivity */;
|
||||
actionBar: any /* android.app.ActionBar */;
|
||||
showActionBar: boolean;
|
||||
fragmentForPage(entry: BackstackEntry): any;
|
||||
rootViewGroup: any /* android.view.ViewGroup */;
|
||||
activity: any /* androidx.appcompat.app.AppCompatActivity */;
|
||||
currentActivity: any /* androidx.appcompat.app.AppCompatActivity */;
|
||||
actionBar: any /* android.app.ActionBar */;
|
||||
showActionBar: boolean;
|
||||
fragmentForPage(entry: BackstackEntry): any;
|
||||
}
|
||||
|
||||
export interface AndroidActivityCallbacks {
|
||||
getRootView(): View;
|
||||
resetActivityContent(activity: any): void;
|
||||
getRootView(): View;
|
||||
resetActivityContent(activity: any): void;
|
||||
|
||||
onCreate(activity: any, savedInstanceState: any, intent: any, superFunc: Function): void;
|
||||
onSaveInstanceState(activity: any, outState: any, superFunc: Function): void;
|
||||
onStart(activity: any, superFunc: Function): void;
|
||||
onStop(activity: any, superFunc: Function): void;
|
||||
onPostResume(activity: any, superFunc: Function): void;
|
||||
onDestroy(activity: any, superFunc: Function): void;
|
||||
onBackPressed(activity: any, superFunc: Function): void;
|
||||
onRequestPermissionsResult(activity: any, requestCode: number, permissions: Array<String>, grantResults: Array<number>, superFunc: Function): void;
|
||||
onActivityResult(activity: any, requestCode: number, resultCode: number, data: any, superFunc: Function);
|
||||
onNewIntent(activity: any, intent: any, superSetIntentFunc: Function, superFunc: Function): void;
|
||||
onCreate(
|
||||
activity: any,
|
||||
savedInstanceState: any,
|
||||
intent: any,
|
||||
superFunc: Function
|
||||
): void;
|
||||
onSaveInstanceState(
|
||||
activity: any,
|
||||
outState: any,
|
||||
superFunc: Function
|
||||
): void;
|
||||
onStart(activity: any, superFunc: Function): void;
|
||||
onStop(activity: any, superFunc: Function): void;
|
||||
onPostResume(activity: any, superFunc: Function): void;
|
||||
onDestroy(activity: any, superFunc: Function): void;
|
||||
onBackPressed(activity: any, superFunc: Function): void;
|
||||
onRequestPermissionsResult(
|
||||
activity: any,
|
||||
requestCode: number,
|
||||
permissions: Array<String>,
|
||||
grantResults: Array<number>,
|
||||
superFunc: Function
|
||||
): void;
|
||||
onActivityResult(
|
||||
activity: any,
|
||||
requestCode: number,
|
||||
resultCode: number,
|
||||
data: any,
|
||||
superFunc: Function
|
||||
);
|
||||
onNewIntent(
|
||||
activity: any,
|
||||
intent: any,
|
||||
superSetIntentFunc: Function,
|
||||
superFunc: Function
|
||||
): void;
|
||||
}
|
||||
|
||||
export interface AndroidFragmentCallbacks {
|
||||
onHiddenChanged(fragment: any, hidden: boolean, superFunc: Function): void;
|
||||
onCreateAnimator(fragment: any, transit: number, enter: boolean, nextAnim: number, superFunc: Function): any;
|
||||
onCreate(fragment: any, savedInstanceState: any, superFunc: Function): void;
|
||||
onCreateView(fragment: any, inflater: any, container: any, savedInstanceState: any, superFunc: Function): any;
|
||||
onSaveInstanceState(fragment: any, outState: any, superFunc: Function): void;
|
||||
onDestroyView(fragment: any, superFunc: Function): void;
|
||||
onDestroy(fragment: any, superFunc: Function): void;
|
||||
onPause(fragment: any, superFunc: Function): void;
|
||||
onStop(fragment: any, superFunc: Function): void;
|
||||
toStringOverride(fragment: any, superFunc: Function): string;
|
||||
onHiddenChanged(fragment: any, hidden: boolean, superFunc: Function): void;
|
||||
onCreateAnimator(
|
||||
fragment: any,
|
||||
transit: number,
|
||||
enter: boolean,
|
||||
nextAnim: number,
|
||||
superFunc: Function
|
||||
): any;
|
||||
onCreate(fragment: any, savedInstanceState: any, superFunc: Function): void;
|
||||
onCreateView(
|
||||
fragment: any,
|
||||
inflater: any,
|
||||
container: any,
|
||||
savedInstanceState: any,
|
||||
superFunc: Function
|
||||
): any;
|
||||
onSaveInstanceState(
|
||||
fragment: any,
|
||||
outState: any,
|
||||
superFunc: Function
|
||||
): void;
|
||||
onDestroyView(fragment: any, superFunc: Function): void;
|
||||
onDestroy(fragment: any, superFunc: Function): void;
|
||||
onPause(fragment: any, superFunc: Function): void;
|
||||
onStop(fragment: any, superFunc: Function): void;
|
||||
toStringOverride(fragment: any, superFunc: Function): string;
|
||||
}
|
||||
|
||||
/* tslint:disable */
|
||||
export interface iOSFrame {
|
||||
/* tslint:enable */
|
||||
controller: any /* UINavigationController */;
|
||||
navBarVisibility: "auto" | "never" | "always";
|
||||
_disableNavBarAnimation: boolean;
|
||||
/* tslint:enable */
|
||||
controller: any /* UINavigationController */;
|
||||
navBarVisibility: "auto" | "never" | "always";
|
||||
_disableNavBarAnimation: boolean;
|
||||
}
|
||||
|
||||
@@ -4,47 +4,49 @@ import { FrameBase } from "./frame-common";
|
||||
export let frameStack: Array<FrameBase> = [];
|
||||
|
||||
export function topmost(): FrameBase {
|
||||
if (frameStack.length > 0) {
|
||||
return frameStack[frameStack.length - 1];
|
||||
}
|
||||
if (frameStack.length > 0) {
|
||||
return frameStack[frameStack.length - 1];
|
||||
}
|
||||
|
||||
return undefined;
|
||||
return undefined;
|
||||
}
|
||||
|
||||
export function _pushInFrameStack(frame: FrameBase): void {
|
||||
if (frame._isInFrameStack && frameStack[frameStack.length - 1] === frame) {
|
||||
return;
|
||||
}
|
||||
if (frame._isInFrameStack && frameStack[frameStack.length - 1] === frame) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (frame._isInFrameStack) {
|
||||
const indexOfFrame = frameStack.indexOf(frame);
|
||||
frameStack.splice(indexOfFrame, 1);
|
||||
}
|
||||
if (frame._isInFrameStack) {
|
||||
const indexOfFrame = frameStack.indexOf(frame);
|
||||
frameStack.splice(indexOfFrame, 1);
|
||||
}
|
||||
|
||||
frameStack.push(frame);
|
||||
frame._isInFrameStack = true;
|
||||
frameStack.push(frame);
|
||||
frame._isInFrameStack = true;
|
||||
}
|
||||
|
||||
export function _popFromFrameStack(frame: FrameBase): void {
|
||||
if (!frame._isInFrameStack) {
|
||||
return;
|
||||
}
|
||||
if (!frame._isInFrameStack) {
|
||||
return;
|
||||
}
|
||||
|
||||
const top = topmost();
|
||||
if (top !== frame) {
|
||||
throw new Error("Cannot pop a Frame which is not at the top of the navigation stack.");
|
||||
}
|
||||
const top = topmost();
|
||||
if (top !== frame) {
|
||||
throw new Error(
|
||||
"Cannot pop a Frame which is not at the top of the navigation stack."
|
||||
);
|
||||
}
|
||||
|
||||
frameStack.pop();
|
||||
frame._isInFrameStack = false;
|
||||
frameStack.pop();
|
||||
frame._isInFrameStack = false;
|
||||
}
|
||||
|
||||
export function _removeFromFrameStack(frame: FrameBase): void {
|
||||
if (!frame._isInFrameStack) {
|
||||
return;
|
||||
}
|
||||
if (!frame._isInFrameStack) {
|
||||
return;
|
||||
}
|
||||
|
||||
const index = frameStack.indexOf(frame);
|
||||
frameStack.splice(index, 1);
|
||||
frame._isInFrameStack = false;
|
||||
const index = frameStack.indexOf(frame);
|
||||
frameStack.splice(index, 1);
|
||||
frame._isInFrameStack = false;
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
735
nativescript-core/ui/frame/frame.d.ts
vendored
735
nativescript-core/ui/frame/frame.d.ts
vendored
@@ -9,205 +9,208 @@ import { Transition } from "../transition";
|
||||
* Nested frames are supported, enabling hierarchical navigation scenarios.
|
||||
*/
|
||||
export class Frame extends View {
|
||||
/**
|
||||
* Gets a frame by id.
|
||||
*/
|
||||
static getFrameById(id: string): Frame;
|
||||
/**
|
||||
* Gets a frame by id.
|
||||
*/
|
||||
static getFrameById(id: string): Frame;
|
||||
|
||||
/**
|
||||
* Gets the topmost frame in the frames stack. An application will typically has one frame instance. Multiple frames handle nested (hierarchical) navigation scenarios.
|
||||
*/
|
||||
static topmost(): Frame;
|
||||
/**
|
||||
* Gets the topmost frame in the frames stack. An application will typically has one frame instance. Multiple frames handle nested (hierarchical) navigation scenarios.
|
||||
*/
|
||||
static topmost(): Frame;
|
||||
|
||||
/**
|
||||
* Navigates back using the navigation hierarchy (if any). Updates the Frame stack as needed.
|
||||
* This method will start from the topmost Frame and will recursively search for an instance that has the canGoBack operation available.
|
||||
*/
|
||||
static goBack();
|
||||
/**
|
||||
* Navigates back using the navigation hierarchy (if any). Updates the Frame stack as needed.
|
||||
* This method will start from the topmost Frame and will recursively search for an instance that has the canGoBack operation available.
|
||||
*/
|
||||
static goBack();
|
||||
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
static reloadPage(context?: ModuleContext): void;
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
static reloadPage(context?: ModuleContext): void;
|
||||
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
static _stack(): Array<Frame>;
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
static _stack(): Array<Frame>;
|
||||
|
||||
/**
|
||||
* Navigates to the previous entry (if any) in the back stack.
|
||||
* @param to The backstack entry to navigate back to.
|
||||
*/
|
||||
goBack(to?: BackstackEntry);
|
||||
/**
|
||||
* Navigates to the previous entry (if any) in the back stack.
|
||||
* @param to The backstack entry to navigate back to.
|
||||
*/
|
||||
goBack(to?: BackstackEntry);
|
||||
|
||||
/**
|
||||
* Checks whether the goBack operation is available.
|
||||
*/
|
||||
canGoBack(): boolean;
|
||||
/**
|
||||
* Checks whether the goBack operation is available.
|
||||
*/
|
||||
canGoBack(): boolean;
|
||||
|
||||
/**
|
||||
* Navigates to a Page instance as described by the module name.
|
||||
* This method will require the module and will check for a Page property in the exports of the module.
|
||||
* @param pageModuleName The name of the module to require starting from the application root.
|
||||
* For example if you want to navigate to page called "myPage.js" in a folder called "subFolder" and your root folder is "app" you can call navigate method like this:
|
||||
* const frames = require("@nativescript/core/ui/frame");
|
||||
* frames.topmost().navigate("app/subFolder/myPage");
|
||||
*/
|
||||
navigate(pageModuleName: string);
|
||||
/**
|
||||
* Navigates to a Page instance as described by the module name.
|
||||
* This method will require the module and will check for a Page property in the exports of the module.
|
||||
* @param pageModuleName The name of the module to require starting from the application root.
|
||||
* For example if you want to navigate to page called "myPage.js" in a folder called "subFolder" and your root folder is "app" you can call navigate method like this:
|
||||
* const frames = require("@nativescript/core/ui/frame");
|
||||
* frames.topmost().navigate("app/subFolder/myPage");
|
||||
*/
|
||||
navigate(pageModuleName: string);
|
||||
|
||||
/**
|
||||
* Creates a new Page instance using the provided callback and navigates to that Page.
|
||||
* @param create The function to be used to create the new Page instance.
|
||||
*/
|
||||
navigate(create: () => Page);
|
||||
/**
|
||||
* Creates a new Page instance using the provided callback and navigates to that Page.
|
||||
* @param create The function to be used to create the new Page instance.
|
||||
*/
|
||||
navigate(create: () => Page);
|
||||
|
||||
/**
|
||||
* Navigates to a Page resolved by the provided NavigationEntry object.
|
||||
* Since there are a couple of ways to specify a Page instance through an entry, there is a resolution priority:
|
||||
* 1. entry.moduleName
|
||||
* 2. entry.create()
|
||||
* @param entry The NavigationEntry instance.
|
||||
*/
|
||||
navigate(entry: NavigationEntry);
|
||||
/**
|
||||
* Navigates to a Page resolved by the provided NavigationEntry object.
|
||||
* Since there are a couple of ways to specify a Page instance through an entry, there is a resolution priority:
|
||||
* 1. entry.moduleName
|
||||
* 2. entry.create()
|
||||
* @param entry The NavigationEntry instance.
|
||||
*/
|
||||
navigate(entry: NavigationEntry);
|
||||
|
||||
/**
|
||||
* Used to control the visibility the Navigation Bar in iOS and the Action Bar in Android.
|
||||
*/
|
||||
public actionBarVisibility: "auto" | "never" | "always";
|
||||
/**
|
||||
* Used to control the visibility the Navigation Bar in iOS and the Action Bar in Android.
|
||||
*/
|
||||
public actionBarVisibility: "auto" | "never" | "always";
|
||||
|
||||
/**
|
||||
* Gets the back stack of this instance.
|
||||
*/
|
||||
backStack: Array<BackstackEntry>;
|
||||
/**
|
||||
* Gets the back stack of this instance.
|
||||
*/
|
||||
backStack: Array<BackstackEntry>;
|
||||
|
||||
/**
|
||||
* Gets the Page instance the Frame is currently navigated to.
|
||||
*/
|
||||
currentPage: Page;
|
||||
/**
|
||||
* Gets the Page instance the Frame is currently navigated to.
|
||||
*/
|
||||
currentPage: Page;
|
||||
|
||||
/**
|
||||
* Gets the NavigationEntry instance the Frame is currently navigated to.
|
||||
*/
|
||||
currentEntry: NavigationEntry;
|
||||
/**
|
||||
* Gets the NavigationEntry instance the Frame is currently navigated to.
|
||||
*/
|
||||
currentEntry: NavigationEntry;
|
||||
|
||||
/**
|
||||
* Gets or sets if navigation transitions should be animated.
|
||||
*/
|
||||
animated: boolean;
|
||||
/**
|
||||
* Gets or sets if navigation transitions should be animated.
|
||||
*/
|
||||
animated: boolean;
|
||||
|
||||
/**
|
||||
* Gets or sets the default navigation transition for this frame.
|
||||
*/
|
||||
transition: NavigationTransition;
|
||||
/**
|
||||
* Gets or sets the default navigation transition for this frame.
|
||||
*/
|
||||
transition: NavigationTransition;
|
||||
|
||||
/**
|
||||
* Gets or sets if navigation transitions should be animated globally.
|
||||
*/
|
||||
static defaultAnimatedNavigation: boolean;
|
||||
/**
|
||||
* Gets or sets if navigation transitions should be animated globally.
|
||||
*/
|
||||
static defaultAnimatedNavigation: boolean;
|
||||
|
||||
/**
|
||||
* Gets or sets the default NavigationTransition for all frames across the app.
|
||||
*/
|
||||
static defaultTransition: NavigationTransition;
|
||||
/**
|
||||
* Gets or sets the default NavigationTransition for all frames across the app.
|
||||
*/
|
||||
static defaultTransition: NavigationTransition;
|
||||
|
||||
/**
|
||||
* Gets the AndroidFrame object that represents the Android-specific APIs for this Frame. Valid when running on Android OS.
|
||||
*/
|
||||
android: AndroidFrame;
|
||||
/**
|
||||
* Gets the AndroidFrame object that represents the Android-specific APIs for this Frame. Valid when running on Android OS.
|
||||
*/
|
||||
android: AndroidFrame;
|
||||
|
||||
/**
|
||||
* Gets the iOSFrame object that represents the iOS-specific APIs for this Frame. Valid when running on iOS.
|
||||
*/
|
||||
ios: iOSFrame;
|
||||
/**
|
||||
* Gets the iOSFrame object that represents the iOS-specific APIs for this Frame. Valid when running on iOS.
|
||||
*/
|
||||
ios: iOSFrame;
|
||||
|
||||
//@private
|
||||
/**
|
||||
* @private
|
||||
* @param entry to check
|
||||
*/
|
||||
isCurrent(entry: BackstackEntry): boolean;
|
||||
//@private
|
||||
/**
|
||||
* @private
|
||||
* @param entry to check
|
||||
*/
|
||||
isCurrent(entry: BackstackEntry): boolean;
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @param entry to set as current
|
||||
* @param navigationType
|
||||
*/
|
||||
setCurrent(entry: BackstackEntry, navigationType: NavigationType): void;
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
navigationQueueIsEmpty(): boolean;
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
navigationBarHeight: number;
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
_animationInProgress: boolean;
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
_currentEntry: BackstackEntry;
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
_executingContext: NavigationContext;
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
_processNavigationQueue(page: Page);
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
_getIsAnimatedNavigation(entry: NavigationEntry): boolean;
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
_getNavigationTransition(entry: NavigationEntry): NavigationTransition;
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
_updateActionBar(page?: Page, disableNavBarAnimation?: boolean);
|
||||
/**
|
||||
* @private
|
||||
* @param navigationContext
|
||||
*/
|
||||
public performNavigation(navigationContext: NavigationContext): void;
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
_getNavBarVisible(page: Page): boolean;
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
_findEntryForTag(fragmentTag: string): BackstackEntry;
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
_updateBackstack(entry: BackstackEntry, navigationType: NavigationType): void;
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
_pushInFrameStack();
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
_pushInFrameStackRecursive();
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
_removeFromFrameStack();
|
||||
//@endprivate
|
||||
/**
|
||||
* @private
|
||||
* @param entry to set as current
|
||||
* @param navigationType
|
||||
*/
|
||||
setCurrent(entry: BackstackEntry, navigationType: NavigationType): void;
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
navigationQueueIsEmpty(): boolean;
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
navigationBarHeight: number;
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
_animationInProgress: boolean;
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
_currentEntry: BackstackEntry;
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
_executingContext: NavigationContext;
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
_processNavigationQueue(page: Page);
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
_getIsAnimatedNavigation(entry: NavigationEntry): boolean;
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
_getNavigationTransition(entry: NavigationEntry): NavigationTransition;
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
_updateActionBar(page?: Page, disableNavBarAnimation?: boolean);
|
||||
/**
|
||||
* @private
|
||||
* @param navigationContext
|
||||
*/
|
||||
public performNavigation(navigationContext: NavigationContext): void;
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
_getNavBarVisible(page: Page): boolean;
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
_findEntryForTag(fragmentTag: string): BackstackEntry;
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
_updateBackstack(
|
||||
entry: BackstackEntry,
|
||||
navigationType: NavigationType
|
||||
): void;
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
_pushInFrameStack();
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
_pushInFrameStackRecursive();
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
_removeFromFrameStack();
|
||||
//@endprivate
|
||||
|
||||
/**
|
||||
* A basic method signature to hook an event listener (shortcut alias to the addEventListener method).
|
||||
* @param eventNames - String corresponding to events (e.g. "propertyChange"). Optionally could be used more events separated by `,` (e.g. "propertyChange", "change").
|
||||
* @param callback - Callback function which will be executed when event is raised.
|
||||
* @param thisArg - An optional parameter which will be used as `this` context for callback execution.
|
||||
*/
|
||||
on(eventNames: string, callback: (args: EventData) => void, thisArg?: any);
|
||||
/**
|
||||
* A basic method signature to hook an event listener (shortcut alias to the addEventListener method).
|
||||
* @param eventNames - String corresponding to events (e.g. "propertyChange"). Optionally could be used more events separated by `,` (e.g. "propertyChange", "change").
|
||||
* @param callback - Callback function which will be executed when event is raised.
|
||||
* @param thisArg - An optional parameter which will be used as `this` context for callback execution.
|
||||
*/
|
||||
on(eventNames: string, callback: (args: EventData) => void, thisArg?: any);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -250,143 +253,143 @@ export function _stack(): Array<Frame>;
|
||||
* Represents an entry to be used to create a view or load it form file
|
||||
*/
|
||||
export interface ViewEntry {
|
||||
/**
|
||||
* The name of the module containing the View instance to load. Optional.
|
||||
*/
|
||||
moduleName?: string;
|
||||
/**
|
||||
* The name of the module containing the View instance to load. Optional.
|
||||
*/
|
||||
moduleName?: string;
|
||||
|
||||
/**
|
||||
* A function used to create the View instance. Optional.
|
||||
*/
|
||||
create?: () => View;
|
||||
/**
|
||||
* A function used to create the View instance. Optional.
|
||||
*/
|
||||
create?: () => View;
|
||||
}
|
||||
/**
|
||||
* Represents an entry in passed to navigate method.
|
||||
*/
|
||||
export interface NavigationEntry extends ViewEntry {
|
||||
/**
|
||||
* An object passed to the onNavigatedTo callback of the Page. Typically this is used to pass some data among pages. Optional.
|
||||
*/
|
||||
context?: any;
|
||||
/**
|
||||
* An object passed to the onNavigatedTo callback of the Page. Typically this is used to pass some data among pages. Optional.
|
||||
*/
|
||||
context?: any;
|
||||
|
||||
/**
|
||||
* An object to become the binding context of the page navigating to. Optional.
|
||||
*/
|
||||
bindingContext?: any;
|
||||
/**
|
||||
* An object to become the binding context of the page navigating to. Optional.
|
||||
*/
|
||||
bindingContext?: any;
|
||||
|
||||
/**
|
||||
* True to navigate to the new Page using animated transitions, false otherwise.
|
||||
*/
|
||||
animated?: boolean;
|
||||
/**
|
||||
* True to navigate to the new Page using animated transitions, false otherwise.
|
||||
*/
|
||||
animated?: boolean;
|
||||
|
||||
/**
|
||||
* Specifies an optional navigation transition for all platforms. If not specified, the default platform transition will be used.
|
||||
*/
|
||||
transition?: NavigationTransition;
|
||||
/**
|
||||
* Specifies an optional navigation transition for all platforms. If not specified, the default platform transition will be used.
|
||||
*/
|
||||
transition?: NavigationTransition;
|
||||
|
||||
/**
|
||||
* Specifies an optional navigation transition for iOS. If not specified, the default platform transition will be used.
|
||||
*/
|
||||
transitioniOS?: NavigationTransition;
|
||||
/**
|
||||
* Specifies an optional navigation transition for iOS. If not specified, the default platform transition will be used.
|
||||
*/
|
||||
transitioniOS?: NavigationTransition;
|
||||
|
||||
/**
|
||||
* Specifies an optional navigation transition for Android. If not specified, the default platform transition will be used.
|
||||
*/
|
||||
transitionAndroid?: NavigationTransition;
|
||||
/**
|
||||
* Specifies an optional navigation transition for Android. If not specified, the default platform transition will be used.
|
||||
*/
|
||||
transitionAndroid?: NavigationTransition;
|
||||
|
||||
/**
|
||||
* True to record the navigation in the backstack, false otherwise.
|
||||
* If the parameter is set to false then the Page will be displayed but once navigated from it will not be able to be navigated back to.
|
||||
*/
|
||||
backstackVisible?: boolean;
|
||||
/**
|
||||
* True to record the navigation in the backstack, false otherwise.
|
||||
* If the parameter is set to false then the Page will be displayed but once navigated from it will not be able to be navigated back to.
|
||||
*/
|
||||
backstackVisible?: boolean;
|
||||
|
||||
/**
|
||||
* True to clear the navigation history, false otherwise. Very useful when navigating away from login pages.
|
||||
*/
|
||||
clearHistory?: boolean;
|
||||
/**
|
||||
* True to clear the navigation history, false otherwise. Very useful when navigating away from login pages.
|
||||
*/
|
||||
clearHistory?: boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* Represents a context passed to navigation methods.
|
||||
*/
|
||||
export interface NavigationContext {
|
||||
entry: BackstackEntry;
|
||||
isBackNavigation: boolean;
|
||||
navigationType: NavigationType;
|
||||
entry: BackstackEntry;
|
||||
isBackNavigation: boolean;
|
||||
navigationType: NavigationType;
|
||||
}
|
||||
|
||||
/**
|
||||
* Represents an object specifying a page navigation transition.
|
||||
*/
|
||||
export interface NavigationTransition {
|
||||
/**
|
||||
* Can be one of the built-in transitions:
|
||||
* - curl (same as curlUp) (iOS only)
|
||||
* - curlUp (iOS only)
|
||||
* - curlDown (iOS only)
|
||||
* - explode (Android Lollipop(21) and up only)
|
||||
* - fade
|
||||
* - flip (same as flipRight)
|
||||
* - flipRight
|
||||
* - flipLeft
|
||||
* - slide (same as slideLeft)
|
||||
* - slideLeft
|
||||
* - slideRight
|
||||
* - slideTop
|
||||
* - slideBottom
|
||||
*/
|
||||
name?: string;
|
||||
/**
|
||||
* Can be one of the built-in transitions:
|
||||
* - curl (same as curlUp) (iOS only)
|
||||
* - curlUp (iOS only)
|
||||
* - curlDown (iOS only)
|
||||
* - explode (Android Lollipop(21) and up only)
|
||||
* - fade
|
||||
* - flip (same as flipRight)
|
||||
* - flipRight
|
||||
* - flipLeft
|
||||
* - slide (same as slideLeft)
|
||||
* - slideLeft
|
||||
* - slideRight
|
||||
* - slideTop
|
||||
* - slideBottom
|
||||
*/
|
||||
name?: string;
|
||||
|
||||
/**
|
||||
* An user-defined instance of the "ui/transition".Transition class.
|
||||
*/
|
||||
instance?: Transition;
|
||||
/**
|
||||
* An user-defined instance of the "ui/transition".Transition class.
|
||||
*/
|
||||
instance?: Transition;
|
||||
|
||||
/**
|
||||
* The length of the transition in milliseconds. If you do not specify this, the default platform transition duration will be used.
|
||||
*/
|
||||
duration?: number;
|
||||
/**
|
||||
* The length of the transition in milliseconds. If you do not specify this, the default platform transition duration will be used.
|
||||
*/
|
||||
duration?: number;
|
||||
|
||||
/**
|
||||
* An optional transition animation curve. Possible values are contained in the [AnimationCurve enumeration](https://docs.nativescript.org/api-reference/modules/_ui_enums_.animationcurve.html).
|
||||
* Alternatively, you can pass an instance of type UIViewAnimationCurve for iOS or android.animation.TimeInterpolator for Android.
|
||||
*/
|
||||
curve?: any;
|
||||
/**
|
||||
* An optional transition animation curve. Possible values are contained in the [AnimationCurve enumeration](https://docs.nativescript.org/api-reference/modules/_ui_enums_.animationcurve.html).
|
||||
* Alternatively, you can pass an instance of type UIViewAnimationCurve for iOS or android.animation.TimeInterpolator for Android.
|
||||
*/
|
||||
curve?: any;
|
||||
}
|
||||
|
||||
/**
|
||||
* Represents an entry in the back stack of a Frame object.
|
||||
*/
|
||||
export interface BackstackEntry {
|
||||
entry: NavigationEntry;
|
||||
resolvedPage: Page;
|
||||
entry: NavigationEntry;
|
||||
resolvedPage: Page;
|
||||
|
||||
//@private
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
navDepth: number;
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
fragmentTag: string;
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
fragment?: any;
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
viewSavedState?: any;
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
frameId?: number;
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
recreated?: boolean;
|
||||
//@endprivate
|
||||
//@private
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
navDepth: number;
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
fragmentTag: string;
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
fragment?: any;
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
viewSavedState?: any;
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
frameId?: number;
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
recreated?: boolean;
|
||||
//@endprivate
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -395,65 +398,107 @@ export interface BackstackEntry {
|
||||
* To start a new Activity, a new Frame instance should be created and navigated to the desired Page.
|
||||
*/
|
||||
export interface AndroidFrame extends Observable {
|
||||
/**
|
||||
* Gets the native [android ViewGroup](http://developer.android.com/reference/android/view/ViewGroup.html) instance that represents the root layout part of the Frame.
|
||||
*/
|
||||
rootViewGroup: any /* android.view.ViewGroup */;
|
||||
/**
|
||||
* Gets the native [android ViewGroup](http://developer.android.com/reference/android/view/ViewGroup.html) instance that represents the root layout part of the Frame.
|
||||
*/
|
||||
rootViewGroup: any /* android.view.ViewGroup */;
|
||||
|
||||
/**
|
||||
* Gets the native [android Activity](http://developer.android.com/reference/android/app/Activity.html) instance associated with this Frame. In case of nested Frame objects, this property points to the activity of the root Frame.
|
||||
*/
|
||||
activity: any /* androidx.appcompat.app.AppCompatActivity */;
|
||||
/**
|
||||
* Gets the native [android Activity](http://developer.android.com/reference/android/app/Activity.html) instance associated with this Frame. In case of nested Frame objects, this property points to the activity of the root Frame.
|
||||
*/
|
||||
activity: any /* androidx.appcompat.app.AppCompatActivity */;
|
||||
|
||||
/**
|
||||
* Gets the current (foreground) activity for the application. This property will recursively traverse all existing Frame objects and check for own Activity property.
|
||||
*/
|
||||
currentActivity: any /* androidx.appcompat.app.AppCompatActivity */;
|
||||
/**
|
||||
* Gets the current (foreground) activity for the application. This property will recursively traverse all existing Frame objects and check for own Activity property.
|
||||
*/
|
||||
currentActivity: any /* androidx.appcompat.app.AppCompatActivity */;
|
||||
|
||||
/**
|
||||
* Gets the actionBar property of the currentActivity.
|
||||
*/
|
||||
actionBar: any /* android.app.ActionBar */;
|
||||
/**
|
||||
* Gets the actionBar property of the currentActivity.
|
||||
*/
|
||||
actionBar: any /* android.app.ActionBar */;
|
||||
|
||||
/**
|
||||
* Determines whether the Activity associated with this Frame will display an action bar or not.
|
||||
*/
|
||||
showActionBar: boolean;
|
||||
/**
|
||||
* Determines whether the Activity associated with this Frame will display an action bar or not.
|
||||
*/
|
||||
showActionBar: boolean;
|
||||
|
||||
/**
|
||||
* Finds the native androidx.fragment.app.Fragment instance created for the specified Page.
|
||||
* @param page The Page instance to search for.
|
||||
*/
|
||||
fragmentForPage(entry: BackstackEntry): any;
|
||||
/**
|
||||
* Finds the native androidx.fragment.app.Fragment instance created for the specified Page.
|
||||
* @param page The Page instance to search for.
|
||||
*/
|
||||
fragmentForPage(entry: BackstackEntry): any;
|
||||
}
|
||||
|
||||
export interface AndroidActivityCallbacks {
|
||||
getRootView(): View;
|
||||
resetActivityContent(activity: any): void;
|
||||
getRootView(): View;
|
||||
resetActivityContent(activity: any): void;
|
||||
|
||||
onCreate(activity: any, savedInstanceState: any, intent: any, superFunc: Function): void;
|
||||
onSaveInstanceState(activity: any, outState: any, superFunc: Function): void;
|
||||
onStart(activity: any, superFunc: Function): void;
|
||||
onStop(activity: any, superFunc: Function): void;
|
||||
onPostResume(activity: any, superFunc: Function): void;
|
||||
onDestroy(activity: any, superFunc: Function): void;
|
||||
onBackPressed(activity: any, superFunc: Function): void;
|
||||
onRequestPermissionsResult(activity: any, requestCode: number, permissions: Array<String>, grantResults: Array<number>, superFunc: Function): void;
|
||||
onActivityResult(activity: any, requestCode: number, resultCode: number, data: any, superFunc: Function);
|
||||
onNewIntent(activity: any, intent: any, superSetIntentFunc: Function, superFunc: Function): void;
|
||||
onCreate(
|
||||
activity: any,
|
||||
savedInstanceState: any,
|
||||
intent: any,
|
||||
superFunc: Function
|
||||
): void;
|
||||
onSaveInstanceState(
|
||||
activity: any,
|
||||
outState: any,
|
||||
superFunc: Function
|
||||
): void;
|
||||
onStart(activity: any, superFunc: Function): void;
|
||||
onStop(activity: any, superFunc: Function): void;
|
||||
onPostResume(activity: any, superFunc: Function): void;
|
||||
onDestroy(activity: any, superFunc: Function): void;
|
||||
onBackPressed(activity: any, superFunc: Function): void;
|
||||
onRequestPermissionsResult(
|
||||
activity: any,
|
||||
requestCode: number,
|
||||
permissions: Array<String>,
|
||||
grantResults: Array<number>,
|
||||
superFunc: Function
|
||||
): void;
|
||||
onActivityResult(
|
||||
activity: any,
|
||||
requestCode: number,
|
||||
resultCode: number,
|
||||
data: any,
|
||||
superFunc: Function
|
||||
);
|
||||
onNewIntent(
|
||||
activity: any,
|
||||
intent: any,
|
||||
superSetIntentFunc: Function,
|
||||
superFunc: Function
|
||||
): void;
|
||||
}
|
||||
|
||||
export interface AndroidFragmentCallbacks {
|
||||
onHiddenChanged(fragment: any, hidden: boolean, superFunc: Function): void;
|
||||
onCreateAnimator(fragment: any, transit: number, enter: boolean, nextAnim: number, superFunc: Function): any;
|
||||
onCreate(fragment: any, savedInstanceState: any, superFunc: Function): void;
|
||||
onCreateView(fragment: any, inflater: any, container: any, savedInstanceState: any, superFunc: Function): any;
|
||||
onSaveInstanceState(fragment: any, outState: any, superFunc: Function): void;
|
||||
onDestroyView(fragment: any, superFunc: Function): void;
|
||||
onDestroy(fragment: any, superFunc: Function): void;
|
||||
onPause(fragment: any, superFunc: Function): void;
|
||||
onStop(fragment: any, superFunc: Function): void;
|
||||
toStringOverride(fragment: any, superFunc: Function): string;
|
||||
onHiddenChanged(fragment: any, hidden: boolean, superFunc: Function): void;
|
||||
onCreateAnimator(
|
||||
fragment: any,
|
||||
transit: number,
|
||||
enter: boolean,
|
||||
nextAnim: number,
|
||||
superFunc: Function
|
||||
): any;
|
||||
onCreate(fragment: any, savedInstanceState: any, superFunc: Function): void;
|
||||
onCreateView(
|
||||
fragment: any,
|
||||
inflater: any,
|
||||
container: any,
|
||||
savedInstanceState: any,
|
||||
superFunc: Function
|
||||
): any;
|
||||
onSaveInstanceState(
|
||||
fragment: any,
|
||||
outState: any,
|
||||
superFunc: Function
|
||||
): void;
|
||||
onDestroyView(fragment: any, superFunc: Function): void;
|
||||
onDestroy(fragment: any, superFunc: Function): void;
|
||||
onPause(fragment: any, superFunc: Function): void;
|
||||
onStop(fragment: any, superFunc: Function): void;
|
||||
toStringOverride(fragment: any, superFunc: Function): string;
|
||||
}
|
||||
|
||||
/* tslint:disable */
|
||||
@@ -463,26 +508,28 @@ export interface AndroidFragmentCallbacks {
|
||||
* The navigation controller will automatically hide/show its navigation bar depending on the back stack of the Frame.
|
||||
*/
|
||||
export interface iOSFrame {
|
||||
/**
|
||||
* Gets the native [UINavigationController](https://developer.apple.com/library/prerelease/ios/documentation/UIKit/Reference/UINavigationController_Class/index.html) instance associated with this Frame.
|
||||
*/
|
||||
controller: any /* UINavigationController */;
|
||||
/**
|
||||
* Gets the native [UINavigationController](https://developer.apple.com/library/prerelease/ios/documentation/UIKit/Reference/UINavigationController_Class/index.html) instance associated with this Frame.
|
||||
*/
|
||||
controller: any /* UINavigationController */;
|
||||
|
||||
/**
|
||||
* Gets or sets the visibility of navigationBar.
|
||||
* Use NavBarVisibility enumeration - auto, never, always
|
||||
*/
|
||||
navBarVisibility: "auto" | "never" | "always";
|
||||
/**
|
||||
* Gets or sets the visibility of navigationBar.
|
||||
* Use NavBarVisibility enumeration - auto, never, always
|
||||
*/
|
||||
navBarVisibility: "auto" | "never" | "always";
|
||||
|
||||
//@private
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
_disableNavBarAnimation: boolean;
|
||||
//@endprivate
|
||||
//@private
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
_disableNavBarAnimation: boolean;
|
||||
//@endprivate
|
||||
}
|
||||
|
||||
export function setActivityCallbacks(activity: any /*androidx.appcompat.app.AppCompatActivity*/): void;
|
||||
export function setActivityCallbacks(
|
||||
activity: any /*androidx.appcompat.app.AppCompatActivity*/
|
||||
): void;
|
||||
//@private
|
||||
/**
|
||||
* @deprecated Use Frame.reloadPage() instead.
|
||||
@@ -493,5 +540,7 @@ export function reloadPage(context?: ModuleContext): void;
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
export function setFragmentCallbacks(fragment: any /*androidx.fragment.app.Fragment*/): void;
|
||||
export function setFragmentCallbacks(
|
||||
fragment: any /*androidx.fragment.app.Fragment*/
|
||||
): void;
|
||||
//@endprivate
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,54 +1,72 @@
|
||||
// Definitions for Android API lvl 21 transitions
|
||||
declare module android {
|
||||
export module transition {
|
||||
export abstract class Transition extends java.lang.Object {
|
||||
addListener(transition: Transition.TransitionListener): Transition;
|
||||
removeListener(transition: Transition.TransitionListener): Transition;
|
||||
setDuration(duration: number): Transition;
|
||||
setInterpolator(interpolator: android.animation.TimeInterpolator): Transition;
|
||||
}
|
||||
export module transition {
|
||||
export abstract class Transition extends java.lang.Object {
|
||||
addListener(transition: Transition.TransitionListener): Transition;
|
||||
removeListener(
|
||||
transition: Transition.TransitionListener
|
||||
): Transition;
|
||||
setDuration(duration: number): Transition;
|
||||
setInterpolator(
|
||||
interpolator: android.animation.TimeInterpolator
|
||||
): Transition;
|
||||
}
|
||||
|
||||
export abstract class Visibility extends android.transition.Transition {
|
||||
constructor();
|
||||
}
|
||||
export abstract class Visibility extends android.transition.Transition {
|
||||
constructor();
|
||||
}
|
||||
|
||||
export class Slide extends Visibility {
|
||||
constructor(slideEdge: number);
|
||||
}
|
||||
export class Slide extends Visibility {
|
||||
constructor(slideEdge: number);
|
||||
}
|
||||
|
||||
export class Fade extends Visibility {
|
||||
constructor(fadingMode: number);
|
||||
static IN: number;
|
||||
static OUT: number;
|
||||
}
|
||||
export class Fade extends Visibility {
|
||||
constructor(fadingMode: number);
|
||||
static IN: number;
|
||||
static OUT: number;
|
||||
}
|
||||
|
||||
export class Explode extends Visibility {
|
||||
constructor();
|
||||
}
|
||||
export class Explode extends Visibility {
|
||||
constructor();
|
||||
}
|
||||
|
||||
export module Transition {
|
||||
export interface TransitionListener {
|
||||
onTransitionStart(transition: android.transition.Transition): void;
|
||||
onTransitionEnd(transition: android.transition.Transition): void;
|
||||
onTransitionResume(transition: android.transition.Transition): void;
|
||||
onTransitionPause(transition: android.transition.Transition): void;
|
||||
onTransitionCancel(transition: android.transition.Transition): void;
|
||||
}
|
||||
}
|
||||
}
|
||||
export module Transition {
|
||||
export interface TransitionListener {
|
||||
onTransitionStart(
|
||||
transition: android.transition.Transition
|
||||
): void;
|
||||
onTransitionEnd(
|
||||
transition: android.transition.Transition
|
||||
): void;
|
||||
onTransitionResume(
|
||||
transition: android.transition.Transition
|
||||
): void;
|
||||
onTransitionPause(
|
||||
transition: android.transition.Transition
|
||||
): void;
|
||||
onTransitionCancel(
|
||||
transition: android.transition.Transition
|
||||
): void;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export module app {
|
||||
export interface Fragment {
|
||||
getEnterTransition(): android.transition.Transition;
|
||||
getExitTransition(): android.transition.Transition;
|
||||
getReenterTransition(): android.transition.Transition;
|
||||
getReturnTransition(): android.transition.Transition;
|
||||
setEnterTransition(transition: android.transition.Transition): void;
|
||||
setExitTransition(transition: android.transition.Transition): void;
|
||||
setReenterTransition(transition: android.transition.Transition): void;
|
||||
setReturnTransition(transition: android.transition.Transition): void;
|
||||
setAllowEnterTransitionOverlap(allow: boolean): void;
|
||||
setAllowReturnTransitionOverlap(allow: boolean): void;
|
||||
}
|
||||
}
|
||||
export module app {
|
||||
export interface Fragment {
|
||||
getEnterTransition(): android.transition.Transition;
|
||||
getExitTransition(): android.transition.Transition;
|
||||
getReenterTransition(): android.transition.Transition;
|
||||
getReturnTransition(): android.transition.Transition;
|
||||
setEnterTransition(transition: android.transition.Transition): void;
|
||||
setExitTransition(transition: android.transition.Transition): void;
|
||||
setReenterTransition(
|
||||
transition: android.transition.Transition
|
||||
): void;
|
||||
setReturnTransition(
|
||||
transition: android.transition.Transition
|
||||
): void;
|
||||
setAllowEnterTransitionOverlap(allow: boolean): void;
|
||||
setAllowReturnTransitionOverlap(allow: boolean): void;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user