TypeError: undefined is not an object (evaluating 'this')

I do not get an error when I delete the component menu I created specially from where I put it, but I get an error when my component is there. Thank you for your comments already.



import Menu from './Navigator'
import { FontAwesomeIcon } from '@fortawesome/react-native-fontawesome';
import { faBars } from '@fortawesome/free-solid-svg-icons';

export default class HeaderLeft extends Component {
    constructor(props){
        super(props);
        this.state={check:false}
    }
    render() {
        return (<SafeAreaView><View onStartShouldSetResponderCapture={() => { this.setState({ check: !this.state.check }) }} style={styles.align}>
            <FontAwesomeIcon icon={faBars} size={16} color={"#2D6A4F"} /><Menu check={this.state.check}></Menu></View></SafeAreaView>)
    }

}
const styles = StyleSheet.create({

    align: {
        height: 60, display: 'flex', justifyContent: 'center', padding: 20
    },

});```

25 thoughts on “TypeError: undefined is not an object (evaluating 'this')”

Leave a Comment