-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Update bottom margin to accommodate iPhone X home indicator #619
Conversation
Guys any ETA when this pull request will get merged. I need to make my App ready for iPhone X as soon as possible. |
@hipwelljo This updates the UI so the UPDATE: Last version fixed touch events issues |
Bump |
This commit didn't solve it for me. |
This fixes the issue for me. Any chance this will get merged? |
For me this fix isn't completely working, and I also can't understand how it should. |
@Qonstrukt I'm not seeing what you're seeing. When scrolling up, the bar still covers the text. If you set the background color of the input bar, the entire bar is colored, this should just add padding to the bottom of the bar. |
Yes, I also see that in the first screenshot, but I can't understand how that's possible, as in, in my own layouts it's not working that way. The vertical constraints are based on the following: Then a constrain More specifically, what makes you say this works as a padding, an not as a margin? Just trying to understand what I might be doing wrong here. 🙂 |
@Qonstrukt I see what you mean. Checking out view debugger I see the input bar itself has a bottom margin of 34pt. Yet its background fills to the bottom of the screen. Which in my app and the demo this appears to be working exactly as desired, but perhaps it won't work for all setups as you're seeing. Also I see hiding the input bar leaves the safe area amount visible. Seems this needs more attention to work properly for all situations. Feel free to play with it and see what's going to work. |
iPhone X is due out 3rd November, that's 9 working days away! What's the likelihood of this getting fixed in time? |
@@ -237,6 +237,13 @@ - (void)viewDidLayoutSubviews | |||
[super viewDidLayoutSubviews]; | |||
} | |||
|
|||
- (void)viewSafeAreaInsetsDidChange | |||
{ | |||
[super viewSafeAreaInsetsDidChange]; |
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.
This should still be wrapped in if (@available(iOS 11.0, *))
isn't it?
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.
No need to. It's never called for older iOS versions, not by the system nor manually. If you run it on an iOS 10 device all is well. But it also wouldn't hurt to wrap it in that.
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.
True
I'll test this fix today and get it merged asap. Thanks @hipwelljo |
@dzenbot @Qonstrukt did have some concerns, mentioned it's not working as intended for his app, if you have any insight into why that would be or how it can be tweaked, it may need some attention there before being merged in. |
Of course. I read the whole thread. Will pay attention to that, thanks for the headsup. |
I'm trying this right now, and although the margin is visible for the iPhone X, the color of the bar is not being expanding to the bottom. Is this what you were experiencing @Qonstrukt? |
@hipwelljo please mind merging master into your branch? So we can run the CI on this PR, moving forward. I've tried making I tried implementing the UIBarPositioning protocol, and play around with it... but this is not enough. I feel like we should go back at using Any other suggestions are welcomed! |
@hipwelljo btw, check this commit out: This should fix that issue you brought up, where the bottom safe area would remain while the Text Inputbar was hidden. |
I can merge that later tonight I'm sure. I can envision how that's a problem with the view instead of toolbar now. When it is a UIToolbar, I'm still confused why the toolbar itself is moved up yet the background of the bar still stretches to the bottom, as you can see in the view debugger. I was thinking, a different approach could be to adjust constraints in the SLKTextInputbar instead of SLKTextViewController. I looked into that briefly, but there's a lot of items constrained to the bottom in there. I wasn't sure if that was a good approach anyways. |
I thought about constraining it in SLKTextInputbar too, and yes, it may overcomplicate things, specially because we'd have to adjust the bottom margin depending on the firstResponder state of the textView... I think a cleaner approach would be to go back using UIToolbar, which behaves natively, and just make sure the custom elements are on the foreground so they're not obfuscated with these new subviews. |
@dzenbot Ok merged and pushed up :) Your commit for hiding the input bar is working well. |
@dzenbot that’s exactly what I’m experiencing yea. I have some time reserved next week to try and fix it, but I’ve translated this to C# for use with Xamarin so I can’t directly push it back, but will share my solution if I’ll fimd one before you guys. Might also try the UIToolbar approach. |
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.
This PR solves the bottom margin for iPhone X. But as you mentioned the "Toolbar" is not extend to the bottom of the screen, resulting in a clear area where you can see the tableView.
My idea to solve this is:
Set the tableView bottom constraint to the toolbarView.top.
Set the background color of the main view to the background color of the toolbar (this will extend to the home indicator).
Alternatively place a new view matching the toolbar background color between the safe area.bottom and the screen edge.
Ok, so I found a working solution in this SO post: I've reverted back to a UIToolbar, and then added this line:
In This combined with the solution in this PR makes the text input bar stretch all the way to the bottom with the correct margins.
|
…mpatibility so the bottom edge of the input bar expands to the bottom of the screen Fixes #619
@hipwelljo I've updated my branch, with @Qonstrukt's suggestion of rolling back the change of UIToolbar https://github.com/slackhq/SlackTextViewController/tree/iPhoneX Want to update this branch with the latest from |
Cool, merged and pushed :) |
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.
Looks good to go! Thanks @hipwelljo 🥇
Although there are still known iOS 11 / iPhone X issues, I've pushed 1.9.6 release, which is also available on Cocoapods. At least, we've fixed the most critical issues. Thanks again to all the contributors! 👏 |
) * Update bottom margin to accommodate iPhone X home indicator * Skips the bottom safe area when the textinputbar is hidden * Reverting slackhq#624 to be using UIToolbar again, specially for iPhone X compatibility so the bottom edge of the input bar expands to the bottom of the screen Fixes slackhq#619 * [skip-ci] updating changelog
@@ -26,7 +26,7 @@ typedef NS_ENUM(NSUInteger, SLKCounterPosition) { | |||
NS_ASSUME_NONNULL_BEGIN | |||
|
|||
/** @name A custom tool bar encapsulating messaging controls. */ | |||
@interface SLKTextInputbar : UIView | |||
@interface SLKTextInputbar : UIToolbar |
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.
@dzenbot @hipwelljo regression?
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.
@dzenbot intentionally reverted that to UIToolbar
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.
I see, thanks
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.
We did revert it back tho, in https://github.com/slackhq/SlackTextViewController/pull/619/files#diff-19e165dd48b58feca5abccfcedc9efd8R29
Using UIToolbar
was still better for being able to extend the view to the very bottom on iPhone X. I would have liked moving away from UIToolbar
but this seemed like the quickest and safest way of being iPhone X complaint.
PR Summary
This PR updates the bottom margin to accommodate the home indicator on iPhone X.
Related Issues
Fixes (at least the biggest issue with) #618