0
votes

Failed prop type: Invalid prop navigation of type object supplied to ProductDetail, expected number

I am getting this warning in my console, for following code,

Home class

this.props.navigation.push('ProductDetail', { screenBottom: result.safeAreaInsets.bottom });

ProductDetail class

static defaultProps = {
    draggableRange: {
      top: (Platform.OS === 'ios' ? (height / 1.15) : (height - 80)),
      bottom: (Platform.OS === 'ios' ? (height / 3.75) : 146),
    },
    navigation: 0,
}

static propTypes = {
    draggableRange: PropTypes.shape({
      top: PropTypes.number,
      bottom: PropTypes.number,
    }),
    navigation: PropTypes.number,
};

constructor(props) {
    super(props);
    const { navigation } = this.props;
    this.screenBottom = navigation.getParam('screenBottom', 0);
}

Warning: Failed prop type: Invalid prop navigation of type object supplied to ProductDetail, expected number

1

1 Answers

0
votes

Try to check your propTypes, there's probably something like:

someComponentName.propTypes = { navigation:PropTypes.number }