Coder Social home page Coder Social logo

thenativescriptbook's People

Contributors

mikebranstein avatar nickbranstein avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

thenativescriptbook's Issues

CH7. android resources file name limitation

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.

  • What went wrong:
    Execution failed for task ':app:mergeDebugResources'.

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

  • Try:
    Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
  • Get more help at https://help.gradle.org
    BUILD FAILED in 3s

Problem with SelectDateComponent on chapter 17

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

calcAge not working chapter 8

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>

Ch8 - PetScrapbook code crashing and doesn't work correctly

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)

  1. Start the app.
  2. On the Home page, tap "Continue".
  3. On the Pet Scrapbook list page, either tap the existing empty "undefined Scrapbook Page" entry, or tap "Add" to create a new one.
  4. In the settings page, define your settings.
  5. Tap "Done".
  6. The page will slide out towards the left (so it will give you the illusion as if you are moving towards the next (right) page.
  7. The page you arrive to will be completely blank, but there will be an "Add" button in the ActionBar on the right.
  8. Tap the "Add" button in the top right.
  9. The app will crash.

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

PetScrapbook sample project failing to launch scrapbook-page

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

CH8 - Problems with DatePicker

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());

Examples incompatible with 4.0.2 ?

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')

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.