Browsing the NativeScript category

NativeScript Android publication reminder

You need to have a “strings.xml” file – it’s not made for you in the NativeScript command line.

In it, put the name of your app (as you want it to appear on the user’s phone).

Read the article

NativeScript iOS Pre-Publishing error

I got this error:

“Code signing is required for product type ‘Application’ in SDK ‘iOS 10.3′”

The trick was to re-run the “build” (and prepare) commands:

 

tns platform remove ios

tns platform add ios

tns build ios
tns build ios –release
tns prepare ios
THEN you’ll see the screen where you can specify the signing.
Also in the warnings, in “Update to Recommended Settings”, click the button for “Perform Changes”.
… Don’t re-run in XCode the emulator / on your phone or else it’ll disappear.
I haven’t figured out yet if doing a Clean + Build will mess things up or not…
But I’m really enjoying NativeScript!

Read the article

NativeScript Android process died and unfortunately stopped working

I received those errors in my NativeScript Android app; where at some points it “unfortunately stopped working” or in the CLI, it said the “process died”.

I re-created a brand new app and slowly copied/pasted pieces in.

I realized that it was my AndroidManifest.xml file that was wrong.

Specifically, I changed the application android:name  and  the activity android:name to something specific to my app (instead of “NativeScript”).   I think NativeScript uses that specific activity.

Don’t change the activity name nor the package name!  It’ll be updated for you when you “release” the app.

Read the article

NativeScript Android Font Awesome

I needed to use FontAwesome in my NativeScript app; it was working in iOS, but not in Android.

The trick was, in the CSS, add the part in bold:

font-family: 'FontAwesome', fontawesome-webfont;

 

…Note that this didn’t negatively affect the iOS running.

Read the article

Nativescript get value of textfield

I had to get the value of a textfield using JavaScript in NativeScript; I tried a bunch of things and ended up just using a global variable to bind it.

XML:

<TextField id=”searchBox” text=”{{searchContents}}” />

And in the <Page> tag, add in:

loaded=”loaded”

JavaScript:

var model = {searchContents: “”};

exports.loaded = function(e){
var page = e.object;
page.bindingContext = model;
}

 

Then I could get it with model.searchContents;

Read the article

nativescript doesn’t scroll

I’m creating an app with NativeScript.  I’m using the Grid Layout, but I’m noticing that my content doesn’t scroll.

 

Solution: enclose everything in a <ScrollView>

Ex.

<ScrollView orientation="vertical" height="100%"  width="100%">
  <GridView Here...>
</ScrollView>

Read the article

NativeScript installation error

I was getting an error trying to install NativeScript (on my Mac).  Here’s (part of) the error I got:

TypeError: Object function Object() { [native code] } has no method ‘assign’ at Object.<anonymous> (/usr/local/lib/node_modules/npm/lib/config/cmd-list.js:113:33)

 

The solution: I thought I had the right version of Node installed; but I didn’t.  Even after doing “brew update”.  I manually re-installed Node (going to the official site) to make sure I had the latest version; then I was able to run npm correctly.

Read the article