Open lijl opened 6 months ago
@rechsteiner
me too
Hi! Can you try targeting the 4.0 branch directly and see it works for you there? There's a fix there which should handle this
@lijl can you work? @rechsteiner 4.0 not work for me. a new view will be generated.
Podfile: pod 'Parchment', '~> 4.0.0' PageView { getPages() } .menuItemSize(.selfSizing(estimatedWidth: 50, height: 40)) .menuItemLabelSpacing(0) .menuItemSpacing(32) .menuInsets(.init(top: 0, leading: 16, bottom: 0, trailing: 16)) .indicatorOptions(.visible(height: 3, zIndex: Int.max, spacing: .zero, insets: .zero)) .indicatorColor(Color.primary) .borderColor(Color.separator) .borderOptions(.visible(height: 1, zIndex: Int.max - 1, insets: .zero))
func getPages() -> [Page] {
var pages = [Page]()
for tab in viewModel.investModel?.tabs ?? [] {
pages.append(
Page(header: { state in
Text(tab.name ?? "")
.fixedSize()
.font(Font.h6())
.foregroundColor(state.isSelected ? Color.primary : Color.text2)
}, content: {
switch tab.typeE {
case .aaa:
TestA()
case .bbb:
TestB()
case .ccc:
TestC()
default:
TestD()
}
})
)
}
return pages
}
I used the swiftUI component. After loading, sliding the testview left or right will reload, so the interface will be re-requested every time, which is a very bad experience. How to make testview not reload?