Splash Screen Reinitializes When Using Custom Keyboard with RCTSurfaceHostingProxyRootView #689
RalissonMattias
started this conversation in
General
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hello,
I’m encountering an issue where the splash screen unexpectedly reinitializes when using a custom keyboard in my React Native app. I’d like to share the details of the problem and the workaround I’ve implemented, hoping it might help improve the library or its documentation for other developers.
Context
Problem
In my app, I’ve implemented a custom keyboard that requires creating a new instance of
RCTSurfaceHostingProxyRootView
to display the keyboard UI. However, I’ve noticed that doing so triggers theinitWithStoryboard:rootView:
method inreact-native-bootsplash
again, causing the splash screen to reinitialize. This results in the splash screen reappearing unexpectedly, even though it was properly hidden during the app’s initial startup.Cause
It seems the library assumes that
initWithStoryboard:rootView:
is called only once, during the standard app initialization. In my case, however, instantiating a newRCTSurfaceHostingProxyRootView
for the custom keyboard calls this method again, leading to the splash screen reinitialization.Workaround Implemented
To fix this, I added a static flag to ensure the splash screen initializes only once. Here’s the code I used:
This prevents the method from running multiple times, effectively stopping the splash screen from reinitializing.
Suggestion
While my workaround resolves the issue, I think the library could benefit from built-in protection against accidental multiple initializations. Here are a couple of ideas:
Question
Would you consider adding a safeguard against multiple initializations or updating the documentation to address this case? I’d be happy to contribute with a pull request if needed.
Thanks for your attention and for the great work on this library!
Beta Was this translation helpful? Give feedback.
All reactions