小编Max*_*ner的帖子

反应本机Flatlist renderItem不更新

我正在使用FlatList,它可以正确显示所有内容。

但是,当我更新产品数量时,它只会增加总量,FlatList的renderItem 不会发生任何变化。

在此处输入图片说明

当我按下加号按钮时,总金额会更改,但产品数量不会更改。

如何更新产品数量?更新总金额后FlatList,为什么不更改项目数量

我的代码:-

constructor(props) {
    super(props);
    this.state = {
        data:[
            {id:4, productName:'Product 4', shortDescription:'shortDescription 4', qty:1, price:500 },
            {id:5, productName:'Product 5', shortDescription:'shortDescription 5', qty:1, price:1000},
            {id:6, productName:'Product 6', shortDescription:'shortDescription 6', qty:1, price:1000},
        ],
    };
}

_addQty = (index) => {
    var data = this.state.data;
    data[index].qty = data[index].qty + 1;
    this.setState(data:data);
}


_getTotalPrice = () => {
    var total = 0;
    for (var i = 0; i < this.state.data.length; …
Run Code Online (Sandbox Code Playgroud)

android ios reactjs react-native

7
推荐指数
1
解决办法
1631
查看次数

在iOS swift中转换不正常?

功能覆盖

func willTransition(to newCollection: UITraitCollection, with coordinator: UIViewControllerTransitionCoordinator) { } 
Run Code Online (Sandbox Code Playgroud)

我在iPad设备上构建和运行时没有触发,但它在移动设备上工作正常(iphone 5,6,7 ......).怎么解决这个?

提前致谢!!

ios uideviceorientation swift

1
推荐指数
1
解决办法
264
查看次数