-
Notifications
You must be signed in to change notification settings - Fork 615
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
feat(keyboard): Add keyboardAnimationDuration to KeyboardInfo #523
base: main
Are you sure you want to change the base?
Conversation
viablecell
commented
Jul 20, 2021
- Add keyboardAnimationDuration to KeyboardInfo
- iOS, Android, notifyListeners keyboardWillShow and keyboardDidShow with keyboardAnimationDuration
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.
Reviewed
@@ -75,9 +75,11 @@ void onKeyboardEvent(String event, int size) { | |||
switch (event) { | |||
case Keyboard.EVENT_KB_WILL_SHOW: | |||
case Keyboard.EVENT_KB_DID_SHOW: | |||
String data = "{ 'keyboardHeight': " + size + " }"; | |||
// Convert Handler().postDelayed() 350ms to 0.35s | |||
String data = "{ 'keyboardHeight': " + size + ", 'keyboardAnimationDuration': " + 0.35 + " }"; |
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.
Thanks so much for contributing this. Is 350 a constant on Android?
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.
@PluginMethod
public void show(final PluginCall call) {
execute(
() ->
new Handler()
.postDelayed(
() -> {
implementation.show();
call.resolve();
},
350
)
);
}
350 is method param long delayMillis
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'm sorry, I meant: on Android, is 350 milliseconds always the time it takes for the keyboard animation to complete. I'm wondering why that number is hard-coded.
Thank you.
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 may be speaking out of ignorance here, but is this value only useful on iOS? Perhaps the android part of this should be removed, and the docs should specify this as an iOS only value for the plugin?
Is there any chance we can merge this soon? This is extremely useful for adapting the keyboard on iOS. We should probably match react native and do 0 for android. (It's been implemented in react for years). |