https://kotlinlang.org logo
c

codeslubber

02/28/2020, 5:16 PM
Had slider working, not working anymore, another cryptic error I can do nothing with:
Wow I don’t know what is going on here, but I am just going to give up for now. I made a new project, updated the text it was outputting so I could do a countdown timer, that worked, centered, made the font larger, now I add other components to the same block and they don’t render at all. No error.
This:
Copy code
@Composable
fun TimerView() {

    val timerState = state { TimerState(minutes = TimeDigit(8)) }

    Column {
        Align(Alignment.Center) {
            Text(text = timerState.value.currentStatus, style = TextStyle(fontSize = 36.sp))
            Text("What is going on here????")
            TextField(value = "50", onValueChange = {})
        }
    }
}
renders as this:
l

Louis Pullen-Freilich [G]

02/28/2020, 6:07 PM
You need to remove
Align
, it is a layout that only expects one child. Instead I think you want to have:
Copy code
@Composable
fun TimerView() {
    val timerState = state { TimerState(minutes = TimeDigit(8)) }
    Column(modifier = LayoutAlign.Center) {
            Text(text = timerState.value.currentStatus, style = TextStyle(fontSize = 36.sp))
            Text("What is going on here????")
            TextField(value = "50", onValueChange = {})
    }
}
Functions like
Align
have mostly all been replaced by modifiers, so you should try to use them instead 🙂 they help avoid confusing behavior such as this
👍🏻 1
l

Leland Richardson [G]

02/28/2020, 6:25 PM
are these marked as deprecated yet? if not, why not?
l

Louis Pullen-Freilich [G]

02/28/2020, 6:26 PM
We are working on deprecating them, however unfortunately we still have a lot of internal usage inside components, and so we cannot deprecate them until we first remove these internal usages (as using deprecated APIs is a warning, which will fail the build 🙂 )
l

Leland Richardson [G]

02/28/2020, 6:28 PM
@Suppress? 🧌
only half joking… it’s a useful signal to our users that something is going to be going away…. and a signal in our code when someone is refactoring something to go ahead and remove the “not deprecated but actually deprecated” code
1
c

codeslubber

02/28/2020, 6:40 PM
Yeah these types of sinkholes are really demoralizing… I should have tried removing it, I never would have guessed it. Can it not see that it was passed > 1 item and error out?
l

Louis Pullen-Freilich [G]

02/28/2020, 6:42 PM
We used to do that before, but throwing exceptions at runtime is also really sad, and it made iterating really painful. Modifiers are our solutions to both 🙂 But we should probably deprecate and suppress in the near term, to provide an indicator that you should move away, and what you should move to. FWIW the documentation for Align does say that it is deprecated, it just isn't actually marked, which isn't really helpful
3
l

Leland Richardson [G]

02/28/2020, 6:43 PM
it’s behavior right now (single child) can be very frustrating which is why we are deprecating it as opposed to making it error out or something
the fact that it isn’t actually marked as deprecated is a bit of a problem IMO
i just started a conversation internally for us to mark all composables we plan to deprecate as deprecated even before we refactor all of our usages. not sure how others feel about this but we shall see.
👍🏻 1
c

codeslubber

02/28/2020, 7:12 PM
I should have figured it out through good old fashioned process of elimination.
l

Leland Richardson [G]

02/28/2020, 7:15 PM
either way, thank you for the feedback. it helps to light a fire under our buts for certain things when multiple ppl externally run into these things
💯 1
a

Adam Powell

02/28/2020, 10:55 PM
regarding the, "expected a group start" error, the first thing to look for in those is whether there are any calls to
@Composable
functions inside of a
remember {}
block somewhere. It's supposed to be a compiler error but said error isn't hooked up yet and it tends to produce that exception or one like it.
👍🏻 2
l

Leland Richardson [G]

02/28/2020, 11:06 PM
adding this to a list of errors that we need to improve with “likely causes” in the message
👍🏻 1