-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
disable keyboard controller in the composer screen #4399
Conversation
Your Render PR Server URL is https://social-app-pr-4399.onrender.com. Follow its progress at https://dashboard.render.com/web/srv-cph06k021fec73ajgcag. |
|
Hello, maintainer and creator of I believe I fixed a very similar problem in kirillzyusko/react-native-keyboard-controller#207 (a year ago), but maybe your problem is slightly different than a mentioned one 🤔 Anyway, since your codebase is open source I can try to tackle this problem 👀 Can we have a chat in discord so you can answer on my questions (if I have them) on how to setup a project/which credentials to use/etc.? |
@@ -129,6 +130,17 @@ export const ComposePost = observer(function ComposePost({ | |||
const {closeAllDialogs} = useDialogStateControlContext() | |||
const t = useTheme() | |||
|
|||
// Disable this in the composer to prevent any extra keyboard height being applied. | |||
// See https://github.com/bluesky-social/social-app/pull/4399 | |||
const {setEnabled} = useKeyboardContext() |
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.
Just a small hint - for toggling enabled/disabled states it's better to use useKeyboardController
hook. Was there any reasons why you preferred to consume context directly?
I mean, it's not forbidden and eventually useKeyboardController
is also a simple context consumer, but consuming context directly it's kind of a last resort and was designed to be used in class-components (and in general useKeyboardContext
is not mentioned in API section, so it can be a subject to internal changes). For functional components I think it would be better to use useKeyboardController
hook which has a defined area of responsibility (toggling enabled/disabled state).
But let me know if I'm missing something important and in which cases better to consume a context 🙌
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.
Ah, that's good to know! We ran into some nasty problems yesterday and had to get something through quickly. I had been toying around with the library the other day and knew about the context but wasn't aware of the useKeyboardController
hook itself 😅. Thanks for catching that! Have not tried it yet but I assume it works the same way according to the docs 🙌
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.
Switched this here, thanks for the tip 🙏 a5434e9
Hi @kirillzyusko! We'd love it if you would like to take a look! Regarding credentials, you can create an account at https://bsky.app, no need for a phone number or anything. You can send me a message on Discord too (haileyok is my username) if you'd like. Is there anything specific that would help for you to understand? This problem originally came up whenever we switched from using a bottom sheet to a RN It does appear that maybe Android is adding that padding, though we're not sure. Additionally, the |
Yeah, I'll clone your app and see what's the root cause in your app. And yeah, probably I need to allocate some time and finally fix the problem with Modals, because it bothers a lot of devs 😀
Yeah, I don't think |
So the problem comes from the fact, that when Modal is shown - Because of these two facts we apply double padding (on API > 29 it doesn't happen, because keyboard movement is not emulated and callbacks are not getting fired, so we have only one padding applied by I hope I can merge and publish a new version soon 🤞 |
Really appreciate you looking into this so quickly! We've reverted this modal on Android for now, but definitely would love to use it if you're able to get it working. Thanks for all this info, amazing! 🙌 |
@haileyok slightly late, but it's better than never I believe 😅 I fixed a problem of If you encounter any issues - please don't hesitate to post them here or send me a DM in discord 👀 |
@kirillzyusko Hey! And I'm a little late too...no worries about being late haha. My attention is pretty much fully on other tasks right now but I definitely want to revisit this. Going to add a todo to come back to this and will reach out to you in discord if anything comes up 🙏 |
Why
See https://kirillzyusko.github.io/react-native-keyboard-controller/blog/set-enabled
It appears that on some devices, the
react-native-keyboard-controller
library is setting some padding on the bottom of the composer. This breaks the composer, for example as seen here:Instead, what we can do is enable it in the app, but specifically disable it in this screen. If we do that, this is the result:
Test Plan