moved files to app folder

This commit is contained in:
hariroshan 2023-01-11 18:41:23 +05:30
parent bfb857f3c1
commit 33f7bd51ff
13 changed files with 26 additions and 86 deletions

View File

@ -215,6 +215,21 @@ counter model =
, NA.selectedIndex "1"
]
[]
Native.listView
[ E.list E.int [ 2022, 2021, 2020, 2019, 2018, 2017 ] |> NA.items
, NA.itemTemplateSelector "{{ $value % 2 == 0 ? 'even' : 'odd' }}"
]
[ Layout.asElement <|
Layout.stackLayout
[ NA.key "even" ]
[ Native.label [ NA.text "{{ $value.toString() }}", NA.color "green" ] []
]
, Layout.asElement <|
Layout.stackLayout
[ NA.key "odd" ]
[ Native.label [ NA.text "{{ $value.toString() }}", NA.color "red" ] [] ]
]
-}
@ -226,10 +241,13 @@ detailsPage model =
[ Native.listView
[ E.list E.int [ 2022, 2021, 2020, 2019, 2018, 2017 ] |> NA.items
, NA.itemTemplateSelector "{{ $value % 2 == 0 ? 'even' : 'odd' }}"
, NA.separatorColor "#dedede"
]
[ Layout.asElement <|
Layout.stackLayout
[ NA.key "even" ]
[ NA.key "even"
, NA.padding "20, 20"
]
[ Native.label [ NA.text "{{ $value.toString() }}", NA.color "green" ] []
]
, Layout.asElement <|

View File

@ -1,2 +0,0 @@
<Frame defaultPage="main-page">
</Frame>

View File

@ -1,6 +1,7 @@
@import '@nativescript/theme/css/core.css';
@import '@nativescript/theme/css/default.css';
Button.-primary {
font-size: 18;
}
/* Label {
font-size: 23;
color: red;
} */

View File

@ -2,8 +2,6 @@ import Elm from "./Main.elm";
import { start } from "../elm-native-js/App.bs"
import { Application } from "@nativescript/core";
Application.setCssFileName('style.css')
start(
{
elmModule: Elm,

View File

@ -1,14 +0,0 @@
/*
In NativeScript, the app.ts file is the entry point to your application.
You can use this file to perform app-level initialization, but the primary
purpose of the file is to pass control to the apps first module.
*/
import { Application } from '@nativescript/core'
Application.run({ moduleName: 'app-root' })
/*
Do not place any code after the application has been started as it will not
be executed on iOS.
*/

View File

View File

@ -1,7 +0,0 @@
import { EventData, Page } from '@nativescript/core'
import { HelloWorldModel } from './main-view-model'
export function navigatingTo(args: EventData) {
const page = <Page>args.object
page.bindingContext = new HelloWorldModel()
}

View File

@ -1,9 +0,0 @@
<Page xmlns="http://schemas.nativescript.org/tns.xsd" navigatingTo="navigatingTo">
<ActionBar title="My App" icon="" />
<StackLayout class="p-20">
<Label text="Tap the button" class="h1 text-center" />
<Button text="TAP" tap="{{ onTap }}" class="-primary" />
<Label text="{{ message }}" class="h2 text-center" textWrap="true" />
</StackLayout>
</Page>

View File

@ -1,38 +0,0 @@
import { Observable } from '@nativescript/core'
export class HelloWorldModel extends Observable {
private _counter: number
private _message: string
constructor() {
super()
// Initialize default values.
this._counter = 42
this.updateMessage()
}
get message(): string {
return this._message
}
set message(value: string) {
if (this._message !== value) {
this._message = value
this.notifyPropertyChange('message', value)
}
}
onTap() {
this._counter--
this.updateMessage()
}
private updateMessage() {
if (this._counter <= 0) {
this.message = 'Hoorraaay! You unlocked the NativeScript clicker achievement!'
} else {
this.message = `${this._counter} taps left`
}
}
}

View File

@ -86,7 +86,7 @@ let addView: (. Types.htmlElement, Types.htmlElement) => unit = %raw(`
const expression =
getExpression(parentElement.getAttribute("item-template-selector"))
parentElement.data.itemTemplateSelector = ($value, $index, $items) => {
parentElement.data.itemTemplateSelector = ($value, $index, _) => {
return eval(expression)
}
parentElement.data.itemTemplates = keyedTemplates

View File

@ -1,7 +1,7 @@
{
"type": "application",
"source-directories": [
"src",
"app",
"elm-native/src"
],
"elm-version": "0.19.1",

View File

@ -1,6 +1,6 @@
{
"name": "elm-native",
"main": "src/app.js",
"main": "app/app.js",
"version": "0.1.0",
"private": true,
"scripts": {

View File

@ -1,7 +0,0 @@
@import '@nativescript/theme/css/core.css';
@import '@nativescript/theme/css/default.css';
/* Label {
font-size: 23;
color: red;
} */