mirror of
https://github.com/hariroshan/elm-native-library.git
synced 2025-01-07 17:27:48 +03:00
added html view
This commit is contained in:
parent
8f95fb5b24
commit
8411e7c60c
@ -1,4 +1,4 @@
|
|||||||
module Native exposing (activityIndicator, button, formattedString, label, span, datePicker)
|
module Native exposing (activityIndicator, button, datePicker, formattedString, htmlView, label, span)
|
||||||
|
|
||||||
import Html exposing (Attribute, Html)
|
import Html exposing (Attribute, Html)
|
||||||
|
|
||||||
@ -32,6 +32,12 @@ span : List (Attribute msg) -> List (Html msg) -> Html msg
|
|||||||
span =
|
span =
|
||||||
buildElement "ns-span"
|
buildElement "ns-span"
|
||||||
|
|
||||||
|
|
||||||
datePicker : List (Attribute msg) -> List (Html msg) -> Html msg
|
datePicker : List (Attribute msg) -> List (Html msg) -> Html msg
|
||||||
datePicker =
|
datePicker =
|
||||||
buildElement "ns-datepicker"
|
buildElement "ns-datepicker"
|
||||||
|
|
||||||
|
|
||||||
|
htmlView : List (Attribute msg) -> List (Html msg) -> Html msg
|
||||||
|
htmlView =
|
||||||
|
buildElement "ns-html-view"
|
||||||
|
@ -802,3 +802,8 @@ month =
|
|||||||
year : String -> Attribute msg
|
year : String -> Attribute msg
|
||||||
year =
|
year =
|
||||||
attribute "year"
|
attribute "year"
|
||||||
|
|
||||||
|
|
||||||
|
html : String -> Attribute msg
|
||||||
|
html =
|
||||||
|
attribute "html"
|
||||||
|
@ -214,7 +214,21 @@ let formattedString =
|
|||||||
|
|
||||||
let span = [formattedString, ["text"]->Belt.Array.map(dashed)]->Belt.Array.concatMany
|
let span = [formattedString, ["text"]->Belt.Array.map(dashed)]->Belt.Array.concatMany
|
||||||
|
|
||||||
let datePicker = [view, ["date", "day", "iosPreferredDatePickerStyle", "maxDate", "minDate", "month", "year"]->Belt.Array.map(dashed)]->Belt.Array.concatMany
|
let datePicker =
|
||||||
|
[
|
||||||
|
view,
|
||||||
|
[
|
||||||
|
"date",
|
||||||
|
"day",
|
||||||
|
"iosPreferredDatePickerStyle",
|
||||||
|
"maxDate",
|
||||||
|
"minDate",
|
||||||
|
"month",
|
||||||
|
"year",
|
||||||
|
]->Belt.Array.map(dashed),
|
||||||
|
]->Belt.Array.concatMany
|
||||||
|
|
||||||
|
let htmlView = [view, ["html"]->Belt.Array.map(dashed)]->Belt.Array.concatMany
|
||||||
|
|
||||||
// Js.log("****************************")
|
// Js.log("****************************")
|
||||||
// ["date", "day", "iosPreferredDatePickerStyle", "maxDate", "minDate", "month", "year"]
|
// ["date", "day", "iosPreferredDatePickerStyle", "maxDate", "minDate", "month", "year"]
|
||||||
|
@ -74,6 +74,15 @@ module DatePicker = {
|
|||||||
|
|
||||||
let handler: Types.handler = buildHandler(new, Constants.datePicker, Helper.addView)
|
let handler: Types.handler = buildHandler(new, Constants.datePicker, Helper.addView)
|
||||||
}
|
}
|
||||||
|
module HtmlView = {
|
||||||
|
%%private(
|
||||||
|
@module("@nativescript/core") @new
|
||||||
|
external new: unit => Types.nativeObject = "HtmlView"
|
||||||
|
)
|
||||||
|
let tagName = "ns-html-view"
|
||||||
|
|
||||||
|
let handler: Types.handler = buildHandler(new, Constants.htmlView, Helper.addView)
|
||||||
|
}
|
||||||
|
|
||||||
let all: array<Types.customElement> = [
|
let all: array<Types.customElement> = [
|
||||||
{
|
{
|
||||||
@ -100,4 +109,8 @@ let all: array<Types.customElement> = [
|
|||||||
tagName: DatePicker.tagName,
|
tagName: DatePicker.tagName,
|
||||||
handler: DatePicker.handler,
|
handler: DatePicker.handler,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
tagName: HtmlView.tagName,
|
||||||
|
handler: HtmlView.handler,
|
||||||
|
},
|
||||||
]
|
]
|
||||||
|
13
src/Main.elm
13
src/Main.elm
@ -148,6 +148,19 @@ detailsPage model =
|
|||||||
, NA.minDate "1980-02-01"
|
, NA.minDate "1980-02-01"
|
||||||
]
|
]
|
||||||
[]
|
[]
|
||||||
|
, Native.htmlView
|
||||||
|
[ NA.html """
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<span style="color: green">Hello World</span>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
"""
|
||||||
|
]
|
||||||
|
[]
|
||||||
]
|
]
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
|
Loading…
Reference in New Issue
Block a user