-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Description
I encountered a very, very odd bug. In an app with a tab bar, when I switch to the second tab, the screen flashes the contents of the tab and then goes blank. However, it only happens under very specific situations:
- Only on my iPhone, i.e., not in the simulator
- Only when debugging with Chrome is turned off
- When I tap on a
TouchableHighlight
to make the transition, it seems to always happen; when I tap on the tab bar, it happens only sometimes
I know this sounds odd but I can recreate the issue reliably. Here's a screencast:
I also put together a barebones example here: https://github.com/lrettig/router-tab-bug-example
I can still interact with the blank screen. If there's a button there, I can still tap it, which leads me to believe that opacity is going to zero somewhere. My best guess is that it's a non-deterministic issue with animations, probably with the default Animations.None
and NoTransition
defined in Animations.js. If I set a sceneConfig
on the routes in question to use a different animation--any animation--the issue appears to go away.
Here's some other things I noticed, in case it helps. If I change:
<Schema name="tab" type="switch" icon={TabIcon} />
to
<Schema name="tab" type="replace" icon={TabIcon} />
the problem goes away. If I instead change it to "push", the problem gets worse, affecting both screens. Also, in this code:
class TabIcon extends React.Component {
render () {
return (
<Text
style={this.props.selected ?
{color: 'red'} : {color: 'black'}}>
{this.props.title}
</Text>
);
}
}
If I simplify the style
code, removing this.props.selected
, or remove the style code entirely, it happens much less often, but it still happens sometimes.
Note that it happens when running from packaged JS code, making this a serious production issue.
I'm completely stumped.
Here's the packages I'm running:
$ npm -v
3.3.6
$ node -v
v5.0.0
$ react-native -v
react-native-cli: 0.1.10
react-native: 0.19.0
$ grep version node_modules/react-native-router-flux/package.json
"version": "2.1.8"