mikebranstein / thenativescriptbook Goto Github PK
View Code? Open in Web Editor NEWLicense: MIT License
License: MIT License
File-based resource names must contain only lowercase a-z, 0-9, or underscore
below error occured when using "-" in filename as in the book.
[18-07-02 15:55:34.276] Error detected during LiveSync on xxx for D:_workspace\nativescript\Tekmo. Error: Command gradlew.bat failed with exit code 1 Error output:
FAILURE: Build failed with an exception.
D:_workspace\nativescript\Tekmo\platforms\android\app\src\main\res\drawable-hdpi\couch-commander.png: Error: '-' is not a valid file-based resource name character: File-based resource names must contain only lowercase a-z, 0-9, or underscore
D:_workspace\nativescript\Tekmo\platforms\android\app\src\main\res\drawable-ldpi\couch-commander.png: Error: '-' is not a valid file-based resource name character: File-based resource names must contain only lowercase a-z, 0-9, or underscore
D:_workspace\nativescript\Tekmo\platforms\android\app\src\main\res\drawable-mdpi\couch-commander.png: Error: '-' is not a valid file-based resource name character: File-based resource names must contain only lowercase a-z, 0-9, or underscore
D:_workspace\nativescript\Tekmo\platforms\android\app\src\main\res\drawable-xhdpi\couch-commander.png: Error: '-' is not a valid file-based resource name character: File-based resource names must contain only lowercase a-z, 0-9, or underscore
D:_workspace\nativescript\Tekmo\platforms\android\app\src\main\res\drawable-xxhdpi\couch-commander.png: Error: '-' is not a valid file-based resource name character: File-based resource names must contain only lowercase a-z, 0-9, or underscore
D:_workspace\nativescript\Tekmo\platforms\android\app\src\main\res\drawable-xxxhdpi\couch-commander.png: Error: '-' is not a valid file-based resource name character: File-based resource names must contain only lowercase a-z, 0-9, or underscore
Hello, I am having problems trying to use the SelectDateComponent as a modal.
Every time I tapped into <TextField [text]="page.BirthDate | date:'shortDate'" class="input" editable="false" (tap)="onBirthDateTap()" hint="Enter a birth date...">
via onBirthDateTap() the modal won't open and the following error appears on the console.
JS ERROR TypeError: value.getFullYear is not a function. (In 'value.getFullYear()', 'value.getFullYear' is undefined)
My setup:
Component │ Current version │ Latest version │ Information │
│ nativescript │ 3.4.1 │ 3.4.1 │ Up to date │
│ tns-core-modules │ 3.4.0 │ 3.4.0 │ Up to date │
│ tns-android │ │ 3.4.1 │ Not installed │
│ tns-ios │ 3.4.1 │ 3.4.1 │ Up to date
I have followed your book and even copy pasted from the repository files but still get the NaN error. Is there anything I am missing? I have even downgraded my tns and core-modules versions to match the repo. My code for scrapbook.js now:
`var observable = require("data/observable");
var frame = require("ui/frame");
var scrapbook;
exports.onLoaded = function(args) {
var page = args.object;
var scrapbook = new observable.fromObject({
genders: ["Female", "Male", "Other"],
calcAge: function(birthDate){
var now = Date.now();
var diff = Math.abs(now - birthDate) / 1000 / 31536000;
return diff.toFixed(1);
}
});
page.bindingContext = scrapbook;
};
exports.onDoneTap = function(args) {
var page = args.object;
frame.topmost().navigate({
moduleName: "packages/test/views/scrapbook-page",
context: { model: scrapbook }
});
};`
and the xml:
<Page loaded="onLoaded"> <StackLayout> <Label text="{{ title, title + ' Scrapbook Page' }}" /> <TextField class="header" text="{{ title }}" hint="Enter title..."/> <Label text="{{ 'Age: ' + calcAge(date) + ' years old'}} " /> <DatePicker year="{{ year }}" month="{{ month }}" day="{{ day }}" /> <Label text="Gender: " /> <ListPicker items="{{ genders }}" selectedIndex="{{ gender }}" /> <Button tap="onDoneTap" text="Done"/> </StackLayout> </Page>
Getting TypeError while converting image to Base64String in fileSystemService.js file in chapter9.
NativeScriptInAction/Chapter9/PetScrapbook/app/data/fileSystemService.js.
Thanks.
Vivek
Hello,
Just finished reading chapter 8 in the PDF book. Instead of typing all the code in for the PetScrapbook project, I decided to download it as a ZIP and run it. There seem to be a few issues with the code as provided.
ISSUE 1:
When you add a new scrapbook entry (or modify the existing one), when you tap "Done" it will navigate back in the wrong direction. It will navigate towards the right as opposed to towards the left. Also, the page you navigate back to, is completely blank, and the app will crash when you add a new list item entry.
STEPS:
(I am using the iOS emulator)
ISSUE 2:
On the settings page, the "Done" button is off the screen and cannot be seen on a 4.5" emulator (iOS 5S). I had to wrap the "ScrapBook Update Page" into a in order to see the "Done" button. No biggie, but still.
MY SETUP:
Using the iPhone 5S emulator for iOS 9.3.5 (since I have older devices they can only be updated up to iOS 9.3.5, so I'm using "matching" emulators for the iOS version).
OS X 10.11.6 El Capitan
Xcode 8.2.1 (this is the last Xcode version that runs on El Capitan 10.11.6)
Android Studio 3.0.1
JRE 1.8.0-152
tns 3.3.1
Hi Mike & Nick,
I was reviewing your book and got some errors while running some sample code for chapter 8, like "JS: Cannot find function or filter: calcAge" or some errors while initializing the observable object. So I thought to check your working example from Github for chapter 8, but this one is also giving me quite a few errors. and it's not even launching the scrapbook-page when I click continue button on homepage.
I am using windows machine and running Google Nexus Emulator with NativeScript Runtime version 3.0.0.
Thanks,
Vivek
I read that the book is available for free however the link: https://nativescript.org/get-the-nativescript-book/#
does not have a downloadable book. Would this be fixed soon?
Following the book so far and I am having a lot of trouble with DatePicker, because the way that it's used in this chapter leads to an undefined object message when logging
console.log("Age: " + scrapbook.date.toLocaleDateString());
Hi,
I've just begun implementing the books's examples with the latest version of NativeScript 4.0.2.
It seems though that some of the examples are not compatible with this last version, for example:
the code in 4.7 leads to
file:///app/views/home/home.js:6:23: JS ERROR TypeError: undefined is not an object (evaluating 'frameModule.topmost().navigate')
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.