wix-incubator / react-native-keyboard-input

Use your own custom input component instead of the system keyboard
MIT License
819 stars 150 forks source link

Feature Request: isCustomKeyboardOpen #11

Closed thorbenandresen closed 7 years ago

thorbenandresen commented 7 years ago

Hi Artal,

I am not sure if the current API already offers it, but I have use case for KeyboardUtils.isCustomKeyboardOpen() method.

Example: I display the sticker keyboard on Android, which means the native keyboard is not shown. I would like the user to be able to press the Android Button in order to trigger a KeyboardUtils.dismiss(). If the keyboard/custom keyboards are hidden the Android back button should perform another action (pop a route).

My BackAndroid listener is on the root, so KeyboardUtils.isCustomKeyboardOpen() would be very handy. This way I could avoid adding the custom keyboard state to my global state object.

What do you think about this? Do you also think such a method would be useful?

artald commented 7 years ago

Hey Thorben,

Thanks for the suggestion. The API currently doesn't offer such functionality.

I'm wondering if such API is necessary - since a parent component that uses KeyboardAccessoryView holds the state of the currently displayed keyboard and controls it, i'm not sure it makes sense to expose a native API that could potentially get out of sync because of the asynchronous nature of RN.

I think you can easily implement such method in your own project according to the state of the keyboard that you hold. But it can't be a static method because only the instance of your component knows about the state.

Does this makes sense? What do you think?

thorbenandresen commented 7 years ago

Hi Artal, that makes sense. Thanks for clarifying!

thorbenandresen commented 7 years ago

Hi Artal, that makes sense. Thanks for clarifying!