fix(store): replace custom geometry safe area top reader with computed property to fix category tabs placement
This commit is contained in:
@@ -62,30 +62,5 @@ struct AsyncStoreImage: View {
|
||||
}
|
||||
}
|
||||
|
||||
struct SafeAreaTopPreferenceKey: PreferenceKey {
|
||||
static let defaultValue: CGFloat = 0
|
||||
static func reduce(value: inout CGFloat, nextValue: () -> CGFloat) {
|
||||
let next = nextValue()
|
||||
if next > 0 {
|
||||
value = next
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
struct SafeAreaTopReader: View {
|
||||
@Binding var safeAreaTop: CGFloat
|
||||
|
||||
var body: some View {
|
||||
GeometryReader { geometry in
|
||||
Color.clear
|
||||
.preference(key: SafeAreaTopPreferenceKey.self, value: geometry.safeAreaInsets.top)
|
||||
}
|
||||
.frame(height: 0)
|
||||
.onPreferenceChange(SafeAreaTopPreferenceKey.self) { value in
|
||||
if value > 0 && safeAreaTop != value {
|
||||
safeAreaTop = value
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user