v2 #1

Open
kamil wants to merge 231 commits from v2 into main
Showing only changes of commit 24cb18e0fe - Show all commits

View File

@@ -759,6 +759,16 @@ struct ChaptersListSheet: View {
let onChapterSelect: (Int) -> Void
@Environment(\.dismiss) private var dismiss
// Initialize scroll position to current chapter immediately (before view appears)
init(chapters: [ChapterIndexBrief], currentChapter: Int, onChapterSelect: @escaping (Int) -> Void) {
self.chapters = chapters
self.currentChapter = currentChapter
self.onChapterSelect = onChapterSelect
// Set initial scroll position state before view renders
_scrollPosition = State(initialValue: currentChapter)
}
@State private var scrollPosition: Int?
var body: some View {
@@ -815,10 +825,6 @@ struct ChaptersListSheet: View {
}
.listStyle(.plain)
.scrollPosition(id: $scrollPosition, anchor: .center)
.onAppear {
// Set initial scroll position without animation
scrollPosition = currentChapter
}
.navigationTitle("Chapters")
.navigationBarTitleDisplayMode(.inline)
.toolbar {