Skip to content

Commit cf8ca79

Browse files
author
たつぞう
committed
fix: ProgressView offset & Pulling keyboard up
1 parent aa189f3 commit cf8ca79

File tree

4 files changed

+33
-20
lines changed

4 files changed

+33
-20
lines changed

EhPanda/View/Content/ContentView.swift

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -83,15 +83,17 @@ struct ContentView: View, StoreAccessor {
8383
}
8484
HStack(alignment: .center) {
8585
Spacer()
86-
ProgressView()
87-
.opacity(moreLoadingFlag ? 1 : 0)
88-
NetworkErrorCompactView(
89-
retryAction: fetchMoreMangaContents
90-
)
91-
.opacity(moreLoadFailedFlag ? 1 : 0)
86+
if moreLoadingFlag {
87+
ProgressView()
88+
} else if moreLoadFailedFlag {
89+
NetworkErrorCompactView(
90+
retryAction: fetchMoreMangaContents
91+
)
92+
}
9293
Spacer()
9394
}
94-
.frame(height: 30)
95+
.frame(height: 50)
96+
.padding(.bottom, 20)
9597
}
9698
.onAppear {
9799
onLazyVStackAppear(scrollProxy)

EhPanda/View/Detail/AssociatedView.swift

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -41,12 +41,13 @@ struct AssociatedView: View, StoreAccessor {
4141
.transition(animatedTransition)
4242
HStack(alignment: .center) {
4343
Spacer()
44-
ProgressView()
45-
.opacity(moreLoadingFlag ? 1 : 0)
46-
NetworkErrorCompactView(
47-
retryAction: fetchMoreAssociatedItems
48-
)
49-
.opacity(moreLoadFailedFlag ? 1 : 0)
44+
if moreLoadingFlag {
45+
ProgressView()
46+
} else if moreLoadFailedFlag {
47+
NetworkErrorCompactView(
48+
retryAction: fetchMoreAssociatedItems
49+
)
50+
}
5051
Spacer()
5152
}
5253
.listRowBackground(Color.clear)

EhPanda/View/Home/HomeView.swift

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -528,12 +528,13 @@ private struct GenericList: View, StoreAccessor {
528528
.transition(animatedTransition)
529529
HStack(alignment: .center) {
530530
Spacer()
531-
ProgressView()
532-
.opacity(moreLoadingFlag ? 1 : 0)
533-
NetworkErrorCompactView(
534-
retryAction: loadMoreAction
535-
)
536-
.opacity(moreLoadFailedFlag ? 1 : 0)
531+
if moreLoadingFlag {
532+
ProgressView()
533+
} else if moreLoadFailedFlag {
534+
NetworkErrorCompactView(
535+
retryAction: loadMoreAction
536+
)
537+
}
537538
Spacer()
538539
}
539540
.listRowBackground(Color.clear)

EhPanda/View/Tools/Comment.swift

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ struct CommentButton: View {
3232

3333
struct DraftCommentView: View {
3434
@Binding private var content: String
35+
@FocusState private var isTextEditorFocused: Bool
3536

3637
private let title: String
3738
private let postAction: () -> Void
@@ -53,7 +54,7 @@ struct DraftCommentView: View {
5354
NavigationView {
5455
VStack {
5556
TextEditor(text: $content)
56-
.padding()
57+
.focused($isTextEditorFocused)
5758
.autocapitalization(.none)
5859
.disableAutocorrection(true)
5960
.navigationBarTitle(
@@ -72,8 +73,16 @@ struct DraftCommentView: View {
7273
}
7374
.disabled(content.isEmpty)
7475
)
76+
.onAppear(perform: onTextEditorAppear)
77+
.padding()
7578
Spacer()
7679
}
7780
}
7881
}
82+
83+
private func onTextEditorAppear() {
84+
DispatchQueue.main.asyncAfter(deadline: .now() + 0.2) {
85+
isTextEditorFocused = true
86+
}
87+
}
7988
}

0 commit comments

Comments
 (0)