These are chat archives for chandu0101/scalajs-react-components

5th
May 2017
nafg
@nafg
May 05 2017 18:44
@rleibman I think you want gitter.im/japgolly/scalajs-react
Øyvind Raddum Berg
@oyvindberg
May 05 2017 21:52
lets switch channel anyway @rleibman
can you paste the whole MiuStepper file?
Roberto Leibman
@rleibman
May 05 2017 21:54
package chandu0101.scalajs.react.components
package materialui

import chandu0101.macros.tojs.JSMacro
import japgolly.scalajs.react._
import org.scalajs.dom
import scala.scalajs.js
import scala.scalajs.js.`|`
import japgolly.scalajs.react.vdom._
import japgolly.scalajs.react.raw.React

/**
 * This file is generated - submit issues instead of PR against it
 */

case class MuiStepper(
    key: js.UndefOr[String] = js.undefined,
    ref: js.UndefOr[MuiStepperM => Unit] = js.undefined,
    /* Set the active step (zero based index). This will enable `Step` control helpers. */
    activeStep: js.UndefOr[Double] = js.undefined,
    /* A component to be placed between each step. */
    connector: js.UndefOr[VdomNode] = js.undefined,
    /* If set to `true`, the `Stepper` will assist in controlling steps for linear flow */
    linear: js.UndefOr[Boolean] = js.undefined,
    /* The stepper orientation (layout flow direction) */
    orientation: js.UndefOr[HorizontalVertical] = js.undefined,
    /* Override the inline-style of the root element. */
    style: js.UndefOr[CssProperties] = js.undefined
) {

  /**
   * @param children Should be two or more `<Step />` components
   */
  def apply(children: js.Any*) = {

    val props = JSMacro[MuiStepper](this)
    val f = React.asInstanceOf[js.Dynamic].createFactory(Mui.Stepper)
    if (children.isEmpty)
      f(props).asInstanceOf[ScalaComponent.Unmounted[_, _, _]]
    else if (children.size == 1)
      f(props, children.head).asInstanceOf[ScalaComponent.Unmounted[_, _, _]]
    else
      f(props, children).asInstanceOf[ScalaComponent.Unmounted[_, _, _]]
  }
}

@js.native
class MuiStepperM extends js.Object {
  def getChildContext(): js.Dynamic = js.native
}
Øyvind Raddum Berg
@oyvindberg
May 05 2017 21:55
right, so i'm pretty sure the error is connector: js.UndefOr[VdomNode] = js.undefined,
does it compile if you comment out that?
Roberto Leibman
@rleibman
May 05 2017 21:57
Looking... I basically ran their migration script, and apparently it replaces ReactNode with VdomNode
Øyvind Raddum Berg
@oyvindberg
May 05 2017 21:58
So I'm not really up to speed on the new types yet, but I would guess Raw.ReactNode is what you want there
so the problem is this: These wrappers have to be a description of the javascript world, not the scala-js world
VdomNode is the scala-js type that is used to build ReactNodes
Roberto Leibman
@rleibman
May 05 2017 21:59
Yeah, I'm going at this totally blind, all I want is to get it to compile, then I can worry about making it work.
Øyvind Raddum Berg
@oyvindberg
May 05 2017 21:59
The only scalajs-native thing we support is Callback
you can see how that is rewritten in the JsMacro
Roberto Leibman
@rleibman
May 05 2017 22:00
Commenting out made it compile.
Øyvind Raddum Berg
@oyvindberg
May 05 2017 22:00
good
Roberto Leibman
@rleibman
May 05 2017 22:00
Let me try changing it to Raw.ReactNode
Øyvind Raddum Berg
@oyvindberg
May 05 2017 22:01
so we have two options: Either accept VdomNode (if that is what clients of the api would use, which seems probably) and rewrite them to ReactNode. Or, we can accept Raw.ReactNode and have clients do the rewrite themselves
a rewrite would take this form i think (havent compiled):
val vdomNode: VdomNode
vdomNode.render.rawNode
I'm not sure if ReactNode or ReactElement would be correct either, I have never used these things
in fact, we could have it be js.Any and be happy with it
Roberto Leibman
@rleibman
May 05 2017 22:09
ok, using raw.ReactNode made it compile, so I'll go with that for now.
Øyvind Raddum Berg
@oyvindberg
May 05 2017 22:10
good enough for me
I see we make a distinction between ReactNode and ReactElement, so you can keep that
just put raw. in front
also, just to have said that: If any component give you much trouble I could very easily be convinced to drop some of them
I'm not sure how many of the scala.js components see any use :)