We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent aff908a commit 352c2ceCopy full SHA for 352c2ce
Sources/SwiftCrossUI/Modifiers/OnSubmitModifier.swift
@@ -1,9 +1,15 @@
1
extension View {
2
/// Adds an action to perform when the user submits a text field within this
3
- /// view (generally via pressing the Enter/Return key).
+ /// view (generally via pressing the Enter/Return key). Outer `onSubmit`
4
+ /// handlers get called before inner `onSubmit` handlers. To prevent
5
+ /// submissions from propagating upwards, use ``View/submitScope()`` after
6
+ /// adding the handler.
7
public func onSubmit(perform action: @escaping () -> Void) -> some View {
8
EnvironmentModifier(self) { environment in
- environment.with(\.onSubmit, action)
9
+ environment.with(\.onSubmit) {
10
+ environment.onSubmit?()
11
+ action()
12
+ }
13
}
14
15
0 commit comments