react-native-yusha-customKeyboard icon indicating copy to clipboard operation
react-native-yusha-customKeyboard copied to clipboard

autofoucs issue in android

Open swaroopa94 opened this issue 6 years ago • 2 comments

Hi

I am using this module and its working great but the issue is

when I keep autofocus to the textInput in iOS working fine but in android it is getting the default keyboard again when we click on the textInput then it shows the custom keyboard.

Can you tell me how to solve this I used same code as in RNdemo project

React-Native : 0.57.1 react-native-yusha-customkeyboard: "^0.1.3",

swaroopa94 avatar Dec 28 '18 04:12 swaroopa94

Hi @swaroopa94 ! Thank you for using this module and your feedback. The issue is with the Android custom keyboard. Because React Native's will invoke API to display the default keyboard when the TextInput component is focused. In my code https://github.com/lyxia/react-native-yusha-customKeyboard/blob/master/android/src/main/java/com/facebook/react/uimanager/RNCustomKeyboardModule.java#L75 , it will listen to the focus event and hide the default keyboard. Thus there might be some time lag between the the default keyboard hiding and the custom one popping out. Currently I don't have any better solutions to resolve this issue. If you have any ideas, please tell me and pull requests are always welcome and appreciated :) (Reply by @lyxia )

Gri22ly avatar Jan 30 '19 02:01 Gri22ly

componentDidMount() { this.installTime = setTimeout(()=>{ install(findNodeHandle(this.input), this.props.customKeyboardType);

    if(Platform.OS === 'android') {
        this.showSub = addKeyBoardShowListener(this._showKeyboard);
        this.hideSub = addKeyBoardHideListener(this._hideKeyboard);
    }

    AppState.addEventListener('change', this._handleAppStateChange);
    this.input && this.input.focus();
}, 300)

}

ShawSmall avatar Feb 20 '19 03:02 ShawSmall