43
Views
1
Comments
Input field auto focus not working in IOS Devices
Application Type
Mobile
Service Studio Version
11.54.46 (Build 63163)

Hello everyone,

I'm currently developing a mobile application, and I've encountered an issue on one of my screens. I have over 10 input fields, and when I tap on one of the bottom input fields on Android devices, the input automatically scrolls up when the keyboard appears. However, on iOS devices, the input field does not automatically scroll up. please provide a solution for iOS devices.


Thank you.


2024-07-12 05-57-50
Gourav Shrivastava
Champion

Hello @Dhivakar Velumani ,

You can add this javascript code onfocus event of the input types add pass the dynamic I'd inside the JS widget .

Code:- 

// Listen for keyboard show event

window.addEventListener('keyboardWillShow', function(event) {

    // Get the height of the keyboard

    var keyboardHeight = event.keyboardHeight;


    // Adjust the position of the input field

    document.getElementById('your-input-field-id').style.bottom = keyboardHeight + 'px';

});


// Listen for keyboard hide event

window.addEventListener('keyboardWillHide', function() {

    // Reset the position of the input field

    document.getElementById('your-input-field-id').style.bottom = '0';

});


Replace 'your-input-field-id' with the ID of your input field. This script will adjust the position of the input field when the keyboard appears and reset it when the keyboard is hidden.



Regards 

Gourav Shrivastava




Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.