reactxp-navigation
Version:
Plugin for ReactXP that provides a navigation framework
70 lines (69 loc) • 2.85 kB
JavaScript
;
/**
* Types.ts
*
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT license.
* Type definitions for reactxp-naviigation extension.
*/
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
// Use only for type data
var React = require("react");
//
// Navigator
// ----------------------------------------------------------------------
var NavigatorSceneConfigType;
(function (NavigatorSceneConfigType) {
NavigatorSceneConfigType[NavigatorSceneConfigType["FloatFromRight"] = 0] = "FloatFromRight";
NavigatorSceneConfigType[NavigatorSceneConfigType["FloatFromLeft"] = 1] = "FloatFromLeft";
NavigatorSceneConfigType[NavigatorSceneConfigType["FloatFromBottom"] = 2] = "FloatFromBottom";
NavigatorSceneConfigType[NavigatorSceneConfigType["Fade"] = 3] = "Fade";
NavigatorSceneConfigType[NavigatorSceneConfigType["FadeWithSlide"] = 4] = "FadeWithSlide";
})(NavigatorSceneConfigType = exports.NavigatorSceneConfigType || (exports.NavigatorSceneConfigType = {}));
var CommandType;
(function (CommandType) {
CommandType[CommandType["Push"] = 0] = "Push";
CommandType[CommandType["Pop"] = 1] = "Pop";
CommandType[CommandType["Replace"] = 2] = "Replace";
})(CommandType = exports.CommandType || (exports.CommandType = {}));
var Navigator = /** @class */ (function (_super) {
__extends(Navigator, _super);
function Navigator() {
return _super !== null && _super.apply(this, arguments) || this;
}
return Navigator;
}(React.Component));
exports.Navigator = Navigator;
var NavigatorDelegate = /** @class */ (function () {
function NavigatorDelegate(navigator) {
var _this = this;
this.onBackPress = function () {
var routes = _this.getRoutes();
if (routes.length > 1) {
_this.handleBackPress();
if (_this._owner.props.navigateBackCompleted) {
_this._owner.props.navigateBackCompleted();
}
// Indicate that we handled the event.
return true;
}
return false;
};
this._owner = navigator;
}
return NavigatorDelegate;
}());
exports.NavigatorDelegate = NavigatorDelegate;