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

Extra keyboard #8348

Merged
merged 7 commits into from
Nov 29, 2024
Merged

Extra keyboard #8348

merged 7 commits into from
Nov 29, 2024

Conversation

enahum
Copy link
Contributor

@enahum enahum commented Nov 14, 2024

Summary

This PR removes the KeyboardTrackingView used to track the keyboard on the post list for iOS as well as adds functionality to change the adjust behavior on Android.

With the two above taken care of, now our app will no longer move the contents of the screen (aka post list) on both Android and iOS when giving focus to the draft input. Instead we are adding a View below the draft input that will animate its height to the keyboard height, moving the contents of the screen upwards (this works fine even when using a hardware keyboard).

Additionally, we have the ability to set a custom component where the keyboard is displayed to accommodate for things like the emoji picker and in the future if we want the image picker and others.

Ticket Link

https://mattermost.atlassian.net/browse/MM-61739
https://mattermost.atlassian.net/browse/MM-61551
https://mattermost.atlassian.net/browse/MM-61917

Checklist

  • Added or updated unit tests (required for all new features)

Device Information

This PR was tested on:
iPhone 14
iPhone SE
iPhone 16 Pro
iPad 11
iPad 13 Max
Emulators for Android 14 and 15 including foldable devices

Release Note

NONE

@enahum enahum added 2: Dev Review Requires review by a core commiter 2: UX Review Requires review by a UX Designer labels Nov 14, 2024
@matthewbirtch matthewbirtch requested review from abhijit-singh and removed request for matthewbirtch November 15, 2024 20:44
@abhijit-singh abhijit-singh added the Build Apps for PR Build the mobile app for iOS and Android to test label Nov 18, 2024
Copy link

@abhijit-singh abhijit-singh left a comment

Choose a reason for hiding this comment

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

Tested on Android and iPhone, looks good to me! Thanks @enahum.

Copy link
Contributor

@larkox larkox left a comment

Choose a reason for hiding this comment

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

It looks great. Just a few comments.

app/context/extra_keyboard/index.tsx Show resolved Hide resolved
app/context/extra_keyboard/index.tsx Outdated Show resolved Hide resolved
Comment on lines 72 to 77
const registerTextInputFocus = useCallback(() => {
setIsTextInputFocused(true);
setTimeout(() => {
setExtraKeyboardVisible(false);
}, 400);
}, []);
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't completely understand why the extra keyboard sets visible to false when the input is focused. Is it a mistake, or I am missing something?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah.. yes this one is tricky.. in short is a hack to handle the fact that the Android Keyboard when receiving focus will cause an animation glitch if the extra keyboard was already opened.

Copy link
Contributor

Choose a reason for hiding this comment

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

Since this is one is tricky, I think we should add some comment to explain why we do this.

app/context/extra_keyboard/index.tsx Outdated Show resolved Hide resolved
app/context/extra_keyboard/index.tsx Outdated Show resolved Hide resolved
@enahum enahum requested a review from larkox November 25, 2024 06:35
Copy link
Contributor

@larkox larkox left a comment

Choose a reason for hiding this comment

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

Apart of the comment on my previous review about adding a comment to the tricky behavior, LGTM.

@Willyfrog
Copy link
Contributor

This also fixes https://mattermost.atlassian.net/browse/MM-61917

Copy link
Contributor

@Willyfrog Willyfrog left a comment

Choose a reason for hiding this comment

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

Looks good

@enahum enahum merged commit d25c6fe into main Nov 29, 2024
4 checks passed
@enahum enahum deleted the extra-keyboard branch November 29, 2024 03:58
@amyblais amyblais added this to the v2.24.0 milestone Nov 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
2: Dev Review Requires review by a core commiter 2: UX Review Requires review by a UX Designer Build Apps for PR Build the mobile app for iOS and Android to test release-note-none
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants