mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-08-18 05:18:39 +08:00

* fix: crash at application launch on Android P Reference: https://developer.android.com/preview/restrictions-non-sdk-interfaces Android P introduces new restrictions on the use of non-SDK interfaces, whether directly, via reflection, or via JNI. These restrictions are applied whenever an app references a non-SDK interface or attempts to obtain its handle using reflection or JNI. In particular, remove reflection via Class.getDeclaredField() and fallback default transition to fade transition. * refactor: create default transition based on SDK version Create default transition and setup default animations based on SDK version. This is to avoid reflection via Class.getDeclaredMethod() for Android P where it throws. * refactor: extract isAndroidP method
Use the frame in the following way:
To navigate to the starting page of the application
// put this in the bootstrap.js
var app = require("application");
var frameModule = require("ui/frame");
app.onLaunch = function(context) {
var frame = new frameModule.Frame();
frame.navigate("testPage");
}
// or use the mainModule property of the application module
// in this a Frame instance is internally created and used to navigate to the main page module
app.mainModule = "testPage";
To navigate to a new Page
// take the frame from an existing (and navigatedTo) Page instance
var frame = page.frame;
frame.navigate("newPage");
To navigate to a new Activity (Android)
// create a new Frame instance
var frameModule = require("ui/frame");
var frame = new frameModule.Frame();
frame.navigate("newPage");