page two should display parameter
there is no parameter, also console.log(this.props) has no parameter filed
when I click 'go to page two' button, I except to see "Here is page Two parameter ". but actually is just "Here is page Two"
my code here
export default class App extends Component<Props> {
render() {
return (
<Router>
<Scene key={'tabBar'} tabs hadeNavBar>
<Tabs key={'one'} component={PageOne} hideNavBar/>
<Tabs key={'two'} component={PageTwo} hideNavBar/>
</Scene>
</Router>
);
}
}
class PageOne extends React.Component {
render() {
return (
<View>
<Text>Here is Page One</Text>
<Button onPress={()=>{
Actions.jump('two', {data: 'parameter'});
}}>
<Text>go to page two</Text>
</Button>
</View>
);
}
}
class PageTwo extends React.Component {
render() {
return (
<View>
<Text>Here is Page Two</Text>
<Text>{this.props.data}</Text>
</View>
);
}
}
Do you have any solution? Or just I use it in wrong way?
@microxiong I was having the same issue but I have found the work around.
if you console.log the props on the PageTwo and look at the "name" prop. This is the tab name but it will have a underscore with it for example
name: _two"
If you then write your onPress event like this it should work.
<Button onPress={()=>{
Actions.jump('_two', {data: 'parameter'});
}}>
Let me know if you have any issues 馃憤
I have the same issue and found the same behavior to fix it, seems like the ineer key and the exposed key do not accept props the same way.
Most helpful comment
@microxiong I was having the same issue but I have found the work around.
if you console.log the props on the PageTwo and look at the "name" prop. This is the tab name but it will have a underscore with it for example
If you then write your onPress event like this it should work.
Let me know if you have any issues 馃憤