1

I wonder how to determine if the content inside ScrollView is fully visible without scrolling?

ScrollView {

 LazyVStack {
  PlainButton("1")
  PlainButton("2")
  PlainButton("3")
  PlainButton("4")
  PlainButton("5")
  PlainButton("6")
  PlainButton("7")
 }

}

I was going to use onAppear/onDisappear to tell if "1" and "7" are visible. Works for "1" as it's always visible from the very beginning... But if "7" is not visible - "onDisappear" event is not called right after load..

UPDATE: replaced VStack with LazyVStack

2
  • Does this answer your question stackoverflow.com/a/62466397/12299030? Commented Jan 24, 2021 at 18:46
  • Hi. Unfortunately, i have to use LazyVStack inside of my ScrollView , therefore it doesn't work. Is there any workaround for this case? Commented Jan 24, 2021 at 19:05

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.