1. Requiring unknown module "593". if you are sure the module is threr,try restarting Metro Bundler
意思就是没有导入控件
2.出现undefined is not an object (evaluating 'this.props.navigator')
https://blog.csdn.net/m13215519957/article/details/65940297
3.Warning:Each child in an array or iterator should have a unique "key" prop 给 cell 添加一个标识
<View style={styles.bottomItemView} key={I}>
4.给数组里面的添加点击方法
/** 定义一个数组 然后把数组输出数去 **/
setView(){
var itemArr = [];
for (var i = 0; i < MiddleData.length; i++){
var data = MiddleData[i];
itemArr.push(
<TouchableOpacity key={i} onPress={this.changeChild.bind(this, data.title)}>
<InnerView key={i} iconName={data.iconName} title={data.title}/>
</TouchableOpacity>
)
}
return itemArr;
}
changeChild(key){
this.props.clickMiddenCell?this.props.clickMiddenCell(key):null
}
- 导航栏的点击
/** 设置导航栏 **/
static navigationOptions = ({navigation,screenProps}) => ({
headerRight:(
<HeaderView clickCell={navigation.state.params?navigation.state.params.clickHeaderViewCell:null}/>
)
})
componentDidMount(){
this.props.navigation.setParams({
clickHeaderViewCell:this.clickHeaderViewCell,
})
}
clickHeaderViewCell(title){
const { navigate } = this.props.navigation;
navigate('YBXMoreContent',{headerTitle:title});
}
constructor(props) {
super(props);
this.clickCell=this.clickCell.bind(this);
this.clickMiddenCell=this.clickMiddenCell.bind(this);
this.clickHeaderViewCell=this.clickHeaderViewCell.bind(this);
}
Warning: Failed child context type: Invalid child context `virtualizedCell.cellKey` of type `number` supplied to `CellRenderer`, expected `string`.
消除方法:keyExtractor={(item, index) => index.toString()}
7.WebStore的一些坑
render() {
return (
<View style={styles.container}>
<Animated.View style={[styles.grass, {transform: [{translateY: this.state.grassTransY}]}]}/>
</View>
);
}
里面注释的一些代码尽然可以运行 = =
网友评论