tradingview/lightweight-charts-android

Compose: ChartView blinks with white color

sudansh opened this issue · 0 comments

I am using Android Compose and setting background but there white background comes up momentarily before setting up the background color.
I have gone through previous issues on white color like 38 which was closed but still persists

code:

AndroidView(
                modifier = Modifier,
                factory = {
                    ChartsView(it).apply {
                        with(api) {
                            applyOptions {
                                layout = layoutOptions {
                                    background = SolidColor(Color.Green)
                                }
                            }
                        }
                    }
                },
                update = { chartsView ->
                    with(chartsView.api) {
                        applyOptions {
                            layout = layoutOptions {
                                background = SolidColor(surfaceColor)
                            }
                        }
                        addHistogramSeries(
                            options = histogramSeriesOptions {
                                color = barColor
                                visible = false
                                priceScaleId = PriceScaleId("")
                            },
                            onSeriesCreated = { seriesApi ->
                                seriesApi.priceScale().applyOptions(PriceScaleOptions().apply {
                                    scaleMargins = PriceScaleMargins(
                                        top = 0.7f,
                                        bottom = 0f,
                                    )
                                })
                                seriesApi.setData(barData.distinctBy { it.time })
                            }
                        )
                    }
                }
            )
white.mov