Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Typeerror: undefined is not an object (evaluating '_this.setState') #3

Open
glitchwizard opened this issue Aug 18, 2020 · 0 comments
Open

Comments

@glitchwizard
Copy link

glitchwizard commented Aug 18, 2020

I'm getting the following error:

image

with the following component:

import React, { useState } from 'react';
import Background from './components/background';
import { StyleSheet, View, Text, StatusBar } from 'react-native';
import Icon from 'react-native-vector-icons/MaterialCommunityIcons';
import WeekdayPicker from "react-native-weekday-picker";

<link href="https://fonts.googleapis.com/css2?family=Lato:wght@300&display=swap" rel="stylesheet"></link>

export default function App() {
  
  let days = {
    1: 0,
    2: 0,
    3: 0,
    4: 0,
    5: 0,
    6: 0,
    0: 0
  };
  
  const handleChange = (days) => { this.setState(days) }

  return (
    <View style={styles.container}>
      <View style={styles.calApptComponentContainer}>
        <View style={styles.calHeader}>
          <Text style={{ borderColor: "green", borderWidth: 1, flex: 1 }}>
            Tues, Jan 14
          </Text>
          <View
            style={{
              borderColor: "purple",
              borderWidth: 1,
              flex: 1,
              alignItems: "flex-end",
            }}
          >
            <Icon name="calendar-blank" size={30} color="#000" />
          </View>
        </View>
            <WeekdayPicker
              days={days}
              onChange={handleChange}
              style={styles.picker}
              dayStyle={styles.day}
            />
        <View style={styles.calMeetingTimeSelectorContainer}>
          <Text>CalMeetingTimeSelector</Text>
        </View>
        <View style={styles.calFooter}>
          <Text>CalFooter</Text>
        </View>
      </View>
      <Background />
      <StatusBar />
    </View>
  );
}

Am I setting this up incorrectly?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant