Skip to content

Commit 3de264f

Browse files
fix: textfield comes into View when tapped
1 parent 25cf980 commit 3de264f

File tree

1 file changed

+34
-5
lines changed

1 file changed

+34
-5
lines changed

FirebaseSwiftUI/FirebaseAuthSwiftUI/Sources/Views/MFAResolutionView.swift

Lines changed: 34 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
1414

15+
import FirebaseCore
1516
import FirebaseAuth
1617
import SwiftUI
1718

@@ -109,8 +110,7 @@ public struct MFAResolutionView {
109110

110111
extension MFAResolutionView: View {
111112
public var body: some View {
112-
ScrollView {
113-
VStack(spacing: 24) {
113+
VStack(spacing: 24) {
114114
// Header
115115
VStack(spacing: 12) {
116116
Image(systemName: "lock.shield")
@@ -180,9 +180,8 @@ extension MFAResolutionView: View {
180180
.accessibilityIdentifier("cancel-button")
181181
}
182182
.padding(.horizontal)
183-
}
184-
.padding(.vertical, 20)
185183
}
184+
.padding(.vertical, 20)
186185
}
187186

188187
@ViewBuilder
@@ -377,7 +376,37 @@ private extension MFAHint {
377376
}
378377
}
379378

380-
#Preview {
379+
#Preview("Phone SMS Only") {
380+
FirebaseOptions.dummyConfigurationForPreview()
381+
let authService = AuthService()
382+
authService.currentMFARequired = MFARequired(hints: [
383+
.phone(displayName: "Work Phone", uid: "phone-uid-1", phoneNumber: "+15551234567")
384+
])
385+
return MFAResolutionView().environment(authService)
386+
}
387+
388+
#Preview("TOTP Only") {
389+
FirebaseOptions.dummyConfigurationForPreview()
390+
let authService = AuthService()
391+
authService.currentMFARequired = MFARequired(hints: [
392+
.totp(displayName: "Authenticator App", uid: "totp-uid-1")
393+
])
394+
return MFAResolutionView().environment(authService)
395+
}
396+
397+
#Preview("Multiple Methods") {
398+
FirebaseOptions.dummyConfigurationForPreview()
399+
let authService = AuthService()
400+
authService.currentMFARequired = MFARequired(hints: [
401+
.phone(displayName: "Mobile", uid: "phone-uid-1", phoneNumber: "+15551234567"),
402+
.totp(displayName: "Google Authenticator", uid: "totp-uid-1")
403+
])
404+
return MFAResolutionView().environment(authService)
405+
}
406+
407+
#Preview("No MFA Required") {
408+
FirebaseOptions.dummyConfigurationForPreview()
381409
let authService = AuthService()
410+
// currentMFARequired is nil by default
382411
return MFAResolutionView().environment(authService)
383412
}

0 commit comments

Comments
 (0)