I have a Router
setup with 2 tab scenes:
The code is as follows.
app.js:
import React from 'react';
import { Router, Scene } from 'react-native-router-flux';
import Tab from '../tab';
import ScreenA from './a';
import ScreenB from './b';
import ScreenC from './c';
export default class App extends React.Component {
render(){
return (
<Router>
<Scene key="root">
<Scene key="tabbar" tabs={true}>
<Scene key="tab1" title="Tab 1" icon={Tab}>
<Scene key="a" title="Screen A" component={ScreenA} />
<Scene key="b" title="Screen B" component={ScreenB} />
</Scene>
<Scene key="tab2" title="Tab 2" icon={Tab}>
<Scene key="c" title="Screen C" component={ScreenC} />
</Scene>
</Scene>
</Scene>
</Router>
);
}
}
The screens are pretty simple too.
a.js:
export default class ScreenA extends React.Component {
render(){
return (
<View>
<Text>This is Screen A</Text>
<TouchableHighlight onPress={() => Actions.b()}>
<Text>Go to Screen B</Text>
</TouchableHighlight>
</View>
);
}
}
b.js:
export default class ScreenB extends React.Component {
render(){
return (
<View>
<Text>This is Screen B</Text>
</View>
);
}
}
c.js:
export default class ScreenC extends React.Component {
render(){
return (
<View>
<Text>This is Screen C</Text>
</View>
);
}
}
react-native-router-flux
is not retaining the Tabs' history stack when we get back to them. Or am I doing something wrong here?
Packages versions:
Turns out this was a bug in react-native-router-flux package, and it was fixed in this pull request.