![]() ![]() Just in case it isn't obvious - yes - I used something in NativeScript that worked perfectly fine for Cordova too. I used one of the methods I described in my blog post on the topic - Parsing RSS Feeds in JavaScript - Options. Again - that's possibly my fault.įinally, let's look at the view model. I had tried to bind directly to my instance of RssListViewModel, but noticed that content only updated one time. PageData.text = ('selectedItem').description īasically I ask for the data I saved in the previous view and update a local observable. Ok, so now the code behind the view.Ĭonsole.log(('selectedItem').title) I'm fairly certain it is probably my code, but I've let me friends on the NativeScript code know about what I encountered. Then I saw a noticeable lag in rendering the view. I did find odd performance issues with this control. I first used a TextView and of course that doesn't render HTML. I honestly don't know the difference (I just asked on Slack though so hopefully I'll get a clue ).Īgain - fairly simple. I didn't see that at first because when I went to the API reference in the docs, I was initially on the "Module" for Frame and not the "Class" for it. You can see that described here in the docs. I also discovered later that you can pass random data to another view via navigate. That seems trivial, but it took me forever to get around that. ![]() That meant when I set a value on it on the list page, I lost that when the object was recreated on the detail page. Why? At first, I was creating an instance of my view model, not just requiring it. This is how I handle "I'm leaving this view but want to remember what I clicked." This one thing took me roughly 70% of the development time for this project. Notice in loadItem() I call a set operation. This file basically handles asking the view model to do it's thing and return a list of RSS entries. So for the most part, this too is rather simple. ('selectedItem', ) įrameModule.topmost().navigate('views/item-page') Var viewModule = require('ui/core/view') Ĭonsole.log('tap item 2', ) Var Observable = require('data/observable').Observable Var RssListViewModel = require('./shared/view-models/rss-list-view-model') On top you can see a call to loaded() for when the page loads. Now let's take a look at the code.įirst off, the home page view, which is really just a list. That's a lot of text (partially because that blog entry really does have a lot of text at first) and not terribly nice looking, but it works. To be clear, that lovely red header there was me using my design chops. My RSS reader consists of two screens - an initial list based on the entries from an RSS feed and a detail page for the actual blog entry. (Although you are welcome to it - I'll have a link to the code at the end.) ![]() It works - but I'm sure I've done things like - well - a noob. Before going further, note that you should assume my code is crap. After working through the getting started guide, I thought I'd take a stab at building a simple app, a RSS reader. Last week I wrote up my initial thoughts on working with NativeScript. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |