mirror of
https://github.com/hariroshan/elm-native-library.git
synced 2025-01-06 03:54:33 +03:00
fixed performance and variable mangling error
This commit is contained in:
parent
666d222cba
commit
d9e2c50299
@ -10,6 +10,8 @@ import Native.Event as Event
|
||||
import Native.Frame as Frame
|
||||
import Native.Layout as Layout exposing (rootLayout)
|
||||
import Native.Page as Page
|
||||
import Process
|
||||
import Task
|
||||
|
||||
|
||||
type alias Flick =
|
||||
@ -302,7 +304,7 @@ detailsPage model =
|
||||
Just flick ->
|
||||
Page.pageWithActionBar [ Event.on "navigatedTo" (D.field "isBackNavigation" D.bool |> D.map Back) ]
|
||||
(Native.actionBar [ NA.title flick.title ]
|
||||
[ Native.navigationButton [NA.text "Back"] []
|
||||
[ Native.navigationButton [ NA.text "Back" ] []
|
||||
]
|
||||
)
|
||||
(Layout.scrollView
|
||||
|
@ -319,10 +319,8 @@ module ListView = {
|
||||
current.data
|
||||
->Js.Nullable.toOption
|
||||
->Belt.Option.forEach(data => {
|
||||
if !Belt.Array.eq(data.items, newItems, (x, y) => x == y) {
|
||||
data->Types.setItems(newItems)
|
||||
data->Types.refresh
|
||||
}
|
||||
data->Types.setItems(newItems)
|
||||
data->Types.refresh
|
||||
})
|
||||
}
|
||||
)
|
||||
|
@ -87,7 +87,11 @@ let addView: (. Types.htmlElement, Types.htmlElement) => unit = %raw(`
|
||||
getExpression(parentElement.getAttribute("item-template-selector"))
|
||||
|
||||
parentElement.data.itemTemplateSelector = ($value, $index, _) => {
|
||||
return eval(expression)
|
||||
// Mangling the variable can affect the variables used in the expression
|
||||
const replacedExpression = expression
|
||||
.replaceAll("$value", Object.keys({$value})[0])
|
||||
.replaceAll("$index", Object.keys({$index})[0])
|
||||
return eval(replacedExpression)
|
||||
}
|
||||
parentElement.data.itemTemplates = keyedTemplates
|
||||
return
|
||||
|
Loading…
Reference in New Issue
Block a user