-
Notifications
You must be signed in to change notification settings - Fork 28
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
Update KeyboardObserver #499
Conversation
- A new `custom` case is added to `KeyboardAdjustmentMode` which allows the consumer to fully customize the inset behavior. `onKeyboardFrameWillChange` and `customScrollViewInsets` have been added to `ListView` and `updateScrollViewInsets` is now public. All of these can be utilized in conjunction to respond to the keyboard and fully control the insets. For now, these are available through `ListView` only. | ||
|
||
### Removed | ||
|
||
### Changed | ||
|
||
- `SwipeAction` property names have been updated to better reflect what they're for. `Completion` also now takes in a more descriptive enum, instead of a boolean, to make reading callsites clearer. Eg, `completion(.expandActions)` instead of `completion(true)`. | ||
- `KeyboardObserverDelegate` now provides `UIView.AnimationCurve` instead of `UIView.AnimationOptions`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
God bless
// KeyboardObserver.swift | ||
// ListableUI | ||
// | ||
// Created by Kyle Van Essen on 2/16/20. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wow rude
|
||
var endingFrame : CGRect = .zero | ||
@available(iOS 16.1, *) | ||
var screen: UIScreen { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this intermediary useful? Can we not just do this in init?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
AFAIK, you can't have stored properties that are marked with @available
. So to keep the public API as accurate as possible I'm using that private optional UIScreen
property for storage. There might be a cleaner way to do this but I didn't come across anything when I looked.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A ha!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Couple small things, otherwise LGTM!
@kyleve The notification screen handling was updated in 27d578d to match the revised Market implementation (https://github.com/squareup/market/pull/6826). |
* origin/main: Release 13.0.0 (#504) Update KeyboardObserver (#499) CONV-1435: Gravity layout frame change fix - Before: Layout gravity doesn't take into account frame changes. For example, when the orientation changes the scroll position (relative to the bottom) changes - After: Layout gravity takes frame changes into account so the when the frame changes the scroll position relative to the bottom remains unchanged Release 12.0.0 (#501) CONV-1435: Add scroll indicator insets to customScrollViewInsets (#500) CONV-1435: Gravity layout - Adds a new Chat App demo and a new behavior called verticalLayoutGravity. When verticalLayoutGravity is set to bottom, scrolling works the way you would expect for a messaging app. expose onKeyboardFrameWillChange on ListProperties onKeyboardFrameWillChange: Improve CHANGELOG, DocC CONV-1435: Custom keyboard adjustment mode - Adds a .custom KeyboardAdjustmentMode to fully customize inset behavior remove contentOffset from isContentScrollable calculation, improve comment Add ListView#isContentScrollable property - Add this property to ListView. It will be used in conjunction with upcoming so-called gravity scrolling changes to workaround an animation issue with paging Update CI script to reference the `xcodesorg/made/xcodes` package for installing simulator runtimes. (#494)
…rovements * origin/main: (123 commits) Update CHANGELOG.md (#508) Revert "Supplementary Tracking Fixes (#433)" Revert "Force layout before appear, to avoid animated updates (#505)" Force layout before appear, to avoid animated updates (#505) Update workaround versions (#506) Fix supplementary view + contained first responder reuse issue (#507) Supplementary Tracking Fixes (#433) Release 13.0.0 (#504) Update KeyboardObserver (#499) CONV-1435: Gravity layout frame change fix - Before: Layout gravity doesn't take into account frame changes. For example, when the orientation changes the scroll position (relative to the bottom) changes - After: Layout gravity takes frame changes into account so the when the frame changes the scroll position relative to the bottom remains unchanged Release 12.0.0 (#501) CONV-1435: Add scroll indicator insets to customScrollViewInsets (#500) CONV-1435: Gravity layout - Adds a new Chat App demo and a new behavior called verticalLayoutGravity. When verticalLayoutGravity is set to bottom, scrolling works the way you would expect for a messaging app. expose onKeyboardFrameWillChange on ListProperties onKeyboardFrameWillChange: Improve CHANGELOG, DocC CONV-1435: Custom keyboard adjustment mode - Adds a .custom KeyboardAdjustmentMode to fully customize inset behavior remove contentOffset from isContentScrollable calculation, improve comment Add ListView#isContentScrollable property - Add this property to ListView. It will be used in conjunction with upcoming so-called gravity scrolling changes to workaround an animation issue with paging Update CI script to reference the `xcodesorg/made/xcodes` package for installing simulator runtimes. (#494) Swipe Action Updates (#489) ...
This updates the
KeyboardObserver
to match the more recent implementation we use elsewhere.Changes include:
UIView.AnimationCurve
instead ofUIView.AnimationOptions
ListView
changes:UIViewPropertyAnimator
instead ofUIView.animate
when responding to keyboard notifications.KeyboardFrameWillChangeCallback
now receives theUIView.AnimationCurve
instead ofUIView.AnimationOptions
Note: This implementation
Checklist
Please do the following before merging:
Main
section.