f111fei/react-native-unity-view

react-navigation

Closed this issue · 4 comments

gif- commented

Hi! I'm using the createBottomTabNavigator (from react-navigation) call to create a tab navigator and one tab contains the UnityView component. If I navigate to the tab containing the unity view, it loads correctly, but once I navigate away, all of the remaining tabs content will become black. (tested with run-android)
However I can go back to the unity tab and it loads again, but none of the previously working tabs show anything but a black screen.

It seems however, when I put an Alert.alert('something') into the render() function, the screen is somehow forced to redraw correctly.

Yet stranger, if I enable the Inspector in the debug menu, everything starts to work even without calling Alert.alert() in render(). I guess the overlaying inspector gui forces the content to be redrawn on each frame.

I also tried to catch willFocus/willBlur and call setState from there to hide the unity view, but without any luck.

@f111fei : Can you please check/verify this?

What‘s your UnityView style? If UnityView is full-screen in Android, there will be some rendering problems.

Try change UnityView style.

<UnityView style={{ position: 'absolute', left: 0, right: 0, top: 1, bottom: 1 }} />
gif- commented

Geez, I've been fiddling around for days with it, and that solved it instantly. Thanks a bunch!

I have another kind of issue with bottom tab navigation. My system action sheet or alerts only pop up in Unity View window not in other tabs. Any suggestion or workarounds?

@f111fei 's suggestion solved my problem as well. I was using flex: 1 to size the unity container. Thanks!