mirror of
https://github.com/hariroshan/elm-native-library.git
synced 2025-01-06 03:54:33 +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)
|
||||
|
||||
@ -32,6 +32,12 @@ span : List (Attribute msg) -> List (Html msg) -> Html msg
|
||||
span =
|
||||
buildElement "ns-span"
|
||||
|
||||
|
||||
datePicker : List (Attribute msg) -> List (Html msg) -> Html msg
|
||||
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 =
|
||||
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 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("****************************")
|
||||
// ["date", "day", "iosPreferredDatePickerStyle", "maxDate", "minDate", "month", "year"]
|
||||
|
@ -74,6 +74,15 @@ module DatePicker = {
|
||||
|
||||
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> = [
|
||||
{
|
||||
@ -100,4 +109,8 @@ let all: array<Types.customElement> = [
|
||||
tagName: DatePicker.tagName,
|
||||
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"
|
||||
]
|
||||
[]
|
||||
, 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