Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Jan 28 23:02
    ramnivas synchronize #302
  • Jan 27 21:34
    joan38 edited #323
  • Jan 27 21:32
    joan38 opened #323
  • Jan 27 21:31

    shadaj on master

    Make CustomTag and CustomAttrib… (compare)

  • Jan 27 21:31
    shadaj closed #318
  • Jan 27 21:12
    joan38 synchronize #322
  • Jan 27 21:11
    joan38 edited #322
  • Jan 27 21:11
    joan38 synchronize #322
  • Jan 27 21:09
    joan38 opened #322
  • Jan 27 21:01
    joan38 commented #318
  • Jan 27 21:00
    joan38 synchronize #318
  • Jan 27 20:20

    shadaj on master

    Add docs on introducing React a… (compare)

  • Jan 27 20:20
    shadaj closed #238
  • Jan 27 20:20
    shadaj edited #238
  • Jan 27 20:19

    shadaj on master

    Introduce linting with Scalafix… (compare)

  • Jan 27 20:19
    shadaj closed #320
  • Jan 27 20:16
    shadaj edited #318
  • Jan 27 05:25
    joan38 commented #318
  • Jan 27 05:12
    joan38 synchronize #318
  • Jan 27 05:07
    joan38 commented #320
Shadaj Laddad
@shadaj
React does still support the tags (https://github.com/facebook/react/blob/master/packages/react-dom/src/client/validateDOMNesting.js), so we should probably keep them around. Not sure about deprecating the generated tag, one side of me says we should deprecate because they're legacy elements, the other side says we shouldn't because React hasn't deprecated them.
Joan Goyeau
@joan38
So we will have to remove -Xfatal-warnings
Shadaj Laddad
@shadaj
Yes, but only for the web module. I've done that already on the work-in-progress branch for supporting Scala.js 1.0
On case classification, the primary concern I have is that at least to me, a case class is a signal that the instance contains data for some model with the usual case class goodies like serialization. Since custom tags/attrs are meant to be used as wrapper types, I feel like they don't fit in too well. Are there any specific use cases you have in mind where being a case class would help?
Joan Goyeau
@joan38
I don't have really it just felt weird to write new but maybe you are right and Dotty's creator applications (http://dotty.epfl.ch/docs/reference/other-new-features/creator-applications.html) solves this.
Feel free to close the PR if you juge class right
Shadaj Laddad
@shadaj
Ah yeah the new is a good point! Perhaps we can just add an apply to the companion object?
Joan Goyeau
@joan38
True
I can modify the PR with it and leave us a day to think about that?
Shadaj Laddad
@shadaj
Yeah, that sounds great!
Joan Goyeau
@joan38
@shadaj are you open to introducing scalafmt and scalafix in the codebase?
Shadaj Laddad
@shadaj
That would be great! Might need some tweaking to get the config just right, but I think it would be a great addition.
Joan Goyeau
@joan38
I'll make a PR with the settings I usually use and then just comment on it to make it to your taste
jhegedus42
@jhegedus42
@mcallisto i am doing stuff with scalajs-react... it works nice... i think that might become a pretty nice solution... if it works it will convince the scalajs-react ppl to use sodium and from there it might come over to slinky ... if i can convince scalajs-react users to use sodium instead of anything else for state handling then it may make sense to use it for slinky too...
its really not trivial how to use frp for this story...
in the end if sodium will not get adopted in the scalajs-react community then that is the end of the sodium story
bringing sodium to slinky might make sense if sodium will be considered as a good way to write scalajs-react based apps
jhegedus42
@jhegedus42
so, the answer is yes, after i am convinced that sodium is a good idea to be used to write scalajs-react apps
at the moment i am learning frp coding myself
i wanna put together a simple note taking app
and use that as a demo to show how sodium can be used for state handling with scalajs-react
if ppl will like that, and will adopt it, then it makes sense to use it with slinky
mcallisto
@mcallisto

in the end if sodium will not get adopted in the scalajs-react community then that is the end of the sodium story

Thank you for the answer. If you are convinced is a good solution, getting adopted by the slinky community could make sense as well. Personally so far I have investigated alternatives such as diode and MobX.

Joan Goyeau
@joan38
@jhegedus42 What is sodium? Do you have a link?
jhegedus42
@jhegedus42
mcallisto
@mcallisto
Just to let you know that I have just published a public repo with a Slinky and Diode take on the well known TodoMVC demo, see https://github.com/mcallisto/slinky-diode-todomvc
Joan Goyeau
@joan38
Hey, Do you know if it's possible to manage images per component like this?:
https://create-react-app.dev/docs/adding-images-fonts-and-files/
anticipation
@NKhoroshevsky_twitter

@joan38 Please take a look:

@spf3000 This is how you can do it:

@js.native
@JSImport("resources/img/facebook.svg", JSImport.Default)
object FacebookLogo extends js.Object

And then, use is as follows:

img(src := FacebookLogo.asInstanceOf[String])
Joan Goyeau
@joan38
That is awesome thanks @NKhoroshevsky_twitter
sidnt
@sidnt
@mcallisto it'd be great if there's some documentation/instructions/manual/code-comments .
Artem
@sokArtSer_twitter
hello everyone
is there some example apps like TODO-list ? or something bigger like complex production projects..?
particulariy, im looking for authentication examples
(Beside TodoMVC that i see in prev post)
Joan Goyeau
@joan38
@sokArtSer_twitter I think the goal of this project is that it's close enough to vanilla React.JS that you can translate easily any example from React.JS to Slinky/Scala.
mcallisto
@mcallisto

@mcallisto it'd be great if there's some documentation/instructions/manual/code-comments .

@sidnt if you open a specific question issue on the repo I will try my best to reply and then integrate in the docs

Seamus Venasse
@seamusv
Would someone please tell me how I could define this interface in ScalaJS:
interface QueryParams { [key: string]: any; }
sidnt
@sidnt

in the expo-template-scala, it is @react class App extends Component that is loaded in Main.scala as @JSExportTopLevel("app"); val app = App.componentConstructor

How to load functional components in expo-template-scala? IOW, a @react object FunComp ?

just following the types, this approach works, but am not sure if this is the idiomatic style:

@react object FunComp {
  val component = FunctionalComponent[Unit] { _ =>
    View(style = centerStyle)(Text("Hello. From a functional component"))
  }
}

@react class FunCompLoader extends StatelessComponent {
  type Props = Unit
  def render(): ReactElement =
    FunComp.component.apply(()).withKey("somekey")
}

Later, FunCompLoader.componentConstructor can be called.

Artem
@sokArtSer_twitter
@joan38 yeah, i thought that too. but i think i can have problems with state management and with dependencies bundling in scalajs. final working example is still better, i think
Shadaj Laddad
@shadaj
@seamusv that'll be a js.Dictionary[js.Any] in Scala.js
@sidnt you can use FunComp.component to get access to the loaded component
sidnt
@sidnt

@shadaj doing that, can't we export that component as:

object Main {
  if (LinkingInfo.developmentMode) {
    hot.initialize()
  }

  @JSExportTopLevel("app")
  val app =
    FunComp.componentConstructor
}

This is not the case. Instead, given the above example, this approach underneath works.

object Main {
  if (LinkingInfo.developmentMode) {
    hot.initialize()
  }

  @JSExportTopLevel("app")
  val app =
    FunCompLoader.componentConstructor
}
Artem
@sokArtSer_twitter

in the end if sodium will not get adopted in the scalajs-react community then that is the end of the sodium story

Thank you for the answer. If you are convinced is a good solution, getting adopted by the slinky community could make sense as well. Personally so far I have investigated alternatives such as diode and MobX.

hello, did you get some results with mobx and scalajs?

mcallisto
@mcallisto
Hi @sokArtSer_twitter you can get some evidence from: https://github.com/ScalablyTyped/SlinkyTypedDemos/tree/master/react-mobx and https://github.com/mcallisto/slinky-mobx-example.
Regarding the latter, my demo, I still have doubts about the best design to reach inside components and about working with references.
Overall I am preferring Diode right now, but I cannot say I have it tested yet against something big (but I am planning to).
Shadaj Laddad
@shadaj
@sidnt you would need to export as
@JSExportTopLevel("app")
val app =
  FunComp.component: ReactComponentClass[_]
sidnt
@sidnt
thanks shadaj. that works :)
vonchav
@voonchav_gitlab
Hi all, is there a UI automation test framework equivalent to Cypress within the scalajs/slinky ecosystem? Preferably integrated with ScalaTest.
Ramnivas Laddad
@ramnivas
Not sure about Cypress, but we use Selenium and it works great.
sidnt
@sidnt
  1. when using the RN apis in slinky, any demo which shows how to render to the web from a RN slinky codebase?? the expo scala template is straightforward when it comes to rendering to android/ios. the RN official website examples provides rendering to all three target platforms.
mcallisto
@mcallisto

Not sure about Cypress, but we use Selenium and it works great.

@ramnivas do you have any (even basic) code example on how to use Selenium on a slinky project?

Ramnivas Laddad
@ramnivas
@mcallisto We started with https://github.com/agido/pageobject, but recently created our own framework. It is not open source, atm, but we do intent to make it time-permitting.
Ramnivas Laddad
@ramnivas
@mcallisto Also, Selenium tests have no dependency/relation on Slinky. Basically, tests you write for an application built using Slinky is no different than an application written using (say) plain JavaScript.
mcallisto
@mcallisto
@ramnivas thanks for the useful info, I appreciate that. And for sure interested in your framework, if and when it will be open sourced.