Skip to content

Commit

Permalink
fix: ProgressView offset & Pulling keyboard up
Browse files Browse the repository at this point in the history
  • Loading branch information
tatsuz0u committed Jun 10, 2021
1 parent aa189f3 commit cf8ca79
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 20 deletions.
16 changes: 9 additions & 7 deletions EhPanda/View/Content/ContentView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
13 changes: 7 additions & 6 deletions EhPanda/View/Detail/AssociatedView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
13 changes: 7 additions & 6 deletions EhPanda/View/Home/HomeView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
11 changes: 10 additions & 1 deletion EhPanda/View/Tools/Comment.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -53,7 +54,7 @@ struct DraftCommentView: View {
NavigationView {
VStack {
TextEditor(text: $content)
.padding()
.focused($isTextEditorFocused)
.autocapitalization(.none)
.disableAutocorrection(true)
.navigationBarTitle(
Expand All @@ -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
}
}
}

0 comments on commit cf8ca79

Please sign in to comment.