Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Field steals focus #4

Closed
eyaleizenberg opened this issue Dec 20, 2015 · 5 comments
Closed

Field steals focus #4

eyaleizenberg opened this issue Dec 20, 2015 · 5 comments

Comments

@eyaleizenberg
Copy link

Tapping on the element, steals the focus and dismisses the keyboard. Is there a way I can prevent this from happening? keyboardShouldPersistTaps={true} didn't work...

@eyaleizenberg
Copy link
Author

@chirag04 Any chance to look into this?

@wwwdata
Copy link

wwwdata commented Oct 25, 2017

@eyaleizenberg did you find a solution for this? I have the exact same problem i have a list view with chat messages in it and while the keyboard is open i want to open the tooltip menu to offer some options like copy the chat message but that makes the text input field loose the focus and then the keyboard closes and the tooltip is hanging around in the middle of the screen :D

@eyaleizenberg
Copy link
Author

@wwwdata Nope sorry.

@wwwdata
Copy link

wwwdata commented Oct 25, 2017

I did a little research and at least I think I know why this happens now. When the UIMenuController is displayed, it dispatches (inside Xcode implementation) an event to become the first responder. This first responder logic also applies for TextInput fields and when they are the first responder, they display the keyboard. So if you take that away from the TextInput field, it will hide the keyboard.. see apple docs: https://developer.apple.com/documentation/uikit/uiresponder

Now I just need to find out how to get around that because this is also made in other chat apps like Telegram. So I guess I have to do something in XCode to open the menu without it being the first responder?

@wwwdata
Copy link

wwwdata commented Oct 25, 2017

There are some crazy workarounds that involve subclassing the UITextField just to avoid handling the event.. @chirag04 do you have any idea how this could be achieved in react native in a sane and easy way? Or can this hack described here also somehow be applied to this plugin? https://stackoverflow.com/questions/13601643/uimenucontroller-hides-the-keyboard

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants