Skip to content

Commit 65ec552

Browse files
committed
fix: replace animated visibility with animateItem modifier
1 parent 097ec7b commit 65ec552

File tree

1 file changed

+25
-33
lines changed

1 file changed

+25
-33
lines changed

app/src/main/java/to/bitkit/ui/screens/wallets/activity/components/ActivityListGrouped.kt

Lines changed: 25 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,6 @@
11
package to.bitkit.ui.screens.wallets.activity.components
22

3-
import androidx.compose.animation.AnimatedVisibility
43
import androidx.compose.animation.core.tween
5-
import androidx.compose.animation.expandVertically
6-
import androidx.compose.animation.fadeIn
7-
import androidx.compose.animation.fadeOut
8-
import androidx.compose.animation.shrinkVertically
94
import androidx.compose.foundation.layout.Column
105
import androidx.compose.foundation.layout.PaddingValues
116
import androidx.compose.foundation.layout.Spacer
@@ -71,40 +66,37 @@ fun ActivityListGrouped(
7166
is Activity.Lightning -> "lightning_${item.rawId()}"
7267
is Activity.Onchain -> "onchain_${item.rawId()}"
7368
}
74-
7569
else -> "item_$index"
7670
}
7771
}
7872
) { index, item ->
79-
AnimatedVisibility(
80-
visible = true,
81-
enter = fadeIn(animationSpec = tween(durationMillis = 400, delayMillis = 50)) +
82-
expandVertically(
83-
animationSpec = tween(durationMillis = 400, delayMillis = 50),
84-
expandFrom = Alignment.Top
85-
),
86-
exit = fadeOut(animationSpec = tween(durationMillis = 300)) +
87-
shrinkVertically(
88-
animationSpec = tween(durationMillis = 300),
89-
shrinkTowards = Alignment.Top
73+
when (item) {
74+
is String -> {
75+
Caption13Up(
76+
text = item,
77+
color = Colors.White64,
78+
modifier = Modifier
79+
.fillMaxWidth()
80+
.padding(vertical = 8.dp)
81+
.animateItem(
82+
fadeInSpec = tween(durationMillis = 300),
83+
fadeOutSpec = tween(durationMillis = 300),
84+
placementSpec = tween(durationMillis = 300)
85+
)
9086
)
91-
) {
92-
when (item) {
93-
is String -> {
94-
Caption13Up(
95-
text = item,
96-
color = Colors.White64,
97-
modifier = Modifier
98-
.fillMaxWidth()
99-
.padding(vertical = 16.dp)
100-
)
101-
}
87+
}
10288

103-
is Activity -> {
104-
Column {
105-
ActivityRow(item, onActivityItemClick, testTag = "Activity-$index")
106-
VerticalSpacer(16.dp)
107-
}
89+
is Activity -> {
90+
Column(
91+
modifier = Modifier
92+
.animateItem(
93+
fadeInSpec = tween(durationMillis = 300),
94+
fadeOutSpec = tween(durationMillis = 300),
95+
placementSpec = tween(durationMillis = 300)
96+
)
97+
) {
98+
ActivityRow(item, onActivityItemClick, testTag = "Activity-$index")
99+
VerticalSpacer(16.dp)
108100
}
109101
}
110102
}

0 commit comments

Comments
 (0)