diff --git a/EhPanda/View/Content/ContentView.swift b/EhPanda/View/Content/ContentView.swift index 520e4f2b..f0a09214 100644 --- a/EhPanda/View/Content/ContentView.swift +++ b/EhPanda/View/Content/ContentView.swift @@ -83,15 +83,17 @@ struct ContentView: View, StoreAccessor { } HStack(alignment: .center) { Spacer() - ProgressView() - .opacity(moreLoadingFlag ? 1 : 0) - NetworkErrorCompactView( - retryAction: fetchMoreMangaContents - ) - .opacity(moreLoadFailedFlag ? 1 : 0) + if moreLoadingFlag { + ProgressView() + } else if moreLoadFailedFlag { + NetworkErrorCompactView( + retryAction: fetchMoreMangaContents + ) + } Spacer() } - .frame(height: 30) + .frame(height: 50) + .padding(.bottom, 20) } .onAppear { onLazyVStackAppear(scrollProxy) diff --git a/EhPanda/View/Detail/AssociatedView.swift b/EhPanda/View/Detail/AssociatedView.swift index 3ab72493..a93206d8 100644 --- a/EhPanda/View/Detail/AssociatedView.swift +++ b/EhPanda/View/Detail/AssociatedView.swift @@ -41,12 +41,13 @@ struct AssociatedView: View, StoreAccessor { .transition(animatedTransition) HStack(alignment: .center) { Spacer() - ProgressView() - .opacity(moreLoadingFlag ? 1 : 0) - NetworkErrorCompactView( - retryAction: fetchMoreAssociatedItems - ) - .opacity(moreLoadFailedFlag ? 1 : 0) + if moreLoadingFlag { + ProgressView() + } else if moreLoadFailedFlag { + NetworkErrorCompactView( + retryAction: fetchMoreAssociatedItems + ) + } Spacer() } .listRowBackground(Color.clear) diff --git a/EhPanda/View/Home/HomeView.swift b/EhPanda/View/Home/HomeView.swift index a968b372..cc2fb975 100644 --- a/EhPanda/View/Home/HomeView.swift +++ b/EhPanda/View/Home/HomeView.swift @@ -528,12 +528,13 @@ private struct GenericList: View, StoreAccessor { .transition(animatedTransition) HStack(alignment: .center) { Spacer() - ProgressView() - .opacity(moreLoadingFlag ? 1 : 0) - NetworkErrorCompactView( - retryAction: loadMoreAction - ) - .opacity(moreLoadFailedFlag ? 1 : 0) + if moreLoadingFlag { + ProgressView() + } else if moreLoadFailedFlag { + NetworkErrorCompactView( + retryAction: loadMoreAction + ) + } Spacer() } .listRowBackground(Color.clear) diff --git a/EhPanda/View/Tools/Comment.swift b/EhPanda/View/Tools/Comment.swift index 43a29b54..7986337f 100644 --- a/EhPanda/View/Tools/Comment.swift +++ b/EhPanda/View/Tools/Comment.swift @@ -32,6 +32,7 @@ struct CommentButton: View { struct DraftCommentView: View { @Binding private var content: String + @FocusState private var isTextEditorFocused: Bool private let title: String private let postAction: () -> Void @@ -53,7 +54,7 @@ struct DraftCommentView: View { NavigationView { VStack { TextEditor(text: $content) - .padding() + .focused($isTextEditorFocused) .autocapitalization(.none) .disableAutocorrection(true) .navigationBarTitle( @@ -72,8 +73,16 @@ struct DraftCommentView: View { } .disabled(content.isEmpty) ) + .onAppear(perform: onTextEditorAppear) + .padding() Spacer() } } } + + private func onTextEditorAppear() { + DispatchQueue.main.asyncAfter(deadline: .now() + 0.2) { + isTextEditorFocused = true + } + } }