dokar3 / compose-sonner Goto Github PK
View Code? Open in Web Editor NEWAn opinionated toast component for Compose Multiplatform.
Home Page: https://dokar3.github.io/compose-sonner/
License: Apache License 2.0
An opinionated toast component for Compose Multiplatform.
Home Page: https://dokar3.github.io/compose-sonner/
License: Apache License 2.0
I suppose I could handle this myself, but I think any users would appreciate the change.
My suggestion is that the duration for a toast should start when it is the top toast on the stack, instead of when it's created.
In readme.md
Under "Button" section
// Enable close buttons
Toaster(
state = toaster,
closeButton = true,
)
this should be
// Enable close buttons
Toaster(
state = toaster,
showCloseButton = true,
)
as closeButton
does not accept a boolean while showCloseButton
does.
This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.
This repository currently has no open or pending branches.
.github/workflows/build.yaml
actions/checkout v4
actions/setup-java v4
gradle/gradle-build-action v3.5.0
.github/workflows/publish-library.yaml
actions/checkout v4
actions/setup-java v4
gradle/gradle-build-action v3.5.0
macos 14
.github/workflows/publish-wasmjs-demo.yaml
actions/checkout v4
actions/setup-java v4
gradle/gradle-build-action v3.5.0
actions/upload-pages-artifact v3
actions/deploy-pages v4
gradle.properties
settings.gradle.kts
build.gradle.kts
gradle/libs.versions.toml
org.jetbrains.kotlin:kotlin-test 2.0.0
androidx.activity:activity-compose 1.9.0
org.jetbrains.kotlinx:kotlinx-coroutines-core 1.8.1
org.jetbrains.kotlinx:kotlinx-coroutines-test 1.8.1
com.android.application 8.5.1
com.android.library 8.5.1
org.jetbrains.compose 1.6.11
org.jetbrains.kotlin.multiplatform 2.0.0
org.jetbrains.kotlin.android 2.0.0
org.jetbrains.kotlin.plugin.compose 2.0.0
com.vanniktech.maven.publish 0.29.0
sample/build.gradle.kts
sonner/gradle.properties
sonner/build.gradle.kts
gradle/wrapper/gradle-wrapper.properties
gradle 8.9
Exception in thread "main" java.lang.UnsupportedClassVersionError: com/dokar/sonner/ToasterStateKt has been compiled by a more recent version of the Java Runtime (class file version 64.0), this version of the Java Runtime only recognizes class file versions up to 61.0
I'm trying to use this in a project that uses Java 17. I'm not ready to update because some of the tooling breaks with 21.
Could you switch from Java 20 to 17?
val someResourceFile = ... // can be also a task that generates resources.
kotlin {
// declared targets
sourceSets {
yourTargetsMain {
resources.srcDir(someResourceFile)
}
}
}
/**
* Workaround for https://youtrack.jetbrains.com/issue/KT-65315
* Please remove after upgrade to Kotlin 2.0
*/
tasks.withType(MetadataDependencyTransformationTask::class).configureEach {
if (kotlinToolingVersion >= KotlinToolingVersion("2.0.0-RC1")) error("Please remove workaround for KT-65315")
fun File.isValidDependency(): Boolean {
if (extension != "klib") return true
val klibManifestEntry = ZipFile(this).getEntry("default/manifest")
return klibManifestEntry != null
}
val transformedLibrariesGetter = MetadataDependencyTransformationTask::class.java
.getDeclaredMethod("getTransformedLibrariesIndexFile")
transformedLibrariesGetter.isAccessible = true
doLast {
val transformedLibrariesFileProperty = transformedLibrariesGetter.invoke(this) as RegularFileProperty
val transformedLibrariesFile = transformedLibrariesFileProperty.get().asFile
val validTransformedLibraries = transformedLibrariesFile
.readLines()
.map(::File)
.filter { it.isValidDependency() }
transformedLibrariesFile.writeText(
validTransformedLibraries.joinToString("\n") { it.absolutePath }
)
}
}
toastState.listenMany(
errorMessages.map { entries ->
entries.map { entry ->
Toast(
id = entry.key,
message = entry.value.toString(),
duration = ToasterDefaults.DurationLong,
action = TextToastAction(
text = "Dismiss",
onClick = { toastState.dismiss(it.id) }
)
)
}
}
)
The toast is not equal to itself, because the TextToastAction
is created each time. The updateOrShow
has a problem in this case. I think showing a toast with the same id
should leave it in place. That is, don't check if it's at the end and just always update it in place.
Hey @dokar3, it's a cool library you've got going on here ๐
As you mentioned in your comment (iOS target. Waiting for contributors because I don't have any Apple devices to run
), I can try to help you out here as I have a Macbook. We can test the iOS implementation on an iOS simulator.
Would you like to create a new feature branch containing the iOS implementation that I can test out and give you any kind of feedback you'd like?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.