Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add focus modifier for inputfields #651

Merged
merged 1 commit into from
Aug 15, 2023

Conversation

PavelHolec
Copy link
Collaborator

@PavelHolec PavelHolec commented Aug 15, 2023

The modifier has a different API than the native one. Ours can be specified only once for the whole screen, using our existing identifier identity. We can later add another modifier mimicking the native one, if needed.

Native:

@FocusState private var focus: FieldType?

TextField(...)
   .focused($focus, equals: .firstname)

TextField(...)
   .focused($focus, equals: .middleName)

TextField(...)
   .focused($focus, equals: .lastname)

Orbit:

VStack(alignment: .leading, spacing: .large) {
    InputField(...)
        .identifier(Input.one)

    InputField(...)
        .identifier(Input.two)

    InputField(...)
        .identifier(Input.three)
}
.inputFieldFocus($focus)
Screen.Recording.2023-08-15.at.10.23.40.mov

@PavelHolec PavelHolec added the feature Orbit component related changes label Aug 15, 2023
@PavelHolec PavelHolec added this to the 2023Q3 milestone Aug 15, 2023
@PavelHolec PavelHolec requested a review from a team as a code owner August 15, 2023 08:29
@PavelHolec PavelHolec linked an issue Aug 15, 2023 that may be closed by this pull request
@PavelHolec PavelHolec self-assigned this Aug 15, 2023
@PavelHolec PavelHolec merged commit 69f8c53 into main Aug 15, 2023
7 checks passed
@PavelHolec PavelHolec deleted the 541-add-custom-focused-modifier-to-inputfield branch August 15, 2023 09:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature Orbit component related changes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add custom focused modifier to InputField
2 participants