douglasjunior / react-native-keyboard-manager

⚛ Library to prevent issues of keyboard sliding up and cover inputs on React-Native iOS projects.
https://www.npmjs.com/package/react-native-keyboard-manager
MIT License
971 stars 59 forks source link

IQKeyboardManager not firing default 'focus' on TextInput #32

Closed rohozhnikoff closed 4 years ago

rohozhnikoff commented 6 years ago

hey guys thank you for this integration i've spent too much time to make my form-ux perfect, and your package is significant part of it

here is known issue: when using react-native-keyboard-manager, app stops firing internal react-native NativeMethodsMixin.focus() behavior, which is contain logic like this:

TextInputState.focusTextInput(findNodeHandle(this.inputRef));

except you manage it imperative with this.inputRef.focus()

it cause problem with Keyboard.dismiss(), with inputRef.blur(), cause they linked to TextInputState internal state, which isnt refreshed from last focus.

in my app, i solved it by patching like this:

onFocus={() => TextInputState.focusTextInput(findNodeHandle(this.input))}

it's okay for my situation, cause i have generic input component but will be better to solve somehow globally

douglasjunior commented 6 years ago

This kind of problem is complicated. Because IQKeyboardManager updates native components directly, so React Native does not know what's changing.

rohozhnikoff commented 6 years ago

@douglasjunior can we bind on this 'focus' update if so, we can send message with react id across the bridge, and update TextInputState from js it should solve the issue

douglasjunior commented 6 years ago

I'm not sure. But the React Native changes a lot, that would make us dependent.