added progress bar

This commit is contained in:
hariroshan 2023-01-09 14:30:07 +05:30
parent 1358279afe
commit 9db913f66a
5 changed files with 58 additions and 19 deletions

View File

@ -1,4 +1,4 @@
module Native exposing (activityIndicator, button, datePicker, formattedString, htmlView, image, label, listPicker, span)
module Native exposing (activityIndicator, button, datePicker, formattedString, htmlView, image, label, listPicker, span, progress)
import Html exposing (Attribute, Html)
@ -51,3 +51,7 @@ image =
listPicker : List (Attribute msg) -> List (Html msg) -> Html msg
listPicker =
buildElement "ns-list-picker"
progress : List (Attribute msg) -> List (Html msg) -> Html msg
progress =
buildElement "ns-progress"

View File

@ -1,8 +1,7 @@
module Native.Attributes exposing (..)
import Html exposing (Attribute)
import Html.Attributes exposing (attribute)
import Html.Attributes exposing (property)
import Html.Attributes exposing (attribute, property)
import Json.Encode as E
@ -854,3 +853,13 @@ items =
selectedIndex : String -> Attribute msg
selectedIndex =
attribute "selected-index"
maxValue : String -> Attribute msg
maxValue =
attribute "max-value"
value : String -> Attribute msg
value =
attribute "value"

View File

@ -246,7 +246,10 @@ let image =
]->Belt.Array.map(dashed),
]->Belt.Array.concatMany
let listPicker = [view, ["items", "selectedIndex"]->Belt.Array.map(dashed)]->Belt.Array.concatMany
let listPicker = [view, ["selectedIndex"]->Belt.Array.map(dashed)]->Belt.Array.concatMany
let progress = [view, ["maxValue", "value"]->Belt.Array.map(dashed)]->Belt.Array.concatMany
// Js.log("****************************")
// ["items", "selectedIndex"]

View File

@ -92,6 +92,16 @@ module Image = {
let handler: Types.handler = buildHandler(new, Constants.image, Helper.addView)
}
module Progress = {
%%private(
@module("@nativescript/core") @new
external new: unit => Types.nativeObject = "Progress"
)
let tagName = "ns-progress"
let handler: Types.handler = buildHandler(new, Constants.progress, Helper.addView)
}
module ListPicker = {
%%private(
@module("@nativescript/core") @new
@ -156,4 +166,8 @@ let all: array<Types.customElement> = [
tagName: ListPicker.tagName,
handler: ListPicker.handler,
},
{
tagName: Progress.tagName,
handler: Progress.handler,
},
]

View File

@ -153,6 +153,24 @@ counter model =
[]
]
]
Native.activityIndicator
[ NA.busy "true"
, NA.color "#610fc8"
]
[]
Layout.asElement <|
Layout.flexboxLayout
[ NA.flexDirection "column"
]
[ Native.listPicker
[ E.list E.string
[ "2022", "2021", "2020" ]
|> NA.items
, NA.selectedIndex "1"
]
[]
]
-}
@ -168,23 +186,14 @@ detailsPage model =
, NA.fontSize "40"
]
[]
, Native.activityIndicator
[ NA.busy "true"
, NA.color "#610fc8"
, Native.progress
[ NA.value "50"
, NA.maxValue "100"
, NA.backgroundColor "red"
, NA.color "green"
, NA.scaleY "2"
]
[]
, Layout.asElement <|
Layout.flexboxLayout
[ NA.flexDirection "column"
]
[ Native.listPicker
[ E.list E.string
[ "2022", "2021", "2020" ]
|> NA.items
, NA.selectedIndex "1"
]
[]
]
]
)