Everything about Slinky -- issues, ideas for features, where it's being used, and more
shadaj on master
Update sbt-sonatype to 3.9.5 (#… (compare)
shadaj on master
Update sbt to 1.4.7 (#462) (compare)
shadaj on v0.6.7
shadaj on master
Release v0.6.7 (compare)
shadaj on master
Add dependency on Java IntelliJ… (compare)
[warn] Note: Unresolved dependencies path:
[error] stack trace is suppressed; run 'last update' for the full output
[error] (update) sbt.librarymanagement.ResolveException: Error downloading me.shadaj:slinky-styled-components_sjs1_2.13:0.1.0
[error] Not found
[error] Not found
[error] not found: C:\Users\phn\.ivy2\local\me.shadaj\slinky-styled-components_sjs1_2.13\0.1.0\ivys\ivy.xml
[error] not found: https://repo1.maven.org/maven2/me/shadaj/slinky-styled-components_sjs1_2.13/0.1.0/slinky-styled-components_sjs1_2.13-0.1.0.pom
[error] Total time: 1 s, completed 07-10-2020 16:58:47
package hello.world
import slinky.core.ExternalComponentWithRefType
import slinky.core.annotations.react
import scala.scalajs.js
import scala.scalajs.js.annotation.JSImport
@js.native
trait RichEditorInstance extends js.Object {
}
@react object RichEditor extends ExternalComponentWithRefType[RichEditorInstance] {
case class Props(style: js.UndefOr[js.Object] = js.undefined)
@js.native
@JSImport("react-native", "RichEditor")
object Component extends js.Object
override val component = Component
}
I have
@JSImport("./assets/images/fish.png", JSImport.Default) @js.native object Fish extends js.Object
I am going back to this question by @msinton , since I am currently stuck on the same... In React Native, where do you place a local image in order for it to be found by the @JSImport
?
Hi all, I'm sure I'm missing something really obvious here. I'm trying to add a checkbox like so:
input(`type` := "checkbox", id := thing, name := thing),
label(`for` := thing, thing)
but of course for
does not exist. Perhaps I don't need the label, but I'd like to understand how to define one. Thanks!
small bug in documentation ( https://slinky.dev/docs/the-tag-api/ )?
input(onChange := (event) => {
println("the value of this input element was changed!")
})
does not work - this works:
input(onChange := (event => {
println(s"the value of this input element was changed!")
}))
Only difference are the parentheses.
onKeyPress
working? Looks like it never gets called.If you change your element to input
, it works fine (unless the element has focus, it won't receive any key events):
input(
onClick:= (_ => println(s"MOUSE")),
onKeyPress:= (_ => println(s"KEYBOARD"))
)
Also, onKeyPress
is deprecated (but works), so you should be using onKeyDown
(https://developer.mozilla.org/en-US/docs/Web/API/Document/keypress_event)
Is there any example for functional components depending on generic types? apparently, def component[D] = FuncionalComponent[Props[D]] {...}
is not enough
@react must annotate:
[error] - a class that extends (Stateless)Component,
[error] - an object that extends ExternalComponent(WithAttributes)(WithRefType)
[error] - an object defining a `val component = FunctionalComponent(...)`
[error] @react class RemoteDataLoaderComponent {
I have tried some variations without luck
trait RemoteDataLoaderBase[D] {
case class Props(fetcher: () => Future[D], render: D => ReactElement)
val theComponent: FunctionalComponent[Props] = FunctionalComponent[Props] { ...}
}
@react object MyProductsSummaryLoader extends RemoteDataLoaderBase[GetTrackedProductsResponse] {
val component = theComponent
}
def forceRefresh() = {
val (_, increment) = Hooks.useReducer[Int, Int](_ + _, 0)
() => increment(1)
}
Hooks.setEffect(..., "")
, which prevents the effect from running multiple times, unfortunately, I have no idea how to force such effect to run again without getting in executed indefinitely
Anyway, I ended up writing this: https://github.com/wiringbits/cazadescuentos/blob/master/lib/ui/src/main/scala/net/wiringbits/cazadescuentos/ui/components/RemoteDataLoaderBase.scala
I'm not 100% happy with the solution but it works, thanks for the help