Ignat
Ignat

Reputation: 3787

How to use TouchableOpacity onPress in side menu?

How to implement active links to other pages in side menu?
I'm using this example https://github.com/react-native-fellowship/react-native-side-menu/tree/master/examples/Basic on my app, but when I added TouchableOpacity with onPress function

this.props.navigator.push({
        name: 'Main'
    });

I had an error "Cannot read property 'push' of undefined". And all functions execute when side menu opened (before I press the buttons). How to fix it?

Upvotes: 0

Views: 375

Answers (1)

Maksim
Maksim

Reputation: 2466

I had an error "Cannot read property 'push' of undefined".

You need to use

<Menu navigator={this.props.navigator}/>

instead of

<Menu/>

Upvotes: 1

Related Questions