https://linen.dev logo
Join Discord
Powered by
# react
  • a

    ambitious-knife-25690

    07/22/2021, 11:10 PM
    I came back to it
  • a

    ambitious-knife-25690

    07/22/2021, 11:10 PM
    This works :)
  • a

    ambitious-knife-25690

    07/22/2021, 11:12 PM
    hacky but ah well
  • a

    ambitious-knife-25690

    07/23/2021, 1:12 AM
    yay finished with updating the native_base externs 😊
  • u

    user

    07/23/2021, 5:59 AM
    There's a trick for this https://github.com/kLabz/haxe-react-transition-group/blob/master/src/react/transition/Transition.hx#L47 https://github.com/kLabz/haxe-react-transition-group/blob/master/src/react/transition/TransitionMacro.hx https://github.com/kLabz/haxe-react-transition-group/blob/master/extraParams.hxml
  • u

    user

    07/23/2021, 6:00 AM
    Uh, not a good example since it allows anything else x) you'll want to return null instead of
    expr
  • u

    user

    07/23/2021, 6:13 AM
    Oh there's some doc here https://github.com/kLabz/haxe-react/blob/next/doc/custom-meta.md#acceptsmoreprops
  • a

    ambitious-knife-25690

    07/23/2021, 1:15 PM
    it's not the primary usecase to create an additional prop to pass down
  • a

    ambitious-knife-25690

    07/23/2021, 1:15 PM
    i can't define a prop called
    in
    in a typesafe way because it's a keyword in haxe
  • a

    ambitious-knife-25690

    07/23/2021, 1:16 PM
    so wrapping the extern and modifying the prop at runtime is the best solution i could think of
  • u

    user

    07/23/2021, 1:17 PM
    What I linked does exactly that: - define an extern component which accepts an
    in
    prop - allow you to do
    <MyExternComponent in={foo} />
    in your jsx - get it to send "in" prop in js, without runtime overhead
  • a

    ambitious-knife-25690

    07/23/2021, 1:18 PM
    oh hm i don't understand the code then
  • u

    user

    07/23/2021, 1:19 PM
    With that, you don't define your
    in
    prop in your props typedef (because it doesn't work properly), but instead hook a macro that will check props that were not recognized and allow (+ pass) any prop named "in" (with typechecking iirc)
  • u

    user

    07/23/2021, 1:20 PM
    The doc link explains it better I hope x) (read until the end, the next section is what you're after)
  • a

    ambitious-knife-25690

    07/23/2021, 1:47 PM
    i read the doc but i'm not sure i got the interpretation you wanted me to get, i thought props were type checked pretty well in jsx
  • a

    ambitious-knife-25690

    07/23/2021, 1:48 PM
    also, this is a library, isn't an init macro something that is added in the users code base?
  • a

    ambitious-knife-25690

    07/23/2021, 1:48 PM
    I guess i can add that to the extern as well 🤔
  • a

    ambitious-knife-25690

    07/23/2021, 1:49 PM
    but in the doc i saw nothing that indicates this kind of use, i'll have a play with it :3
  • a

    ambitious-knife-25690

    07/23/2021, 1:53 PM
    and initmacro is a bit cryptic,
    if (some_condition)
    what is this condition meant to be? 🤣
  • a

    ambitious-knife-25690

    07/23/2021, 1:54 PM
    am i meant to make the assumption that I have to determine that the the
    expr
    and the
    name
    match up?
  • u

    user

    07/23/2021, 2:02 PM
    if (name == "in")
    ?
  • u

    user

    07/23/2021, 2:04 PM
    expr
    will be what is passed as value to the
    name
    prop So you check if
    name
    is recognized, and generate
    ($expr :ExpectedTypeForThisProp)
    and compiler does the type checking Then this will be set to
    name
    prop
  • a

    ambitious-knife-25690

    07/23/2021, 4:00 PM
    aaahhh
  • a

    ambitious-knife-25690

    07/23/2021, 4:01 PM
    i get it
  • a

    ambitious-knife-25690

    07/23/2021, 4:01 PM
    it works, but i'm gonna stick to the runtime overhead because this appears to very reliably, break completion/diagnostics 😂
  • a

    ambitious-knife-25690

    07/23/2021, 4:02 PM
    compiles fine, and restarting the language server fixes this
  • a

    ambitious-knife-25690

    07/23/2021, 4:02 PM
    but the error comes back rapidly or every time you reboot vscode
  • a

    ambitious-knife-25690

    07/23/2021, 4:02 PM
    I think i'd prefer just commenting the props to use a different field in place of the default approach 😆
  • u

    user

    07/23/2021, 4:05 PM
    Oh nice catch, will try to find time to handle that
  • u

    user

    12/22/2021, 5:38 PM
    Haxe and react?
1...636465...80Latest