Deprecated accompanist Modifier.placeholder(..) shimmer loading solution

Rohail Ahmad
2 min readNov 22, 2023
Fade
Fade
Shimmer
Shimmer

Accompanist is a group of libraries that aim to supplement Jetpack Compose with features that are commonly required by developers but not yet officially supported in Jetpack Compose AndroidX libraries.

Accompanist has deprecated the following libraries, with no replacement:

System UI Controller

Material/AppCompat Theme Adapters

Pager Indicators

Placeholder

WebView

Placeholder is what we use for shimmer effect loading in Jetpack compose. This is now deprecated.

It is very simple to fork their library and add customizations according to your needs.

A very simple extension method example is this:

You can then use shimmer or fade effect (or add your custom effect)

Simmer

To use shimmer or more specifically lerp(..) you need to add a compose ui-util dependency:

compose-ui-util = { module = "androidx.compose.ui:ui-util" }

Fade

Usage

Usage is quite simple, you only have to use Modifier.placeholder(isLoading = true, showShimmerAnimation = true/false) which will enable loading shimmer/fade:

Text(modifier = Modifier.placeholder(isLoading = true), text = "Follow me")

Hopefully, you get the idea and now is the time for you to explore a sample project on my Github: link

Don’t forget to follow 𝌘 and hit clap 👏

--

--

Rohail Ahmad

Android Engineer with @kivrasweden formerly @Eliq & @Inov8