From 48dd11a36f8450f6904c0b6ef847da6ff93e86a2 Mon Sep 17 00:00:00 2001 From: Lucian Cerbu Date: Wed, 24 Apr 2024 17:36:15 +0300 Subject: [PATCH] Removed the animation where the buttom buttons (back and next) are following the keyboard when the user inputs archive name. --- .../Onboarding/Views/OnboardingArchiveName.swift | 11 ++--------- .../Modules/Onboarding/Views/OnboardingView.swift | 2 +- 2 files changed, 3 insertions(+), 10 deletions(-) diff --git a/Permanent/Modules/Onboarding/Views/OnboardingArchiveName.swift b/Permanent/Modules/Onboarding/Views/OnboardingArchiveName.swift index 7fe2983e..e27803f4 100644 --- a/Permanent/Modules/Onboarding/Views/OnboardingArchiveName.swift +++ b/Permanent/Modules/Onboarding/Views/OnboardingArchiveName.swift @@ -12,7 +12,6 @@ struct OnboardingArchiveName: View { var backButton: (() -> Void) var nextButton: (() -> Void) - @State var bottomButtonsPadding: CGFloat = 40 @State var isKeyboardPresented = false @State var textFieldText: String = "" @@ -52,14 +51,11 @@ struct OnboardingArchiveName: View { } .onReceive(keyboardPublisher) { keyboard in if keyboard.isFirstResponder { - bottomButtonsPadding = 10 DispatchQueue.main.asyncAfter(deadline: .now() + 0.1, execute: { withAnimation { scrollReader.scrollTo(0, anchor: .center) } }) - } else { - bottomButtonsPadding = 40 } } .onAppear { @@ -73,7 +69,7 @@ struct OnboardingArchiveName: View { SmallRoundButtonImageView(type: .noColor, imagePlace: .onLeft, text: "Back", image: Image(.leftArrowShort), action: backButton) SmallRoundButtonImageView(isDisabled: onboardingValues.textFieldText.isEmpty, text: "Next", action: nextButton) } - .padding(.bottom, bottomButtonsPadding) + .padding(.bottom, 40) .sheet(isPresented: $presentSelectArchivesType, content: { OnboardingSelectArchiveTypeView(onboardingValues: onboardingValues) }) @@ -115,14 +111,11 @@ struct OnboardingArchiveName: View { } .onReceive(keyboardPublisher) { keyboard in if keyboard.isFirstResponder { - bottomButtonsPadding = 10 DispatchQueue.main.asyncAfter(deadline: .now() + 0.1, execute: { withAnimation { scrollReader.scrollTo(1, anchor: .center) } }) - } else { - bottomButtonsPadding = 40 } } .onAppear { @@ -137,7 +130,7 @@ struct OnboardingArchiveName: View { .frame(width: 120) RoundButtonRightImageView(text: "Create the archive", action: nextButton) } - .padding(.bottom, bottomButtonsPadding) + .padding(.bottom, 40) } } } diff --git a/Permanent/Modules/Onboarding/Views/OnboardingView.swift b/Permanent/Modules/Onboarding/Views/OnboardingView.swift index 6af2cabb..215409f4 100644 --- a/Permanent/Modules/Onboarding/Views/OnboardingView.swift +++ b/Permanent/Modules/Onboarding/Views/OnboardingView.swift @@ -92,7 +92,7 @@ struct OnboardingView: View { .padding(.horizontal, Constants.Design.isPhone ? 32 : 64) .padding(.top, Constants.Design.isPhone ? 70 : 48) } - .ignoresSafeArea(.container) + .ignoresSafeArea(.all) }