Questions tagged [scrollviewreader]
34 questions
1
vote
1 answer
SwiftUI ScrollViewReader scrollTo not scrolling to end of horizontal scroller with a text view
I have the below code.
The weird part: This method works perfectly as intended... as long as I nudge the scroll. It needs only what seems to be a pixel width scroll and then proceeds to work perfectly.
I get the feeling this is a swiftui bug or…

Chris de Wet
- 43
- 5
1
vote
1 answer
Why is ScrollView changing content height to a random value on device but not on preview?
I am currently using **Xcode Version 14.3.1** (14E300c).
The scrollview in the code has an array of objects that I am iterating through with, ForEach(). When the user scrolls, lets say to object 30(each object is numbered, for demonstration…

codingethics
- 13
- 3
1
vote
1 answer
Horizontal ScrollView scrolls outside of the visible area - SwiftUI
As can be seen in the gif loop, the scrollbar will occasionally scroll randomly out of view and the scrollbar must first be dragged to the right for the items to appear.
This only happens every now and then and is totally random. I don't think it's…

Mike Keller
- 65
- 1
- 7
1
vote
0 answers
ScrollViewReader not scrolling to the correct id with anchor
Problem
First time when the button "Go to 990" is tapped the scroll view doesn't scroll to 990 on top. (see screenshot below)
The anchor is not respected.
Second time it scrolls to 990 top correctly.
Questions
What is wrong and how can it be…

user1046037
- 16,755
- 12
- 92
- 138
1
vote
0 answers
Scrolling inside a ScrollView in SwiftUI
In a giant ScrollView, I want to place Circles, and scroll to them so that, when scrolled, they end up in the middle of the screen, one after another.
I can position the Circles either by using .position, .offset or .padding. I have positioned them…

niklassaers
- 8,480
- 20
- 99
- 146
1
vote
1 answer
How to use ScrollViewReader in two List from two different api (without Button\TextField) using .onTapGesture in SwiftUI?
I have project, where two list of different banks show currency rate. And I want when I choose currency in first List, second List will have autoscrolling to the same currency. I saw tutorials with buttons, but it's not what I need. I thought use…

Diana Domoslavska
- 13
- 3
0
votes
1 answer
How do I cause my List to scroll to show the last line in the backing Array of String using SwiftUI under macOS
I've tried several solutions that I've found but none work for me, mostly lengthy with compile errors that I didn't understand how to fix. I collaborated with an AI today and after the third iteration edited this compact solution that compiled -…

Nate Lockwood
- 3,325
- 6
- 28
- 34
0
votes
1 answer
How to automatically scroll in SwiftUI View, if a new item appears?
I have a ScrollView inside a VStack, that will be filled and refreshed each time a new array item appearing. This array containing two sections (qa.question and qa.answer) and was created in a function outside the view. The ScrollView will be filled…

Peter Duckjibe
- 3
- 3
0
votes
0 answers
SwiftUI Autoscroll all horizontal row on UITableView
How to programmatically scroll ScrollViewReader component inside UITableViewCell
Basically, I have 2 horizontal axis (rows) inside UITableViewCell.
As shown in an attached gif file, I select the h3 option on the first axis, explicitly scroll, and…

kb920
- 3,039
- 2
- 33
- 44
0
votes
0 answers
How to make sure that the scrollView shows the entire row element when the row is extended? - SwiftUI
I have a simple LazyVStack which is wrapped by a ScrollView and ScrollViewReader. On tap, the element extends and at times goes outside the visible screen. How can I scroll the scrollview so that I can see the full extended element?
This…

Osama Naeem
- 1,830
- 5
- 16
- 34
0
votes
0 answers
Why ScrollView with ScrollViewReader does not scroll with animation
I am using ScrollViewReader to slowly scroll images behind text. On my ScrollView I am using:
.onAppear {
withAnimation(.easeInOut) {
proxy.scrollTo(9, anchor: .bottom)
}
…
user19727360
0
votes
0 answers
SwiftUI ScrollView won't let me scroll up
I'm trying to implement a chat feature, the relevant codes are simple enough
struct ContentView: View {
@State private var channelId = ""
@State private var message = ""
@ObservedObject var sig = SignalRService(urlStr:…

marko
- 1,721
- 15
- 25
0
votes
1 answer
How do I recalculate the yOffSet starting from 0, for items in a scrollview in SwiftUI when the user changes orientation
I'm trying to create a scrollview with a custom navigator in the bottom. The navigation item should get a background when the scrollview is inside it's proximity.
I've used a scrollviewReader to save the item and the yOffSet inside an array. Then…
0
votes
0 answers
SwiftUI - Animation not working for a subview inside parent scrollView
I have horizontal menu scrollView inside Parent vertical scrollView. When I select menu, it refresh it refreshes listView. But to fix parent scrollView content size, I need to refresh entire View (scrollView) by assigning menuItem selected id to…

Vishwanath Deshmukh
- 619
- 1
- 10
- 32
0
votes
0 answers
ScrollViewReader broke on 2-dimension ScrollView
I have a 2d ScrollView (vertical/horizontal) wrapped in a ScrollViewReader and populated by two ForEachs ... straight from the book.
Now the buttons don't scroll to the specified items, but strangely always to double of the row, i.e. 10_10 scrolls…

ChrisR
- 9,523
- 1
- 8
- 26