nativescript / docs-v7 Goto Github PK
View Code? Open in Web Editor NEWDocumentation, API reference, and code snippets for NativeScript
Home Page: https://docs.nativescript.org
License: Apache License 2.0
Documentation, API reference, and code snippets for NativeScript
Home Page: https://docs.nativescript.org
License: Apache License 2.0
Describe where does the console.log statement output its results
After reading through http://docs.nativescript.org/plugins/plugins and http://docs.nativescript.org/plugins/ui-plugin
It is still not entirely clear to me how a typescript plugin should be made aware of the various type declarations in the nativescript platform (including core modules and/or native types).
From @valentinstoychev on May 25, 2015 8:37
I know we have this article, but it doesn't show you how a basic layout is done and it is hard for web dev to get started with our layout system. We should start with simple scenarios and show the analogies.
Copied from original issue: NativeScript/NativeScript#212
The location documentation has a javascript snippet which is mostly typescript - it crashes the ios emulator:
var buttonModule = require("ui/button");
var appModule = require("application");
var platformModule = require("platform");
var onRequestButtonTap = function(args: observable.EventData) {
var button = <buttonModule.Button>(args.object);
if (button.android) {
console.log("Application run on Android");
(<android.app.Activity>appModule.android.currentContext).startActivityForResult(new android.content.Intent(android.provider.Settings.ACTION_LOCATION_SOURCE_SETTINGS), 0);
}
else if (button.ios) {
console.log("Application run on iOS");
if (platformModule.device.osVersion.indexOf("8") === 0) {
console.log("iOS version is greater or equal to 8.0");
var iosLocationManager = CLLocationManager.alloc().init();
iosLocationManager.requestWhenInUseAuthorization();
}
}
Further to this, this whole section is not as clear as it might be - it took me some time to decipher. I think it could be more obvious with an end-to-end example. The following is a suggested structure for the page:
To enable location services it is first required to configure a location service in the respective application bundles:
For an IOS 8.0+ project:
Add one of the two following snippets to <applicationName>-Info.plist
depending on your business needs:
<key>NSLocationAlwaysUsageDescription</key>
<string>Your message goes here</string>
<key>NSLocationWhenInUseUsageDescription</key>
<string>Your message goes here</string>
In an Android project:
<android example/instructions>
Next, a request to use the location service is required. Unfortunately... (section as it stands with corrected javascript snippet above)...
Either point to, or move the
HOW-TO page to this location in the interests of DRY. The HOW-TO page seems clearer, and contains more information (with less words).
The blocks of JavaScript and TypeScript are very similar in nature, and when next to each other do not always show the language type: https://github.com/NativeScript/docs/blob/master/ui-with-xml.md#declaring-application-mainmodule-and-start-the-application
Would you accept a PR for adding a language declaration above or in the language example block?
JavaScript
// Navigate to page called “my-page”
frames.topmost().navigate("app/my-page")
TypeScript
// Navigate to page called “my-page”
frames.topmost().navigate("app/my-page")
It really would be nice if the official documentation is updated in a timely manner based on changes --- especially breaking changes --- implemented in every version update/release.
For example, in the Application Management section, the supposedly obsolete "local-settings" module is still referenced in the text and sample code under "Persist and Restore Application Settings".
Note this page: https://github.com/NativeScript/docs/wiki/NativeScript-Android-Application-Initialization-with-JavaScript
Would it be possible to have examples describing setup in JavaScript ES6 (Harmony)?
A few trivial typos and errors in some sentences:
Please provide some samples, how long objects persist, etc etc...
In section 2.2 layouts the second point in tip has broken layout for layouts page.
It will be good to have these properties (listed as "inherited from ...").
Add support for multiple versions of the documentation.
An example would be the way the Ember.js documentation is organized.
Currently there is no documentation on how to create a release build, or how to submit an app to the app stores. IMO we should have a page that shows the basic process, starting with using the --release
flag. For things out of our control (Application Loader, iTunes Connect, Google Play Developer Console, etc), we could at least give people links to point them in the right direction.
This is outdated, for example, the function loadFromBase64 should be fromBase64
https://docs.nativescript.org/ApiReference/image-source/ImageSource.html
The UI components are lacking definitions for the XML properties that are available. For example, what attributes are valid for the Image
tag?
Based on reading the source code and some experiments, I believe the documentation at http://docs.nativescript.org/styling.html#page-specific-css is a bit faulty. It does not appear to be clear that if you attempt to set the Page.css property you are actually eliminating all CSS except the Application wide CSS. So if you use Page.addCss="..." or Page.addCssFile(...) and then do a Page.css = "..."; you will wipe out any and all other css that was added via all the prior calls.
From @valentinstoychev on June 9, 2015 5:55
Often is the question how to setup testing environment and it will be good if we have articles about this in the docs.
Copied from original issue: NativeScript/NativeScript#298
Our styling docs use the term “device-independent units”, but we never really explain what that term means.
I think we should add a small section in the styling docs to explain how, for example, margin: 5
actually gets applied in iOS and Android.
Is there a way to build nativescript docs in html or to build them similar to docs.nativescript.org ?
As described in this issue, the sizing of e.g. a a GridLayout's cols/rows can be set by a XAML-like sizing system, like "*, 3*, *"
. I haven't found this documented anyway and it's really a hidden gem as we quite often want to have non-pixel-sizing.
Docker is a great fit for NativeScript. instead of installing all the dependencies on the developer's laptop, everything can be inside a container and the installation can be done via a simple bash script.
It can be similar to this:
https://registry.hub.docker.com/u/kallikrein/android-cordova/
The iOS- and Android-specific links at the bottom of index.md are broken. I'd fix them but I'm not sure where they should link to.
From @valentinstoychev on June 24, 2015 5:58
Link to github repos and provide a summary of the features they are showing inside the code.
Update the getting started article to point to this page with the samples so that this become a natural next step fro everyone learning NativeScript.
Copied from original issue: NativeScript/NativeScript#354
Web view lacks a lot necessary functionality like callback uri and oauth support this is i guess very common these days. I even looked in web-viwe-common.js and android file but cannot find anything suitable?
Hey, which promise spec is NativeScript following. Do you have it documented somewhere?
Section 4.0 of the docs refers to the hard-coded API URL that utilizes HTTP:
module.exports = {
apiUrl: "http://api.everlive.com/v1/GWfRtXi1Lwt4jcqK/"
};
But the app employs HTTPS in the config.js
file for both the start and end branches.
If a user thought to change HTTPS of the repo to HTTP - to follow the docs - then you obtain the "Unfortunately we could not find your account" dialog and the following log:
2015-11-03 09:35:08.155 sampleGroceries[5287:133749] App Transport Security has blocked a cleartext HTTP (http://) resource load since it is insecure. Temporary exceptions can be configured via your app's Info.plist file.
file:///app/views/login/login.js:26:24: CONSOLE LOG TypeError: Network request failed
Perhaps the docs should be updated to reflect HTTPS?
i.e. https://docs.nativescript.org/styling#custom-fonts
The docs are very vague on how you include custom fonts and apply them.
Lets start to have only a single Changelog for all the repos, as currently there is no a single place where to point customers to see the changelog for a particular version.
An easy to implement idea is to just have a placeholder article that links to the existing changelogs.
mainViewModel.testButton = function () {
var http = require("http");
http.getJSON("http://httpbin.org/get").then(function (r) {
alert(JSON.stringify(r))
}).fail(function (e) {
// Argument (e) is Error!
alert("Failed")
});
}
when i click on button application is getting crashed. I changed the button action to a string alert, it worked. So i made some mistakes in http request part it seems.
I'd like to suggest that there be a single changelog file that lives at http://docs.nativescript.org/Changelog, and that links to the more detailed changelogs (CLI, runtimes, and modules).
My reasoning is we really need a single place we can link to in order to show people exactly what changed in a given release. For instance it'd be great if @NativeScript could tweet out, “1.1 is out! Here's what changed: http://docs.nativescript.org/changelog.
Ideally this “base” log could also give a three or four bullet summation of the release's major features, and again link to the more detailed changelogs or GitHub issues for more details.
cc @ligaz
From @sfeather on July 11, 2015 23:37
See https://kapeli.com/docsets for reference
Copied from original issue: NativeScript/NativeScript#420
http://docs.nativescript.org/hello-world/hello-world-ns-cli.html
Scetion "3. You can quickly check how your blank project looks like in the emulator or on device." suggests running created app on emulator right away, without mentioning that setting up an image is required.
var frameModule = require("ui/frame");
console.log(frameModule.topmost())
This always returns undefined?
The examples for using the CSS @import directive (http://docs.nativescript.org/styling) suggest using curly braces to surround the url...
@import { url('~/your-style.css') }
I think the braces should be omitted as I could only get the directive to work (in AppBuilder) using the following...
@import url('~/your-style.css')
Hi,
https://docs.nativescript.org/ApiReference/ui/layouts/grid-layout/HOW-TO.html is completely confusing as discussed in https://groups.google.com/forum/#!topic/nativescript/O-uimQ4GDDE .
Also it uses .setColumn which doesn't exist anymore, so the actual example in there is broken ("gridLayout.setColumn(button1, 0);" etc.).
An example that actually shows how it works would be greatly appreciated. Please make it for mor than one row, so that one of the most unclear points, which is how to feed the GridView with cells across rows, is done.
Also http://docs.nativescript.org/ApiReference/ui/layouts/grid-layout/GridLayout.html claims that .setColumn exists which it does not, so it should be removed!
And perhaps the same document should mention something so the reader can understand how data is fed to it.
(Trying to run .setColum gives the error "gridLayout.setColumn is not a function".)
Thanks!
Mike
Trying "width: 20%" on a button gives me a 0.4cm wide element. Looking in the documentation for what units exist e.g. px, cm, em, % and what that % relates to - like a box model or something - I don't find that.
Could you please document this?
Thanks!
Hi,
Are there any ready-to-compile example apps?
-G
See NativeScript/NativeScript#1197, as this has come up a lot.
A lot of people are using icon fonts in {N} apps, so I feel like we should add a quick note on our existing fonts documentation about using them—specifically this caveat about how to use them with data binding.
When i was following the nativescript guide (sample groceries) I couldn't visualize the list that supposely is contained in the [email protected] account. I was checking for any errorcode in the views models.js (grocery-view-model and user-view-model...). So i want to know how can I visualize it.
Thanks in advance.
Anargu
It would be great, that screenshot is displayed to show how it would look as an example. Since there are no known functions as shown.
Data binding is such an important feature in NativeScript and key to understanding its power.
Is it okay for the Documentation Team to find time to revisit the "App: Data Binding" doc and make it just a little bit easier to understand, especially the "Using expressions for bindings" section?
Thanks guys!
This request work fine under ionic mobile app using angular js http but never works in nativescript.
var url = "http://localhost/MySpecial.Authorisation.API/api/audience/SetClient";
debugger;
fetch.fetch(url, {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ UserName: "SuperUser", Password: "SuperUser" })
}).then(function (r) {
return r.json();
})
.then(function (r) {
console.log(result);
}, function (e) {
console.log("Error occurred " + e);
});
Android Setup:
{N} CLI:
Detour: How do I know which {N} modules I need in my code? This always has irritated me. I’d love some guidance on when I need to require which modules in KB doc.
[3.2] For me, anything output in console.log doesn’t show up in the terminal, but rather in the system.log in the simulator.
[4.3] “load function empties the list” à should be “empty function” I think
[4.5] Instructions there to “open list.js” and add some xml à should be list.xml
[5] minor spelling issue on “install and use and external…”
From @valentinstoychev on September 30, 2015 11:19
Copied from original issue: NativeScript/NativeScript#855
http://docs.nativescript.org/setup/ab-setup/ab-vse-setup.html
Instruction 5.2 should let the user know they can use PATH to see if it added the JDK successfully.
In the instructions, it just says "If not present.."
Also, the path to JDK will not appear in the same command prompt where they installed it. They will have to close the prompt and open it back up to check if the path was added successfully.
From @valentinstoychev on June 26, 2015 11:59
We need to know what events the UI components exposes and in what order they are created. This can be part of the Custom UI components article.
Copied from original issue: NativeScript/NativeScript#362
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.