Question

As soon as I try to set the style of a Text, I get this error:

Cannot read property 'arity' of undefined
    Open the developer console for more details.

Developer console gives TypeError: fun is undefined.

Elm 0.12, and http://elm-lang.org/try Browsers: Chrome, Firefox

titleStyle : Text.Style
titleStyle = 
    { typeface = [ "serif" ]
    , height   = Just 18
    , color    = white
    , bold     = True
    , italic   = False
    , line     = Nothing
    }

main = centered (style titleStyle (toText "hello"))

If you change main to:

main = centered (toText "hello")

text renders as expected, with no style.

I can't find any example of Text.style on the Elm site -- am I doing something wrong or is this a bug?

Was it helpful?

Solution

This error was caused by the style function not being exported in the standard libraries (Elm/libraries/Native/Text.js)

Fixed in main as of 2014-04-01. https://github.com/elm-lang/Elm/issues/549

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top