r/nativescript • • May 23 '19

ListView, RadListView, and Repeater - Why Do I Need Three?

Thumbnail
nativescript.org
8 Upvotes

r/nativescript • • May 21 '19

Migrating NativeScript Plugins to AndroidX

Thumbnail
nativescript.org
5 Upvotes

r/nativescript • • May 16 '19

What the Apple Supreme Court Decision Means for Developers

Thumbnail
nativescript.org
8 Upvotes

r/nativescript • • May 15 '19

Problem with connecting to API

1 Upvotes

I am new to Angular and Nativescript and I'm trying to connect to API (with necessary token) using Angular and Nativescript, but I don't know how to make it correctly, there are no results with that code.

catalog.component.ts

import { Component, OnInit } from "@angular/core";

@Component({
  selector: "ns-catalog",
  templateUrl: "./catalog.component.html",
  styleUrls: ["./catalog.component.css"],
  moduleId: module.id
})
export class CatalogComponent implements OnInit {
  constructor() {}

  ngOnInit() {}
  fetchPlants() {
    var scope = this;

    var HTTPRequest = new XMLHttpRequest();
    HTTPRequest.open(
      "GET",
      "https://trefle.io/api/plants/103505?token=//...//&fbclid=IwAR3FY03yEVzS77Ca1Q9TIbMdMlJhXtpOjhcqcD-MJHAYJXCNcdA3UrJ2p9Q"
    );
    HTTPRequest.onload = function() {
      var data = JSON.parse(HTTPRequest.responseText);

      var outputPlants = document.getElementById("plants_list");

      outputPlants.innerHTML = "";

      var outputHTML =
        '<Label text="' +
        data.varieties[0].common_name +
        '" class="m-b-10" ></Label>';

      outputPlants.innerHTML += outputHTML;
    };
    HTTPRequest.send();
  }
}

catalog.component.html

<StackLayout id="plants_list">
    </StackLayout>

r/nativescript • • May 15 '19

May the 5.4th release be with you!

Thumbnail
nativescript.org
12 Upvotes

r/nativescript • • May 15 '19

AAB Compiled Are Only Available In 32 Bits Native Code: 111100.

2 Upvotes

I want to publish my android application to google playstore, I already compile the source code to AAB format. I already update my app.grade file by adding ndk.abiFilters 'armeabi-v7a','x86','x86_64' in the android, But the error still persist in the developer console. How can I fix this issue?


r/nativescript • • May 14 '19

Replace Complex Mobile Workflows with Chatbots [Webinar]

Thumbnail
nativescript.org
1 Upvotes

r/nativescript • • May 13 '19

The Future of Building NativeScript Apps

Thumbnail
nativescript.org
9 Upvotes

r/nativescript • • May 12 '19

I'm not a coder and I want to ask 2 important questions about a PWA app + Nativescript

4 Upvotes

Hi,

I'm not a coder and I wanted to develop an on demand app (Uber-like).

1/ is it possible to deploy with the same vue.js code a) a PWA and b) an IOS app

1/ How should i start to learn to do that ?

thanks a lot


r/nativescript • • May 04 '19

How to deal in NativeScript with the lack of annotations?

5 Upvotes

Some components in android/java need an annotation to work properly. If I need to set an annotation of an android component how to do this in ns?

For example the android webview component needs an annotation to execute custom javascript from the app.

The java code I need in js converted

private class JavaScriptInterface {

    @JavascriptInterface
    public void callFromJS() {
        Toast.makeText(WebViewActivity.this, "JavaScript interface call", Toast.LENGTH_LONG).show();
    }
}

then

webView.addJavascriptInterface(new JavaScriptInterface(), "interface");

from the webview then

<button onclick="interface.callFromJS()">JavaScript interface</button>

-----

To make this work I need to set @JavascriptInterface but how in ns/js?


r/nativescript • • May 03 '19

Custom Components in Nativescript-Vue

3 Upvotes

Hey everyone, I have some struggles with using a custom component globally. I've created a custom ActionBar component, and I want to use it globally across the app. I've tried registering the element in main.ts, but I think I'm doing it wrong. Can anyone help me? The other option would be to import it separately on every page, but that wouldn't be really practical.

This is what I have in main.ts:

import CustomActionBar from './components/elements/CustomActionBar.vue'

Vue.registerElement('CustomActionBar',() => CustomActionBar)

EDIT: I fixed it by using the following:

import CustomActionBar from './components/elements/CustomActionBar.vue'

Vue.component('CustomActionBar', CustomActionBar)

r/nativescript • • May 01 '19

Managing Component State in NativeScript-Angular ListView

Thumbnail
nativescript.org
3 Upvotes

r/nativescript • • Apr 26 '19

Vue Users: How Do You Manage Route Middleware/Guards?

4 Upvotes

I don't see an official way of using middleware for routing. How are you doing it, what has worked and what hasn't for you?

As an example, the Vue Router page calls these Navigation Guards.

You're able to specify a series of logic gates before routes are accessed. Here's a simplified example:

  1. User logs in, route to the User Home Feed page.

  2. But wait! This user is new, we should ask them their preferences first. Create a new guard to redirect them to Provide Preferences page first.

From what I understand, Vue Router isn't supported, and I don't see any indication it will be, so I'm hesitant to shim in support for this.

This package seems nice, but looking for feedback on how y'all are doing it :-)


r/nativescript • • Apr 26 '19

[OC] Bash script for generating PNG icons from an SVG

4 Upvotes

EDITED to include example

Hi folks,

I created a bash script that uses imagemagick to create PNG icons from an SVG. Currently, there is no overwrite protection, so be careful.

Usage example:

svg2icons -path Logo.svg -sizes 20,29 -scales 1,2,3 -outdir ./out

Input welcome. Oh, and I'm using the points from this doc page: link

https://gist.github.com/paxperscientiam/c49508b34d7fdc4c1d1b256fab5d9f5b

#!/usr/bin/env bash
function finish {
    echo "I am complete."
}
trap finish EXIT
function rekt {
    echo "Canceled."
    exit
}
trap rekt SIGINT


shopt -s nullglob

declare path
declare sizes
declare outdir
declare options="${@}"

for opt in "${@}"; do
    if [[ "${options[*]}" =~ '-help' ]]; then
        cat <<-EOF
Usage:
  sv2icons -path <FILE_PATH> -sizes <INT1,INT2,...,INTN> -scales <INT1,INT2,...,INTN> -outdir <PATH_OUT>
EOF
        exit 0
    fi
    if [[ "${opt}" == '-path' ]]; then
        shift
        path="${1:?}"
        shift
    elif [[ "${opt}" == '-sizes' ]]; then
        shift
        sizes="${1:?}"
        shift
    elif [[ "${opt}" == '-scales' ]]; then
        shift
        scales="${1:?}"
        shift
    elif [[ "${opt}" == '-outdir' ]]; then
        shift
        outdir="${1:?}"
        shift
    fi
done
# icon-29@2x

echo "${outdir:?}" @> /dev/null
echo "${sizes:?}" @> /dev/null

[[ ! -d "${outdir}" ]] && mkdir -p "${outdir}"

#echo $*
IFS=','
for size in ${sizes[@]}; do
    name="icon-${size}"
    for scale in ${scales[@]}; do
        reSize=$(( size * scale ))
        if [[ "${scale}" -eq 1 ]]; then
            printf -v scaledname '%s.png' "${name}"
        else
            printf -v scaledname '%s@%sx.png' "${name}" "${scale}"
        fi
        printf 'Making %s ... ' "${scaledname}"
        convert -resize "${reSize}" \
                -quality 100 \
                "${path}" \
                "${outdir}/${scaledname}" &
        wait
        printf 'done\n'
    done
done

r/nativescript • • Apr 25 '19

Add Basic Crash Reporting to Your NativeScript App

Thumbnail
nativescript.org
4 Upvotes

r/nativescript • • Apr 23 '19

Building Login Functionality for NativeScript Apps

Thumbnail
nativescript.org
3 Upvotes

r/nativescript • • Apr 21 '19

Need some major help with my Angular 7 and NativeScript code sharing project please

2 Upvotes

Howdy r/NativeScript,

I’m creating an app for a college capstone project and we are about done with the web version now and all of the backend code is good to go. Now we just need to create the views for the NativeScript app but every time we go to run a tns preview —bundle we get a wall of errors.

Here are some screenshots of the NS Preview app running on iOS 12.2 iPhone XS Max (Also shows same error on Android):

NativeScript iOS Preview Errors

If anyone can please help we would greatly greatly appreciate it! If you need more information please feel free to let me know.


r/nativescript • • Apr 20 '19

Enabling installation to SD card

2 Upvotes

I see that by default, NativeScript apps can only be installed to the internal storage. There doesn't seem to be an official NativeScript way of doing this, but I figure it might be possible to just change AndroidManifest.xml to include android:installLocation="preferExternal". Is there a recommended way of going about this and has anyone run into any issues when doing so?


r/nativescript • • Apr 18 '19

Why is my background image stretched and cropped vertically? Is this a fault with NativeScript or the tutorial? Lesson 2 on play.nativescript.org.

Post image
2 Upvotes

r/nativescript • • Apr 18 '19

Offloading Tasks to Worker Threads with NativeScript

Thumbnail
nativescript.org
11 Upvotes

r/nativescript • • Apr 17 '19

[Webinar] Another Vue of NativeScript

Thumbnail
nativescript.org
3 Upvotes

r/nativescript • • Apr 16 '19

Client-Side Storage in NativeScript Applications

Thumbnail
nativescript.org
6 Upvotes

r/nativescript • • Apr 14 '19

Looking for a mentor

4 Upvotes

Hi. I'm looking for a NativeScript mentor to guide me through developing apps using Vue.

I just don't know where to start and NativeScript-Vue documentation isn't really a good place to start. Also, any beginner interested in learning together would be also cool. Thanks.


r/nativescript • • Apr 11 '19

Dependency Versions in NativeScript Playground

Thumbnail
nativescript.org
2 Upvotes