Skip to content

Instantly share code, notes, and snippets.

One of the main goals of tns-core-modules@4.0 is to enable more flexible composition of UI. Let's start with some history. Before 4.0 we create Frame control for you (check application.ios.ts and frame.android.ts). Frame control allows you to do navigation forward or backward. While this is convenient it introduce other issues that can't be workaround easliy. For example if you want to have TabView in all pages you have to include it in the xml and set its selectedIndex so that once you navigate to different page a correct TabViewItem is selected. This leads to several problems:

  • parse more xml
  • increase memory usage
  • increase loading time

Same issues apply if you want to have SideDrawer control as a root component.

So in order to resolve these starting with 4.0 applicat

@vchimev
vchimev / update-angular5-webpack
Last active December 8, 2017 12:10
Steps to upgrade a {N} app to angular 5 and webpack.
npm install --save tns-core-modules@next
npm install --save nativescript-angular@next
node_modules/.bin/update-app-ng-deps
npm install --save nativescript-pro-ui@next
npm install --save-dev nativescript-dev-webpack@next
- add `update-ns-webpack` script - could add this script on install?
```
"scripts": {
"update-ns-webpack": "update-ns-webpack",
@vchimev
vchimev / reset-emulators.sh
Created November 28, 2017 09:50
A `bash` script to reset Android emulators.
#!/bin/bash
var=$(android -h)
configure_emulators() {
# Append "hw.gpu.enabled=yes", "hw.lcd.density=240" and "skin.name=480x800" to config.ini file of each emulator
find ~/.android/avd -type f -name 'config.ini' -exec bash -c 'echo $0 && echo "hw.lcd.density=240" | tee -a $0 && echo "skin.name=480x800" | tee -a $0 && echo "hw.gpu.enabled=yes" | tee -a $0 && echo "hw.keyboard=no" | tee -a $0 && cat $0' {} \;
}
echo "Cleanup existing emulators!"
@vchimev
vchimev / ENOENT
Created September 14, 2017 21:25
0 info it worked if it ends with ok
1 verbose cli [ '/usr/local/bin/node',
1 verbose cli '/usr/local/bin/npm',
1 verbose cli 'i',
1 verbose cli '-g',
1 verbose cli 'nativescript' ]
2 info using npm@5.3.0
3 info using node@v8.4.0
4 verbose npm-session c45e9246c762d353
5 silly install loadCurrentTree
@vchimev
vchimev / publish
Created August 9, 2017 14:44 — forked from sis0k0/publish
simple bash script for npm packages publish prepare
#!/bin/bash
set -e
# release defaults to patch (last number in semver)
RELEASE="patch" && [ -n "$1" ] && RELEASE=$1
# cut the release
VERSION=$(npm --no-git-tag-version version $RELEASE | sed 's/v//')
git add package.json
git commit -m "release: cut the $VERSION release"
I: Using Apktool 2.2.1
I: Checking whether sources has changed...
I: Smaling smali folder into classes.dex...
I: Checking whether resources has changed...
I: Building resources...
W: /Users/nsbuilduser/workspace/tns-modules-PR/AndroidTestApp/res/values-v24/styles.xml:7: error: Error retrieving parent for item: No resource found that matches the given name '@android:style/Animation.OptionsPanel'.
W:
W: /Users/nsbuilduser/workspace/tns-modules-PR/AndroidTestApp/res/values-v24/styles.xml:8: error: Error retrieving parent for item: No resource found that matches the given name '@android:style/Animation.LockScreen'.
W:
Exception in thread "main" brut.androlib.AndrolibException: brut.androlib.AndrolibException: brut.common.BrutException: could not exec (exit code = 1): [/var/folders/0z/36pc0x513611h_zzwnddp9zw3wctsh/T/brut_util_Jar_64184121466194604.tmp, p, --forced-package-id, 127, --min-sdk-version, 17, --target-sdk-version, 25, --version-code, 1, --version-name, 1.0, -F, /var/folders/0z/36pc0x513611h_zzwnddp9z
@vchimev
vchimev / qsf
Created December 1, 2016 13:04
12-01 15:01:58.848 10936 10936 V JS : Firebase init!!!
12-01 15:01:58.983 10936 10936 V JS : onLaunch
12-01 15:01:58.994 10936 10936 I ATA : Initializing ACRA...
12-01 15:01:58.996 10936 10936 D ACRA : ACRA is enabled for org.nativescript.examples, initializing...
12-01 15:01:58.997 10936 10936 D ACRA : Using custom Report Fields
12-01 15:01:59.000 10936 10936 D ACRA : Looking for error files in /data/user/0/org.nativescript.examples/files
12-01 15:01:59.000 10936 10936 I ATA : Creating ACRA AnalyticsReportSender...
12-01 15:01:59.000 10936 10936 I ATA : Creating Telerik AnalyticsMonitor with product key 8c086e8562544cc9b378eb4b0505da4a and application version code 17.0...
12-01 15:01:59.005 10936 10936 I ATA : Telerik AnalyticsMonitor created with installationId fa62306f-6a06-494a-b6b2-243c2f78c665
12-01 15:01:59.006 10936 10936 I ATA : ACRA AnalyticsReportSender created.
--------- beginning of system
11-22 17:55:52.807 909 3872 D ConnectivityService: reportNetworkConnectivity(821, false) by 10012
11-22 17:55:52.809 909 3256 D ConnectivityService: NetworkAgentInfo [WIFI () - 821] EVENT_NETWORK_INFO_CHANGED, going from CONNECTED to DISCONNECTED
11-22 17:55:52.809 909 3256 D ConnectivityService: NetworkAgentInfo [WIFI () - 821] got DISCONNECTED, was satisfying 5
11-22 17:55:52.829 909 3256 D ConnectivityService: notifyType LOST for NetworkAgentInfo [WIFI () - 821]
11-22 17:55:52.889 909 3256 D CSLegacyTypeTracker: Sending DISCONNECTED broadcast for type 1 NetworkAgentInfo [WIFI () - 821] isDefaultNetwork=true
11-22 17:55:52.889 909 3256 D ConnectivityService: sendStickyBroadcast: action=android.net.conn.CONNECTIVITY_CHANGE
11-22 17:55:52.958 909 3256 E ConnectivityService: EVENT_NETWORK_INFO_CHANGED from unknown NetworkAgent
11-22 17:55:52.958 909 3256 D ConnectivityService: setProvNotificationVisibleIntent null visible=false networkType=MOBILE extraInfo=
Process: TestApp [2678]
Path: /Users/USER/Library/Developer/CoreSimulator/Devices/3BC744DC-B10C-4282-BB3B-35A44646EE82/data/Containers/Bundle/Application/B905172D-38F8-49FD-A253-10A3B0F3DF3D/TestApp.app/TestApp
Identifier: TestApp
Version: 1.0 (1.0)
Code Type: X86-64 (Native)
Parent Process: launchd_sim [2587]
Responsible: TestApp [2678]
User ID: 1150864773
Date/Time: 2016-11-15 11:14:55.571 +0200
6:57:10 PM - File change detected. Starting incremental compilation...
<--- Last few GCs --->
662198 ms: Mark-sweep 1370.9 (1434.5) -> 1370.9 (1434.5) MB, 1340.7 / 0.0 ms [allocation failure] [GC in old space requested].
663599 ms: Mark-sweep 1370.9 (1434.5) -> 1370.9 (1434.5) MB, 1400.8 / 0.0 ms [allocation failure] [GC in old space requested].
665210 ms: Mark-sweep 1370.9 (1434.5) -> 1374.4 (1418.5) MB, 1610.4 / 0.0 ms [last resort gc].
666825 ms: Mark-sweep 1374.4 (1418.5) -> 1378.0 (1418.5) MB, 1614.5 / 0.0 ms [last resort gc].