Skip to content

Commit 2b8fb04

Browse files
authored
Fix Binding animations (#338)
1 parent c1f88bd commit 2b8fb04

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

Sources/ComposableArchitecture/ViewStore.swift

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,10 +125,15 @@ public final class ViewStore<State, Action>: ObservableObject {
125125
Binding(
126126
get: { get(self.state) },
127127
set: { newLocalState, transaction in
128-
withAnimation(transaction.disablesAnimations ? nil : transaction.animation) {
128+
if transaction.animation != nil {
129+
withTransaction(transaction) {
130+
self.send(localStateToViewAction(newLocalState))
131+
}
132+
} else {
129133
self.send(localStateToViewAction(newLocalState))
130134
}
131-
})
135+
}
136+
)
132137
}
133138

134139
/// Derives a binding from the store that prevents direct writes to state and instead sends

0 commit comments

Comments
 (0)