Thread
#compose
    d

    dimsuz

    11 months ago
    I need to inform the grand-grand-[grand]-parent of LazyRow that scroll is in progress. What is the most idiomatic way to do this? Code in thread.
    Box {
      var showButton = remember { mutableStateOf(false) }
      ComposableWithRow(
        onScrollStateChange = { isScrolling -> showButton = isScrolling }
      )
      if (showButton) Button()
    }
    
    fun ComposableWithRow(
      onScrollStateChange: (isScrolling: Boolean) -> Unit
    ) {
      Box {
        Box {
            val listState = rememberLazyListState()
            listState.isScrollInProgress // HOW TO USE?
    
            LazyRow(state = listState)
        }
      }
    }
    How should I call
    onScrollStateChange
    ? Or should I instead pass
    State<Boolean>
    as an argument to
    ComposableWithRow
    ?
    Albert Chang

    Albert Chang

    11 months ago
    You should hoist
    LazyListState
    .
    d

    dimsuz

    11 months ago
    got it, thanks