Reputation: 1176
I have a problem with my React Native code, i am new in React programming, so cannot read the errors correct :-(
Hopefully someone can help
export default class NavigationBar extends Component {
_handleNavigationRequest = () => {
this.refs.nav.push({
component: Settings,
title: 'Genius',
passProps: { myProp: 'genius' },
});
}
render() {
return (
<NavigatorIOS barTintColor='#50C26B' titleTextColor='#fff' tintColor='#fff'
initialRoute={{
component: Genius,
title: 'Happy Genius',
rightButtonTitle: 'Add',
onRightButtonPress: () => this._handleNavigationRequest(),
}}
style={style.navBarStyle}
/>
);
}
}
Got the error: undefined is noch an object (evaluating 'this.refs.nav.push')
Upvotes: 0
Views: 47
Reputation: 1693
You forgot the ref parameter in your NavigatorIOS
render() {
return (
<NavigatorIOS ref='nav'
barTintColor='#50C26B' titleTextColor='#fff' tintColor='#fff'
initialRoute={{
component: Genius,
title: 'Happy Genius',
rightButtonTitle: 'Add',
onRightButtonPress: () => this._handleNavigationRequest(),
}}
style={style.navBarStyle}
/>
);
}
Upvotes: 1