道具类型失败:提供给navigation
的类型object
的道具ProductDetail
无效,预期number
对于以下代码,我在控制台中收到此警告
家庭课堂
this.props.navigation.push('ProductDetail', { screenBottom: result.safeAreaInsets.bottom });
ProductDetail类
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);
}
警告:道具类型失败:提供给navigation
的类型object
的道具ProductDetail
无效的道具number
答案 0 :(得分:0)
尝试检查您的propTypes,可能类似于:
someComponentName.propTypes = { 导航:PropTypes.number }