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 flag to disable EpoxySwiftUIHostingController keyboard avoidance #170

Merged
merged 6 commits into from
Jul 23, 2024
Merged

Add flag to disable EpoxySwiftUIHostingController keyboard avoidance #170

merged 6 commits into from
Jul 23, 2024

Conversation

sammygutierrez
Copy link
Contributor

Change summary

This PR fixes an issue where an EpoxySwiftUIHostingView used as a bottom bar was being pushed above the keyboard when presented causing layout issues with the screen. There doesn't seem to be a way to disable this from SwiftUI (.ignoresSafeArea(.keyboard) doesn't work) so this uses dynamic subclassing to override the hosting controller's keyboardWillShowWithNotification method.

How was it tested?

How did you verify that this change accomplished what you expected? Add more detail as needed.

  • Wrote automated tests
  • Built and ran on the iOS simulator
  • Built and ran on a device

Pull request checklist

All items in this checklist must be completed before a pull request will be reviewed.

  • Risky changes have been put behind a feature flag, e.g. CollectionViewConfiguration
  • Added a CHANGELOG.md entry in the "Unreleased" section for any library changes

@bryankeller bryankeller enabled auto-merge (squash) July 23, 2024 20:31
@@ -19,7 +19,7 @@ open class EpoxySwiftUIHostingController<Content: View>: UIHostingController<Con

/// Creates a `UIHostingController` that optionally ignores the `safeAreaInsets` when laying out
/// its contained `RootView`.
public convenience init(rootView: Content, ignoreSafeArea: Bool) {
public convenience init(rootView: Content, ignoreSafeArea: Bool, ignoreKeyboardAvoidance: Bool) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just realized both should be ignores for consistency

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we rename the API, it'll be a breaking change. That's fine but just something to keep in mind since it will change the semver version when we tag another release off of master.

auto-merge was automatically disabled July 23, 2024 21:19

Head branch was pushed to by a user without write access

@bryankeller bryankeller enabled auto-merge (squash) July 23, 2024 23:23
@bryankeller bryankeller merged commit a1a2929 into airbnb:master Jul 23, 2024
7 of 9 checks passed
@sammygutierrez sammygutierrez deleted the sammy--hosting-controller-keyboard-avoidance branch July 23, 2024 23:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants