Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Counter sample doesn't behave correctly #39

Closed
ColtonIdle opened this issue Jun 29, 2021 · 2 comments
Closed

Counter sample doesn't behave correctly #39

ColtonIdle opened this issue Jun 29, 2021 · 2 comments

Comments

@ColtonIdle
Copy link

Here is my build.gradle.kts in an intellij project where I created the project with the gradle cmd line app wizard

import org.jetbrains.kotlin.gradle.tasks.KotlinCompile

buildscript {
    repositories {
        mavenCentral()
    }
    dependencies {
        classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.5.10")
        classpath("com.jakewharton.mosaic:mosaic-gradle-plugin:0.1.0")
    }
}

plugins {
    id("org.jetbrains.kotlin.jvm") version "1.5.10"
    id("org.jetbrains.kotlin.plugin.serialization") version "1.5.10"
    id("com.jakewharton.mosaic") version "0.1.0"
    application
}

group = "me.coltonidle"
version = "1.0-SNAPSHOT"

repositories {
    mavenCentral()
}

dependencies {
    testImplementation(kotlin("test-junit"))
}

tasks.test {
    useJUnit()
}

tasks.withType<KotlinCompile>() {
    kotlinOptions.jvmTarget = "1.8"
}

application {
    mainClassName = "MainKt"
}

Here is my MainKt

import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.setValue
import com.jakewharton.mosaic.Column
import com.jakewharton.mosaic.Text
import com.jakewharton.mosaic.runMosaic
import kotlinx.coroutines.delay

fun main() = runMosaic {
    var count by mutableStateOf(0)

    setContent {
        Column {
            Text("The count is: $count")
        }
    }

    for (i in 1..20) {
        delay(250)
        count = i
    }
}

Running this gives me

Screen Shot 2021-06-29 at 10 59 35 AM

@JakeWharton
Copy link
Owner

Looks like you're running in the IDE which strips ANSI control chars. Try in a real terminal.

@JakeWharton
Copy link
Owner

See #36

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants