Skip to content

Instantly share code, notes, and snippets.

@chapeljuice
Created May 17, 2017 15:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chapeljuice/bef4b0a4dedef2994c81f3634b81aa43 to your computer and use it in GitHub Desktop.
Save chapeljuice/bef4b0a4dedef2994c81f3634b81aa43 to your computer and use it in GitHub Desktop.
React Navigation not working. Getting error: "undefined is not an object (evaluating 'this.props.navigation.navigate')".
import React from 'react'
import { Image, ListView, ScrollView, Text, TouchableOpacity, View } from 'react-native'
import styles from './Styles/CardStyle'
import { connect } from 'react-redux'
import Icon from 'react-native-vector-icons/FontAwesome'
import ButtonCTA from '../Components/ButtonCTA'
import CheckInStatus from '../Components/CheckInStatus'
class Card extends React.Component {
render() {
const { navigate } = this.props.navigation;
return (
<View>
<ButtonCTA text='View Details' onPress={() => navigate('DetailsScreen')} />
</View>
)
}
}
const mapStateToProps = (state) => {
return {
dataSource: state.dataSource
}
}
export default connect(mapStateToProps)(Card)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment