Open Cavidan998 opened 6 days ago
Hey,
I'm not exactly sure what the problem is. VDynamicPagerTabView
is implemented using native TabView
with page
configuration. It shouldn't disable button clicks.
I used the following snippet to test:
private enum WeekDay: Int, Hashable, Identifiable, CaseIterable {
case monday, tuesday, wednesday, thursday, friday, saturday, sunday
var id: Int { rawValue }
var title: String { .init(describing: self).capitalized }
var color: Color {
switch rawValue.quotientAndRemainder(dividingBy: 3).remainder {
case 0: Color.red
case 1: Color.green
case 2: Color.blue
default: fatalError()
}
}
}
@State private var selection: WeekDay = .thursday
var body: some View {
VDynamicPagerTabView(
selection: $selection,
data: WeekDay.allCases,
tabItemTitle: { $0.title },
content: { tab in
ZStack(content: {
tab.color.opacity(0.3)
Button(tab.title, action: {
print("Clicked")
})
})
}
)
}
Scrolling worked. And both, buttons taps and long presses, worked as well.
https://github.com/user-attachments/assets/667e7267-3cc5-4199-bf6c-728956d85d90
Maybe you are doing something incorrectly?
As for API for disabling the scroll, I'm not aware of any ways of doing it with TabView
. It can be achieved with ScrollView
in iOS
17.0
. But currently, package supports 16.0
. So that API will come next year.
this is interesting. In my case when i touch button , this first touch understood like scrolling left or right. But after long press on button, i saw button get clicked. Without VDynamicPagerTabView everything works fine.
VDynamicPagerTabView( uiModel: .register, selection: $viewModel.selectionTab, data: RegisterTab.allCases, tabItemTitle: { loginTab in viewModel.pagerTitleContent(loginTab: loginTab) }, content: { loginTab in pagerContent(loginTab: loginTab) .layoutPriority(1) } ) .padding(.vertical, .p16)
.layoutPriority(1) after this sometimes work and sometimes not working
I'll look into ScrollView
API over the weekend. I can probably create an alternate implementation for iOS
17.0
, that exposes new functionality with isScrollEnabled
property in the UI model.
Yes, i created custom pager , after you change i will uncomment my old code. Thanks)
I've added an alternate implementation.
Check out dev branch, and try using component with the following UI model:
VDynamicPagerTabView(
uiModel: {
var uiModel: VDynamicPagerTabViewUIModel = .init()
uiModel.isTabViewScrollingEnabled = false
return uiModel
}(),
...
)
Let me know if it works.
Hi,
when i add button inside VDynamicPagerTabView content, button's click work only after long click, i research and find that this because of changing tabs with left and right scroll
in this case forgot password work after long press not with tap.
and i think if we have disable option for changing tabs with scroll, issue will be resolved.