0
votes

I test a component contains a child component has Image. I define propTypes of Image in in child component is number. At main components I passed the image props by import. But test file run warning Invalid prop iconBack of type object supplied to HeaderVideoNavigation

enter image description here

This is code at HeaderVideoNavigation

const HeaderVideoNavigation = props => (
  <Container>
    <IconContent>
      <TouchableWithoutFeedback onPress={props.onPressBackIcon}>
        <IconButton isDisplay source={props.iconBack} />
      </TouchableWithoutFeedback>
    </IconContent>
    {!!props.editText && <EditText>{props.editText}</EditText>}
  </Container>
)

and at main Component

<Header>
  <HeaderVideoNavigation
    onPressBackIcon={closeModal}
    iconBack={Images.iconBackWhite}
  />
</Header>
1
hi @Hoai di you find the solution?hinciler

1 Answers

0
votes

The warning basically says that iconBackWhite is an object rather than a number which is expected in IconButton component of its source prop.

<IconButton isDisplay source={props.iconBack} />