Skip to content

warning failed prop type: invalid prop backgroundColor supplied to View : this.state.buttoncolor #31

@jingfreeks

Description

@jingfreeks

I got an issue here, Hope you can help me in this situation here is my code.

const routes = [
  {
      value:"Daily Time Record",
      datavalue:"Home",
      buttoncolors:"this.state.buttoncolor"
  },
  {
     value:"Personal Info",
     datavalue: "EmployeePersonalInfo",
     buttoncolors:"this.state.buttoncolor1"
   },
   {
     value:"Employment Info",
     datavalue: "EmploymentInfo",
     buttoncolors:"this.state.buttoncolor2"
   }
 ];

export default class SideBar extends React.Component {
  constructor(props){
    super(props);
    this.state={
      buttoncolor:'white',
      buttoncolor1:'gray',
      buttoncolor1:'blue'
    };
  }


  render() {
    return (
      <View style={{
        width:300,
        height:540,
        backgroundColor:'#212223'
      }}>

        <Header style={{
          height:100,
          backgroundColor:'#212223',
          justifyContent:'flex-start',
          alignItems:'center',
          borderBottomWidth:1,
          borderBottomColor:'black',
        }}>
          <Title>Juan De la cruz</Title>
        </Header>
        
        <View style={{width:300,height:165}}>
          <List style={{marginLeft:-17}}
            dataArray={routes}
            renderRow={data => {
              return (
                <ListItem style={{
                    backgroundColor:'#212223',
                    borderColor:'black',
                    borderBottomWidth:1
                  }}
                  button style={{backgroundColor:data.buttoncolors}}
                  onPress={() => this.props.navigation.navigate(data.datavalue)}
                >
                  <Body>
                    <Text style={{color:'white'}}>{data.value}</Text>
                  </Body>
                  <Right>
                    <Icon name="ios-arrow-forward" />
                  </Right>
                </ListItem>
              );
            }}
          <List />
        </View>

      </View>
    );
  }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions