Godot Version
4.5.1
Question
I tried to prevent the bottom input box from being covered by the virtual keyboard by DisplayServer.virtual_keyboard_get_height() and setting the margin bottom in the process function:
func _process(delta: float) -> void:
var keyboard_height: int = DisplayServer.virtual_keyboard_get_height()
var scaled_keyboard_height: float = ControlUtils.calculate_scaled_size(Vector2(0, keyboard_height)).y
var margin_bottom = (origin_margin_bottom + int(scaled_keyboard_height)) if is_visible else origin_margin_bottom
add_theme_constant_override("margin_bottom", margin_bottom)
However, on iOS, the input box does not dynamically rise and fall during the virtual keyboard’s appearance and disappearance process, it only moves to the start and end positions with a significant delay, whereas the behavior on Android meets expectations:
By printing the keyboard height, it was found that during the keyboard’s rise and fall process, Android will output values between 0 and the maximum keyboard height in real time, while iOS will only output two values: 0 and the maximum keyboard height.
Android:
virtual_keyboard_get_height: 0
virtual_keyboard_get_height: 0
virtual_keyboard_get_height: 0
virtual_keyboard_get_height: 478
virtual_keyboard_get_height: 601
virtual_keyboard_get_height: 601
virtual_keyboard_get_height: 683
virtual_keyboard_get_height: 756
virtual_keyboard_get_height: 804
virtual_keyboard_get_height: 837
virtual_keyboard_get_height: 860
virtual_keyboard_get_height: 873
virtual_keyboard_get_height: 880
virtual_keyboard_get_height: 882
virtual_keyboard_get_height: 882
virtual_keyboard_get_height: 882
...
iOS:
virtual_keyboard_get_height: 0
virtual_keyboard_get_height: 0
virtual_keyboard_get_height: 0
virtual_keyboard_get_height: 1008
virtual_keyboard_get_height: 1008
virtual_keyboard_get_height: 1008
...
Is there any way to solve my iOS input box rising issue?