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

Keyboard not showing when focusing a text input within Unity #21

Open
CurralesDragon opened this issue Sep 21, 2020 · 2 comments
Open

Comments

@CurralesDragon
Copy link

Hi,

I can refer to this same issue: f111fei/react-native-unity-view#140

The keyboard won't show, but if you trigger a keyboard from within react-native before any unity events, it works.

Does anyone have any ideas what the issue is here? Im guessing its some sort of lifecycle event not firing until react-native triggers a keyboard to open.

Thanks

@daijiangping
Copy link

Hi! Did you encounter this problem in IOS? The situation I encountered in IOS is the same as you. I solved it in the following way. After you start unity, call the following function. I call it through react native

RCT_EXPORT_METHOD(focusInput){
  dispatch_async(dispatch_get_main_queue(), ^{
    UIWindow* window = [[UIApplication sharedApplication].delegate window];
    if (window != nil && window.rootViewController != nil)
    {
        [window makeKeyAndVisible];
    }
  });
}

@CurralesDragon
Copy link
Author

Yeah the problem was for iOS, I didn’t find a fix but just worked around it.

Thanks very much for posting your fix, Il be sure to give that a go!

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